Fix code standard

This commit is contained in:
Laurent Destailleur 2015-04-06 12:22:52 +02:00
parent a5c74a7d95
commit 828dc2c9f4
12 changed files with 26 additions and 26 deletions

View File

@ -85,7 +85,7 @@ class mailing_contacts1 extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * 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 * @return int
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -152,7 +152,7 @@ class mailing_contacts2 extends MailingTargets
/** /**
* Return here number of distinct emails returned by your selector. * 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 * @return int
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -157,7 +157,7 @@ class mailing_contacts3 extends MailingTargets
/** /**
* Return here number of distinct emails returned by your selector. * 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 * @return int Number of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -158,7 +158,7 @@ class mailing_contacts4 extends MailingTargets
/** /**
* Return here number of distinct emails returned by your selector. * 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 * @return int Number of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -100,8 +100,8 @@ class mailing_example extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * 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 * @return int|string Number of recipient or '?'
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -86,8 +86,8 @@ class mailing_fraise extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * 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 Nb of recipients * @return int Nb of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -150,8 +150,8 @@ class mailing_framboise extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * 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 Nb of recipients * @return int Nb of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -72,8 +72,8 @@ class MailingTargets // This can't be abstract as it is used for some method
/** /**
* Retourne nombre de destinataires * Retourne nombre de destinataires
* *
* @param string $sql Requete sql de comptage * @param string $sql Sql request to count
* @return int Nb de destinataires si ok, < 0 si erreur * @return int Nb of recipient, or <0 if error
*/ */
function getNbOfRecipients($sql) function getNbOfRecipients($sql)
{ {
@ -85,7 +85,7 @@ class MailingTargets // This can't be abstract as it is used for some method
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }

View File

@ -157,7 +157,7 @@ class mailing_thirdparties extends MailingTargets
* emails from a text file, this function must return 500. * 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 Nb of recipients * @return int Nb of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -73,8 +73,8 @@ class mailing_xinputfile extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * emails from a text file, this function must return 500.
* *
* @param string $sql Requete sql de comptage * @param string $sql Sql request to count
* @return int '' means NA * @return string '' means NA
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -73,8 +73,8 @@ class mailing_xinputuser extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * emails from a text file, this function must return 500.
* *
* @param string $sql Requete sql de comptage * @param string $sql Sql request to count
* @return int '' means NA * @return string '' means NA
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {

View File

@ -111,17 +111,17 @@ function test_sql_and_script_inject($val, $type)
/** /**
* Security: Return true if OK, false otherwise. * Security: Return true if OK, false otherwise.
* *
* @param string $var Variable name * @param string $var Variable name
* @param string $type 1=GET, 0=POST, 2=PHP_SELF * @param string $type 1=GET, 0=POST, 2=PHP_SELF
* @return boolean true if there is an injection * @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)) if (is_array($var))
{ {
foreach ($var as $key => $value) foreach ($var as $key => $value)
{ {
if (analyse_sql_and_script($value,$type)) if (analyseVarsForSqlAndScriptsInjection($value,$type))
{ {
$var[$key] = $value; $var[$key] = $value;
} }
@ -147,16 +147,16 @@ if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIRE
if (! empty($_SERVER["PHP_SELF"])) if (! empty($_SERVER["PHP_SELF"]))
{ {
$morevaltochecklikepost=array($_SERVER["PHP_SELF"]); $morevaltochecklikepost=array($_SERVER["PHP_SELF"]);
analyse_sql_and_script($morevaltochecklikepost,2); analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2);
} }
// Sanity check on GET parameters // Sanity check on GET parameters
if (! empty($_SERVER["QUERY_STRING"])) if (! empty($_SERVER["QUERY_STRING"]))
{ {
$morevaltochecklikeget=array($_SERVER["QUERY_STRING"]); $morevaltochecklikeget=array($_SERVER["QUERY_STRING"]);
analyse_sql_and_script($morevaltochecklikeget,1); analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1);
} }
// Sanity check on POST // Sanity check on POST
analyse_sql_and_script($_POST,0); analyseVarsForSqlAndScriptsInjection($_POST,0);
// This is to make Dolibarr working with Plesk // This is to make Dolibarr working with Plesk
if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');