chregu Tue Mar 6 03:32:10 2001 EDT
Modified files:
/php4/pear/Cache Container.php
/php4/pear/Cache/Container db.php phplib.php
Log:
replaced db->quoteString with addslashes
adjusted encoding_mode = "slash" that it doesn't quote slashes, the
save() function in phplib/db-container is now in charge for that.
Index: php4/pear/Cache/Container.php
diff -u php4/pear/Cache/Container.php:1.4 php4/pear/Cache/Container.php:1.5
--- php4/pear/Cache/Container.php:1.4 Sat Mar 3 11:14:36 2001
+++ php4/pear/Cache/Container.php Tue Mar 6 03:32:10 2001
@@ -1,4 +1,5 @@
<?php
+
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
@@ -16,7 +17,7 @@
// | Sebastian Bergmann <[EMAIL PROTECTED]> |
// +----------------------------------------------------------------------+
//
-// $Id: Container.php,v 1.4 2001/03/03 19:14:36 uw Exp $
+// $Id: Container.php,v 1.5 2001/03/06 11:32:10 chregu Exp $
/**
* Common base class of all cache storage container.
@@ -36,7 +37,7 @@
* not recommended!
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: Container.php,v 1.4 2001/03/03 19:14:36 uw Exp $
+* @version $Id: Container.php,v 1.5 2001/03/06 11:32:10 chregu Exp $
* @package Cache
* @access public
* @abstract
@@ -215,7 +216,7 @@
* @return boolean
*/
function isCached($id, $group) {
-
+
if ($this->preload) {
if ($this->id != $id || $this->group != $group)
@@ -343,7 +344,7 @@
// Uuups, unknown ID
$this->flushPreload();
-
+
return false;
}
@@ -406,7 +407,7 @@
if ("base64" == $this->encoding_mode)
return base64_encode(serialize($data));
else
- return addslashes(serialize($data));
+ return serialize($data);
} // end func encode
@@ -421,9 +422,9 @@
if ("base64" == $this->encoding_mode)
return unserialize(base64_decode($data));
else
- return unserialize(stripslashes($data));
+ return unserialize($data);
} // end func decode
}
-?>
\ No newline at end of file
+?>
Index: php4/pear/Cache/Container/db.php
diff -u php4/pear/Cache/Container/db.php:1.5 php4/pear/Cache/Container/db.php:1.6
--- php4/pear/Cache/Container/db.php:1.5 Sat Mar 3 11:01:03 2001
+++ php4/pear/Cache/Container/db.php Tue Mar 6 03:32:10 2001
@@ -17,7 +17,7 @@
// | Chuck Hagenbuch <[EMAIL PROTECTED]> |
// +----------------------------------------------------------------------+
//
-// $Id: db.php,v 1.5 2001/03/03 19:01:03 uw Exp $
+// $Id: db.php,v 1.6 2001/03/06 11:32:10 chregu Exp $
require_once 'DB.php';
require_once 'Cache/Container.php';
@@ -52,7 +52,7 @@
* )
* @author Sebastian Bergmann <[EMAIL PROTECTED]>
- * @version $Id: db.php,v 1.5 2001/03/03 19:01:03 uw Exp $
+ * @version $Id: db.php,v 1.6 2001/03/06 11:32:10 chregu Exp $
* @package Cache
*/
class Cache_Container_db extends Cache_Container {
@@ -107,8 +107,8 @@
{
$query = sprintf("SELECT cachedata, userdata, expires FROM %s WHERE id = '%s'
AND cachegroup = '%s'",
$this->cache_table,
- $this->db->quoteString($id),
- $this->db->quoteString($group)
+ addslashes($id),
+ addslashes($group)
);
$res = $this->db->query($query);
@@ -117,7 +117,7 @@
return new CacheError('DB::query failed: ' . DB::errorMessage($res),
__FILE__, __LINE__);
$row = $res->fetchRow();
-
+
if (is_array($row))
return array($row['expires'], $this->decode($row['cachedata']),
$row['userdata']);
}
@@ -136,17 +136,17 @@
$query = sprintf("REPLACE INTO %s (userdata, cachedata, expires, id,
cachegroup) VALUES ('%s', '%s', %d, '%s', '%s')",
$this->cache_table,
- $this->db->quoteString($userdata),
- $this->db->quoteString($this->encode(($data))),
+ addslashes($userdata),
+ addslashes($this->encode($data)),
($expires) ? $expires + time() : 0,
- $this->db->quoteString($id),
- $this->db->quoteString($group)
+ addslashes($id),
+ addslashes($group)
);
-
+
$res = $this->db->query($query);
if (DB::isError($res)) {
- return new CacheError('DB::query failed: ' . DB::errorMessage($res),
__FILE__, __LINE__);
+ return new CacheError('DB::query failed: ' . DB::errorMessage($res) ,
+__FILE__, __LINE__);
}
}
@@ -157,8 +157,8 @@
$query = sprintf("DELETE FROM %s WHERE id = '%s' and cachegroup = '%s'",
$this->cache_table,
- $this->db->quoteString($id),
- $this->db->quoteString($group)
+ addslashes($id),
+ addslashes($group)
);
$res = $this->db->query($query);
@@ -174,7 +174,7 @@
$this->flushPreload();
if ($group) {
- $query = sprintf("DELETE FROM %s WHERE cachegroup = '%s'",
$this->cache_table, $this->db->quoteString($group));
+ $query = sprintf("DELETE FROM %s WHERE cachegroup = '%s'",
+$this->cache_table, addslashes($group));
} else {
$query = sprintf("DELETE FROM %s", $this->cache_table);
}
@@ -190,12 +190,12 @@
{
$query = sprintf("SELECT id FROM %s WHERE ID = '%s' AND cachegroup = '%s'",
$this->cache_table,
- $this->db->quoteString($id),
- $this->db->quoteString($group)
+ addslashes($id),
+ addslashes($group)
);
$res = $this->db->query($query);
-
+
if (DB::isError($res))
return new CacheError('DB::query failed: ' . DB::errorMessage($res),
__FILE__, __LINE__);
@@ -222,4 +222,4 @@
}
}
-?>
\ No newline at end of file
+?>
Index: php4/pear/Cache/Container/phplib.php
diff -u php4/pear/Cache/Container/phplib.php:1.6
php4/pear/Cache/Container/phplib.php:1.7
--- php4/pear/Cache/Container/phplib.php:1.6 Sat Mar 3 11:05:22 2001
+++ php4/pear/Cache/Container/phplib.php Tue Mar 6 03:32:10 2001
@@ -16,7 +16,7 @@
// | Sebastian Bergmann <[EMAIL PROTECTED]> |
// +----------------------------------------------------------------------+
//
-// $Id: phplib.php,v 1.6 2001/03/03 19:05:22 uw Exp $
+// $Id: phplib.php,v 1.7 2001/03/06 11:32:10 chregu Exp $
require_once 'Cache/Container.php';
@@ -51,7 +51,7 @@
*
*
* @author Ulf Wendel <[EMAIL PROTECTED]>, Sebastian Bergmann
<[EMAIL PROTECTED]>
-* @version $Id: phplib.php,v 1.6 2001/03/03 19:05:22 uw Exp $
+* @version $Id: phplib.php,v 1.7 2001/03/06 11:32:10 chregu Exp $
* @package Cache
* @see save()
*/
@@ -170,7 +170,7 @@
$query = sprintf("REPLACE INTO %s (cachedata, expires, id, cachegroup) VALUES
('%s', %d, '%s', '%s')",
$this->cache_table,
- $this->encode($data),
+ addslashes($this->encode($data)),
($expires) ? $expires + time() : 0,
$id,
$group
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]