本文整理汇总了PHP中Piwik_Url::getLocalReferer方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Url::getLocalReferer方法的具体用法?PHP Piwik_Url::getLocalReferer怎么用?PHP Piwik_Url::getLocalReferer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Url
的用法示例。
在下文中一共展示了Piwik_Url::getLocalReferer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRefererToRedirect
/**
* Redirect to referer only if from within Piwik
*
* @returns string
*/
public static function getRefererToRedirect()
{
// retrieve any previously saved referer
$referer = Piwik_Common::getRequestVar('form_url', '', 'string');
if (!empty($referer)) {
return htmlspecialchars_decode($referer);
}
// if the referer contains module=Login, Installation, or CoreUpdater, we instead redirect to the doc root
$referer = Piwik_Url::getLocalReferer();
if (empty($referer) || preg_match('/module=(Login|Installation|CoreUpdater)/', $referer)) {
$referer = 'index.php';
}
return $referer;
}
示例2: verifyNonce
/**
* Verify nonce and check referrer (if present, i.e., it may be suppressed by the browser or a proxy/network).
*
* @param string $id Unique id
* @param string $cnonce Nonce sent to client
* @return bool true if valid; false otherwise
*/
public static function verifyNonce($id, $cnonce)
{
$ns = new Piwik_Session_Namespace($id);
$nonce = $ns->nonce;
// validate token
if (empty($cnonce) || $cnonce !== $nonce) {
return false;
}
// validate referer
$referer = Piwik_Url::getReferer();
if (!empty($referer) && Piwik_Url::getLocalReferer() === false) {
return false;
}
// validate origin
$origin = self::getOrigin();
if (!empty($origin) && ($origin == 'null' || !in_array($origin, self::getAcceptableOrigins()))) {
return false;
}
return true;
}
示例3: verifyNonce
/**
* Verify nonce and check referrer (if present, i.e., it may be suppressed by the browser or a proxy/network).
*
* @param string $id Unique id
* @param string $nonce Nonce sent to client
* @return bool true if valid; false otherwise
*/
public static function verifyNonce($id, $nonce)
{
$ns = new Zend_Session_Namespace($id);
$snonce = $ns->nonce;
// validate token
if (empty($nonce) || $snonce !== $nonce) {
return false;
}
// validate referer
$referer = Piwik_Url::getReferer();
if (!empty($referer) && Piwik_Url::getLocalReferer() === false) {
return false;
}
return true;
}
示例4: redirect
/**
* Output redirection page instead of linking directly to avoid
* exposing the referrer on the Piwik demo.
*
* @param string $url (via $_GET)
*/
public function redirect()
{
$url = Piwik_Common::getRequestVar('url', '', 'string', $_GET);
// validate referrer
$referrer = Piwik_Url::getReferer();
if (!empty($referrer) && Piwik_Url::getLocalReferer() === false) {
die('Invalid Referer detected - check that your browser sends the Referer header. <br/>The link you would have been redirected to is: ' . $url);
exit;
}
// mask visits to *.piwik.org
if (self::isPiwikUrl($url)) {
echo '<html><head>
<meta http-equiv="refresh" content="0;url=' . $url . '" />
</head></html>';
}
exit;
}