当前位置: 首页>>代码示例>>PHP>>正文


PHP Url::getReferrer方法代码示例

本文整理汇总了PHP中Piwik\Url::getReferrer方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::getReferrer方法的具体用法?PHP Url::getReferrer怎么用?PHP Url::getReferrer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Url的用法示例。


在下文中一共展示了Url::getReferrer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

 private function sendMail($subject, $body)
 {
     $feedbackEmailAddress = Config::getInstance()->General['feedback_email_address'];
     $subject = '[ Feedback Feature - Piwik ] ' . $subject;
     $body = Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Version::VERSION . "\n" . 'IP: ' . IP::getIpFromHeader() . "\n" . 'URL: ' . Url::getReferrer() . "\n";
     $mail = new Mail();
     $mail->setFrom(Piwik::getCurrentUserEmail());
     $mail->addTo($feedbackEmailAddress, 'Piwik Team');
     $mail->setSubject($subject);
     $mail->setBodyText($body);
     @$mail->send();
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:12,代码来源:API.php

示例2: verifyNonce

 /**
  * Returns if a nonce is valid and comes from a valid request.
  * 
  * A nonce is valid if it matches the current nonce and if the current nonce
  * has not expired.
  * 
  * The request is valid if the referrer is a local URL (see {@link Url::isLocalUrl()})
  * and if the HTTP origin is valid (see {@link getAcceptableOrigins()}).
  *
  * @param string $id The nonce's unique ID. See {@link getNonce()}.
  * @param string $cnonce Nonce sent from client.
  * @return bool `true` if valid; `false` otherwise.
  */
 public static function verifyNonce($id, $cnonce)
 {
     $ns = new SessionNamespace($id);
     $nonce = $ns->nonce;
     // validate token
     if (empty($cnonce) || $cnonce !== $nonce) {
         return false;
     }
     // validate referrer
     $referrer = Url::getReferrer();
     if (!empty($referrer) && !Url::isLocalUrl($referrer)) {
         return false;
     }
     // validate origin
     $origin = self::getOrigin();
     if (!empty($origin) && ($origin == 'null' || !in_array($origin, self::getAcceptableOrigins()))) {
         return false;
     }
     return true;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:33,代码来源:Nonce.php

示例3: redirect

    /**
     * Output redirection page instead of linking directly to avoid
     * exposing the referrer on the Piwik demo.
     *
     * @internal param string $url (via $_GET)
     */
    public function redirect()
    {
        $url = Common::getRequestVar('url', '', 'string', $_GET);
        // validate referrer
        $referrer = Url::getReferrer();
        if (empty($referrer) || !Url::isLocalUrl($referrer)) {
            die('Invalid Referrer detected - This means that your web browser is not sending the "Referrer URL" which is
				required to proceed with the redirect. Verify your browser settings and add-ons, to check why your browser
				 is not sending this referrer.

				<br/><br/>You can access the page at: ' . $url);
        }
        // mask visits to *.piwik.org
        if (!self::isPiwikUrl($url)) {
            Piwik::checkUserHasSomeViewAccess();
        }
        if (!UrlHelper::isLookLikeUrl($url)) {
            die('Please check the &url= parameter: it should to be a valid URL');
        }
        @header('Content-Type: text/html; charset=utf-8');
        echo '<html><head><meta http-equiv="refresh" content="0;url=' . $url . '" /></head></html>';
        exit;
    }
开发者ID:brienomatty,项目名称:elmsln,代码行数:29,代码来源:Controller.php

示例4: testGetReferrer

 /**
  * @group Core
  */
 public function testGetReferrer()
 {
     $_SERVER['HTTP_REFERER'] = 'http://www.piwik.org';
     $this->assertEquals('http://www.piwik.org', Url::getReferrer());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:UrlTest.php

示例5: sendFeedback

 /**
  * send email to Piwik team and display nice thanks
  * @throws Exception
  */
 function sendFeedback()
 {
     $email = Common::getRequestVar('email', '', 'string');
     $body = Common::getRequestVar('body', '', 'string');
     $category = Common::getRequestVar('category', '', 'string');
     $nonce = Common::getRequestVar('nonce', '', 'string');
     $view = new View('@Feedback/sendFeedback');
     $view->feedbackEmailAddress = Config::getInstance()->General['feedback_email_address'];
     try {
         $minimumBodyLength = 40;
         if (strlen($body) < $minimumBodyLength || strpos($email, 'probe@') !== false || strpos($body, '&lt;probe') !== false) {
             throw new Exception(Piwik::translate('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
         }
         if (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik::translate('UsersManager_ExceptionInvalidEmail'));
         }
         if (preg_match('/https?:/i', $body)) {
             throw new Exception(Piwik::translate('Feedback_ExceptionNoUrls'));
         }
         if (!Nonce::verifyNonce('Feedback.sendFeedback', $nonce)) {
             throw new Exception(Piwik::translate('General_ExceptionNonceMismatch'));
         }
         Nonce::discardNonce('Feedback.sendFeedback');
         $mail = new Mail();
         $mail->setFrom(Common::unsanitizeInputValue($email));
         $mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
         $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
         $mail->setBodyText(Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Version::VERSION . "\n" . 'IP: ' . IP::getIpFromHeader() . "\n" . 'URL: ' . Url::getReferrer() . "\n");
         @$mail->send();
     } catch (Exception $e) {
         $view->errorString = $e->getMessage();
         $view->message = $body;
     }
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:39,代码来源:Controller.php


注:本文中的Piwik\Url::getReferrer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。