[horde] ops wrong diff format

Ilya mail at krel.org
Mon Sep 2 21:29:50 PDT 2002


new file attached
-------------- next part --------------
--- sql.php.orig	Mon Sep  2 22:07:30 2002
+++ sql.php	Tue Sep  3 00:25:19 2002
@@ -14,6 +14,10 @@
  * Optional values:
  *   'table'         The name of the auth table in 'database'. Defaults to
  *                   'horde_users'.
+ *   'userf'         The name of user field in the auth table in 'database'. 
+ *					  Defaults to 'user_uid'.
+ *   'passf'         The name of the password field in auth table in 'database'. 
+ *				  	  Defaults to 'user_pass'.
  *
  * Required by some database implementations:
  *   'options'       Additional options to pass to the database.
@@ -106,9 +110,9 @@
         $this->_connect();
 
         /* Build the SQL query. */
-        $query = 'SELECT user_uid FROM ' . $this->_params['table'];
-        $query .= ' WHERE user_uid = ' . $this->_db->quote($userID);
-        $query .= ' AND user_pass = ' . $this->_db->quote(md5($credentials['password']));
+        $query = 'SELECT ' .  $this->_params['userf'] . ' FROM ' . $this->_params['table'];
+        $query .= ' WHERE ' .  $this->_params['userf'] . ' = ' . $this->_db->quote($userID);
+        $query .= ' AND ' . $this->_params['passf'] . ' = ' . $this->_db->quote(md5($credentials['password']));
 
         /* Execute the query. */
         $result = $this->_db->query($query);
@@ -144,7 +148,7 @@
         $this->_connect();
 
         /* Build the SQL query. */
-        $query = 'INSERT INTO ' . $this->_params['table'] . ' (user_uid, user_pass) ';
+        $query = 'INSERT INTO ' . $this->_params['table'] . ' (' .  $this->_params['userf'] . ', ' . $this->_params['passf'] . ') ';
         $query .= 'VALUES (' . $this->_db->quote($userID) . ', ' . $this->_db->quote(md5($credentials['password'])) . ')';
 
         /* Execute the query. */
@@ -174,9 +178,9 @@
         $this->_connect();
 
         /* Build the SQL query. */
-        $query = 'UPDATE ' . $this->_params['table'] . ' SET user_uid = ' . $this->_db->quote($newID);
-		$query .= ', user_pass = ' . $this->_db->quote(md5($credentials['password']));
-        $query .= ' WHERE user_uid = ' . $this->_db->quote($oldID);
+        $query = 'UPDATE ' . $this->_params['table'] . ' SET ' .  $this->_params['userf'] . ' = ' . $this->_db->quote($newID);
+		$query .= ', ' . $this->_params['passf'] . ' = ' . $this->_db->quote(md5($credentials['password']));
+        $query .= ' WHERE ' .  $this->_params['userf'] . ' = ' . $this->_db->quote($oldID);
 
         /* Execute the query. */
         $result = $this->_db->query($query);
@@ -204,7 +208,7 @@
 
         /* Build the SQL query. */
         $query = 'DELETE FROM ' . $this->_params['table'];
-        $query .= ' WHERE user_uid = ' . $this->_db->quote($userID);
+        $query .= ' WHERE ' .  $this->_params['userf'] . ' = ' . $this->_db->quote($userID);
 
         /* Execute the query. */
         $result = $this->_db->query($query);
@@ -229,7 +233,7 @@
         $this->_connect();
 
         /* Build the SQL query. */
-        $query = 'SELECT user_uid from ' . $this->_params['table'];
+        $query = 'SELECT ' .  $this->_params['userf'] . ' from ' . $this->_params['table'];
 
         /* Execute the query. */
         $result = $this->_db->getAll($query, null, DB_FETCHMODE_ORDERED);
@@ -276,6 +280,12 @@
             }
             if (!array_key_exists('table', $this->_params)) {
                 $this->_params['table'] = 'horde_users';
+            }
+            if (!array_key_exists('userf', $this->_params)) {
+                $this->_params['userf'] = 'user_uid';
+            }
+            if (!array_key_exists('passf', $this->_params)) {
+                $this->_params['passf'] = 'user_pass';
             }
 
             /* Connect to the SQL server using the supplied parameters. */


More information about the horde mailing list