public static function getCampaign() { // use static one if we're on an entry page if (!is_null(self::$campaign)) { return self::$campaign; } $storage = new MrClay_CookieStorage(array('secret' => UserConfig::$SESSION_SECRET, 'mode' => MrClay_CookieStorage::MODE_ENCRYPT, 'path' => UserConfig::$SITEROOTURL, 'httponly' => true)); return unserialize($storage->fetch(UserConfig::$entry_cmp_key)); }
public static function getReturn() { $storage = new MrClay_CookieStorage(array('secret' => UserConfig::$SESSION_SECRET, 'path' => UserConfig::$SITEROOTURL, 'httponly' => true)); $return = $storage->fetch(UserConfig::$session_return_key); if (is_string($return)) { return $return; } else { return null; } }
<?php require_once dirname(__FILE__) . '/config.php'; require_once dirname(__FILE__) . '/User.php'; $current_user = User::get(); $oauth_user_id = null; try { if (!array_key_exists('module', $_GET)) { throw new Exception('module not specified'); } if (!array_key_exists('oauth_token', $_GET) || !array_key_exists('oauth_verifier', $_GET)) { throw new Exception('oauth_token & oauth_varifier required'); } $module = AuthenticationModule::get($_GET['module']); $storage = new MrClay_CookieStorage(array('secret' => UserConfig::$SESSION_SECRET, 'mode' => MrClay_CookieStorage::MODE_ENCRYPT, 'path' => UserConfig::$SITEROOTURL, 'httponly' => true)); $oauth_user_id = $storage->fetch(UserConfig::$oauth_user_id_key); $storage->delete(UserConfig::$oauth_user_id_key); if (is_null($oauth_user_id)) { throw new Exception("can't determine OAuth User ID"); } try { $module->getAccessToken($oauth_user_id); } catch (OAuthException2 $e) { throw new Exception('problem getting access token: ' . $e->getMessage()); } try { $identity = $module->getIdentity($oauth_user_id); } catch (OAuthException2 $e) { throw new Exception('problem getting user identity: ' . $e->getMessage()); } if (is_null($identity)) {