Example #1
0
	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);
		}
	}
Example #2
0
	public function update(array $data, $where)
	{
		// 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']);
		}
		return parent::update($data, $where);
	}