/** * 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; } }
/** * Executes generate container config * * @param sfWebRequest $request A request object */ public function executeGenerateContainerConfig(sfWebRequest $request) { sfConfig::set('sf_web_debug', false); $response = $this->getResponse(); $response->setContentType('text/javascript'); $opOpenSocialContainerConfig = new opOpenSocialContainerConfig(false); $containerName = $opOpenSocialContainerConfig->getContainerName(); $response->setHttpHeader('Content-Disposition', 'attachment; filename="' . $containerName . '.js"'); $this->json = $opOpenSocialContainerConfig->generate(); }