public function load($id, $context = null, $returnNewBucket = true) { if (!Bucket::isValidId($id)) { return false; } $this->_checkDatabase(); $data = $this->database->query('SELECT expires, data, context FROM ' . $this->table . ' WHERE id = %t% LIMIT 0, 1', array($id), Database::FILTER_ROW); if (!$data) { return false; } $expires = DateTime::$utc->setBySqlString($data['expires'])->getTimestamp(); if ($expires < time()) { $this->database->exec('DELETE FROM ' . $this->table . ' WHERE id = %t%', array($id)); return false; } if ($context !== false && $data['context'] != $context) { return false; } if ($returnNewBucket) { $b = new DatabaseBucket(); $b->_mergeSettings($this); } else { $b = $this; } $b->database = $this->database; $b->table = $this->table; $b->id = $id; $b->expires = $expires; $b->data = unserialize(base64_decode($data['data'])); $b->context = $data['context']; return $b; }
public function __construct() { parent::__construct(); if (self::$_filterArraySearch === null) { self::$_filterArraySearch = array('\\', '"', "", "\n", "\r", chr(26), "'"); } }