public static function invalidateRemoteContents(array $uris) { $invalidateService = trim(Shindig_Config::get('invalidate_service')); $cache = Cache::createCache(Shindig_Config::get('data_cache'), 'RemoteContent'); $service = new $invalidateService($cache); // dummy token $token = opShindigSecurityToken::createFromValues(1, 1, 1, 'openpne', '', 1, ''); $service->invalidateApplicationResources($uris, $token); }
/** * * @see BasicSecurityTokenDecoder::createToken() */ public function createToken($stringToken) { if (empty($stringToken) && !empty($_GET['authz'])) { throw new GadgetException('INVALID_GADGET_TOKEN'); } try { if (Shindig_Config::get('allow_plaintext_token') && count(explode(':', $stringToken)) == 6) { $tokens = explode(":", $stringToken); return new opShindigSecurityToken(null, null, urldecode($tokens[$this->OWNER_INDEX]), urldecode($tokens[$this->VIEWER_INDEX]), urldecode($tokens[$this->APP_ID_INDEX]), urldecode($tokens[$this->CONTAINER_INDEX]), urldecode($tokens[$this->APP_URL_INDEX]), urldecode($tokens[$this->MODULE_ID_INDEX])); } else { return opShindigSecurityToken::createFromToken($stringToken, Shindig_Config::get('token_max_age')); } } catch (Exception $e) { throw new GadgetException('INVALID_GADGET_TOKEN'); } }
/** * Executes set action * * @param sfWebRequest $request A request object */ public function executeSet(sfWebRequest $request) { $response = $this->getResponse(); if ($request->isMethod(sfRequest::POST) || !$request->hasParameter('st') || !$request->hasParameter('name') || !$request->hasParameter('value')) { $this->forward404(); } try { $st = urldecode(base64_decode($request->getParameter('st'))); $name = $request->getParameter('name'); $value = $request->getParameter('value'); $token = opShindigSecurityToken::createFromToken($st, 60); $modId = $token->getModuleId(); $owner = $token->getOwnerId(); $viewer = $token->getViewerId(); $this->forward404Unless($viewer == $owner); $memberApplication = Doctrine::getTable('MemberApplication')->find($modId); $this->forward404Unless($memberApplication); $memberApplication->setUserSetting($name, $value); } catch (Exception $e) { $this->forward404(); } return sfView::NONE; }
/** * Executes gadget component * * @param sfWebRequest $request */ public function executeGadget(sfWebRequest $request) { $this->isTitleLink = true; if (!$this->titleLinkTo) { $this->isTitleLink = false; $this->titleLinkTo = '@homepage'; } $culture = $this->getUser()->getCulture(); $culture = split("_", $culture); $this->application = $this->memberApplication->getApplication(); $this->height = $this->application->getHeight() ? $this->application->getHeight() : 200; $viewerId = $this->getUser()->getMemberId(); $this->isOwner = false; if ($this->memberApplication->getMemberId() == $viewerId) { $this->isOwner = true; } $isUseOuterShindig = Doctrine::getTable('SnsConfig')->get('is_use_outer_shindig', false); $opOpenSocialContainerConfig = new opOpenSocialContainerConfig(); $containerName = $opOpenSocialContainerConfig->getContainerName(); $securityToken = opShindigSecurityToken::createFromValues($this->memberApplication->getMemberId(), $viewerId, $this->application->getId(), $containerName, urlencode($this->application->getUrl()), $this->memberApplication->getId(), Shindig_Config::get('container_id')); $getParams = array('synd' => $containerName, 'container' => $containerName, 'owner' => $this->memberApplication->getMemberId(), 'viewer' => $viewerId, 'aid' => $this->application->getId(), 'mid' => $this->memberApplication->getId(), 'country' => isset($culture[1]) ? $culture[1] : 'ALL', 'lang' => $culture[0], 'view' => $this->view, 'parent' => $this->getRequest()->getUri(), 'st' => base64_encode($securityToken->toSerialForm()), 'url' => $this->application->getUrl()); $this->hasApp = $this->application->isHadByMember($this->getUser()->getMemberId()); $this->rpcToken = rand(0, getrandmax()); $userprefParamPrefix = Shindig_Config::get('userpref_param_prefix', 'up_'); foreach ($this->memberApplication->getUserSettings() as $name => $value) { $getParams[$userprefParamPrefix . $name] = $value; } if ($isUseOuterShindig) { $shindigUrl = Doctrine::getTable('SnsConfig')->get('shindig_url'); if (substr($shindigUrl, -1) !== '/') { $shindigUrl .= '/'; } $this->iframeUrl = $shindigUrl . 'gadgets/ifr?' . http_build_query($getParams) . '#rpctoken=' . $this->rpcToken; } else { $this->iframeUrl = sfContext::getInstance()->getController()->genUrl('gadgets/ifr') . '?' . http_build_query($getParams) . '#rpctoken=' . $this->rpcToken; } }