task #6689, strlen problem

replace  strlen with dol_strlen
This commit is contained in:
Philippe Grand 2010-08-24 19:51:56 +00:00
parent d00efff3ec
commit b6d0f859af
21 changed files with 53 additions and 53 deletions

View File

@ -1030,7 +1030,7 @@ class Ldap
* Indispensable pour Active Directory
*/
function littleEndian($hex) {
for ($x=strlen($hex)-2; $x >= 0; $x=$x-2) {
for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) {
$result .= substr($hex,$x,2);
}
return $result;
@ -1250,11 +1250,11 @@ class Ldap
function setDn($peopleOrGroups) {
if ($peopleOrGroups) {
if ( isset($this->people) && (strlen($this->people) > 0) ) {
if ( isset($this->people) && (dol_strlen($this->people) > 0) ) {
$checkDn = "ou=" .$this->people. ", " .$this->dn;
}
} else {
if ( isset($this->groups) && (strlen($this->groups) > 0) ) {
if ( isset($this->groups) && (dol_strlen($this->groups) > 0) ) {
$checkDn = "ou=" .$this->groups. ", " .$this->dn;
}
}

View File

@ -201,7 +201,7 @@ function dol_setshmop($memoryid,$data)
{
$shm_bytes_written1=shmop_write($handle,str_pad($size,6),0);
$shm_bytes_written2=shmop_write($handle,$newdata,6);
if (($shm_bytes_written1 + $shm_bytes_written2) != (6+strlen($newdata)))
if (($shm_bytes_written1 + $shm_bytes_written2) != (6+dol_strlen($newdata)))
{
print "Couldn't write the entire length of data\n";
}

View File

@ -237,7 +237,7 @@ function makesalt($type=CRYPT_SALT_LENGTH)
$saltlen=2; $saltprefix=''; $saltsuffix=''; break;
}
$salt='';
while(strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
$result=$saltprefix.$salt.$saltsuffix;
dol_syslog("security.lib.php::makesalt return=".$result);
@ -325,7 +325,7 @@ function encodedecode_dbpassconf($level=0)
$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 read permission for creator only.
// Should set permission to web user and groups for users used by batch
@ -353,7 +353,7 @@ function encodedecode_dbpassconf($level=0)
*/
function dol_encode($chain)
{
for($i=0;$i<strlen($chain);$i++)
for($i=0;$i<dol_strlen($chain);$i++)
{
$output_tab[$i] = chr(ord(substr($chain,$i,1))+17);
}
@ -371,7 +371,7 @@ function dol_decode($chain)
{
$chain = base64_decode($chain);
for($i=0;$i<strlen($chain);$i++)
for($i=0;$i<dol_strlen($chain);$i++)
{
$output_tab[$i] = chr(ord(substr($chain,$i,1))-17);
}
@ -472,7 +472,7 @@ function dol_efc_config()
foreach ($available["$avCipher"] as $avMode)
$v .= " '".$avMode."', ";
$i = strlen($v) - 2;
$i = dol_strlen($v) - 2;
if ($v[$i] == ",")
$v = substr($v, 2, $i - 3);
}
@ -480,8 +480,8 @@ function dol_efc_config()
$strAv .= "'".$avCipher."' => Array (".$v."),\n ";
}
$strAv = rtrim($strAv);
if ($strAv[strlen($strAv) - 1] == ",")
$strAv = substr($strAv, 0, strlen($strAv) - 1);
if ($strAv[dol_strlen($strAv) - 1] == ",")
$strAv = substr($strAv, 0, dol_strlen($strAv) - 1);
$strAv .= " );\n\n";
$strAv .= "?>";

View File

@ -31,14 +31,14 @@
function make_alpha_from_numbers($number)
{
$numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if($number<strlen($numeric))
if($number<dol_strlen($numeric))
{
return $numeric[$number];
}
else
{
$dev_by = floor($number/strlen($numeric));
return "" . make_alpha_from_numbers($dev_by-1) . make_alpha_from_numbers($number-($dev_by*strlen($numeric)));
$dev_by = floor($number/dol_strlen($numeric));
return "" . make_alpha_from_numbers($dev_by-1) . make_alpha_from_numbers($number-($dev_by*dol_strlen($numeric)));
}
}

View File

@ -388,11 +388,11 @@ function CalEncode($line)
}
else
{
for ($j = 0; $j <= strlen($line) - 1; $j++)
for ($j = 0; $j <= dol_strlen($line) - 1; $j++)
{
$char = substr ( $line, $j, 1 ); // Take char at position $j
if ( ( strlen ( $newpara ) + strlen ( $char ) ) >= 75 )
if ( ( dol_strlen ( $newpara ) + dol_strlen ( $char ) ) >= 75 )
{
$out .= $newpara . "\r\n "; // CRLF + Space for cal
$newpara = '';
@ -415,7 +415,7 @@ function QPEncode($str,$forcal=0)
{
$newpara = '';
for ($j = 0; $j <= strlen($line) - 1; $j++)
for ($j = 0; $j <= dol_strlen($line) - 1; $j++)
{
$char = substr ( $line, $j, 1 );
$ascii = ord ( $char );
@ -423,7 +423,7 @@ function QPEncode($str,$forcal=0)
if ( $ascii < 32 || $ascii == 61 || $ascii > 126 )
$char = '=' . strtoupper ( sprintf("%02X", $ascii ) );
if ( ( strlen ( $newpara ) + strlen ( $char ) ) >= 76 )
if ( ( dol_strlen ( $newpara ) + dol_strlen ( $char ) ) >= 76 )
{
$out .= $newpara . '=' . "\r\n"; // CRLF
if ($forcal) $out .= " "; // + Space for cal

View File

@ -224,11 +224,11 @@ class ProductDefault extends Product
}
}
if (isset($_GET["tosell"]) && strlen($_GET["tosell"]) > 0)
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
{
$sql.= " AND p.tosell = ".addslashes($_GET["tosell"]);
}
if (isset($_GET["canvas"]) && strlen($_GET["canvas"]) > 0)
if (isset($_GET["canvas"]) && dol_strlen($_GET["canvas"]) > 0)
{
$sql.= " AND p.canvas = '".addslashes($_GET["canvas"])."'";
}

View File

@ -160,11 +160,11 @@ class ProductService extends Product
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
if ($snom) $sql.= " AND p.label like '%".addslashes($snom)."%'";
if (isset($_GET["tosell"]) && strlen($_GET["tosell"]) > 0)
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
{
$sql.= " AND p.tosell = ".addslashes($_GET["tosell"]);
}
if (isset($_GET["canvas"]) && strlen($_GET["canvas"]) > 0)
if (isset($_GET["canvas"]) && dol_strlen($_GET["canvas"]) > 0)
{
$sql.= " AND p.canvas = '".addslashes($_GET["canvas"])."'";
}

View File

@ -168,10 +168,10 @@ class Product extends CommonObject
$this->ref = dol_sanitizeFileName(stripslashes($this->ref));
$err = 0;
if (strlen(trim($this->ref)) == 0)
if (dol_strlen(trim($this->ref)) == 0)
$err++;
if (strlen(trim($this->libelle)) == 0)
if (dol_strlen(trim($this->libelle)) == 0)
$err++;
if ($err > 0)
@ -1010,7 +1010,7 @@ class Product extends CommonObject
$this->finished = $result["finished"];
$this->hidden = $result["hidden"];
$this->duration = $result["duration"];
$this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);
$this->duration_value = substr($result["duration"],0,dol_strlen($result["duration"])-1);
$this->duration_unit = substr($result["duration"],-1);
$this->seuil_stock_alerte = $result["seuil_stock_alerte"];
$this->canvas = $result["canvas"];
@ -1441,7 +1441,7 @@ class Product extends CommonObject
// $result[$j] = array($monthnum,isset($tab[$year.$month])?$tab[$year.$month]:0);
$month = "0".($month - 1);
if (strlen($month) == 3)
if (dol_strlen($month) == 3)
{
$month = substr($month,1);
}

View File

@ -141,7 +141,7 @@ if ($sall)
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
}
# if the type is not 1, we show all products (type = 0,2,3)
if (strlen($_GET["type"]) || strlen($_POST["type"]))
if (dol_strlen($_GET["type"]) || dol_strlen($_POST["type"]))
{
if ($type==1) {
$sql.= " AND p.fk_product_type = '1'";
@ -152,11 +152,11 @@ if (strlen($_GET["type"]) || strlen($_POST["type"]))
if ($sref) $sql.= " AND p.ref like '%".$sref."%'";
if ($sbarcode) $sql.= " AND p.barcode like '%".$sbarcode."%'";
if ($snom) $sql.= " AND p.label like '%".addslashes($snom)."%'";
if (isset($_GET["tosell"]) && strlen($_GET["tosell"]) > 0)
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
{
$sql.= " AND p.tosell = ".addslashes($_GET["tosell"]);
}
if (isset($_GET["canvas"]) && strlen($_GET["canvas"]) > 0)
if (isset($_GET["canvas"]) && dol_strlen($_GET["canvas"]) > 0)
{
$sql.= " AND p.canvas = '".addslashes($_GET["canvas"])."'";
}

View File

@ -124,11 +124,11 @@ if ($snom)
{
$sql.= " AND p.label like '%".addslashes($snom)."%'";
}
if (isset($_GET["tosell"]) && strlen($_GET["tosell"]) > 0)
if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0)
{
$sql.= " AND p.tosell = ".$_GET["tosell"];
}
if (isset($_GET["tobuy"]) && strlen($_GET["tobuy"]) > 0)
if (isset($_GET["tobuy"]) && dol_strlen($_GET["tobuy"]) > 0)
{
$sql.= " AND p.tobuy = ".$_GET["tobuy"];
}

View File

@ -151,7 +151,7 @@ class Project extends CommonObject
$this->title = trim($this->title);
$this->description = trim($this->description);
if (strlen(trim($this->ref)) > 0)
if (dol_strlen(trim($this->ref)) > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."projet SET";
$sql.= " ref='".$this->ref."'";

View File

@ -147,9 +147,9 @@ foreach ($dirlist 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)
{

View File

@ -390,7 +390,7 @@ class Societe extends CommonObject
$this->localtax2_assuj=trim($this->localtax2_assuj);
$this->capital=trim($this->capital);
if (strlen($this->capital) == 0) $this->capital = 0;
if (dol_strlen($this->capital) == 0) $this->capital = 0;
$this->effectif_id=trim($this->effectif_id);
$this->forme_juridique_code=trim($this->forme_juridique_code);
@ -1769,7 +1769,7 @@ class Societe extends CommonObject
$chaine=trim($this->siren);
$chaine=preg_replace('/(\s)/','',$chaine);
if (strlen($chaine) != 9) return -1;
if (dol_strlen($chaine) != 9) return -1;
$sum = 0;
@ -1798,7 +1798,7 @@ class Societe extends CommonObject
$chaine=trim($this->siret);
$chaine=preg_replace('/(\s)/','',$chaine);
if (strlen($chaine) != 14) return -1;
if (dol_strlen($chaine) != 14) return -1;
}
return $ok;

View File

@ -188,7 +188,7 @@ if($_GET["socid"])
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."c_typent as te";
$sql.= " WHERE s.fk_typent = te.id";
if (strlen(trim($_GET["search_nom"])))
if (dol_strlen(trim($_GET["search_nom"])))
{
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
}

View File

@ -368,7 +368,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, strlen($module)-4);
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeClient = new $module;
@ -376,7 +376,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, strlen($module)-4);
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;
@ -761,7 +761,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, strlen($module)-4);
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeClient = new $module;
@ -774,7 +774,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, strlen($module)-4);
$module = substr($module, 0, dol_strlen($module)-4);
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;

View File

@ -163,7 +163,7 @@ $sql.= " WHERE s.fk_stcomm = st.id";
$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 ($socid) $sql.= " AND s.rowid = ".$socid;
if (strlen($stcomm))
if (dol_strlen($stcomm))
{
$sql.= " AND s.fk_stcomm=".$stcomm;
}

View File

@ -538,10 +538,10 @@ class User extends CommonObject
{
$row = $this->db->fetch_row($result);
if (strlen($row[1]) > 0)
if (dol_strlen($row[1]) > 0)
{
if (strlen($row[2]) > 0)
if (dol_strlen($row[2]) > 0)
{
$this->rights->$row[0]->$row[1]->$row[2] = 1;
}
@ -1688,7 +1688,7 @@ class User 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;
}

View File

@ -417,10 +417,10 @@ class UserGroup extends CommonObject
{
$row = $this->db->fetch_row($resql);
if (strlen($row[1]) > 0)
if (dol_strlen($row[1]) > 0)
{
if (strlen($row[2]) > 0)
if (dol_strlen($row[2]) > 0)
{
$this->rights->$row[0]->$row[1]->$row[2] = 1;
}

View File

@ -93,9 +93,9 @@ if ($_GET["id"])
{
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)
{

View File

@ -124,9 +124,9 @@ foreach($listdir as $dirroot)
$handle=opendir($dir);
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)
{

View File

@ -77,7 +77,7 @@ if ($resql)
if ($obj->email <> $oldemail)
{
if (strlen($oldemail))
if (dol_strlen($oldemail))
{
envoi_mail($oldemail,$message,$total);
}