public static function put_special($data, $specialkey, $key1, $key2 = '', $key3 = '') { self::__make(); $tmp = cge_encrypt::encrypt($specialkey, serialize($data)); self::$_store->store(base64_encode($tmp), self::$_key, $key1, $key2, $key3); }
/** * A utility function to encrypt parameters for passing through different URL's. * * This method accepts a parameter array, encrypts it, and returns a parameter array with a single element: _d. * * @param array $params an associative array * @return array */ public static function encrypt_params($params) { $key = CMS_VERSION . __FILE__; $out = array(); $out['_d'] = base64_encode(cge_encrypt::encrypt($key, serialize($params))); return $out; }
/** * A convenience method to encrypt some data * * @see cge_encrypt * @param string $key The encryption key * @param string $data The data to encrypt * @return string The encrypted data */ function encrypt($key, $data) { return cge_encrypt::encrypt($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; }