From ba93a4bfe286ca814084d5482dd7a9a3c91dbf8d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 10 Apr 2013 12:20:45 +0200
Subject: [PATCH] Fix: Codesniffer

---
 dev/phpcheckstyle/README                      |  21 --
 dev/phpcheckstyle/phpstandard.cfg.xml         | 316 ------------------
 dev/phpcheckstyle/phpstandard.dtd             |  13 -
 htdocs/commande/class/commande.class.php      |   1 -
 .../thirdparties_services_expired.modules.php |   5 +-
 .../fourn/class/fournisseur.product.class.php |   1 +
 htdocs/opensurvey/adminstuds_preview.php      |   6 +-
 .../class/opensurveysondage.class.php         |   2 +-
 htdocs/opensurvey/fonctions.php               |  17 +-
 htdocs/opensurvey/public/choix_date.php       |   8 +-
 htdocs/opensurvey/public/create_survey.php    |   2 +-
 htdocs/opensurvey/public/exportcsv.php        |  11 +-
 htdocs/public/paybox/paymentko.php            |   6 +-
 htdocs/public/paybox/paymentok.php            |   2 +-
 htdocs/public/paypal/paymentko.php            |   2 +-
 htdocs/public/paypal/paymentok.php            |   2 +-
 test/phpunit/WebservicesInvoicesTest.php      |   4 +-
 test/phpunit/WebservicesOrdersTest.php        |   8 +-
 test/phpunit/WebservicesOtherTest.php         |   4 +-
 test/phpunit/WebservicesThirdpartyTest.php    |   4 +-
 test/phpunit/WebservicesUserTest.php          |   4 +-
 21 files changed, 45 insertions(+), 394 deletions(-)
 delete mode 100644 dev/phpcheckstyle/README
 delete mode 100644 dev/phpcheckstyle/phpstandard.cfg.xml
 delete mode 100644 dev/phpcheckstyle/phpstandard.dtd

diff --git a/dev/phpcheckstyle/README b/dev/phpcheckstyle/README
deleted file mode 100644
index 84c6b1bbdc8..00000000000
--- a/dev/phpcheckstyle/README
+++ /dev/null
@@ -1,21 +0,0 @@
-README (English)
---------------------------------
-
-This directory contains example of PHPCheckStyle configuration
-to use for quality assurance on PHP developpement.
-
-To run PHPCheckstyle in eclipse, you must:
-- install plugin PHP Tools integration http://www.phpsrc.org/eclipse/pti/
-- Unzip PHPCheckStyle archive into a directory.
-- Go in Eclipse - Window - Preferences - Dynamic Languages - Validator
-Choose External PHP Script,
-Set path ro run.php file for localhost
-Choose a PHP version, 
-Set parameter string with 
-  --src %f --config "phpstandard.cfg.xml" --format console
-Choose php as Filename extension
-Check Print PHP output to console
-Then add patern
-    * %f INFO Line:%n - %m     Warning
-    * %f WARNING Line:%n - %m  Warning
-    * %f ERROR Line:%n - %m    Error 
\ No newline at end of file
diff --git a/dev/phpcheckstyle/phpstandard.cfg.xml b/dev/phpcheckstyle/phpstandard.cfg.xml
deleted file mode 100644
index 3dd3b314660..00000000000
--- a/dev/phpcheckstyle/phpstandard.cfg.xml
+++ /dev/null
@@ -1,316 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE phpstandard SYSTEM "phpstandard.dtd">
-<!-- somewhat inspired by java checkstyle -->
-<phpcheckstyle-configuration>
-
-    <!--  ****************  -->
-    <!--        Naming      -->
-    <!--  ****************  -->
-    
-    <!-- Check Constant Naming -->
-    <!-- Disabled to avoid warning with $sql="SELECT ..." 
-    <test name="constantNaming" regexp="/^[A-Z_][A-Z_]*[A-Z_]$/" level="ERROR"/>
-    -->
-    
-     <!-- Check Variable Naming -->
-    <test name="variableNaming" regexp="/^[a-zA-Z_][a-zA-Z0-9_]*$/" />
-    
-    <!-- Check Function Naming -->
-    <test name="functionNaming" regexp="/^[a-z_]/" level="WARNING"/>
-    
-    <!-- Check Private Function Naming -->
-    <test name="privateFunctionNaming" regexp="/^[a-z_]/" level="ERROR"/>
-    
-    <!-- Checks the constuctor naming -->
-    <!-- old = old style (constructor = name of the class) -->
-    <!-- new = "__construct()" -->    
-    <test name="constructorNaming">
-        <property name="naming" value="old"/>
-    </test>
-    
-    <!-- Check Class Naming -->
-    <test name="classNaming" regexp="/^[A-Z]/" level="WARNING"/>
-    
-    
-    <!--  ****************  -->
-    <!--      PHP Tags      -->
-    <!--  ****************  -->    
-    
-        
-    <!-- Test if a short php code open tag is used (? instead of ?php ). -->
-    <test name="noShortPhpCodeTag"/>
-    
-    <!-- Test if a PHP closing file is present at the end of a file -->
-    <!-- <test name="noFileCloseTag"/> -->
-    
-    <!-- Test if a file finish with some inner HTML (OK for some view but could provoque "header already sent" error) -->
-    <!-- <test name="noFileFinishHTML" level="ERROR" /> -->
-    
-    
-    <!--  ****************  -->
-    <!--      Comments      -->
-    <!--  ****************  -->    
-    
-    <!-- Check if some C style comments are used (#) -->    
-    <test name="noShellComments"/>
-    
-    <!-- Tests that every function and class is immediately preceded by a docblock. A property "excludePrivateMembers" can be set if you want to disable docblocks for private member functions. -->
-    <test name="docBlocks">
-        <property name="excludePrivateMembers" value="true"/>
-        <property name="testReturn" value="true"/>
-        <property name="testParam" value="true"/>
-        <property name="testThrow" value="true"/>
-    </test>
-
-    
-    <!--  ****************  -->
-    <!--    Indentation     -->
-    <!--  ****************  -->    
-
-    <!-- Tests to make sure that a line does not contain the tab character. -->
-    <!-- <test name="noTabs"/>  -->
-    
-    <!-- Test to make sure that every control structure is included within a {} block, even if it is syntactically optional. -->
-    <!-- <test name="controlStructNeedCurly"/> -->
-    
-    <!-- Check the position of the open curly brace in a control structure (if) -->
-    <!-- sl = same line -->
-    <!-- nl = new line -->
-    <test name="controlStructOpenCurly">
-        <property name="position" value="nl"/>
-    </test>
-
-    <!-- Check the position of the close curly brace  -->
-    <test name="controlCloseCurly" level="INFO">
-    </test>
-        
-    <!-- Check the position of the open curly brace after a function -->
-    <!-- sl = same line -->
-    <!-- nl = new line -->
-    <test name="funcDefinitionOpenCurly">
-        <property name="position" value="nl"/>
-    </test>
-    
-    <!-- Check the position of the else -->
-    <!-- sl = same line -->
-    <!-- nl = new line -->
-    <test name="controlStructElse">
-        <property name="position" value="nl"/>
-    </test>
-    
-    
-    <!--  ****************  -->
-    <!--      Spaces        -->
-    <!--  ****************  --> 
-        
-    <!-- Tests that the control statements ("if", "else", "while", "for", etc.) 
-         are followed by a space before the opening parenthesis. 
-         PEAR standard stipulates this to distinguish it from function calls. 
-    -->
-    <!--
-    <test name="spaceAfterControlStmt"/>
-    -->
-   
-    <!-- Check that there is no space after a function name in a function call -->
-    <!-- <test name="noSpaceAfterFunctionName" level="INFO"></test>  -->  
-     
-    
-    <!-- Check for the (required) presence of a white space after some tokens (like ,) -->
-    <!--
-    <test name="checkWhiteSpaceAfter"> 
-        <exception value="."/>
-    </test>
-    -->
-        
-    <!-- Check for the (required) presence of a white space before some tokens -->
-    <!--
-    <test name="checkWhiteSpaceBefore">
-        <exception value="."/>
-        <exception value=":"/> 
-    </test> 
-    -->
-        
-    <!-- Check that there is no space before before some tokens  -->
-    <!--
-    <test name="noSpaceBeforeToken" level="INFO">
-    </test>
-    -->
-
-    <!-- Check that there is no space after some tokens -->
-    <!--
-    <test name="noSpaceAfterToken"  level="INFO">
-    </test>
-    -->
-    
-    <!--  ****************  -->
-    <!--      Metrics       -->
-    <!--  ****************  --> 
-    
-    <!-- Check that the lenght of the line doesn't pass the max value -->
-    <test name="lineLength" level="INFO">
-        <property name="maxLineLength" value="160"/>
-    </test>
-    
-    <!-- Checks that the lenght (in lines) of a function doesn't pass the max value -->
-    <test name="functionLength" level="INFO">
-        <property name="maxLength" value="500"/>
-    </test>
-    
-    <!--  Checks for excessive parameters in a function declaration -->
-    <!-- <test name="functionMaxParameters">
-        <property name="maxParameters" value="4"/>
-    </test> -->
-    
-    <!-- Check Cyclomatic Complexity -->
-    <!-- see http://www.aivosto.com/project/help/pm-complexity.html -->
-    <test name="cyclomaticComplexity">
-        <!-- Level raising a warning -->
-        <property name="warningLevel" value="10"/>
-        <!-- Level raising an error -->
-        <property name="errorLevel" value="20"/>
-    </test>
-    
-    <!--  ****************  -->
-    <!--      Other         -->
-    <!--  ****************  --> 
-        
-    <!-- All arguments with default values should be at the end -->
-    <test name="defaultValuesOrder"/>
-                    
-    <!-- Check for prohibited functions -->
-    <!-- @see http://www.php.net/manual/en/indexes.php -->
-    <test name="checkProhibitedFunctions">
-        <item value="echo"/>
-        <item value="system"/>
-        <item value="print_r"/>
-        <item value="var_dump"/>
-        <item value="dl"/>
-        <!--<item value="exec"/>-->
-        <item value="passthru"/>
-        <!-- <item value="delete"/> We disable because of false report when using method delete -->
-        <item value="ereg_replace"/>
-        <item value="ereg"/>
-        <item value="eregi"/>
-        <!-- <item value="copy"/>  -->
-        <!-- <item value="fwrite"/>  -->
-    </test>
-    
-    <!-- Check for prohibited tokens -->
-    <!-- @see http://www.php.net/manual/en/tokens.php -->
-    <test name="checkProhibitedTokens">
-        <item value="T_BAD_CHARACTER"/>
-        <item value="T_DECLARE"/>
-        <item value="T_ENDDECLARE"/>
-        <item value="T_ENDFOR"/>
-        <item value="T_ENDFOREACH"/>
-        <item value="T_ENDIF"/>
-        <item value="T_ENDSWITCH"/>
-        <item value="T_ENDWHILE"/>
-        <item value="T_HALT_COMPILER"/>
-        <item value="T_OLD_FUNCTION"/>
-        <!-- <item value="T_PRINT"/> -->
-        
-        <!--  Same thing as the noShortPhpCodeTag rule -->
-        <!-- <item value="T_OPEN_TAG_WITH_ECHO"/> -->
-        
-        <!-- <item value="T_INLINE_HTML"/> -->
-        <!-- <item value="T_ECHO"/>  -->
-        
-        
-    </test>
-    
-     <!-- Check for silenced errors before function calls (@function) -->
-    <test name="checkSilencedError">
-        <exception value="rename"/> <!-- Exceptions to this rule -->
-        <exception value="mkdir"/>
-        <exception value="chmod"/>
-    </test>
-    
-    <!-- Check for encapsed variables inside a String ("$a") -->
-    <test name="encapsedVariablesInsideString">
-    </test>
-    
-     <!-- Avoid passing parameters by reference -->
-    <test name="avoidPassingReferences">
-    </test>
-        
-    <test name="showTODOs">
-    </test>
-    
-    <!-- Use boolean operators (&&) instead of logical operators (AND) -->
-    <test name="useBooleanOperators">
-    </test>
-    
-    <!-- Check empty block like if ($a) {} -->
-    <test name="checkEmptyBlock">
-        <!--  <exception value="catch"/>  -->
-    </test>
-    
-    <!-- Check empty statement ( ;; ) -->
-    <test name="checkEmptyStatement">
-    </test>
-    
-    <!-- Check for the presence of heredoc -->
-    <test name="checkHeredoc">
-    </test>
-    
-    <!-- Check for braces around code blocs (if, else, elseif, do, while, for, foreach) -->
-    <!--
-    <test name="needBraces">
-    </test>
-    -->
-    
-    <!-- Switch need a default value -->
-    <test name="switchNeedDefault">
-    </test>
-    
-     <!-- Switch case should have a break -->
-    <!--  <test name="switchCaseNeedBreak">
-    </test>  -->
-    
-    <!-- Switch default value should be at the end -->
-    <test name="switchDefaultOrder">
-    </test>
-    
-              
-    <!-- 
-    Avoid using unary operators (++) inside a control statement 
-    With the exception of for iterators, all variable incrementation or decrementation should occur in their own toplevel statement to increase readability.  
-    -->
-    <test name="checkUnaryOperator">
-        <exception value="for"/>
-    </test>
-    
-    <!--
-    With inner assignments it is difficult to see all places where a variable is set.
-    With the exception of for iterators, all assignments should occur in their own toplevel statement to increase readability.  
-    -->
-    <test name="checkInnerAssignment">
-        <exception value="for"/>
-    </test>
-    
-    <!-- Detect unused private functions (detecting unused public ones is more difficult) -->
-    <test name="checkUnusedPrivateFunctions">
-    </test>
-    
-    <!-- Detect unused variables -->
-    <test name="checkUnusedVariables">
-    </test>
-    
-    <!-- Detect unused function parameters -->
-    <test name="checkUnusedFunctionParameters">
-    </test>
-    
-    <!-- Only one class declaration per PHP file -->
-    <test name="oneClassPerFile">
-    </test>
-    
-    <!--  *******************  -->
-    <!--      Optimisation     -->
-    <!--  *******************  --> 
-    
-    <!-- Only one class declaration per PHP file -->
-    <test name="functionInsideLoop">
-    </test>
-    
-</phpcheckstyle-configuration>
\ No newline at end of file
diff --git a/dev/phpcheckstyle/phpstandard.dtd b/dev/phpcheckstyle/phpstandard.dtd
deleted file mode 100644
index bde6e6b2b52..00000000000
--- a/dev/phpcheckstyle/phpstandard.dtd
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!ELEMENT phpcheckstyle-configuration (test+)>
-<!ELEMENT test (property*,item*,exception*)>
-<!ATTLIST test name CDATA "">
-<!ATTLIST test regexp CDATA "">
-<!ATTLIST test level CDATA "">
-<!ELEMENT property (#PCDATA)>
-<!ATTLIST property value CDATA "">
-<!ATTLIST property name CDATA "">
-<!ELEMENT item (#PCDATA)>
-<!ATTLIST item value CDATA "">
-<!ELEMENT exception (#PCDATA)>
-<!ATTLIST exception value CDATA "">
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 0270b0327dd..b6e11a64065 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2783,7 +2783,6 @@ class Commande extends CommonOrder
      *	Update value of extrafields on the proposal
      *
      *	@param      User	$user       Object user that modify
-     *	@param      double	$remise      Amount discount
      *	@return     int         		<0 if ko, >0 if ok
      */
     function update_extrafields($user)
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 4b621b705a2..b9d8feccd5c 100755
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -175,11 +175,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
      *	For example if this selector is used to extract 500 different
      *	emails from a text file, this function must return 500.
      *
-     *	@param	int		$filter		Filter
-     *	@param	string	$option		Option
+     *	@param	string	$sql		Request 
      *	@return	int					Number of recipients
      */
-    function getNbOfRecipients($sql,$filter=1,$option='')
+    function getNbOfRecipients($sql='')
     {
         $now=dol_now();
 
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 09843191692..9a86f0e9ee3 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -146,6 +146,7 @@ class ProductFournisseur extends Product
      *    @param  	string		$charges			costs affering to product
 	 *    @param  	float		$remise_percent		Discount  regarding qty (percent)
 	 *    @param  	float		$remise				Discount  regarding qty (amount)
+	 *    @param  	int			$newnpr				Set NPR or not
      *    @return	int								<0 if KO, >=0 if OK
      */
     function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0)
diff --git a/htdocs/opensurvey/adminstuds_preview.php b/htdocs/opensurvey/adminstuds_preview.php
index 7e7bb6a6967..54a44d40abb 100755
--- a/htdocs/opensurvey/adminstuds_preview.php
+++ b/htdocs/opensurvey/adminstuds_preview.php
@@ -202,7 +202,7 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma
 
 		//on rajoute la valeur dans les valeurs
 		$datesbase = explode(",",$object->sujet);
-		$taillebase = sizeof($datesbase);
+		$taillebase = count($datesbase);
 
 		//recherche de l'endroit de l'insertion de la nouvelle date dans les dates deja entrées dans le tableau
 		if ($nouvelledate < $datesbase[0]) {
@@ -210,7 +210,9 @@ if (isset($_POST["ajoutercolonne"]) && ($object->format == "D" || $object->forma
 		} elseif ($nouvelledate > $datesbase[$taillebase-1]) {
 			$cleinsertion = count($datesbase);
 		} else {
-			for ($i = 0; $i < count($datesbase); $i++) {
+			$nbdatesbase=count($datesbase);
+			for ($i = 0; $i < $nbdatesbase; $i++) 
+			{
 				$j = $i + 1;
 				if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
 					$cleinsertion = $j;
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index 7cdfd1e4c7e..0a3f2c571df 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -340,7 +340,7 @@ class Opensurveysondage extends CommonObject
      *  @param	string	$numsondageadmin	Num sondage to delete
 	 *  @return	int					 		<0 if KO, >0 if OK
 	 */
-	function delete($user, $notrigger=0, $numsondageadmin)
+	function delete($user, $notrigger, $numsondageadmin)
 	{
 		global $conf, $langs;
 		$error=0;
diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php
index 6068ca965f1..fc30da7498b 100755
--- a/htdocs/opensurvey/fonctions.php
+++ b/htdocs/opensurvey/fonctions.php
@@ -120,8 +120,8 @@ function get_server_name()
 /**
  * is_error
  *
- * @param unknown_type $cerr
- * @return boolean
+ * @param 	string	$cerr		Error value
+ * @return 	boolean				Error key found or not
  */
 function is_error($cerr)
 {
@@ -147,7 +147,7 @@ function validateEmail($email)
 {
 	$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
 
-	return (bool)preg_match($pattern, $email);
+	return (bool) preg_match($pattern, $email);
 }
 
 
@@ -188,15 +188,16 @@ function getUrlSondage($id, $admin = false)
 
 
 /**
- * Generate a random id
- *
- * @return	void
+ * 	Generate a random id
+ *
+ *	@param	string	$car	Char to generate key
+ * 	@return	void
  */
 function dol_survey_random($car)
 {
 	$string = "";
 	$chaine = "abcdefghijklmnopqrstuvwxyz123456789";
-	srand((double)microtime()*1000000);
+	srand((double) microtime()*1000000);
 	for($i=0; $i<$car; $i++) {
 		$string .= $chaine[rand()%strlen($chaine)];
 	}
@@ -229,7 +230,7 @@ function ajouter_sondage($origin)
 
 	if ($_SESSION["formatsondage"]=="D"||$_SESSION["formatsondage"]=="D+") {
 		//Calcul de la date de fin du sondage
-		$taille_tableau=sizeof($_SESSION["totalchoixjour"])-1;
+		$taille_tableau=count($_SESSION["totalchoixjour"])-1;
 		$date_fin=$_SESSION["totalchoixjour"][$taille_tableau]+200000;
 	}
 
diff --git a/htdocs/opensurvey/public/choix_date.php b/htdocs/opensurvey/public/choix_date.php
index 72a24357436..59536f1f8e6 100755
--- a/htdocs/opensurvey/public/choix_date.php
+++ b/htdocs/opensurvey/public/choix_date.php
@@ -257,9 +257,9 @@ if (issetAndNoEmpty('choixjourajout')) {
 
 	// Si le test est passé, alors on insere la valeur dans la variable de session qui contient les dates
 	if ($journeuf && issetAndNoEmpty('choixjourajout') === true) {
-		array_push ($_SESSION["totalchoixjour"],mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]));
-		sort ($_SESSION["totalchoixjour"]);
-		$cle=array_search (mktime (0,0,0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);
+		array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]));
+		sort($_SESSION["totalchoixjour"]);
+		$cle=array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]);
 
 		//On sauvegarde les heures deja entrées
 		for ($i = 0; $i < $cle; $i++) {
@@ -540,7 +540,7 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) && (!issetAndNoEmpty('choixheur
 
 //s'il n'y a pas d'erreur et que le bouton de creation est activé, on demande confirmation
 if (!$erreur  && (GETPOST('choixheures') || GETPOST('choixheures_x'))) {
-	$taille_tableau=sizeof($_SESSION["totalchoixjour"])-1;
+	$taille_tableau=count($_SESSION["totalchoixjour"])-1;
 	$jour_arret = $_SESSION["totalchoixjour"][$taille_tableau]+200000;
 	$date_fin=dol_print_date($jour_arret, 'dayhourtext');
 
diff --git a/htdocs/opensurvey/public/create_survey.php b/htdocs/opensurvey/public/create_survey.php
index c5af8db0cab..729255a6ca1 100755
--- a/htdocs/opensurvey/public/create_survey.php
+++ b/htdocs/opensurvey/public/create_survey.php
@@ -162,7 +162,7 @@ print '</script>'."\n";
 
 print '<br>'."\n";
 
-#affichage du cochage par défaut
+// Check or not
 $cocheplus='';
 if ($_SESSION["canedit"]) $cocheplus="checked";
 
diff --git a/htdocs/opensurvey/public/exportcsv.php b/htdocs/opensurvey/public/exportcsv.php
index b2ee0cc1eea..f933b37a317 100755
--- a/htdocs/opensurvey/public/exportcsv.php
+++ b/htdocs/opensurvey/public/exportcsv.php
@@ -64,7 +64,6 @@ $now=dol_now();
 
 $nbcolonnes=substr_count($object->sujet,',')+1;
 $toutsujet=explode(",",$object->sujet);
-#$toutsujet=str_replace("°","'",$toutsujet);
 
 // affichage des sujets du sondage
 $input.=$langs->trans("Name").";";
@@ -139,15 +138,15 @@ if ($resql)
 else dol_print_error($db);
 
 
-$filesize = strlen( $input );
+$filesize = strlen($input);
 $filename=$numsondage."_".dol_print_date($now,'%Y%m%d%H%M').".csv";
 
 
 
-header( 'Content-Type: text/csv; charset=utf-8' );
-header( 'Content-Length: '.$filesize );
-header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
-header( 'Cache-Control: max-age=10' );
+header('Content-Type: text/csv; charset=utf-8');
+header('Content-Length: '.$filesize);
+header('Content-Disposition: attachment; filename="'.$filename.'"');
+header('Cache-Control: max-age=10');
 echo $input;
 
 exit;
diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php
index 4db0684005b..19ce36b3b43 100644
--- a/htdocs/public/paybox/paymentko.php
+++ b/htdocs/public/paybox/paymentko.php
@@ -69,13 +69,13 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu
 	$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
 	$from=$conf->global->MAILING_EMAIL_FROM;
 	require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
-	$mailfile = new CMailFile(
+	$mailfile = new CMailFile(
 		'New subscription payed',
 		$sendto,
 		$from,
 		'New subscription payed '.$fulltag
-	);
-
+	);
+	
 	$result=$mailfile->sendfile();
 	if ($result)
 	{
diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php
index ebd3c834d09..e206556eea1 100644
--- a/htdocs/public/paybox/paymentok.php
+++ b/htdocs/public/paybox/paymentok.php
@@ -99,7 +99,7 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu
 	$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
 	$from=$conf->global->MAILING_EMAIL_FROM;
 	require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
-	$mailfile = new CMailFile(
+	$mailfile = new CMailFile(
 		'New subscription payed',
 		$sendto,
 		$from,
diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php
index c6fe53ac7b0..a291125253f 100755
--- a/htdocs/public/paypal/paymentko.php
+++ b/htdocs/public/paypal/paymentko.php
@@ -77,7 +77,7 @@ if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=',$fu
 	$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
 	$from=$conf->global->MAILING_EMAIL_FROM;
 	require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
-	$mailfile = new CMailFile(
+	$mailfile = new CMailFile(
 		'New subscription payed',
 		$sendto,
 		$from,
diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php
index ca11bcb5422..1241e66b6c8 100755
--- a/htdocs/public/paypal/paymentok.php
+++ b/htdocs/public/paypal/paymentok.php
@@ -136,7 +136,7 @@ if ($PAYPALTOKEN)
 		$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL;
 		$from=$conf->global->MAILING_EMAIL_FROM;
 		require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
-		$mailfile = new CMailFile(
+		$mailfile = new CMailFile(
 			'New subscription payed',
 			$sendto,
 			$from,
diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php
index 65983390cfd..6f04f5320e2 100755
--- a/test/phpunit/WebservicesInvoicesTest.php
+++ b/test/phpunit/WebservicesInvoicesTest.php
@@ -118,11 +118,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSInvoices_xxx
+     * testWSInvoicesXxx
      *
      * @return int
      */
-    public function testWSInvoices_xxx()
+    public function testWSInvoicesXxx()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php
index a4571557a48..750c33fa30a 100755
--- a/test/phpunit/WebservicesOrdersTest.php
+++ b/test/phpunit/WebservicesOrdersTest.php
@@ -118,11 +118,11 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSOrder_xxx
+     * testWSOrderXxx
      *
      * @return int
      */
-    public function testWSOrder_xxx()
+    public function testWSOrderXxx()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
@@ -178,11 +178,11 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSOther_GetVersions
+     * testWSOtherGetVersions
      *
      * @return int
      */
-    public function testWSOther_GetVersions()
+    public function testWSOtherGetVersions()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php
index e06477e7de9..e8a8a6bd19c 100755
--- a/test/phpunit/WebservicesOtherTest.php
+++ b/test/phpunit/WebservicesOtherTest.php
@@ -118,11 +118,11 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSOther_GetVersions
+     * testWSOtherGetVersions
      *
      * @return int
      */
-    public function testWSOther_GetVersions()
+    public function testWSOtherGetVersions()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php
index b28ac8fa2d8..83c7c0ce14d 100755
--- a/test/phpunit/WebservicesThirdpartyTest.php
+++ b/test/phpunit/WebservicesThirdpartyTest.php
@@ -118,11 +118,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSThirdparty_xxx
+     * testWSThirdpartyXxx
      *
      * @return int
      */
-    public function testWSThirdparty_xxx()
+    public function testWSThirdpartyXxx()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php
index 9ef2278015b..832fd1ea4cb 100755
--- a/test/phpunit/WebservicesUserTest.php
+++ b/test/phpunit/WebservicesUserTest.php
@@ -118,11 +118,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
 
 
     /**
-     * testWSUser_xxx
+     * testWSUserXxx
      *
      * @return int
      */
-    public function testWSUser_xxx()
+    public function testWSUserXxx()
     {
     	global $conf,$user,$langs,$db;
     	$conf=$this->savconf;
-- 
GitLab