From 828dc2c9f411df8f9797762a51a3d212cd0d2176 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 12:22:52 +0200 Subject: [PATCH] Fix code standard --- .../core/modules/mailings/contacts1.modules.php | 2 +- .../core/modules/mailings/contacts2.modules.php | 2 +- .../core/modules/mailings/contacts3.modules.php | 2 +- .../core/modules/mailings/contacts4.modules.php | 2 +- htdocs/core/modules/mailings/example.modules.php | 4 ++-- htdocs/core/modules/mailings/fraise.modules.php | 4 ++-- .../core/modules/mailings/framboise.modules.php | 4 ++-- .../core/modules/mailings/modules_mailings.php | 6 +++--- .../modules/mailings/thirdparties.modules.php | 2 +- .../core/modules/mailings/xinputfile.modules.php | 4 ++-- .../core/modules/mailings/xinputuser.modules.php | 4 ++-- htdocs/main.inc.php | 16 ++++++++-------- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 3f8df87cd7a..5d218376983 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -85,7 +85,7 @@ class mailing_contacts1 extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index fe49ce56b35..b1e22110f5e 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -152,7 +152,7 @@ class mailing_contacts2 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 92640291088..feeb0a2cb55 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -157,7 +157,7 @@ class mailing_contacts3 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int Number of recipients */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index 59355b372fe..c0a1c59c01c 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -158,7 +158,7 @@ class mailing_contacts4 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int Number of recipients */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index a7eb1b0b839..428285fb20b 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -100,8 +100,8 @@ class mailing_example extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int + * @param string $sql Requete sql de comptage + * @return int|string Number of recipient or '?' */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index dd6e18dfa91..69b018080b8 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -86,8 +86,8 @@ class mailing_fraise extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @param string $sql Requete sql de comptage + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index c647466e796..e25ffad5f1b 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -150,8 +150,8 @@ class mailing_framboise extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @param string $sql Requete sql de comptage + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 5561526a7ff..2508440c147 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -72,8 +72,8 @@ class MailingTargets // This can't be abstract as it is used for some method /** * Retourne nombre de destinataires * - * @param string $sql Requete sql de comptage - * @return int Nb de destinataires si ok, < 0 si erreur + * @param string $sql Sql request to count + * @return int Nb of recipient, or <0 if error */ function getNbOfRecipients($sql) { @@ -85,7 +85,7 @@ class MailingTargets // This can't be abstract as it is used for some method } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index df8ec79f988..222711cdf65 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -157,7 +157,7 @@ class mailing_thirdparties extends MailingTargets * emails from a text file, this function must return 500. * * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 777621fa432..7b6f8361d24 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -73,8 +73,8 @@ class mailing_xinputfile extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int '' means NA + * @param string $sql Sql request to count + * @return string '' means NA */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 0d01aa53912..7832d1f6a93 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -73,8 +73,8 @@ class mailing_xinputuser extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int '' means NA + * @param string $sql Sql request to count + * @return string '' means NA */ function getNbOfRecipients($sql='') { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e4fe0c06e8e..d0b80db1190 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -111,17 +111,17 @@ function test_sql_and_script_inject($val, $type) /** * Security: Return true if OK, false otherwise. * - * @param string $var Variable name - * @param string $type 1=GET, 0=POST, 2=PHP_SELF - * @return boolean true if there is an injection + * @param string $var Variable name + * @param string $type 1=GET, 0=POST, 2=PHP_SELF + * @return boolean||null true if there is an injection. Stop code if injection found. */ -function analyse_sql_and_script(&$var, $type) +function analyseVarsForSqlAndScriptsInjection(&$var, $type) { if (is_array($var)) { foreach ($var as $key => $value) { - if (analyse_sql_and_script($value,$type)) + if (analyseVarsForSqlAndScriptsInjection($value,$type)) { $var[$key] = $value; } @@ -147,16 +147,16 @@ if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIRE if (! empty($_SERVER["PHP_SELF"])) { $morevaltochecklikepost=array($_SERVER["PHP_SELF"]); - analyse_sql_and_script($morevaltochecklikepost,2); + analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2); } // Sanity check on GET parameters if (! empty($_SERVER["QUERY_STRING"])) { $morevaltochecklikeget=array($_SERVER["QUERY_STRING"]); - analyse_sql_and_script($morevaltochecklikeget,1); + analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1); } // Sanity check on POST -analyse_sql_and_script($_POST,0); +analyseVarsForSqlAndScriptsInjection($_POST,0); // This is to make Dolibarr working with Plesk if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');