public function insert(array $data) { // md5 password if it's not blank if (!empty($data['password'])) { $data['password'] = md5($data['password']); } if (!empty($data['password_hash'])) { $data['password'] = $data['password_hash']; unset($data['password_hash']); } $timestamp = date("Y-m-d H:i:s"); $data['created_on'] = $timestamp; $data['ip'] = $_SERVER['REMOTE_ADDR']; //$this->parseTags($data['tags']); return parent::insert($data); }
function set($module = "default", $ckey, $value, $is_cached = false) { if (!$this->keyExists($module, $ckey)) { $data = array("ckey" => $ckey, "module" => $module, "value" => $value); if ($is_cached) { $data['is_cached'] = 1; } else { $data['is_cached'] = 0; } parent::insert($data); } else { $where = $this->getAdapter()->quoteInto("ckey = ?", $ckey); $where .= $this->getAdapter()->quoteInto(" and module = ?", $module); $data = array("value" => $value); if ($is_cached) { $data['is_cached'] = 1; } else { $data['is_cached'] = 0; } parent::update($data, $where); } }