From fb06c153305c58ac14176994611c271f046f000b Mon Sep 17 00:00:00 2001 From: Philippe Grand <philippe.grand@atoo-net.com> Date: Tue, 24 Aug 2010 14:42:18 +0000 Subject: [PATCH] task #6689, strlen problem replace strlen with dol_strlen --- dev/fpdf/makefont/makefont.php | 2 +- dev/skeletons/build_class_from_table.php | 6 +- htdocs/admin/boxes.php | 4 +- htdocs/admin/commande.php | 8 +-- htdocs/admin/dons.php | 4 +- htdocs/admin/expedition.php | 6 +- htdocs/admin/facture.php | 6 +- htdocs/admin/fichinter.php | 6 +- htdocs/admin/fournisseur.php | 8 +-- htdocs/admin/livraison.php | 10 +-- htdocs/admin/modules.php | 4 +- htdocs/admin/osc-languages.php | 2 +- htdocs/admin/perms.php | 4 +- htdocs/admin/project.php | 8 +-- htdocs/admin/propale.php | 10 +-- htdocs/admin/societe.php | 8 +-- htdocs/admin/system/modules.php | 4 +- htdocs/cashdesk/facturation_dhtml.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- htdocs/comm/contact.php | 4 +- htdocs/comm/propal.php | 6 +- htdocs/commande/fiche.php | 4 +- htdocs/compta/class/comptacompte.class.php | 2 +- htdocs/compta/clients.php | 4 +- htdocs/compta/commande/liste.php | 2 +- htdocs/compta/dons/class/don.class.php | 14 ++-- .../class/ComptaJournalPaiement.class.php | 4 +- .../export/class/ComptaJournalVente.class.php | 4 +- htdocs/compta/export/index.php | 2 +- .../export/modules/compta.export.class.php | 2 +- .../modules/compta.export.safran.class.php | 2 +- htdocs/compta/facture.php | 6 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/impayees.php | 2 +- htdocs/compta/param/comptes/liste.php | 6 +- htdocs/compta/prelevement/demandes.php | 2 +- .../sociales/class/chargesociales.class.php | 6 +- .../compta/ventilation/fournisseur/lignes.php | 2 +- htdocs/compta/ventilation/lignes.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contact/fiche.php | 14 ++-- htdocs/contact/vcard.php | 2 +- htdocs/contrat/class/contrat.class.php | 10 +-- htdocs/core/class/cookie.class.php | 4 +- htdocs/core/class/dolgraph.class.php | 6 +- htdocs/core/class/html.form.class.php | 18 ++--- htdocs/core/class/notify.class.php | 2 +- htdocs/ecm/class/ecmdirectory.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 10 +-- htdocs/expedition/fiche.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/commande/fiche.php | 4 +- htdocs/fourn/commande/liste.php | 2 +- htdocs/fourn/contact.php | 4 +- htdocs/fourn/facture/impayees.php | 2 +- htdocs/includes/boxes/box_factures.php | 2 +- .../modules/DolibarrModules.class.php | 4 +- .../cheque/pdf/modules_chequereceipts.php | 2 +- htdocs/includes/modules/dons/modules_don.php | 2 +- .../modules/facture/modules_facture.php | 2 +- .../modules/fichinter/modules_fichinter.php | 2 +- .../modules/import/import_csv.modules.php | 8 +-- .../modules/livraison/modules_livraison.php | 2 +- .../modules/mailings/peche.modules.php | 2 +- .../modules/member/cards/modules_cards.php | 2 +- .../modules/project/modules_project.php | 2 +- .../modGeneratePassStandard.class.php | 4 +- .../modules/societe/mod_codeclient_monkey.php | 4 +- .../modules/societe/modules_societe.class.php | 2 +- .../modules_commandefournisseur.php | 2 +- htdocs/install/etape1.php | 8 +-- htdocs/install/etape2.php | 6 +- htdocs/install/etape5.php | 4 +- htdocs/install/fileconf.php | 4 +- htdocs/install/repair.php | 2 +- htdocs/install/upgrade.php | 2 +- htdocs/install/upgrade2.php | 2 +- htdocs/lib/databases/mysql.lib.php | 4 +- htdocs/lib/databases/mysqli.lib.php | 4 +- htdocs/lib/databases/pgsql.lib.php | 4 +- htdocs/lib/functions.lib.php | 32 ++++----- htdocs/lib/functions2.lib.php | 66 +++++++++---------- htdocs/lib/functions_ch.lib.php | 2 +- htdocs/lib/google.class.php | 2 +- 84 files changed, 226 insertions(+), 226 deletions(-) diff --git a/dev/fpdf/makefont/makefont.php b/dev/fpdf/makefont/makefont.php index 07b530da5b0..9fa11878a8a 100644 --- a/dev/fpdf/makefont/makefont.php +++ b/dev/fpdf/makefont/makefont.php @@ -232,7 +232,7 @@ function SaveToFile($file,$s,$mode='t') $f=fopen($file,'w'.$mode); if(!$f) die('Can\'t write to file '.$file); - fwrite($f,$s,strlen($s)); + fwrite($f,$s,dol_strlen($s)); fclose($f); } diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 6527041c43f..60a539a6c74 100644 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -230,7 +230,7 @@ foreach($property as $key => $prop) $varprop.="\t\t\$sql.= \" "; if ($prop['istime']) { - $varprop.='".(! isset($this->'.$prop['field'].') || strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate('; + $varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate('; $varprop.="\$this->".$prop['field'].""; $varprop.='))."'; if ($i < sizeof($property)) $varprop.=","; @@ -271,8 +271,8 @@ foreach($property as $key => $prop) $varprop.=$prop['field'].'='; if ($prop['istime']) { - // (strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null') - $varprop.='".(strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate('; + // (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null') + $varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate('; $varprop.='$this->'.$prop['field']; $varprop.=')."\'" : \'null\').'; $varprop.='"'; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 9a66b481768..98f826cbc61 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -206,7 +206,7 @@ if ($resql) { while ($record = $db->fetch_array($result)) { - if (strlen($record['box_order']) == 1) + if (dol_strlen($record['box_order']) == 1) { if (preg_match("/[13579]{1}/",substr($record['box_order'],-1))) { @@ -221,7 +221,7 @@ if ($resql) $resql = $db->query($sql); } } - else if (strlen($record['box_order']) == 2) + else if (dol_strlen($record['box_order']) == 2) { if (preg_match("/[13579]{1}/",substr($record['box_order'],-1))) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index d139b8c1bcc..6d901dd95d6 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -214,9 +214,9 @@ if ($handle) while (($file = readdir($handle))!==false) { - if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php') + if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php"); @@ -334,8 +334,8 @@ while (($file = readdir($handle))!==false) { if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') { - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); $var=!$var; print "<tr ".$bc[$var].">\n <td>"; diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index 273f324798c..82c67bd5935 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -182,8 +182,8 @@ while (($file = readdir($handle))!==false) if (preg_match('/\.modules\.php$/i',$file)) { $var = !$var; - $name = substr($file, 0, strlen($file) -12); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 0, dol_strlen($file) -12); + $classname = substr($file, 0, dol_strlen($file) -12); require_once($dir.'/'.$file); $module=new $classname($db); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index be6c30de580..016727c94c5 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -306,10 +306,10 @@ if(is_dir($dir)) while (($file = readdir($handle))!==false) { - if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_') + if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_') { - $name = substr($file, 15, strlen($file) - 27); - $classname = substr($file, 0, strlen($file) - 12); + $name = substr($file, 15, dol_strlen($file) - 27); + $classname = substr($file, 0, dol_strlen($file) - 12); $var=!$var; print "<tr $bc[$var]><td>"; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 37da46c0570..0045e494edf 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -272,7 +272,7 @@ foreach ($conf->file->dol_document_root as $dirroot) $classname = "mod_facture_".$file; } //print "x".$dir."-".$filebis."-".$classname; - if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, strlen($filebis)-3, 3) == 'php') + if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') { // Chargement de la classe de numerotation require_once($dir.$filebis); @@ -418,8 +418,8 @@ foreach ($conf->file->dol_document_root as $dirroot) if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { $var = !$var; - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); require_once($dir.$file); $module = new $classname($db); diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index f94dfe8c8e7..cb690a37cd7 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -306,10 +306,10 @@ $var=true; $handle=opendir($dir); while (($file = readdir($handle))!==false) { - if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') { - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); $var=!$var; diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 15c5b3cfe8d..af104ef5bbc 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -190,9 +190,9 @@ if ($handle) while (($file = readdir($handle))!==false) { - if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php') + if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php"); @@ -310,8 +310,8 @@ while (($file = readdir($handle))!==false) { if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') { - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); $var=!$var; print "<tr ".$bc[$var].">\n <td>$name"; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index f7e97b6de17..24713357125 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -212,9 +212,9 @@ if ($handle) $var=true; while (($file = readdir($handle))!==false) { - if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, strlen($file)-3, 3) == 'php') + if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php"); @@ -331,10 +331,10 @@ if(is_dir($dir)) while (($file = readdir($handle))!==false) { - if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') + if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_') { - $name = substr($file, 4, strlen($file) - 16); - $classname = substr($file, 0, strlen($file) - 12); + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); $var=!$var; print "<tr $bc[$var]><td>"; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 74d1fcb22be..893f172cb7e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -233,9 +233,9 @@ foreach ($conf->file->dol_document_root as $dirroot) while (($file = readdir($handle))!==false) { //print "$i ".$file."\n<br>"; - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { - $modName = substr($file, 0, strlen($file) - 10); + $modName = substr($file, 0, dol_strlen($file) - 10); if ($modName) { diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php index 0bbca339df2..4e918746296 100644 --- a/htdocs/admin/osc-languages.php +++ b/htdocs/admin/osc-languages.php @@ -34,7 +34,7 @@ accessforbidden(); llxHeader(); -if (! strlen(OSC_DB_NAME)) +if (! dol_strlen(OSC_DB_NAME)) { print "Non dispo"; llxFooter(); diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index e10aae7ed85..65a39b418e5 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -88,9 +88,9 @@ foreach ($conf->file->dol_document_root as $dirroot) { while (($file = readdir($handle))!==false) { - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { - $modName = substr($file, 0, strlen($file) - 10); + $modName = substr($file, 0, dol_strlen($file) - 10); if ($modName) { diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php index 39d8e1e9f5e..cfc9fe2cde1 100644 --- a/htdocs/admin/project.php +++ b/htdocs/admin/project.php @@ -179,9 +179,9 @@ if ($handle) while (($file = readdir($handle))!==false) { - if (substr($file, 0, 12) == 'mod_project_' && substr($file, strlen($file)-3, 3) == 'php') + if (substr($file, 0, 12) == 'mod_project_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/project/".$file.".php"); @@ -298,8 +298,8 @@ while (($file = readdir($handle))!==false) { if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_') { - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); $var=!$var; print "<tr ".$bc[$var].">\n <td>$name"; diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index 9732eff4e43..de5ae3e810e 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -216,9 +216,9 @@ foreach ($conf->file->dol_document_root as $dirroot) { while (($file = readdir($handle))!==false) { - if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php') + if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once($dir.$file.".php"); @@ -335,10 +335,10 @@ $handle=opendir($dir); $var=true; while (($file = readdir($handle))!==false) { - if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_') + if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_') { - $name = substr($file, 12, strlen($file) - 24); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 12, dol_strlen($file) - 24); + $classname = substr($file, 0, dol_strlen($file) -12); $var=!$var; print "<tr ".$bc[$var].">\n <td>"; diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index 302c5a12012..6fe20ccc94a 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -196,7 +196,7 @@ if ($handle) { if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php"); @@ -265,7 +265,7 @@ if ($handle) { if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php') { - $file = substr($file, 0, strlen($file)-4); + $file = substr($file, 0, dol_strlen($file)-4); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php"); @@ -355,8 +355,8 @@ foreach ($conf->file->dol_document_root as $dirroot) if (preg_match('/\.modules\.php$/i',$file)) { $var = !$var; - $name = substr($file, 4, strlen($file) -16); - $classname = substr($file, 0, strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); require_once($dir.'/'.$file); $module = new $classname($db); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 1692ee8aa8b..8566885e40f 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -55,9 +55,9 @@ foreach($conf->file->dol_document_root as $searchdir) $handle=opendir($dirtoscan); while (($file = readdir($handle))!==false) { - if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') + if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { - $modName = substr($file, 0, strlen($file) - 10); + $modName = substr($file, 0, dol_strlen($file) - 10); if ($modName) { diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php index 9a1dcf2c3a4..f5fd1b6bee4 100644 --- a/htdocs/cashdesk/facturation_dhtml.php +++ b/htdocs/cashdesk/facturation_dhtml.php @@ -42,7 +42,7 @@ require(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'); header("Content-type: text/html; charset=".$conf->file->character_set_client); // Search from criteria -if ( strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length at least +if ( dol_strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length at least { $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx"; if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 76939acc996..6702ce34a4d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -634,7 +634,7 @@ class Categorie $this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label']; } // We count number of _ to have level - $this->cats[$id_categ]['level']=strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath'])); + $this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath'])); // Process all childs on several levels of this category $protection++; diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 31f13302c55..f3a297d38f8 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -87,12 +87,12 @@ if ($type == "p") $sql.= " AND s.client IN (2, 3)"; if ($type == "f") $sql.= " AND s.fournisseur = 1"; if ($socid) $sql.= " AND s.rowid = ".$socid; -if (strlen($stcomm)) +if (dol_strlen($stcomm)) { $sql.= " AND s.fk_stcomm=$stcomm"; } -if (strlen($begin)) // filtre sur la premiere lettre du nom +if (dol_strlen($begin)) // filtre sur la premiere lettre du nom { $sql.= " AND upper(p.name) like '$begin%'"; } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 66b8f4ef60d..65979e86cb4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -466,7 +466,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } } - if (strlen($sendto)) + if (dol_strlen($sendto)) { $langs->load("commercial"); @@ -478,7 +478,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] if ($_POST['action'] == 'send') { - if (strlen($_POST['subject'])) $subject = $_POST['subject']; + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; else $subject = $langs->transnoentities('Propal').' '.$propal->ref; $actiontypecode='AC_PROP'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; @@ -1713,7 +1713,7 @@ else { $sql.= " AND date_format(p.datep, '%Y') = $year"; } - if (strlen($_POST['sf_ref']) > 0) + if (dol_strlen($_POST['sf_ref']) > 0) { $sql.= " AND p.ref like '%".addslashes($_POST["sf_ref"]) . "%'"; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 74fe2680246..a41c05fea4c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -864,7 +864,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } } - if (strlen($sendto)) + if (dol_strlen($sendto)) { $langs->load("commercial"); @@ -876,7 +876,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] if ($_POST['action'] == 'send') { - if (strlen($_POST['subject'])) $subject=$_POST['subject']; + if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; else $subject = $langs->transnoentities('Order').' '.$commande->ref; $actiontypecode='AC_COM'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; diff --git a/htdocs/compta/class/comptacompte.class.php b/htdocs/compta/class/comptacompte.class.php index fd8d0b711c2..b7b3537f099 100644 --- a/htdocs/compta/class/comptacompte.class.php +++ b/htdocs/compta/class/comptacompte.class.php @@ -55,7 +55,7 @@ class ComptaCompte function create($user) { - if (strlen(trim($this->numero)) && strlen(trim($this->intitule))) + if (dol_strlen(trim($this->numero)) && dol_strlen(trim($this->intitule))) { $sql = "SELECT count(*)"; $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux "; diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 2178009a904..3bca42e3cfd 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -105,7 +105,7 @@ $sql.= " WHERE s.fk_stcomm = st.id AND s.client=1"; $sql.= " AND s.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if (strlen($stcomm)) +if (dol_strlen($stcomm)) { $sql.= " AND s.fk_stcomm=$stcomm"; } @@ -132,7 +132,7 @@ if ($_GET["search_code_client"]) $sql.= " AND s.code_client like '%".addslashes($_GET["search_code_client"])."%'"; } -if (strlen($begin)) +if (dol_strlen($begin)) { $sql.= " AND s.nom like '".addslashes($begin)."'"; } diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php index 8a523208f6d..dc41aba5062 100644 --- a/htdocs/compta/commande/liste.php +++ b/htdocs/compta/commande/liste.php @@ -85,7 +85,7 @@ if (isset($_GET["afacturer"]) && $_GET['afacturer'] == 1) { $sql.= " AND fk_statut >=1 AND c.facture = 0"; } -if (strlen($_POST["sf_ref"]) > 0) +if (dol_strlen($_POST["sf_ref"]) > 0) { $sql.= " AND c.ref like '%".$_POST["sf_ref"] . "%'"; } diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index b9ba4bdb52b..700167de5d0 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -209,34 +209,34 @@ class Don extends CommonObject { $err = 0; - if (strlen(trim($this->societe)) == 0) + if (dol_strlen(trim($this->societe)) == 0) { - if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0) + if ((dol_strlen(trim($this->nom)) + dol_strlen(trim($this->prenom))) == 0) { $error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe."; $err++; } } - if (strlen(trim($this->adresse)) == 0) + if (dol_strlen(trim($this->adresse)) == 0) { $error_string[$err] = "L'adresse saisie est invalide"; $err++; } - if (strlen(trim($this->cp)) == 0) + if (dol_strlen(trim($this->cp)) == 0) { $error_string[$err] = "Le code postal saisi est invalide"; $err++; } - if (strlen(trim($this->ville)) == 0) + if (dol_strlen(trim($this->ville)) == 0) { $error_string[$err] = "La ville saisie est invalide"; $err++; } - if (strlen(trim($this->email)) == 0) + if (dol_strlen(trim($this->email)) == 0) { $error_string[$err] = "L'email saisi est invalide"; $err++; @@ -245,7 +245,7 @@ class Don extends CommonObject $this->amount = trim($this->amount); $map = range(0,9); - for ($i = 0; $i < strlen($this->amount) ; $i++) + for ($i = 0; $i < dol_strlen($this->amount) ; $i++) { if (!isset($map[substr($this->amount, $i, 1)] )) { diff --git a/htdocs/compta/export/class/ComptaJournalPaiement.class.php b/htdocs/compta/export/class/ComptaJournalPaiement.class.php index 7001882afcd..9324f2c14ca 100644 --- a/htdocs/compta/export/class/ComptaJournalPaiement.class.php +++ b/htdocs/compta/export/class/ComptaJournalPaiement.class.php @@ -164,7 +164,7 @@ class ComptaJournalPaiement $socnom = $obj->nom; $libelle = $obj->libelle; - if (strlen($obj->nom) > 31) + if (dol_strlen($obj->nom) > 31) { $socnom = substr($obj->nom, 0 , 31); } @@ -190,7 +190,7 @@ class ComptaJournalPaiement $s = $socnom . ' '.$libelle; $facnumber = $obj->facnumber; - if (strlen(trim($obj->increment)) > 0) + if (dol_strlen(trim($obj->increment)) > 0) { $facnumber = $obj->increment; } diff --git a/htdocs/compta/export/class/ComptaJournalVente.class.php b/htdocs/compta/export/class/ComptaJournalVente.class.php index 3da1ec4fd69..458cb0ffdea 100644 --- a/htdocs/compta/export/class/ComptaJournalVente.class.php +++ b/htdocs/compta/export/class/ComptaJournalVente.class.php @@ -157,12 +157,12 @@ class ComptaJournalVente { $tva = abs($obj->tva); $facnumber = $obj->facnumber; - if (strlen(trim($obj->increment)) > 0) + if (dol_strlen(trim($obj->increment)) > 0) { $facnumber = $obj->increment; } - if (strlen($obj->nom) > 31) + if (dol_strlen($obj->nom) > 31) { $socnom = substr($obj->nom, 0 , 31); } diff --git a/htdocs/compta/export/index.php b/htdocs/compta/export/index.php index 94ab0a1d76d..2d82b4d5bd2 100644 --- a/htdocs/compta/export/index.php +++ b/htdocs/compta/export/index.php @@ -138,7 +138,7 @@ if ($handle) { while (($file = readdir($handle))!==false) { - if (is_readable($updir.$file) && is_dir($updir.$file) && strlen($file) == 4) + if (is_readable($updir.$file) && is_dir($updir.$file) && dol_strlen($file) == 4) { $var=!$var; print '<tr '.$bc[$var].'><td><a href="index.php?year='.$file.'">'.$file.'</a><td></tr>'; diff --git a/htdocs/compta/export/modules/compta.export.class.php b/htdocs/compta/export/modules/compta.export.class.php index ebe6ce4ab75..8a76251b1ee 100644 --- a/htdocs/compta/export/modules/compta.export.class.php +++ b/htdocs/compta/export/modules/compta.export.class.php @@ -178,7 +178,7 @@ class ComptaExport $this->linep[$i][5] = $obj->amount; $this->linep[$i][6] = $obj->libelle; - if (strlen(trim( $obj->increment)) > 0) + if (dol_strlen(trim( $obj->increment)) > 0) { $this->linep[$i][7] = $obj->increment; } diff --git a/htdocs/compta/export/modules/compta.export.safran.class.php b/htdocs/compta/export/modules/compta.export.safran.class.php index 006057c8865..7c1c5d284c5 100644 --- a/htdocs/compta/export/modules/compta.export.safran.class.php +++ b/htdocs/compta/export/modules/compta.export.safran.class.php @@ -47,7 +47,7 @@ class ComptaExportTableur extends ComptaExport $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls"; - if (strlen(trim($this->fournisseur->email_commande)) == 0) + if (dol_strlen(trim($this->fournisseur->email_commande)) == 0) { return -3; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6b6112e7548..a6eb0799a1a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1166,7 +1166,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a } } - if (strlen($sendto)) + if (dol_strlen($sendto)) { $langs->load("commercial"); @@ -1178,7 +1178,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a if ($_POST['action'] == 'send') { - if (strlen($_POST['subject'])) $subject = $_POST['subject']; + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; else $subject = $langs->transnoentities('Bill').' '.$fac->ref; $actiontypecode='AC_FAC'; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; @@ -1192,7 +1192,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a } if ($_POST['action'] == 'relance') { - if (strlen($_POST['subject'])) $subject = $_POST['subject']; + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; else $subject = $langs->transnoentities('Relance facture '.$fac->ref); $actiontypecode='AC_FAC'; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ac6cc86f687..ae3287de0bf 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -434,7 +434,7 @@ class FactureRec extends Facture // \TODO A virer // Anciens indicateurs: $price, $remise (a ne plus utiliser) - if (trim(strlen($remise_percent)) > 0) + if (trim(dol_strlen($remise_percent)) > 0) { $remise = round(($pu * $remise_percent / 100), 2); $price = $pu - $remise; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 110c3f671e1..c045f362e70 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -211,7 +211,7 @@ if ($_REQUEST["search_montant_ttc"]) $sql .= " AND f.total_ttc = '".$_REQUEST["search_montant_ttc"]."'"; } -if (strlen($_POST["sf_ref"]) > 0) +if (dol_strlen($_POST["sf_ref"]) > 0) { $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; } diff --git a/htdocs/compta/param/comptes/liste.php b/htdocs/compta/param/comptes/liste.php index 52b2364c833..87c5bea61b0 100644 --- a/htdocs/compta/param/comptes/liste.php +++ b/htdocs/compta/param/comptes/liste.php @@ -50,12 +50,12 @@ $sql = "SELECT cg.rowid, cg.numero, cg.intitule, cg.date_creation as dc"; $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux as cg"; -if (strlen(trim($_GET["search_numero"])) ) +if (dol_strlen(trim($_GET["search_numero"])) ) { $sql .= " WHERE cg.numero LIKE '%".$_GET["search_numero"]."%'"; - if ( strlen(trim($_GET["search_intitule"]))) + if ( dol_strlen(trim($_GET["search_intitule"]))) { $sql .= " AND cg.intitule LIKE '%".$_GET["search_intitule"]."%'"; } @@ -63,7 +63,7 @@ if (strlen(trim($_GET["search_numero"])) ) } else { - if ( strlen(trim($_GET["search_intitule"]))) + if ( dol_strlen(trim($_GET["search_intitule"]))) { $sql .= " WHERE cg.intitule LIKE '%".$_GET["search_intitule"]."%'"; } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index f3d419cad7d..570e0c9d3e8 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -79,7 +79,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$statut) $sql.= " AND pfd.traite = 0"; if ($statut) $sql.= " AND pfd.traite = ".$statut; $sql.= " AND pfd.fk_facture = f.rowid"; -if (strlen(trim($_GET["search_societe"]))) +if (dol_strlen(trim($_GET["search_societe"]))) { $sql.= " AND s.nom LIKE '%".$_GET["search_societe"]."%'"; } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 48293067b77..eeb4d7ac87c 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -556,9 +556,9 @@ class PaiementCharge extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET"; $sql.= " fk_charge=".(isset($this->fk_charge)?$this->fk_charge:"null").","; - $sql.= " datec=".(strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; - $sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; - $sql.= " datep=".(strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; + $sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; + $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; $sql.= " amount=".(isset($this->amount)?$this->amount:"null").","; $sql.= " fk_typepaiement=".(isset($this->fk_typepaiement)?$this->fk_typepaiement:"null").","; $sql.= " num_paiement=".(isset($this->num_paiement)?"'".addslashes($this->num_paiement)."'":"null").","; diff --git a/htdocs/compta/ventilation/fournisseur/lignes.php b/htdocs/compta/ventilation/fournisseur/lignes.php index 05d8db6ce5f..e0bb4a69db5 100644 --- a/htdocs/compta/ventilation/fournisseur/lignes.php +++ b/htdocs/compta/ventilation/fournisseur/lignes.php @@ -55,7 +55,7 @@ $sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c"; $sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 "; $sql .= " AND c.rowid = l.fk_code_ventilation"; -if (strlen(trim($_GET["search_facture"]))) +if (dol_strlen(trim($_GET["search_facture"]))) { $sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'"; } diff --git a/htdocs/compta/ventilation/lignes.php b/htdocs/compta/ventilation/lignes.php index 6ef4fd246cd..ba8721582a0 100644 --- a/htdocs/compta/ventilation/lignes.php +++ b/htdocs/compta/ventilation/lignes.php @@ -59,7 +59,7 @@ $sql.= " , ".MAIN_DB_PREFIX."facturedet as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; $sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 "; $sql.= " AND c.rowid = l.fk_code_ventilation"; -if (strlen(trim($_GET["search_facture"]))) +if (dol_strlen(trim($_GET["search_facture"]))) { $sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'"; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 89a855db67c..199b60d8ea0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -306,7 +306,7 @@ class Contact extends CommonObject $info["phpgwContactCatId"] = 0; $info["phpgwContactAccess"] = "public"; - if (strlen($this->egroupware_id) == 0) + if (dol_strlen($this->egroupware_id) == 0) { $this->egroupware_id = 1; } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index f8b1628b105..2ddc89814bd 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -334,17 +334,17 @@ if ($user->rights->societe->contact->creer) print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.(isset($_POST["poste"])?$_POST["poste"]:$contact->poste).'"></td>'; // Address - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address; // Predefined with third party print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><textarea class="flat" name="address" cols="70">'.(isset($_POST["address"])?$_POST["address"]:$contact->address).'</textarea></td>'; // Zip / Town - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp; // Predefined with third party - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville; // Predefined with third party print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80" value="'.(isset($_POST["cp"])?$_POST["cp"]:$contact->cp).'"> '; print '<input name="ville" type="text" size="20" value="'.(isset($_POST["ville"])?$_POST["ville"]:$contact->ville).'" maxlength="80"></td></tr>'; // Country - if (strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id; // Predefined with third party + if (dol_strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id; // Predefined with third party print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'; $form->select_pays((isset($_POST["pays_id"])?$_POST["pays_id"]:$contact->fk_pays),'pays_id',$conf->use_javascript_ajax?' onChange="company_save_refresh_create()"':''); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); @@ -363,16 +363,16 @@ if ($user->rights->societe->contact->creer) print '</td></tr>'; // Phone / Fax - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel; // Predefined with third party print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$contact->phone_pro).'"></td>'; print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$contact->phone_perso).'"></td></tr>'; - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax; // Predefined with third party print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$contact->phone_mobile).'"></td>'; print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.(isset($_POST["fax"])?$_POST["fax"]:$contact->fax).'"></td></tr>'; // EMail - if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email; // Predefined with third party print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.(isset($_POST["email"])?$_POST["email"]:$contact->email).'"></td></tr>'; // Jabberid diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 80abb4f9520..18fb9eed3de 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -90,7 +90,7 @@ $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); Header("Content-Disposition: attachment; filename=\"".$filename."\""); -Header("Content-Length: ".strlen($output)); +Header("Content-Length: ".dol_strlen($output)); Header("Connection: close"); Header("Content-Type: text/x-vcard; name=\"".$filename."\""); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 614a14a1300..2d58d6b65f6 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -104,8 +104,8 @@ class Contrat extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,"; - $sql.= " date_ouverture = ".(strlen($date)!=0?"'".$this->db->idate($date)."'":"null").","; - $sql.= " date_fin_validite = ".(strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").","; + $sql.= " date_ouverture = ".(dol_strlen($date)!=0?"'".$this->db->idate($date)."'":"null").","; + $sql.= " date_fin_validite = ".(dol_strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").","; $sql.= " fk_user_ouverture = ".$user->id.","; $sql.= " date_cloture = null,"; $sql.= " commentaire = '".addslashes($comment)."'"; @@ -562,7 +562,7 @@ class Contrat extends CommonObject $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); $sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL"); $sql.= ",".($this->fk_projet>0?$this->fk_projet:"NULL"); - $sql .= ", " . (strlen($this->ref)<=0 ? "null" : "'".$this->ref."'"); + $sql .= ", " . (dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'"); $sql.= ")"; $resql=$this->db->query($sql); if ($resql) @@ -805,7 +805,7 @@ class Contrat extends CommonObject // Anciens indicateurs: $price, $remise (a ne plus utiliser) $remise = 0; $price = price2num(round($pu_ht, 2)); - if (strlen($remise_percent) > 0) + if (dol_strlen($remise_percent) > 0) { $remise = round(($pu_ht * $remise_percent / 100), 2); $price = $pu_ht - $remise; @@ -899,7 +899,7 @@ class Contrat extends CommonObject $localtax2tx = price2num($localtax2tx); $subprice = $price; $remise = 0; - if (strlen($remise_percent) > 0) + if (dol_strlen($remise_percent) > 0) { $remise = round(($pu * $remise_percent / 100), 2); $price = $pu - $remise; diff --git a/htdocs/core/class/cookie.class.php b/htdocs/core/class/cookie.class.php index d76a17161a1..16191188195 100644 --- a/htdocs/core/class/cookie.class.php +++ b/htdocs/core/class/cookie.class.php @@ -62,7 +62,7 @@ class DolCookie if (!empty($this->myKey)) { $valuecrypt = base64_encode($this->myValue); - for ($f=0 ; $f<=strlen($valuecrypt)-1; $f++) + for ($f=0 ; $f<=dol_strlen($valuecrypt)-1; $f++) { $this->cookie .= intval(ord($valuecrypt[$f]))*$this->myKey."|"; } @@ -191,7 +191,7 @@ class DolCookie $file=DOL_DOCUMENT_ROOT.'/conf/conf.php'; if ($fp = @fopen($file,'w')) { - fputs($fp, $config, strlen($config)); + fputs($fp, $config, dol_strlen($config)); fclose($fp); // It's config file, so we set permission for creator only // @chmod($file, octdec('0600')); diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 2ff4bc232ec..d36733ca4ec 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -355,7 +355,7 @@ class DolGraph { $max = $this->GetMaxValueInData(); if ($max != 0) $max++; - $size=strlen(abs(ceil($max))); + $size=dol_strlen(abs(ceil($max))); $factor=1; for ($i=0; $i < ($size-1); $i++) { @@ -378,7 +378,7 @@ class DolGraph { $min = $this->GetMinValueInData(); if ($min != 0) $min--; - $size=strlen(abs(floor($min))); + $size=dol_strlen(abs(floor($min))); $factor=1; for ($i=0; $i < ($size-1); $i++) { @@ -452,7 +452,7 @@ class DolGraph $paddleft=50; $paddright=10; - $strl=strlen(max(abs($this->MaxValue),abs($this->MinValue))); + $strl=dol_strlen(max(abs($this->MaxValue),abs($this->MinValue))); if ($strl > 6) $paddleft += ($strln * 4); $group->setPadding($paddleft, $paddright); // Width on left and right for Y axis values $group->legend->setSpace(0); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 45c2f47fffc..08837f60a9e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1007,8 +1007,8 @@ class Form $found=0; $currencytext=$langs->trans("Currency".$conf->monnaie); $currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie); - if (strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code - if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code + if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code + if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code // Multiprice if ($price_level >= 1) // If we need a particular price level (from 1 to 6) @@ -1069,7 +1069,7 @@ class Form if ($objp->duration) { - $duration_value = substr($objp->duration,0,strlen($objp->duration)-1); + $duration_value = substr($objp->duration,0,dol_strlen($objp->duration)-1); $duration_unit = substr($objp->duration,-1); if ($duration_value > 1) { @@ -1242,8 +1242,8 @@ class Form { $currencytext=$langs->trans("Currency".$conf->monnaie); $currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie); - if (strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code - if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code + if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code + if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code $opt.= price($objp->fprice).' '.$currencytext."/".$objp->quantity; $outval.= price($objp->fprice).' '.$currencytextnoent."/".$objp->quantity; @@ -2427,14 +2427,14 @@ class Form } // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') - if ($defaulttx < 0 || strlen($defaulttx) == 0) + if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod); $defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod); } // Si taux par defaut n'a pu etre determine, on prend dernier de la liste. // Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant - if ($defaulttx < 0 || strlen($defaulttx) == 0) + if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { $defaulttx = $txtva[sizeof($txtva)-1]; } @@ -2676,7 +2676,7 @@ class Form if ($empty) $retstring.='<option value="-1"> </option>'; for ($hour = 0; $hour < 24; $hour++) { - if (strlen($hour) < 2) + if (dol_strlen($hour) < 2) { $hour = "0" . $hour; } @@ -2702,7 +2702,7 @@ class Form if ($empty) $retstring.='<option value="-1"> </option>'; for ($min = 0; $min < 60 ; $min++) { - if (strlen($min) < 2) + if (dol_strlen($min) < 2) { $min = "0" . $min; } diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 41d497260db..83e1375bf44 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -152,7 +152,7 @@ class Notify $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">"; $actiondefid = $obj->adid; - if (strlen($sendto)) + if (dol_strlen($sendto)) { include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM'); diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index acf84cf22f6..7f235472ea9 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -611,7 +611,7 @@ class EcmDirectory // extends CommonObject $this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label']; } // We count number of _ to have level - $this->cats[$id_categ]['level']=strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath'])); + $this->cats[$id_categ]['level']=dol_strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath'])); // Traite ces enfants $protection++; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bc62ac16599..a73baa571ed 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -604,16 +604,16 @@ class Expedition extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; - $sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql.= " ref=".(isset($this->ref)?"'".addslashes($this->ref)."'":"null").","; $sql.= " ref_customer=".(isset($this->ref_customer)?"'".addslashes($this->ref_customer)."'":"null").","; $sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").","; - $sql.= " date_creation=".(strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; + $sql.= " date_creation=".(dol_strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; $sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").","; - $sql.= " date_valid=".(strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').","; + $sql.= " date_valid=".(dol_strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').","; $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; - $sql.= " date_expedition=".(strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; - $sql.= " date_delivery=".(strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; + $sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; + $sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; $sql.= " fk_address=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").","; $sql.= " fk_expedition_methode=".(isset($this->expedition_method_id)?$this->expedition_method_id:"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".addslashes($this->tracking_number)."'":"null").","; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 0a46f9c6664..074809155cd 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -667,7 +667,7 @@ else $expedition->fetch_object(); } - if (strlen($expedition->tracking_number)) + if (dol_strlen($expedition->tracking_number)) { $expedition->GetUrlTrackingStatus(); } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 8de12d235b4..7b4080f5d29 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -174,7 +174,7 @@ class Fichinter extends CommonObject global $conf; if (! is_numeric($this->duree)) { $this->duree = 0; } - if (! strlen($this->fk_project)) { $this->fk_project = 0; } + if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; } /* * Insertion dans la base diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 8b697baa38c..53dff0b4938 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -614,7 +614,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } } - if (strlen($sendto)) + if (dol_strlen($sendto)) { $langs->load("commercial"); @@ -626,7 +626,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] if ($_POST['action'] == 'send') { - if (strlen($_POST['subject'])) $subject=$_POST['subject']; + if (dol_strlen($_POST['subject'])) $subject=$_POST['subject']; else $subject = $langs->transnoentities('CustomerOrder').' '.$commande->ref; $actiontypecode='AC_SUP_ORD'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index a4240548c55..9bae9fbb24e 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -106,7 +106,7 @@ if ($sall) } if ($socid) $sql.= " AND s.rowid = ".$socid; -if (strlen($_GET["statut"])) +if (dol_strlen($_GET["statut"])) { $sql .= " AND fk_statut =".$_GET["statut"]; } diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 6c3aa016563..9cef3874718 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -68,11 +68,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI $sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.rowid = p.fk_soc"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if (strlen($stcomm)) { +if (dol_strlen($stcomm)) { $sql .= " AND s.fk_stcomm=$stcomm"; } -if (strlen($begin)) { +if (dol_strlen($begin)) { $sql .= " AND p.name like '$begin%'"; } diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index f99834bac8c..64dbff428e7 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -125,7 +125,7 @@ if ($user->rights->fournisseur->facture->lire) $sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'"; } - if (strlen($_POST["sf_ref"]) > 0) + if (dol_strlen($_POST["sf_ref"]) > 0) { $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; } diff --git a/htdocs/includes/boxes/box_factures.php b/htdocs/includes/boxes/box_factures.php index 9228fc2ddca..3644c72b7ae 100644 --- a/htdocs/includes/boxes/box_factures.php +++ b/htdocs/includes/boxes/box_factures.php @@ -67,7 +67,7 @@ class box_factures extends ModeleBoxes { $text = $langs->trans("BoxTitleLastCustomerBills",$max); $this->info_box_head = array( 'text' => $text, - 'limit'=> strlen($text) + 'limit'=> dol_strlen($text) ); if ($user->rights->facture->lire) diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index af46f94579a..2261541bd42 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -885,9 +885,9 @@ class DolibarrModules if (empty($r_type)) $r_type='w'; - if (strlen($r_perms) ) + if (dol_strlen($r_perms) ) { - if (strlen($r_subperms) ) + if (dol_strlen($r_subperms) ) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; $sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)"; diff --git a/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php b/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php index 72e5c850d7e..1d6eab22970 100644 --- a/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php +++ b/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php @@ -80,7 +80,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) $dir = DOL_DOCUMENT_ROOT . "/includes/modules/cheque/pdf/"; // Positionne modele sur le nom du modele a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->FACTURE_ADDON_PDF) { diff --git a/htdocs/includes/modules/dons/modules_don.php b/htdocs/includes/modules/dons/modules_don.php index 99a71af6c8b..6ef01d0731f 100644 --- a/htdocs/includes/modules/dons/modules_don.php +++ b/htdocs/includes/modules/dons/modules_don.php @@ -147,7 +147,7 @@ function don_create($db, $id, $message, $modele, $outputlangs) $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; // Positionne modele sur le nom du modele � utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->DON_ADDON_MODEL) { diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php index b32548282f4..27b15b2cd4f 100644 --- a/htdocs/includes/modules/facture/modules_facture.php +++ b/htdocs/includes/modules/facture/modules_facture.php @@ -149,7 +149,7 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs) $dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/"; // Positionne modele sur le nom du modele a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->FACTURE_ADDON_PDF) { diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php index fee94cba136..bf4b2c638cd 100644 --- a/htdocs/includes/modules/fichinter/modules_fichinter.php +++ b/htdocs/includes/modules/fichinter/modules_fichinter.php @@ -153,7 +153,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='') $dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/"; // Positionne modele sur le nom du modele de facture a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->FICHEINTER_ADDON_PDF) { diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php index 1f14cc282af..077ca9e21b8 100644 --- a/htdocs/includes/modules/import/import_csv.modules.php +++ b/htdocs/includes/modules/import/import_csv.modules.php @@ -226,12 +226,12 @@ class ImportCsv extends ModeleImports if (strtolower($conf->global->IMPORT_CSV_FORCE_CHARSET) == 'utf8') { $newarrayres[$key]['val']=$val; - $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null + $newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null } else { $newarrayres[$key]['val']=utf8_encode($val); - $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null + $newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null } } else // Autodetect format (UTF8 or ISO) @@ -239,12 +239,12 @@ class ImportCsv extends ModeleImports if (utf8_check($val)) { $newarrayres[$key]['val']=$val; - $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null + $newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null } else { $newarrayres[$key]['val']=utf8_encode($val); - $newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null + $newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null } } } diff --git a/htdocs/includes/modules/livraison/modules_livraison.php b/htdocs/includes/modules/livraison/modules_livraison.php index 286e1df754e..b00a0f9034a 100644 --- a/htdocs/includes/modules/livraison/modules_livraison.php +++ b/htdocs/includes/modules/livraison/modules_livraison.php @@ -147,7 +147,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs='' $dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/"; // Positionne modele sur le nom du modele de bon de livraison a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->LIVRAISON_ADDON_PDF) { diff --git a/htdocs/includes/modules/mailings/peche.modules.php b/htdocs/includes/modules/mailings/peche.modules.php index ad1d46e451a..2989ed2df23 100644 --- a/htdocs/includes/modules/mailings/peche.modules.php +++ b/htdocs/includes/modules/mailings/peche.modules.php @@ -143,7 +143,7 @@ class mailing_peche extends MailingTargets $other=$tab[3]; if (! empty($buffer)) { - //print 'xx'.strlen($buffer).empty($buffer)."<br>\n"; + //print 'xx'.dol_strlen($buffer).empty($buffer)."<br>\n"; $id=$cpt; if (isValidEMail($email)) { diff --git a/htdocs/includes/modules/member/cards/modules_cards.php b/htdocs/includes/modules/member/cards/modules_cards.php index 761920db8b2..29a04a084c1 100644 --- a/htdocs/includes/modules/member/cards/modules_cards.php +++ b/htdocs/includes/modules/member/cards/modules_cards.php @@ -77,7 +77,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs) $dir = DOL_DOCUMENT_ROOT . "/includes/modules/member/cards/"; // Positionne modele sur le nom du modele a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->ADHERENT_CARDS_ADDON_PDF) { diff --git a/htdocs/includes/modules/project/modules_project.php b/htdocs/includes/modules/project/modules_project.php index 0ee01ca09de..96c81aa4b61 100644 --- a/htdocs/includes/modules/project/modules_project.php +++ b/htdocs/includes/modules/project/modules_project.php @@ -149,7 +149,7 @@ function project_pdf_create($db, $comid, $modele,$outputlangs) $dir = DOL_DOCUMENT_ROOT."/includes/modules/project/pdf/"; // Positionne modele sur le nom du modele de projet a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if (! empty($conf->global->PROJECT_ADDON_PDF)) { diff --git a/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php index 832cff235a0..73e245e7556 100644 --- a/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php +++ b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php @@ -99,7 +99,7 @@ class modGeneratePassStandard extends ModeleGenPassword { // pick a random character from the possible ones - $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); + $char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) @@ -120,7 +120,7 @@ class modGeneratePassStandard extends ModeleGenPassword */ function validatePassword($password) { - if (strlen($password) < $this->length) return 0; + if (dol_strlen($password) < $this->length) return 0; return 1; } } diff --git a/htdocs/includes/modules/societe/mod_codeclient_monkey.php b/htdocs/includes/modules/societe/mod_codeclient_monkey.php index c0f28f12c7c..5c2249bcf2b 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/includes/modules/societe/mod_codeclient_monkey.php @@ -177,7 +177,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode } else { - if (strlen($code) == 0) + if (dol_strlen($code) == 0) { $result=-2; } @@ -235,7 +235,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { $res = 0; - if (strlen($code) < 11) + if (dol_strlen($code) < 11) { $res = -1; } diff --git a/htdocs/includes/modules/societe/modules_societe.class.php b/htdocs/includes/modules/societe/modules_societe.class.php index 736f08cbe56..8147c97596e 100644 --- a/htdocs/includes/modules/societe/modules_societe.class.php +++ b/htdocs/includes/modules/societe/modules_societe.class.php @@ -290,7 +290,7 @@ function thirdparty_doc_create($db, $id, $message, $modele, $outputlangs) $srctemplatepath=''; // Positionne modele sur le nom du modele a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if ($conf->global->COMPANY_ADDON_PDF) { diff --git a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php index 2a05867993c..854b0a2f0ea 100644 --- a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php @@ -148,7 +148,7 @@ function supplier_order_pdf_create($db, $comid, $modele,$outputlangs) $dir = DOL_DOCUMENT_ROOT."/includes/modules/supplier_order/pdf/"; // Positionne modele sur le nom du modele de commande fournisseur a utiliser - if (! strlen($modele)) + if (! dol_strlen($modele)) { if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 15b0dae5b9c..c848622dc68 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -54,15 +54,15 @@ $error = 0; $main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):''; // On supprime / de fin dans main_dir -if (substr($main_dir, strlen($main_dir) -1) == "/") +if (substr($main_dir, dol_strlen($main_dir) -1) == "/") { - $main_dir = substr($main_dir, 0, strlen($main_dir)-1); + $main_dir = substr($main_dir, 0, dol_strlen($main_dir)-1); } // On supprime / de fin dans main_url -if (substr($_POST["main_url"], strlen($_POST["main_url"]) -1) == "/") +if (substr($_POST["main_url"], dol_strlen($_POST["main_url"]) -1) == "/") { - $_POST["main_url"] = substr($_POST["main_url"], 0, strlen($_POST["main_url"])-1); + $_POST["main_url"] = substr($_POST["main_url"], 0, dol_strlen($_POST["main_url"])-1); } // Directory for generated documents (invoices, orders, ecm, etc...) diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index c0caa20c7a7..9d8ee7f9912 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -151,7 +151,7 @@ if ($_POST["action"] == "set") sort($tabledata); foreach($tabledata as $file) { - $name = substr($file, 0, strlen($file) - 4); + $name = substr($file, 0, dol_strlen($file) - 4); $buffer = ''; $fp = fopen($dir.$file,"r"); if ($fp) @@ -261,7 +261,7 @@ if ($_POST["action"] == "set") sort($tabledata); foreach($tabledata as $file) { - $name = substr($file, 0, strlen($file) - 4); + $name = substr($file, 0, dol_strlen($file) - 4); //print "<tr><td>Creation de la table $name</td>"; $buffer = ''; $fp = fopen($dir.$file,"r"); @@ -480,7 +480,7 @@ if ($_POST["action"] == "set") sort($tabledata); foreach($tabledata as $file) { - $name = substr($file, 0, strlen($file) - 4); + $name = substr($file, 0, dol_strlen($file) - 4); $fp = fopen($dir.$file,"r"); dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG); if ($fp) diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 860a0ffaa12..1e01b6b62d9 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -82,13 +82,13 @@ if ($_POST["action"] == "set") exit; } - if (strlen(trim($_POST["pass"])) == 0) + if (dol_strlen(trim($_POST["pass"])) == 0) { Header("Location: etape4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:'')); exit; } - if (strlen(trim($_POST["login"])) == 0) + if (dol_strlen(trim($_POST["login"])) == 0) { Header("Location: etape4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:'')); exit; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 62f6d98c89b..b44c732a7b3 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -81,7 +81,7 @@ print '<td valign="top" class="label"><b>'; print $langs->trans("WebPagesDirectory"); print "</b></td>"; -if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0) +if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0) { //print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"]; @@ -98,7 +98,7 @@ if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0) } else { - $dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,strlen($_SERVER["SCRIPT_FILENAME"]) - 21); + $dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21); // Nettoyage du path propose // Gere les chemins windows avec double "\" $dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root); diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 6bd1850fbc4..4964aaa787e 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -183,7 +183,7 @@ if ($ok) print '<tr><td nowrap>'; print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'; - $name = substr($file, 0, strlen($file) - 4); + $name = substr($file, 0, dol_strlen($file) - 4); // Run sql script $ok=run_sql($dir.$file, 0, '', 1); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 684748429e4..298edb43f2c 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -322,7 +322,7 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"])) print '<tr><td nowrap>'; print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'."\n"; - $name = substr($file, 0, strlen($file) - 4); + $name = substr($file, 0, dol_strlen($file) - 4); // Run sql script $ok=run_sql($dir.$file, 0, '', 1); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 87d35c5a168..b2af2be5d8d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2673,7 +2673,7 @@ function migrate_project_task_time($db,$langs,$conf) { $obj = $db->fetch_object($resql); - if ($obj->task_duration > 0 && strlen($obj->task_duration) < 3) + if ($obj->task_duration > 0 && dol_strlen($obj->task_duration) < 3) { $newtime = $obj->task_duration*60*60; diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php index 289b1fd14ca..e85e94915a7 100644 --- a/htdocs/lib/databases/mysql.lib.php +++ b/htdocs/lib/databases/mysql.lib.php @@ -253,10 +253,10 @@ class DoliDb { $version= $this->getVersion(); $vlist=preg_split('/[.-]/',$version); - if (strlen($vlist[1])==1){ + if (dol_strlen($vlist[1])==1){ $vlist[1]="0".$vlist[1]; } - if (strlen($vlist[2])==1){ + if (dol_strlen($vlist[2])==1){ $vlist[2]="0".$vlist[2]; } return $vlist[0].$vlist[1].$vlist[2]; diff --git a/htdocs/lib/databases/mysqli.lib.php b/htdocs/lib/databases/mysqli.lib.php index 2133e460bbd..661e8dcc99e 100644 --- a/htdocs/lib/databases/mysqli.lib.php +++ b/htdocs/lib/databases/mysqli.lib.php @@ -261,10 +261,10 @@ class DoliDb { $version= $this->getVersion(); $vlist=preg_split('/[.-]/',$version); - if (strlen($vlist[1])==1){ + if (dol_strlen($vlist[1])==1){ $vlist[1]="0".$vlist[1]; } - if (strlen($vlist[2])==1){ + if (dol_strlen($vlist[2])==1){ $vlist[2]="0".$vlist[2]; } return $vlist[0].$vlist[1].$vlist[2]; diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php index d17061e93fa..28fcbd45ef2 100644 --- a/htdocs/lib/databases/pgsql.lib.php +++ b/htdocs/lib/databases/pgsql.lib.php @@ -376,10 +376,10 @@ class DoliDb { $version = $this->getVersion(); $vlist = preg_split('/[.-]/',$version); - if (strlen($vlist[1])==1){ + if (dol_strlen($vlist[1])==1){ $vlist[1]="0".$vlist[1]; } - if (strlen($vlist[2])==1){ + if (dol_strlen($vlist[2])==1){ $vlist[2]="0".$vlist[2]; } return $vlist[0].$vlist[1].$vlist[2]; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index edeec47fc63..39d4c87e844 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -455,7 +455,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ'; // If date undefined or "", we return "" - if (strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) + if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) //print 'x'.$time; @@ -845,22 +845,22 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ= if (strtoupper($country) == "FR") { // France - if (strlen($phone) == 10) { + if (dol_strlen($phone) == 10) { $newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2); } - elseif (strlen($newphone) == 7) + elseif (dol_strlen($newphone) == 7) { $newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2); } - elseif (strlen($newphone) == 9) + elseif (dol_strlen($newphone) == 9) { $newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2); } - elseif (strlen($newphone) == 11) + elseif (dol_strlen($newphone) == 11) { $newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2); } - elseif (strlen($newphone) == 12) + elseif (dol_strlen($newphone) == 12) { $newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2); } @@ -2091,7 +2091,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath $return.= '<td class="nobordernopadding" valign="middle">'; $return.= '<div class="titre">'.$titre.'</div>'; $return.= '</td>'; - if (strlen($mesg)) + if (dol_strlen($mesg)) { $return.= '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>'; } @@ -2384,7 +2384,7 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1) $end=''; // We increase nbdecimal if there is more decimal than asked (to not loose information) - if (strlen($decpart) > $nbdecimal) $nbdecimal=strlen($decpart); + if (dol_strlen($decpart) > $nbdecimal) $nbdecimal=dol_strlen($decpart); // Si on depasse max if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN) { @@ -2448,7 +2448,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) // We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10 $temps=sprintf("%0.10F",$amount-intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 $temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1 - $nbofdec=max(0,strlen($temps)-2); // -2 to remove "0." + $nbofdec=max(0,dol_strlen($temps)-2); // -2 to remove "0." $amount=number_format($amount,$nbofdec,$dec,$thousand); } //print "QQ".$amount.'<br>'; @@ -2469,7 +2469,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN; elseif ($rounding == '2') $nbofdectoround=2; // For admin info page //print "RR".$amount.' - '.$nbofdectoround.'<br>'; - if (strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0. + if (dol_strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0. else return 'ErrorBadParameterProvidedToFunction'; //print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>'; @@ -2480,7 +2480,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) // We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10 $temps=sprintf("%0.10F",$amount-intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 $temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1 - $nbofdec=max(0,strlen($temps)-2); // -2 to remove "0." + $nbofdec=max(0,dol_strlen($temps)-2); // -2 to remove "0." $amount=number_format($amount,min($nbofdec,$nbofdectoround),$dec,$thousand); // Convert amount to format with dolibarr dec and thousand } //print "TT".$amount.'<br>'; @@ -2984,7 +2984,7 @@ function dol_htmlentities($a,$b,$c) */ function dol_string_is_good_iso($s) { - $len=strlen($s); + $len=dol_strlen($s); $ok=1; for($scursor=0;$scursor<$len;$scursor++) { @@ -3034,11 +3034,11 @@ function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8') { foreach ($a as $line) { - if (strlen($line)>$maxlinesize) + if (dol_strlen($line)>$maxlinesize) { //$line_dec = html_entity_decode(strip_tags($line)); $line_dec = html_entity_decode($line); - if(strlen($line_dec)>$maxlinesize) + if(dol_strlen($line_dec)>$maxlinesize) { $line_dec=wordwrap($line_dec,$maxlinesize,'\n',true); $nblines+=substr_count($line_dec,'\n'); @@ -3284,7 +3284,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive */ function utf8_check($Str) { - for ($i=0; $i<strlen($Str); $i++) + for ($i=0; $i<dol_strlen($Str); $i++) { if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb @@ -3294,7 +3294,7 @@ function utf8_check($Str) elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b else return false; # Does not match any model for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ? - if ((++$i == strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80)) + if ((++$i == dol_strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80)) return false; } } diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php index c1130beceab..72c80b38309 100644 --- a/htdocs/lib/functions2.lib.php +++ b/htdocs/lib/functions2.lib.php @@ -368,7 +368,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskcounter=$reg[1]; $maskraz=-1; $maskoffset=0; - if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) @@ -377,10 +377,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskrefclient_maskclientcode=$regClientRef[1]; $maskrefclient_maskcounter=$regClientRef[2]; $maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset - $maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask - $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode + $maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask + $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like - if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; @@ -388,8 +388,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') if (preg_match('/\{(t+)\}/i',$mask,$regType)) { $masktype=$regType[1]; - $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,strlen($regType[1]));//get n first characters of client code where n is length in mask - $masktype_value=str_pad($masktype_value,strlen($regType[1]),"#",STR_PAD_RIGHT); + $masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask + $masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); } else $masktype=''; @@ -430,16 +430,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $yearoffset=0; $yearcomp=0; if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year - if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset); - if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset); - if (strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset; + if (dol_strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset); + if (dol_strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset); + if (dol_strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset; $sqlwhere=''; - $sqlwhere.='( (SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp; + $sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp; if ($monthcomp > 1) // Test useless if monthcomp = 1 (or 0 is same as 1) { - $sqlwhere.=' AND SUBSTRING('.$field.', '.(strlen($reg[1])+strlen($reg[2])+1).', '.strlen($reg[3]).') >= '.$monthcomp.')'; - $sqlwhere.=' OR SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )'; + $sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')'; + $sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )'; } else { @@ -451,7 +451,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') // Define $sqlstring $posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...) if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; - $sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.strlen($maskcounter).')'; + $sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')'; //print "x".$sqlstring; // Define $maskLike @@ -463,9 +463,9 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskLike = preg_replace('/\{y\}/i','_',$maskLike); $maskLike = preg_replace('/\{mm\}/i','__',$maskLike); $maskLike = preg_replace('/\{dd\}/i','__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike); - if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike); - //if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",strlen($masktype),"_"),$maskLike); + $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike); + if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike); + //if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike); if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike); // Get counter in database @@ -498,7 +498,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') // Define $sqlstring $maskrefclient_posnumstart=strpos($maskwithnocode,$maskrefclient_maskcounter,strpos($maskwithnocode,$maskrefclient)); // Pos of counter in final string (from 0 to ...) if ($maskrefclient_posnumstart <= 0) return 'ErrorBadMask'; - $maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.strlen($maskrefclient_maskcounter).')'; + $maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.dol_strlen($maskrefclient_maskcounter).')'; //print "x".$sqlstring; // Define $maskrefclient_maskLike @@ -510,8 +510,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskrefclient_maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskrefclient_maskLike); $maskrefclient_maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskrefclient_maskLike); $maskrefclient_maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskrefclient_maskLike); - $maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskrefclient_maskLike); - $maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike); + $maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskrefclient_maskLike); + $maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",dol_strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike); // Get counter in database $maskrefclient_counter=0; @@ -522,7 +522,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskrefclient_sql.= " AND entity = ".$conf->entity; if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask - $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; + $maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')"; dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG); $maskrefclient_resql=$db->query($maskrefclient_sql); @@ -548,7 +548,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') // Now we replace the counter $maskbefore='{'.$masktri.'}'; - $maskafter=str_pad($counter,strlen($maskcounter),"0",STR_PAD_LEFT); + $maskafter=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT); //print 'x'.$maskbefore.'-'.$maskafter.'y'; $numFinal = str_replace($maskbefore,$maskafter,$numFinal); @@ -557,7 +557,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') { //print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>"; $maskrefclient_maskbefore='{'.$maskrefclient.'}'; - $maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT); + $maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,dol_strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT); $numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal); } @@ -592,7 +592,7 @@ function check_value($mask,$value) $maskcounter=$reg[1]; $maskraz=-1; $maskoffset=0; - if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) @@ -601,10 +601,10 @@ function check_value($mask,$value) $maskrefclient_maskclientcode=$regClientRef[1]; $maskrefclient_maskcounter=$regClientRef[2]; $maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset - $maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode - $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode + $maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode + $maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode $maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like - if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; @@ -641,12 +641,12 @@ function check_value($mask,$value) } //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n"; - // Check we have a number in ($posnumstart+1).', '.strlen($maskcounter) + // Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter) // // Check length - $len=strlen($maskwithnocode); - if (strlen($value) != $len) $result=-1; + $len=dol_strlen($maskwithnocode); + if (dol_strlen($value) != $len) $result=-1; // Define $maskLike $maskLike = dol_string_nospecial($mask); @@ -657,7 +657,7 @@ function check_value($mask,$value) $maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike); $maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike); $maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike); + $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike); if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike); @@ -675,10 +675,10 @@ function check_value($mask,$value) */ function binhex($bin, $pad=false, $upper=false) { - $last = strlen($bin)-1; + $last = dol_strlen($bin)-1; for($i=0; $i<=$last; $i++){ $x += $bin[$last-$i] * pow(2,$i); } $x = dechex($x); - if($pad){ while(strlen($x) < intval(strlen($bin))/4){ $x = "0$x"; } } + if($pad){ while(dol_strlen($x) < intval(dol_strlen($bin))/4){ $x = "0$x"; } } if($upper){ $x = strtoupper($x); } return $x; } @@ -692,7 +692,7 @@ function binhex($bin, $pad=false, $upper=false) function hexbin($hexa) { $bin=''; - for($i=0;$i<strlen($hexa);$i++) + for($i=0;$i<dol_strlen($hexa);$i++) { $bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT); } diff --git a/htdocs/lib/functions_ch.lib.php b/htdocs/lib/functions_ch.lib.php index dfc01bab9f5..14ccac984d2 100644 --- a/htdocs/lib/functions_ch.lib.php +++ b/htdocs/lib/functions_ch.lib.php @@ -160,7 +160,7 @@ function dol_ch_controle_bvrb ($bvrb) // Make control $report=0; - while (strlen($bv)>1) + while (dol_strlen($bv)>1) { $match=substr($bv,0,1); $report=$tableau[$report][$match]; diff --git a/htdocs/lib/google.class.php b/htdocs/lib/google.class.php index 9762760307c..08520dc84af 100644 --- a/htdocs/lib/google.class.php +++ b/htdocs/lib/google.class.php @@ -70,7 +70,7 @@ class GoogleAPI //print $code; //print "<br>"; $latitude = substr($code, 0, strpos($code, ",")); - $longitude = substr($code, strpos($code, ",")+1, strlen(strpos($code, ","))-3); + $longitude = substr($code, strpos($code, ",")+1, dol_strlen(strpos($code, ","))-3); // Output the coordinates //echo "Longitude: $longitude ',' Latitude: $latitude"; -- GitLab