public static function get_special($specialkey, $key1, $key2 = '', $key3 = '') { self::__make(); $tmp = self::$_store->get(self::$_key, $key1, $key2, $key3); $tmp = base64_decode($tmp); $data = unserialize(cge_encrypt::decrypt($specialkey, $tmp)); return $data; }
/** * A utility function to decrypt previously encrypted parameters. * * This method accepts a parameter array (the output from it's companion method) and decrypts the input. * * @param array $params an encrypted associative array with at least one element: _d. * @return array */ public static function decrypt_params($params) { $key = CMS_VERSION . __FILE__; if (!isset($params['_d'])) { return; } $tmp = cge_encrypt::decrypt($key, base64_decode($params['_d'])); $tmp = unserialize($tmp); unset($params['_d']); $tmp = array_merge($params, $tmp); return $tmp; }
/** * A convenience method to decrypt some data * * @see cge_encrypt * @param string $key The encryption key * @param string $data The data to decrypt * @return string The derypted data */ function decrypt($key, $data) { return cge_encrypt::decrypt($key, $data); }
function SetUserPropertyFull($title, $data, $userid) { if ($userid === false) { return false; } $defn = $this->GetPropertyDefn($title); if (!$defn) { return false; } if ($defn['encrypt']) { // gotta encrypt. if (!$this->_encryption_key) { return false; } $before = $data; $data = base64_encode(cge_encrypt::encrypt($this->_encryption_key, $data)); } $db = $this->GetDB(); $q = "SELECT * FROM " . cms_db_prefix() . "module_feusers_properties WHERE title=? AND userid=?"; $p = array($title, $userid); $r = $db->Execute($q, $p); if (!$r || $r->NumRows() == 0) { $newid = $db->GenID(cms_db_prefix() . "module_feusers_properties_seq"); $q = "INSERT INTO " . cms_db_prefix() . "module_feusers_properties (id,userid,title,data) VALUES (?,?,?,?)"; $p = array($newid, $userid, $title, $data); $r = $db->Execute($q, $p); } else { $row = $r->FetchRow(); $q = "UPDATE " . cms_db_prefix() . "module_feusers_properties SET data=? WHERE id=?"; $p = array($data, $row["id"]); $r = $db->Execute($q, $p); } if (is_array($this->_cached_uid_map) && isset($this->_cached_uid_map[$userid])) { unset($this->_cached_uid_map[$userid]); } return $r != false; }