From 4c0d7378d347ec2714e4ebee7caea61bcb6872ae Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 7 Jan 2012 21:32:35 +0100
Subject: [PATCH] Some change to prepare artichow removal

---
 build/doxygen/dolibarr-doxygen.doxyfile   | 2 +-
 htdocs/compta/bank/graph.php              | 2 +-
 htdocs/includes/artichow/Artichow.cfg.php | 2 +-
 htdocs/main.inc.php                       | 8 +++-----
 htdocs/user/passwordforgotten.php         | 8 +++-----
 test/phpunit/phpunittest.xml              | 4 ++--
 6 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile
index 5431209ced0..b9c4eb973bd 100644
--- a/build/doxygen/dolibarr-doxygen.doxyfile
+++ b/build/doxygen/dolibarr-doxygen.doxyfile
@@ -611,7 +611,7 @@ RECURSIVE = YES
 # excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
 
-EXCLUDE = ../../mssql ../../mysql ../../pgsql ../../CVS ../../build ../../dev ../../doc ../../documents ../../htdocs/conf/conf.php ../../htdocs/includes/adodbtime ../../htdocs/includes/artichow ../../htdocs/includes/barcode ../../htdocs/includes/ckeditor ../../htdocs/includes/fckeditor ../../htdocs/includes/fpdfi ../../htdocs/includes/geoip ../../htdocs/includes/jquery ../../htdocs/includes/nusoap ../../htdocs/includes/odtphp ../../htdocs/includes/pear ../../htdocs/includes/phpexcel ../../htdocs/includes/smtps ../../htdocs/includes/tcpdf ../../htdocs/includes/vcard ../../htdocs/cashdesk/include/jscalendar ../../htdocs/avoir ../../htdocs/document ../../htdocs/documents ../../htdocs/lolix ../../htdocs/postnuke ../../htdocs/rapport ../../htdocs/telephonie ../../htdocs/voyage ../../htdocs/oscommerce_ws/ws_client_demo ../../htdocs/oscommerce_ws/ws_server ../../scripts/addons ../../scripts/courrier ../../scripts/lolix ../../scripts/energie
+EXCLUDE = ../../mssql ../../mysql ../../pgsql ../../CVS ../../build ../../dev ../../doc ../../documents ../../htdocs/conf/conf.php ../../htdocs/includes ../../htdocs/document ../../htdocs/documents
 
 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
 # directories that are symbolic links (a Unix filesystem feature) are excluded
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index a672650a170..3a4fa82db03 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -214,7 +214,7 @@ else
 			$i++;
 		}
 		// If we are the first of month, only $datas[0] is defined to an int value, others are defined to ""
-		// and this make artichow report a warning.
+		// and this may make graph lib report a warning.
 		//$datas[0]=100; KO
 		//$datas[0]=100; $datas[1]=90; OK
 		//var_dump($datas);
diff --git a/htdocs/includes/artichow/Artichow.cfg.php b/htdocs/includes/artichow/Artichow.cfg.php
index ea4b91c9b2f..4037a16c42e 100644
--- a/htdocs/includes/artichow/Artichow.cfg.php
+++ b/htdocs/includes/artichow/Artichow.cfg.php
@@ -11,7 +11,7 @@
  * Path to Artichow
  */
 
-define('ARTICHOW', dirname(__FILE__).DIRECTORY_SEPARATOR.'php'.substr(phpversion(), 0, 1));
+define('ARTICHOW', dirname(__FILE__).DIRECTORY_SEPARATOR.'php5');
 
 
 /*
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index c6555ca0a0c..3b8e44acd14 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -348,13 +348,11 @@ if (! defined('NOLOGIN'))
 		// Verification security graphic code
 		if (GETPOST("username","alpha",2) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
 		{
-			require_once(ARTICHOW_PATH.'Artichow.cfg.php');
-			require_once(ARTICHOW.'/AntiSpam.class.php');
-
-			$object = new AntiSpam();
+            $sessionkey = 'artichow_dol_antispam_value';
+            $ok=(array_key_exists($sessionkey, $_SESSION) === TRUE && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
 
 			// Verifie code
-			if (! $object->check('dol_antispam_value',$_POST['code'],true))
+			if (! $ok)
 			{
 				dol_syslog('Bad value for code, connexion refused');
 				$langs->load('main');
diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php
index 1c8c80d8114..117b8bdde30 100644
--- a/htdocs/user/passwordforgotten.php
+++ b/htdocs/user/passwordforgotten.php
@@ -84,13 +84,11 @@ if ($action == 'validatenewpassword' && $username && $passwordmd5)
 // Action modif mot de passe
 if ($action == 'buildnewpassword' && $username)
 {
-	require_once(ARTICHOW_PATH.'Artichow.cfg.php');
-	require_once(ARTICHOW.'/AntiSpam.class.php');
-
-    $object = new AntiSpam();
+    $sessionkey = 'artichow_dol_antispam_value';
+    $ok=(array_key_exists($sessionkey, $_SESSION) === TRUE && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
 
     // Verify code
-    if (! $object->check('dol_antispam_value',$_POST['code'],true))
+    if (! $ok)
     {
         $message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
     }
diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml
index e2ecddfa384..b14c82defc8 100644
--- a/test/phpunit/phpunittest.xml
+++ b/test/phpunit/phpunittest.xml
@@ -11,6 +11,7 @@
     <directory suffix=".php">../../test/</directory>
     <directory suffix=".php">../../htdocs/custom/</directory>
     <directory suffix=".php">../../htdocs/custom2/</directory>
+    <directory suffix=".php">../../htdocs/core/menus/smartphone/</directory>
     <directory suffix=".php">../../htdocs/products/canvas/</directory>
     <directory suffix=".php">../../htdocs/contact/canvas/</directory>
     <directory suffix=".php">../../htdocs/societe/canvas/</directory>
@@ -21,7 +22,6 @@
     <directory suffix=".php">../../htdocs/includes/geoip/</directory>
     <directory suffix=".php">../../htdocs/includes/jquery/</directory>
     <directory suffix=".php">../../htdocs/includes/jsgantt/</directory>
-    <directory suffix=".php">../../htdocs/core/menus/smartphone/</directory>
     <directory suffix=".php">../../htdocs/includes/nusoap/</directory>
     <directory suffix=".php">../../htdocs/includes/odtphp/</directory>
     <directory suffix=".php">../../htdocs/includes/phpexcel/</directory>
@@ -46,6 +46,7 @@
     <directory suffix=".php">../../test/</directory>
     <directory suffix=".php">../../htdocs/custom/</directory>
     <directory suffix=".php">../../htdocs/custom2/</directory>
+    <directory suffix=".php">../../htdocs/core/menus/smartphone</directory>
     <directory suffix=".php">../../htdocs/products/canvas/</directory>
     <directory suffix=".php">../../htdocs/contact/canvas/</directory>
     <directory suffix=".php">../../htdocs/societe/canvas/</directory>
@@ -56,7 +57,6 @@
     <directory suffix=".php">../../htdocs/includes/geoip/</directory>
     <directory suffix=".php">../../htdocs/includes/jquery/</directory>
     <directory suffix=".php">../../htdocs/includes/jsgantt/</directory>
-    <directory suffix=".php">../../htdocs/core/menus/smartphone</directory>
     <directory suffix=".php">../../htdocs/includes/nusoap/</directory>
     <directory suffix=".php">../../htdocs/includes/odtphp/</directory>
     <directory suffix=".php">../../htdocs/includes/phpexcel/</directory>
-- 
GitLab