Fix code standard
This commit is contained in:
parent
a5c74a7d95
commit
828dc2c9f4
@ -101,7 +101,7 @@ class mailing_example 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
|
* @return int|string Number of recipient or '?'
|
||||||
*/
|
*/
|
||||||
function getNbOfRecipients($sql='')
|
function getNbOfRecipients($sql='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -113,15 +113,15 @@ function test_sql_and_script_inject($val, $type)
|
|||||||
*
|
*
|
||||||
* @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');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user