[geeklog-cvs] Auth_Enterprise/Enterprise/Server DB.php,1.1,1.2
jellybob at iowaoutdoors.org
jellybob at iowaoutdoors.org
Thu Jul 8 10:51:34 EDT 2004
Update of /var/cvs/Auth_Enterprise/Enterprise/Server
In directory www:/tmp/cvs-serv31872/Enterprise/Server
Modified Files:
DB.php
Log Message:
Fix the old password tracking.
Index: DB.php
===================================================================
RCS file: /var/cvs/Auth_Enterprise/Enterprise/Server/DB.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DB.php 8 Jul 2004 14:36:16 -0000 1.1
--- DB.php 8 Jul 2004 14:51:32 -0000 1.2
***************
*** 94,97 ****
--- 94,101 ----
}
+ if (!isset($options['numoldpasswords'])) {
+ $options['numoldpasswords'] = false;
+ }
+
$dboptions = array('portability' => DB_PORTABILITY_ALL);
$this->db = DB::connect($dsn, $dboptions);
***************
*** 940,967 ****
throw new AESQLException($result->toString());
}
! if ($result->numRows() > $gConf[AE_PROVIDER_PEAR_DB]['numoldpasswords']) {
! // Note the hack to the starting value of $i. This is done this way so array_merge
! // will work right
! $prepFinish = '';
! $rowsToDelete = array();
! for ($i = 1; $i <= ($result->numRows() - $gConf[AE_PROVIDER_PEAR_DB]['numoldpasswords']); $i++) {
$row = $result->fetchRow();
! $rowsToDelete[$i] = $row[0];
! // Build ?-string to add to prepare statement
! if ($i == ($result->numRows() - $gConf[AE_PROVIDER_PEAR_DB]['numoldpasswords'])) {
! $prepFinish .= '?';
! } else {
! $prepFinish .= '?,';
}
}
- $row = $result->fetchRow();
- $prepStmt = $this->db->prepare("DELETE FROM ae_user_old_password
- WHERE uop_user_name = ?
- AND uop_insert_date IN ($prepFinish)");
- $result = $this->db->execute($prepStmt,
- array_merge(array(0 => $userName), $rowsToDelete));
- if (DB::isError($result)) {
- throw new AESQLException($result->toString());
- }
}
}
--- 944,973 ----
throw new AESQLException($result->toString());
}
! if ($this->options['numoldpasswords']) {
! if ($result->numRows() > $this->options['numoldpasswords']) {
! // Note the hack to the starting value of $i. This is done this way so array_merge
! // will work right
! $prepFinish = '';
! $rowsToDelete = array();
! for ($i = 1; $i <= ($result->numRows() - $this->options['numoldpasswords']); $i++) {
! $row = $result->fetchRow();
! $rowsToDelete[$i] = $row[0];
! // Build ?-string to add to prepare statement
! if ($i == ($result->numRows() - $this->options['numoldpasswords'])) {
! $prepFinish .= '?';
! } else {
! $prepFinish .= '?,';
! }
! }
$row = $result->fetchRow();
! $prepStmt = $this->db->prepare("DELETE FROM ae_user_old_password
! WHERE uop_user_name = ?
! AND uop_insert_date IN ($prepFinish)");
! $result = $this->db->execute($prepStmt,
! array_merge(array(0 => $userName), $rowsToDelete));
! if (DB::isError($result)) {
! throw new AESQLException($result->toString());
}
}
}
}
More information about the geeklog-cvs
mailing list