public function reset_private_key() { // Generate a new (random) private key. module::set_var("fotomotorw", "fotomoto_private_key", md5(random::hash() . access::private_key())); message::success(t("Your Photomoto private key has been reset.")); url::redirect("admin/fotomotorw"); }
static function get_access_token($user_id) { $key = ORM::factory("user_access_token")->where("user_id", "=", $user_id)->find(); if (!$key->loaded()) { $key->user_id = $user_id; $key->access_key = md5(md5(uniqid(mt_rand(), true) . access::private_key())); $key->save(); } return $key; }
static function install() { // Set up some default values. module::set_var("fotomotorw", "fotomoto_site_key", ''); module::set_var("fotomotorw", "fotomoto_private_key", md5(random::hash() . access::private_key())); module::set_var("fotomotorw", "fotomoto_buy_prints", 1); module::set_var("fotomotorw", "fotomoto_buy_cards", 1); module::set_var("fotomotorw", "fotomoto_buy_download", 1); module::set_var("fotomotorw", "fotomoto_share_ecard", 1); module::set_var("fotomotorw", "fotomoto_share_facebook", 1); module::set_var("fotomotorw", "fotomoto_share_twitter", 1); module::set_var("fotomotorw", "fotomoto_share_digg", 1); module::set_version("fotomotorw", 1); }
static function client_token() { return md5("l10n_client_client_token" . access::private_key()); }
static function access_key() { $key = ORM::factory("user_access_key")->where("user_id", "=", identity::active_user()->id)->find(); if (!$key->loaded()) { $key->user_id = identity::active_user()->id; $key->access_key = md5(random::hash() . access::private_key()); $key->save(); } return $key->access_key; }