/** * Generates a token from an input array of values * @param owner owner of this gadget * @param viewer viewer of this gadget * @param app application id * @param domain domain of the container * @param appUrl url where the application lives * @param moduleId module id of this gadget * @throws BlobCrypterException */ public static function createFromSocialSession($stringToken) { ini_set('session.use_cookies', '0'); ini_set('session.save_handler', 'user'); session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc')); $partsArry = explode(":", $stringToken); $session_key = $partsArry[0]; $api_key = $partsArry[2]; $network_session = new RingsideSocialSession($session_key); $uid = $network_session->getUserId(); $owner = $partsArry[5]; if ($owner == '' || $owner == 'null' || $owner == 'undefined') { $owner = $uid; } $viewer = $uid; $app = $api_key; $domain = $partsArry[4]; $adminClient = RingsideSocialUtils::getAdminClient(); $app_properties = $adminClient->admin_getAppProperties(array('api_key', 'callback_url', 'canvas_url'), null, null, $api_key); $moduleId = $app_properties['canvas_url']; $appUrl = $app_properties['callback_url']; $app = $app_properties['api_key']; error_log("******* Creating RingsideGadgetToken(null,null,{$owner}, {$viewer}, {$app}, {$domain}, {$appUrl}, {$moduleId})"); $rsToken = new RingsideGadgetToken(null, null, $owner, $viewer, $app, $domain, $appUrl, $moduleId); $rsToken->setSocialSession($network_session); return $rsToken; }
public function createToken($stringToken) { if (empty($stringToken)) { throw new GadgetException('INVALID_GADGET_TOKEN'); } return RingsideGadgetToken::createFromSocialSession($stringToken); }