コード例 #1
0
 /**
  * Convert the url or part of it to a string
  *
  * Using scheme://user:pass@host/path?query#fragment';
  *
  * @param integer $parts A bitmask of binary or'ed HTTP_URL constants; FULL is the default
  * @return  string
  */
 public function toString($parts = self::FULL)
 {
     if (isset($this->query['option'])) {
         $this->getObject('application')->getRouter()->build($this);
     }
     return parent::toString($parts);
 }
コード例 #2
0
 /**
  * Returns the HTTP referrer.
  *
  * 'referer' a commonly used misspelling word for 'referrer'
  * @link http://en.wikipedia.org/wiki/HTTP_referrer
  *
  * @param   boolean  $isInternal Only allow internal url's
  * @return  HttpUrl  A HttpUrl object
  */
 public function getReferrer($isInternal = true)
 {
     if (!isset($this->_referrer)) {
         $referrer = $this->getObject('lib:filter.url')->sanitize($this->_headers->get('Referer'));
         $this->_referrer = $this->getObject('lib:http.url', array('url' => $referrer));
     }
     if ($isInternal) {
         if (!$this->getObject('lib:filter.internalurl')->validate($this->_referrer->toString(HttpUrl::SCHEME | HttpUrl::HOST))) {
             return null;
         }
     }
     return $this->_referrer;
 }
コード例 #3
0
ファイル: abstract.php プロジェクト: nooku/nooku-framework
 /**
  * Returns the HTTP referrer.
  *
  * If a base64 encoded _referrer property exists in the request payload, it is used instead of the referrer.
  * 'referer' a commonly used misspelling word for 'referrer'
  * @link http://en.wikipedia.org/wiki/HTTP_referrer
  *
  * @param   boolean  $isInternal Only allow internal url's
  * @return  HttpUrl|null  A HttpUrl object or NULL if no referrer could be found
  */
 public function getReferrer($isInternal = true)
 {
     if (!isset($this->_referrer) && ($this->_headers->has('Referer') || $this->data->has('_referrer'))) {
         if ($this->data->has('_referrer')) {
             $referrer = base64_decode($this->data->get('_referrer', 'base64'));
         } else {
             $referrer = $this->_headers->get('Referer');
         }
         $this->setReferrer($this->getObject('lib:filter.url')->sanitize($referrer));
     }
     if (isset($this->_referrer) && $isInternal) {
         $url = $this->_referrer->toString(HttpUrl::SCHEME | HttpUrl::HOST);
         if (!$this->getObject('lib:filter.internalurl')->validate($url)) {
             return null;
         }
     }
     return $this->_referrer;
 }
コード例 #4
0
 private function makeCheckIdRequest(OpenIdCredentials $credentials, HttpUrl $returnTo, $trustRoot = null, $association = null)
 {
     Assert::isTrue($returnTo->isValid());
     $view = RedirectView::create($credentials->getServer()->toString());
     $model = Model::create()->set('openid.ns', self::NAMESPACE_2_0)->set('openid.identity', $credentials->getRealId()->toString())->set('openid.return_to', $returnTo->toString())->set('openid.claimed_id', $credentials->getRealId()->toString());
     foreach ($this->extensions as $extension) {
         $extension->addParamsToModel($model);
     }
     if ($association) {
         Assert::isTrue($association instanceof OpenIdConsumerAssociation && $association->getServer()->toString() == $credentials->getServer()->toString());
         $model->set('openid.assoc_handle', $association->getHandle());
     }
     if ($trustRoot) {
         Assert::isTrue($trustRoot instanceof HttpUrl && $trustRoot->isValid());
         $model->set('openid.trust_root', $trustRoot->toString())->set('openid.realm', $trustRoot->toString());
     }
     return ModelAndView::create()->setModel($model)->setView($view);
 }