2012-08-22 23:27:53 +02:00
< ? php
2010-12-29 13:13:36 +01:00
/* Copyright ( C ) 2002 - 2007 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2003 Xavier Dutoit < doli @ sydesy . com >
2013-11-07 00:41:27 +01:00
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2010-12-29 13:13:36 +01:00
* Copyright ( C ) 2004 Sebastien Di Cintio < sdicintio @ ressource - toi . org >
* Copyright ( C ) 2004 Benoit Mortier < benoit . mortier @ opensides . be >
2012-12-30 15:11:07 +01:00
* Copyright ( C ) 2005 - 2011 Regis Houssin < regis . houssin @ capnetworks . com >
2010-12-29 13:13:36 +01:00
* Copyright ( C ) 2005 Simon Tosser < simon @ kornog - computing . com >
* Copyright ( C ) 2006 Andre Cianfarani < andre . cianfarani @ acdeveloppement . net >
* Copyright ( C ) 2010 Juanjo Menent < jmenent @ 2 byte . es >
2015-04-18 21:59:00 +02:00
* Copyright ( C ) 2015 Bahfir Abbes < bafbes @ gmail . com >
2010-12-29 13:13:36 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2010-12-29 13:13:36 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2010-12-29 13:13:36 +01:00
*/
/**
* \file htdocs / filefunc . inc . php
* \ingroup core
2011-09-07 15:27:50 +02:00
* \brief File that include conf . php file and commons lib like functions . lib . php
2010-12-29 13:13:36 +01:00
*/
2015-11-04 14:54:17 +01:00
if ( ! defined ( 'DOL_APPLICATION_TITLE' )) define ( 'DOL_APPLICATION_TITLE' , 'Dolibarr' );
2016-07-14 15:33:17 +02:00
if ( ! defined ( 'DOL_VERSION' )) define ( 'DOL_VERSION' , '5.0.0-alpha' );
2015-05-16 17:09:42 +02:00
2011-09-20 00:36:38 +02:00
if ( ! defined ( 'EURO' )) define ( 'EURO' , chr ( 128 ));
2010-12-29 13:13:36 +01:00
2012-01-29 20:57:40 +01:00
// Define syslog constants
2011-10-29 19:50:25 +02:00
if ( ! defined ( 'LOG_DEBUG' ))
2010-12-29 13:13:36 +01:00
{
2015-04-23 23:29:31 +02:00
if ( ! function_exists ( " syslog " )) {
// For PHP versions without syslog (like running on Windows OS)
define ( 'LOG_EMERG' , 0 );
define ( 'LOG_ALERT' , 1 );
define ( 'LOG_CRIT' , 2 );
define ( 'LOG_ERR' , 3 );
define ( 'LOG_WARNING' , 4 );
define ( 'LOG_NOTICE' , 5 );
define ( 'LOG_INFO' , 6 );
define ( 'LOG_DEBUG' , 7 );
}
2010-12-29 13:13:36 +01:00
}
2012-04-28 16:37:58 +02:00
// End of common declaration part
if ( defined ( 'DOL_INC_FOR_VERSION_ERROR' )) return ;
2010-12-29 13:13:36 +01:00
2011-09-20 12:30:56 +02:00
// Define vars
2011-07-30 12:23:24 +02:00
$conffiletoshowshort = " conf.php " ;
2011-09-20 12:30:56 +02:00
// Define localization of conf file
2015-07-12 23:47:39 +02:00
// --- Start of part replaced by Dolibarr packager makepack-dolibarr
2011-07-30 12:23:24 +02:00
$conffile = " conf/conf.php " ;
$conffiletoshow = " htdocs/conf/conf.php " ;
2011-09-20 12:30:56 +02:00
// For debian/redhat like systems
//$conffile = "/etc/dolibarr/conf.php";
//$conffiletoshow = "/etc/dolibarr/conf.php";
2011-07-30 12:23:24 +02:00
2015-07-12 23:47:39 +02:00
// Include configuration
// --- End of part replaced by Dolibarr packager makepack-dolibarr
2015-09-13 22:50:08 +02:00
2015-04-21 11:41:21 +02:00
// Replace conf filename with "conf" parameter on url by GET
2015-09-13 22:50:08 +02:00
/* Disabled . This is a serious security hole
2015-04-21 11:41:21 +02:00
if ( ! empty ( $_GET [ 'conf' ]))
{
$confname = basename ( $_GET [ 'conf' ]);
setcookie ( 'dolconf' , $confname , 0 , '/' );
$conffile = 'conf/' . $confname . '.php' ;
2015-04-18 16:26:33 +02:00
} else {
2015-04-21 11:41:21 +02:00
$confname = basename ( empty ( $_COOKIE [ 'dolconf' ]) ? 'conf' : $_COOKIE [ 'dolconf' ]);
$conffile = 'conf/' . $confname . '.php' ;
2015-04-18 16:26:33 +02:00
}
2015-09-13 22:50:08 +02:00
*/
2011-07-30 12:23:24 +02:00
2010-12-29 13:13:36 +01:00
// Include configuration
2013-05-21 19:53:10 +02:00
$result =@ include_once $conffile ; // Keep @ because with some error reporting this break the redirect
2013-03-09 18:55:57 +01:00
2010-12-29 13:13:36 +01:00
if ( ! $result && ! empty ( $_SERVER [ " GATEWAY_INTERFACE " ])) // If install not done and we are in a web session
{
2016-07-27 10:57:05 +02:00
if ( ! empty ( $_SERVER [ " CONTEXT_PREFIX " ])) // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
{
$path = $_SERVER [ " CONTEXT_PREFIX " ]; // example '/dolibarr/' when using an apache alias.
if ( ! preg_match ( '/\/$/' , $path )) $path .= '/' ;
}
else if ( preg_match ( '/index\.php' , $_SERVER [ 'PHP_SELF' ]))
{
// When we ask index.php, we MUST BE SURE that $path is '' at the end. This is required to make install process
// when using apache alias like '/dolibarr/' that point to htdocs.
// Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails,
// but we don't want to change this because when URL is correct, we must be sure the redirect to install/index.php will be correct.
$path = '' ;
}
else
{
// If what we look is not index.php, we can try to guess location of root. May not work all the time.
// There is no real solution, because the only way to know the apache url relative path is to have it into conf file.
// If it fails to find correct $path, then only solution is to ask user to enter the correct URL to index.php or install/index.php
$TDir = explode ( '/' , $_SERVER [ 'PHP_SELF' ]);
$path = '' ;
$i = count ( $TDir );
while ( $i -- )
{
if ( empty ( $TDir [ $i ]) || $TDir [ $i ] == 'htdocs' ) break ;
if ( $TDir [ $i ] == 'dolibarr' ) break ;
if ( substr ( $TDir [ $i ], - 4 , 4 ) == '.php' ) continue ;
$path .= '../' ;
}
}
2016-06-04 14:31:53 +02:00
header ( " Location: " . $path . " install/index.php " );
2011-02-23 19:20:57 +01:00
exit ;
2010-12-29 13:13:36 +01:00
}
2012-07-09 10:24:33 +02:00
// Force PHP error_reporting setup (Dolibarr may report warning without this)
if ( ! empty ( $dolibarr_strict_mode ))
2012-07-23 16:10:54 +02:00
{
2012-07-09 10:24:33 +02:00
error_reporting ( E_ALL | E_STRICT );
}
else
{
error_reporting ( E_ALL & ~ ( E_STRICT | E_NOTICE | E_DEPRECATED ));
}
2012-04-15 09:30:40 +02:00
// Disable php display errors
2012-04-28 16:37:58 +02:00
if ( ! empty ( $dolibarr_main_prod )) ini_set ( 'display_errors' , 'Off' );
2012-04-15 09:30:40 +02:00
2012-03-07 14:21:49 +01:00
// Clean parameters
$dolibarr_main_data_root = trim ( $dolibarr_main_data_root );
2014-08-06 00:06:27 +02:00
$dolibarr_main_url_root = trim ( preg_replace ( '/\/+$/' , '' , $dolibarr_main_url_root ));
2013-01-15 15:44:42 +01:00
$dolibarr_main_url_root_alt = ( empty ( $dolibarr_main_url_root_alt ) ? '' : trim ( $dolibarr_main_url_root_alt ));
2012-03-07 14:21:49 +01:00
$dolibarr_main_document_root = trim ( $dolibarr_main_document_root );
2013-01-15 15:44:42 +01:00
$dolibarr_main_document_root_alt = ( empty ( $dolibarr_main_document_root_alt ) ? '' : trim ( $dolibarr_main_document_root_alt ));
2012-03-07 14:21:49 +01:00
2010-12-29 13:13:36 +01:00
if ( empty ( $dolibarr_main_db_port )) $dolibarr_main_db_port = 0 ; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
if ( empty ( $dolibarr_main_db_type )) $dolibarr_main_db_type = 'mysql' ; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
if ( empty ( $dolibarr_main_db_prefix )) $dolibarr_main_db_prefix = 'llx_' ;
2015-06-16 20:22:01 +02:00
if ( empty ( $dolibarr_main_db_character_set )) $dolibarr_main_db_character_set = ( $dolibarr_main_db_type == 'mysql' ? 'utf8' : '' ); // Old installation
if ( empty ( $dolibarr_main_db_collation )) $dolibarr_main_db_collation = ( $dolibarr_main_db_type == 'mysql' ? 'utf8_general_ci' : '' ); // Old installation
2010-12-29 13:13:36 +01:00
if ( empty ( $dolibarr_main_db_encryption )) $dolibarr_main_db_encryption = 0 ;
if ( empty ( $dolibarr_main_db_cryptkey )) $dolibarr_main_db_cryptkey = '' ;
if ( empty ( $dolibarr_main_limit_users )) $dolibarr_main_limit_users = 0 ;
if ( empty ( $dolibarr_mailing_limit_sendbyweb )) $dolibarr_mailing_limit_sendbyweb = 0 ;
2012-08-22 17:42:40 +02:00
if ( empty ( $dolibarr_strict_mode )) $dolibarr_strict_mode = 0 ; // For debug in php strict mode
2013-02-11 21:23:25 +01:00
// TODO Multicompany Remove this. Useless.
2011-11-04 09:09:53 +01:00
if ( empty ( $multicompany_transverse_mode )) $multicompany_transverse_mode = 0 ;
2012-09-05 19:17:55 +02:00
if ( empty ( $multicompany_force_entity )) $multicompany_force_entity = 0 ; // To force entity in login page
2010-12-29 13:13:36 +01:00
// Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
// when we post forms (we allow GET to allow direct link to access a particular page).
if ( ! defined ( 'NOCSRFCHECK' ) && empty ( $dolibarr_nocsrfcheck ) && ! empty ( $_SERVER [ 'REQUEST_METHOD' ]) && $_SERVER [ 'REQUEST_METHOD' ] != 'GET' && ! empty ( $_SERVER [ 'HTTP_HOST' ]) && ! empty ( $_SERVER [ 'HTTP_REFERER' ]) && ! preg_match ( '/' . preg_quote ( $_SERVER [ 'HTTP_HOST' ], '/' ) . '/i' , $_SERVER [ 'HTTP_REFERER' ]))
{
2011-02-23 19:20:57 +01:00
//print 'HTTP_POST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
print " Access refused by CSRF protection in main.inc.php. \n " ;
print " If you access your server behind a proxy using url rewriting, you might add the line \$ dolibarr_nocsrfcheck=1 into your conf.php file. \n " ;
die ;
2010-12-29 13:13:36 +01:00
}
if ( empty ( $dolibarr_main_db_host ))
{
2012-10-07 20:04:07 +02:00
print '<div align="center">Dolibarr setup is not yet complete.<br><br>' . " \n " ;
print '<a href="install/index.php">Click here to finish Dolibarr install process</a> ...</div>' . " \n " ;
2010-12-29 13:13:36 +01:00
die ;
}
if ( empty ( $dolibarr_main_url_root ))
{
print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>' . " \n " ;
print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)' . " \n " ;
die ;
}
if ( empty ( $dolibarr_main_db_type )) $dolibarr_main_db_type = 'mysql' ; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
if ( empty ( $dolibarr_main_data_root ))
{
// Si repertoire documents non defini, on utilise celui par defaut
$dolibarr_main_data_root = str_replace ( " /htdocs " , " " , $dolibarr_main_document_root );
$dolibarr_main_data_root .= " /documents " ;
}
// Define some constants
2011-01-14 21:55:45 +01:00
define ( 'DOL_CLASS_PATH' , 'class/' ); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
2010-12-29 13:13:36 +01:00
define ( 'DOL_DATA_ROOT' , $dolibarr_main_data_root ); // Filesystem data (documents)
define ( 'DOL_DOCUMENT_ROOT' , $dolibarr_main_document_root ); // Filesystem core php (htdocs)
2013-10-23 17:47:46 +02:00
// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
2013-09-18 17:59:57 +02:00
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
2011-03-29 11:12:49 +02:00
$tmp = '' ;
2011-02-26 03:51:10 +01:00
$found = 0 ;
2013-09-18 17:59:57 +02:00
$real_dolibarr_main_document_root = str_replace ( '\\' , '/' , realpath ( $dolibarr_main_document_root )); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
2015-12-11 05:08:32 +01:00
if ( ! empty ( $_SERVER [ " DOCUMENT_ROOT " ])) {
2015-12-19 01:38:22 +01:00
$pathroot = $_SERVER [ " DOCUMENT_ROOT " ]; // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
2015-12-11 05:08:32 +01:00
} else {
2015-12-18 21:56:00 +01:00
$pathroot = 'NOTDEFINED' ;
2015-12-11 05:08:32 +01:00
}
2013-09-18 17:59:57 +02:00
$paths = explode ( '/' , str_replace ( '\\' , '/' , $_SERVER [ " SCRIPT_NAME " ])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
2013-10-23 17:47:46 +02:00
// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
2011-02-26 03:51:10 +01:00
$concatpath = '' ;
2013-05-03 16:10:28 +02:00
foreach ( $paths as $tmppath ) // We check to find (B+start of C)=A
2010-12-29 13:13:36 +01:00
{
2013-10-23 17:47:46 +02:00
if ( empty ( $tmppath )) continue ;
$concatpath .= '/' . $tmppath ;
//if ($tmppath) $concatpath.='/'.$tmppath;
2012-06-12 18:35:29 +02:00
//print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
2012-01-04 13:26:06 +01:00
if ( $real_dolibarr_main_document_root == @ realpath ( $pathroot . $concatpath )) // @ avoid warning when safe_mode is on.
2011-02-26 03:51:10 +01:00
{
2013-10-23 17:47:46 +02:00
//print "Found relative url = ".$concatpath;
$tmp3 = $concatpath ;
2011-02-26 03:51:10 +01:00
$found = 1 ;
break ;
}
2012-06-12 18:35:29 +02:00
//else print "Not found yet for concatpath=".$concatpath."<br>\n";
2010-12-29 13:13:36 +01:00
}
2015-12-18 21:56:00 +01:00
//print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n";
2013-10-23 17:47:46 +02:00
if ( ! $found ) $tmp = $dolibarr_main_url_root ; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
2012-12-12 00:49:32 +01:00
else $tmp = 'http' . ((( empty ( $_SERVER [ " HTTPS " ]) || $_SERVER [ " HTTPS " ] != 'on' ) && ( empty ( $_SERVER [ " SERVER_PORT " ]) || $_SERVER [ " SERVER_PORT " ] != 443 )) ? '' : 's' ) . '://' . $_SERVER [ " SERVER_NAME " ] . (( empty ( $_SERVER [ " SERVER_PORT " ]) || $_SERVER [ " SERVER_PORT " ] == 80 || $_SERVER [ " SERVER_PORT " ] == 443 ) ? '' : ':' . $_SERVER [ " SERVER_PORT " ]) . ( $tmp3 ? ( preg_match ( '/^\//' , $tmp3 ) ? '' : '/' ) . $tmp3 : '' );
2013-10-23 17:47:46 +02:00
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
2011-02-23 13:24:09 +01:00
if ( ! empty ( $dolibarr_main_force_https )) $tmp = preg_replace ( '/^http:/i' , 'https:' , $tmp );
define ( 'DOL_MAIN_URL_ROOT' , $tmp ); // URL absolute root (https://sss/dolibarr, ...)
2010-12-29 13:13:36 +01:00
$uri = preg_replace ( '/^http(s?):\/\//i' , '' , constant ( 'DOL_MAIN_URL_ROOT' )); // $uri contains url without http*
2013-07-07 03:26:51 +02:00
$suburi = strstr ( $uri , '/' ); // $suburi contains url without domain:port
2011-02-23 13:24:09 +01:00
if ( $suburi == '/' ) $suburi = '' ; // If $suburi is /, it is now ''
define ( 'DOL_URL_ROOT' , $suburi ); // URL relative root ('', '/dolibarr', ...)
2013-01-18 15:57:11 +01:00
2013-10-23 17:47:46 +02:00
//print DOL_MAIN_URL_ROOT.'-'.DOL_URL_ROOT."\n";
2013-01-18 15:57:11 +01:00
// Define prefix MAIN_DB_PREFIX
2010-12-29 13:13:36 +01:00
define ( 'MAIN_DB_PREFIX' , $dolibarr_main_db_prefix );
2011-09-07 15:27:50 +02:00
/*
* Define PATH to external libraries
* To use other version than embeded libraries , define here constant to path . Use '' to use include class path autodetect .
*/
// Path to root libraries
2011-09-24 01:36:55 +02:00
if ( ! defined ( 'ADODB_PATH' )) { define ( 'ADODB_PATH' , ( ! isset ( $dolibarr_lib_ADODB_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/adodbtime/' : ( empty ( $dolibarr_lib_ADODB_PATH ) ? '' : $dolibarr_lib_ADODB_PATH . '/' )); }
2012-12-19 13:06:45 +01:00
if ( ! defined ( 'FPDF_PATH' )) { define ( 'FPDF_PATH' , ( empty ( $dolibarr_lib_FPDF_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/fpdf/' : $dolibarr_lib_FPDF_PATH . '/' ); } // Used only for package that can't include tcpdf
2015-11-03 11:01:22 +01:00
if ( ! defined ( 'TCPDF_PATH' )) { define ( 'TCPDF_PATH' , ( empty ( $dolibarr_lib_TCPDF_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH . '/' ); }
2012-12-19 13:06:45 +01:00
if ( ! defined ( 'FPDI_PATH' )) { define ( 'FPDI_PATH' , ( empty ( $dolibarr_lib_FPDI_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/fpdfi/' : $dolibarr_lib_FPDI_PATH . '/' ); }
2015-03-02 01:38:40 +01:00
if ( ! defined ( 'TCPDI_PATH' )) { define ( 'TCPDI_PATH' , ( empty ( $dolibarr_lib_TCPDI_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH . '/' ); }
2011-09-24 01:36:55 +02:00
if ( ! defined ( 'NUSOAP_PATH' )) { define ( 'NUSOAP_PATH' , ( ! isset ( $dolibarr_lib_NUSOAP_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/nusoap/lib/' : ( empty ( $dolibarr_lib_NUSOAP_PATH ) ? '' : $dolibarr_lib_NUSOAP_PATH . '/' )); }
2015-08-06 17:07:50 +02:00
if ( ! defined ( 'PHPEXCEL_PATH' )) { define ( 'PHPEXCEL_PATH' , ( ! isset ( $dolibarr_lib_PHPEXCEL_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/phpoffice/phpexcel/Classes/' : ( empty ( $dolibarr_lib_PHPEXCEL_PATH ) ? '' : $dolibarr_lib_PHPEXCEL_PATH . '/' )); }
2011-09-07 15:27:50 +02:00
if ( ! defined ( 'GEOIP_PATH' )) { define ( 'GEOIP_PATH' , ( ! isset ( $dolibarr_lib_GEOIP_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/geoip/' : ( empty ( $dolibarr_lib_GEOIP_PATH ) ? '' : $dolibarr_lib_GEOIP_PATH . '/' )); }
if ( ! defined ( 'ODTPHP_PATH' )) { define ( 'ODTPHP_PATH' , ( ! isset ( $dolibarr_lib_ODTPHP_PATH )) ? DOL_DOCUMENT_ROOT . '/includes/odtphp/' : ( empty ( $dolibarr_lib_ODTPHP_PATH ) ? '' : $dolibarr_lib_ODTPHP_PATH . '/' )); }
if ( ! defined ( 'ODTPHP_PATHTOPCLZIP' )) { define ( 'ODTPHP_PATHTOPCLZIP' , ( ! isset ( $dolibarr_lib_ODTPHP_PATHTOPCLZIP )) ? DOL_DOCUMENT_ROOT . '/includes/odtphp/zip/pclzip/' : ( empty ( $dolibarr_lib_ODTPHP_PATHTOPCLZIP ) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP . '/' )); }
2012-01-14 02:06:05 +01:00
if ( ! defined ( 'JS_CKEDITOR' )) { define ( 'JS_CKEDITOR' , ( ! isset ( $dolibarr_js_CKEDITOR )) ? '' : ( empty ( $dolibarr_js_CKEDITOR ) ? '' : $dolibarr_js_CKEDITOR . '/' )); }
2012-02-18 14:55:41 +01:00
if ( ! defined ( 'JS_JQUERY' )) { define ( 'JS_JQUERY' , ( ! isset ( $dolibarr_js_JQUERY )) ? '' : ( empty ( $dolibarr_js_JQUERY ) ? '' : $dolibarr_js_JQUERY . '/' )); }
if ( ! defined ( 'JS_JQUERY_UI' )) { define ( 'JS_JQUERY_UI' , ( ! isset ( $dolibarr_js_JQUERY_UI )) ? '' : ( empty ( $dolibarr_js_JQUERY_UI ) ? '' : $dolibarr_js_JQUERY_UI . '/' )); }
if ( ! defined ( 'JS_JQUERY_FLOT' )) { define ( 'JS_JQUERY_FLOT' , ( ! isset ( $dolibarr_js_JQUERY_FLOT )) ? '' : ( empty ( $dolibarr_js_JQUERY_FLOT ) ? '' : $dolibarr_js_JQUERY_FLOT . '/' )); }
2011-09-07 15:27:50 +02:00
// Other required path
2011-11-27 22:55:49 +01:00
if ( ! defined ( 'DOL_DEFAULT_TTF' )) { define ( 'DOL_DEFAULT_TTF' , ( ! isset ( $dolibarr_font_DOL_DEFAULT_TTF )) ? DOL_DOCUMENT_ROOT . '/includes/fonts/Aerial.ttf' : ( empty ( $dolibarr_font_DOL_DEFAULT_TTF ) ? '' : $dolibarr_font_DOL_DEFAULT_TTF )); }
if ( ! defined ( 'DOL_DEFAULT_TTF_BOLD' )) { define ( 'DOL_DEFAULT_TTF_BOLD' , ( ! isset ( $dolibarr_font_DOL_DEFAULT_TTF_BOLD )) ? DOL_DOCUMENT_ROOT . '/includes/fonts/AerialBd.ttf' : ( empty ( $dolibarr_font_DOL_DEFAULT_TTF_BOLD ) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD )); }
2011-09-07 15:27:50 +02:00
2010-12-29 13:13:36 +01:00
/*
* Include functions
*/
2012-08-23 02:04:35 +02:00
if ( ! defined ( 'ADODB_DATE_VERSION' )) include_once ADODB_PATH . 'adodb-time.inc.php' ;
2011-09-07 15:27:50 +02:00
2011-10-24 12:59:44 +02:00
if ( ! file_exists ( DOL_DOCUMENT_ROOT . " /core/lib/functions.lib.php " ))
2010-12-29 13:13:36 +01:00
{
print " Error: Dolibarr config file content seems to be not correctly defined.<br> \n " ;
print " Please run dolibarr setup by calling page <b>/install</b>.<br> \n " ;
exit ;
}
2013-03-30 14:27:13 +01:00
2010-12-29 13:13:36 +01:00
2012-02-12 17:41:28 +01:00
// Included by default
2012-08-23 02:04:35 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/security.lib.php' ;
2012-02-12 17:41:28 +01:00
//print memory_get_usage();
2010-12-29 13:13:36 +01:00
// If password is encoded, we decode it
if ( preg_match ( '/crypted:/i' , $dolibarr_main_db_pass ) || ! empty ( $dolibarr_main_db_encrypted_pass ))
{
if ( preg_match ( '/crypted:/i' , $dolibarr_main_db_pass ))
{
$dolibarr_main_db_pass = preg_replace ( '/crypted:/i' , '' , $dolibarr_main_db_pass );
$dolibarr_main_db_pass = dol_decode ( $dolibarr_main_db_pass );
$dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass ; // We need to set this as it is used to know the password was initially crypted
}
else $dolibarr_main_db_pass = dol_decode ( $dolibarr_main_db_encrypted_pass );
}