From f08865b9c52c2cb70f075a7a551967e1be2a3222 Mon Sep 17 00:00:00 2001
From: Cyril Vazquez <cyril.vazquez@maarch.org>
Date: Mon, 2 Apr 2012 12:38:52 +0000
Subject: [PATCH] Remove tests on databasetype (except class functions, db,
 request...)

---
 core/trunk/core/class/StatusControler.php      | 3 +--
 core/trunk/core/class/class_db.php             | 1 -
 core/trunk/core/class/class_functions.php      | 9 +--------
 core/trunk/core/class/class_history.php        | 2 +-
 core/trunk/core/class/class_request.php        | 6 +++---
 core/trunk/core/class/usergroups_controler.php | 4 ++--
 core/trunk/core/class/users_controler.php      | 3 +--
 7 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/core/trunk/core/class/StatusControler.php b/core/trunk/core/class/StatusControler.php
index 098022baa2d..0e59b3b6d6f 100644
--- a/core/trunk/core/class/StatusControler.php
+++ b/core/trunk/core/class/StatusControler.php
@@ -93,7 +93,7 @@ class Maarch_Core_Class_StatusControler
     *                                         log status modification ,
     *                 'log_status_add'   => 'true' / 'false': log status
     *                                          addition,
-    *                 'databasetype'     => Type of the database ('POSTGRESQL'),
+    *                 'databasetype'     => Type of the database
     *                 )
     * @return array (  'status' => 'ok' / 'ko',
     *                  'value'  => User identifier or empty in case of error,
@@ -217,7 +217,6 @@ class Maarch_Core_Class_StatusControler
     *                     'log_status_add'     => 'true' / 'false': log status
     *                                               addition,
     *                     'databasetype'       => Type of the database
-    *                                               ('POSTGRESQL', ...)
     *                )
     * @return array (  'status' => 'ok' / 'ko',
     *                  'value'  => Status identifier or empty in case of error,
diff --git a/core/trunk/core/class/class_db.php b/core/trunk/core/class/class_db.php
index 6b93aa0561f..dc7105f8bea 100644
--- a/core/trunk/core/class/class_db.php
+++ b/core/trunk/core/class/class_db.php
@@ -886,6 +886,5 @@ class dbquery extends functions
         default             : return "''";
         }
     }
-
     
 }
diff --git a/core/trunk/core/class/class_functions.php b/core/trunk/core/class/class_functions.php
index 3f78065b407..b2523eb1520 100644
--- a/core/trunk/core/class/class_functions.php
+++ b/core/trunk/core/class/class_functions.php
@@ -321,14 +321,7 @@ class functions
                         return "";
                     }
                 case "date":
-                    if(isset($_SESSION['config']['databasetype']) && $_SESSION['config']['databasetype'] == "SQLSERVER")
-                    {
-                        $date_pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
-                    }
-                    else // MYSQL & POSTGRESQL
-                    {
-                        $date_pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
-                    }
+                    $date_pattern = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
                     if(preg_match($date_pattern,$w_var))
                     {
                         return $w_var;
diff --git a/core/trunk/core/class/class_history.php b/core/trunk/core/class/class_history.php
index 351bbd7cd82..c9567bc0beb 100644
--- a/core/trunk/core/class/class_history.php
+++ b/core/trunk/core/class/class_history.php
@@ -46,7 +46,7 @@ class history extends dbquery
     * @param  $id integer Identifier of the event to add
     * @param  $how string Event type (Keyword)
     * @param  $what string Event description
-    * @param  $databasetype string Type of the database (MYSQL, POSTGRESQL, etc...)
+    * @param  $databasetype string Type of the database
     * @param  $id_module string Identifier of the module concerned 
     * by the event (admin by default)
     */
diff --git a/core/trunk/core/class/class_request.php b/core/trunk/core/class/class_request.php
index 43e5ffdd970..fc15697dc51 100644
--- a/core/trunk/core/class/class_request.php
+++ b/core/trunk/core/class/class_request.php
@@ -42,7 +42,7 @@ class request extends dbquery
     * @param  $select array Query fields
     * @param  $where  string Where clause of the query
     * @param  $other  string Query complement (order by, ...)
-    * @param  $database_type string Type of the database (MYSQL, POSTGRESQL, ...)
+    * @param  $database_type string Type of the database
     * @param  $limit string Maximum numbers of results (500 by default)
     * @param  $left_join boolean Is the request is a left join ? (false by default)
     * @param  $first_join_table string Name of the first join table (empty by default)
@@ -198,7 +198,7 @@ class request extends dbquery
     *
     * @param string $table table to insert
     * @param array $data data to insert
-    * @param array $database_type type of the database (MYSQL, POSTGRESQL, ...)
+    * @param array $database_type type of the database
     * @return bool True if the query was sent ok and processed by the database without error, False otherwise
     */
     public function insert($table, $data, $database_type)
@@ -238,7 +238,7 @@ class request extends dbquery
     * @param  $table string Table to update
     * @param  $data array Data to update
     * @param  $where array Where clause of the query
-    * @param  $database_type array Type of the database (MYSQL, POSTGRESQL, ...)
+    * @param  $database_type array Type of the database
     */
     public function update($table, $data, $where, $databasetype)
     {
diff --git a/core/trunk/core/class/usergroups_controler.php b/core/trunk/core/class/usergroups_controler.php
index ceea112c2af..6de2c508348 100644
--- a/core/trunk/core/class/usergroups_controler.php
+++ b/core/trunk/core/class/usergroups_controler.php
@@ -254,7 +254,7 @@ class usergroups_controler extends ObjectControler implements ObjectControlerIF
     *      'modules_services'      => $_SESSION['modules_services'] type array,
     *      'log_group_up'          => 'true' / 'false': log group modification ,
     *      'log_group_add'         => 'true' / 'false': log group addition ,
-    *      'databasetype'          => Type of the database ('POSTGRESQL', ...),
+    *      'databasetype'          => Type of the database,
     *      'user_id'               => Current user identifier (used to process
     *                                 context variables : @entities, ...)
     *       )
@@ -451,7 +451,7 @@ class usergroups_controler extends ObjectControler implements ObjectControlerIF
     *           'modules_services'  => $_SESSION['modules_services'] type array,
     *           'log_group_up'      => 'true' / 'false': log group modification,
     *           'log_group_add'     => 'true' / 'false': log group addition ,
-    *           'databasetype'      => Type of the database ('POSTGRESQL', ...)
+    *           'databasetype'      => Type of the database
     *          )
     * @return array (
     *           'status' => 'ok' / 'ko',
diff --git a/core/trunk/core/class/users_controler.php b/core/trunk/core/class/users_controler.php
index 4b134e169a7..66346ed2a98 100644
--- a/core/trunk/core/class/users_controler.php
+++ b/core/trunk/core/class/users_controler.php
@@ -142,7 +142,7 @@ class users_controler extends ObjectControler implements ObjectControlerIF
     *                 'log_user_up'      => 'true' / 'false':
     *                                       log user modification ,
     *                 'log_user_add'     => 'true' / 'false': log user addition,
-    *                 'databasetype'     => Type of the database ('POSTGRESQL'),
+    *                 'databasetype'     => Type of the database,
     *                 'userdefaultpassword' => Default password for user,
     *                 'manageGroups'     => If true manage groups for the user
     *                                       )
@@ -289,7 +289,6 @@ class users_controler extends ObjectControler implements ObjectControlerIF
     *                     'log_user_add'       => 'true' / 'false': log user
     *                                             addition ,
     *                     'databasetype'       => Type of the database
-    *                                             ('POSTGRESQL', ...),
     *                     'userdefaultpassword' => Default password for user,
     *                     'manageGroups'     => If true manage groups for the user
     *                )
-- 
GitLab