diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4ca4aff34e9..c0d6d3883cb 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -91,6 +91,9 @@ class Conf $this->mycompany=(object) array(); $this->admin=(object) array(); $this->user=(object) array(); + $this->syslog=(object) array(); + $this->browser=(object) array(); + $this->multicompany=(object) array(); //! Charset for HTML output and for storing data in memory $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 } @@ -250,21 +253,29 @@ class Conf // for backward compatibility. // Sous module bons d'expedition - $this->expedition_bon->enabled=defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0; + $this->expedition_bon = (object) array(); + $this->expedition_bon->enabled= defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0; // Sous module bons de livraison + $this->livraison_bon = (object) array(); $this->livraison_bon->enabled=defined("MAIN_SUBMODULE_LIVRAISON")?MAIN_SUBMODULE_LIVRAISON:0; // Module fournisseur + $this->fournisseur = (object) array(); + $this->fournisseur->commande = (object) array(); $this->fournisseur->commande->dir_output=$rootfordata."/fournisseur/commande"; $this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp"; + $this->fournisseur->facture = (object) array(); $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; // Module product/service + $this->product = (object) array(); $this->product->dir_output=$rootfordata."/produit"; $this->product->dir_temp =$rootfordata."/produit/temp"; + $this->service = (object) array(); $this->service->dir_output=$rootfordata."/produit"; $this->service->dir_temp =$rootfordata."/produit/temp"; // Module contrat + $this->contrat = (object) array(); $this->contrat->dir_output=$rootfordata."/contracts"; $this->contrat->dir_temp =$rootfordata."/contracts/temp"; @@ -311,10 +322,12 @@ class Conf if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; // conf->notification->email_from = email pour envoi par Dolibarr des notifications + $this->notification = (object) array(); $this->notification->email_from=$this->email_from; if (! empty($this->global->NOTIFICATION_EMAIL_FROM)) $this->notification->email_from=$this->global->NOTIFICATION_EMAIL_FROM; // conf->mailing->email_from = email pour envoi par Dolibarr des mailings + $this->mailing = (object) array(); $this->mailing->email_from=$this->email_from; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; @@ -345,17 +358,36 @@ class Conf if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE='payment'; // Delay before warnings + $this->actions = (object) array(); $this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; + $this->commande = (object) array(); + $this->commande->client = (object) array(); $this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60; - $this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60; - $this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60; - $this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60; + $this->commande->fournisseur = (object) array(); + $this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60; + $this->propal = (object) array(); + $this->propal->cloture = (object) array(); + $this->propal->cloture->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_CLOSE)?$this->global->MAIN_DELAY_PROPALS_TO_CLOSE:0)*24*60*60; + $this->propal->facturation = (object) array(); + $this->propal->facturation->warning_delay=(isset($this->global->MAIN_DELAY_PROPALS_TO_BILL)?$this->global->MAIN_DELAY_PROPALS_TO_BILL:0)*24*60*60; + $this->facture = (object) array(); + $this->facture->client = (object) array(); $this->facture->client->warning_delay=(isset($this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED)?$this->global->MAIN_DELAY_CUSTOMER_BILLS_UNPAYED:0)*24*60*60; - $this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60; - $this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60; - $this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60; + $this->facture->fournisseur = (object) array(); + $this->facture->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY)?$this->global->MAIN_DELAY_SUPPLIER_BILLS_TO_PAY:0)*24*60*60; + $this->contrat = (object) array(); + $this->contrat->services = (object) array(); + $this->contrat->services->inactifs = (object) array(); + $this->contrat->services->inactifs->warning_delay=(isset($this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES)?$this->global->MAIN_DELAY_NOT_ACTIVATED_SERVICES:0)*24*60*60; + $this->contrat->services->expires = (object) array(); + $this->contrat->services->expires->warning_delay=(isset($this->global->MAIN_DELAY_RUNNING_SERVICES)?$this->global->MAIN_DELAY_RUNNING_SERVICES:0)*24*60*60; + $this->adherent = (object) array(); + $this->adherent->cotisation = (object) array(); $this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60; + $this->bank = (object) array(); + $this->bank->rappro = (object) array(); $this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60; + $this->bank->cheque = (object) array(); $this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60; // For backward compatibility diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 55cf0168bf4..ed3bf3c6268 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -83,9 +83,10 @@ class DoliDBMysqli function DoliDBMysqli($type, $host, $user, $pass, $name='', $port=0) { global $conf,$langs; - - if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; - if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; + + // TODO error in strict mode (static property for "$forcecharset" and "$forcecollate") + //if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set; + //if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation; $this->database_user=$user; @@ -142,7 +143,7 @@ class DoliDBMysqli $clientmustbe=''; if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8'; if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1'; - if (mysqli_client_encoding($this->db) != $clientmustbe) + if (mysqli_character_set_name($this->db) != $clientmustbe) { $this->query("SET NAMES '".$clientmustbe."'", $this->db); //$this->query("SET CHARACTER SET ". $this->forcecharset); @@ -168,7 +169,7 @@ class DoliDBMysqli $clientmustbe=''; if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8'; if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1'; - if (mysqli_client_encoding($this->db) != $clientmustbe) + if (mysqli_character_set_name($this->db) != $clientmustbe) { $this->query("SET NAMES '".$clientmustbe."'", $this->db); //$this->query("SET CHARACTER SET ". $this->forcecharset); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 59d6adf5771..5bdbc3ad554 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1101,8 +1101,8 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) function dol_now($mode='gmt') { // Note that gmmktime and mktime return same value (GMT) whithout parameters - if ($mode == 'gmt') $ret=gmmktime(); // Time for now at greenwich. - else if ($mode == 'tzserver') // Time for now with PHP server timezone added + if ($mode == 'gmt') $ret=time(); // Time for now at greenwich. + else if ($mode == 'tzserver') // Time for now with PHP server timezone added { require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); $tzsecond=getServerTimeZoneInt(); // Contains tz+dayling saving time diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 5d60c70c4e6..9fcb2a89f69 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -373,7 +373,7 @@ abstract class DolibarrModules $sql.= $this->numero; $sql.= ", ".$conf->entity; $sql.= ", 1"; - $sql.= ", '".$this->db->idate(gmmktime())."'"; + $sql.= ", '".$this->db->idate(dol_now())."'"; $sql.= ", '".$this->version."'"; $sql.= ")"; diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 96292a89b52..b57b0e8a1c3 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -236,8 +236,8 @@ if (! $error && $db->connected) { if (! empty($_POST["db_create_database"])) // If we create database, we force default value { - $defaultCharacterSet=$db->forcecharset; - $defaultCollationConnection=$db->forcecollate; + $defaultCharacterSet=getStaticMember(get_class($db),'forcecharset'); + $defaultCollationConnection=getStaticMember(get_class($db),'forcecollate'); } else // If already created, we take current value { diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 8dd1b140d6c..3ee0e363d1a 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -43,6 +43,13 @@ require_once(ADODB_PATH.'adodb-time.inc.php'); error_reporting(E_ALL); // To have all errors without disabled E_STRICT +// IMPORTANT with strict mode E_STRICT +$conf = new stdClass(); // instantiate $conf explicitely +$conf->global = (object) array(); +$conf->file = (object) array(); +$conf->db = (object) array(); +$conf->syslog = (object) array(); + // Define $_REQUEST["logtohtml"] $_REQUEST["logtohtml"]=1; @@ -134,7 +141,7 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile)) $includeconferror='ErrorBadFormatForConfFile'; } } -$conf->global->MAIN_LOGTOHTML=1; +$conf->global->MAIN_LOGTOHTML = 1; // Define prefix if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_'; @@ -222,7 +229,7 @@ if (! defined('SYSLOG_FILE')) // To avoid warning on systems with constant alrea if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1); // Removed magic_quotes -if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6 +if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.4 { if (get_magic_quotes_gpc()) {