本文整理汇总了PHP中Sentinel::sign方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentinel::sign方法的具体用法?PHP Sentinel::sign怎么用?PHP Sentinel::sign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentinel
的用法示例。
在下文中一共展示了Sentinel::sign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
break;
default:
$method = 'nw';
break;
}
$url = str_replace(array('rss.pml.php'), array('rss.php'), $url) . '?f=' . urlencode($file_id) . '&l=' . urlencode(isset($_GET['l']) ? $_GET['l'] : $lang) . '&tz=' . urlencode($tz) . '&format=' . urlencode($format) . '&count=' . (isset($files[$file_id]['max']) ? urlencode($files[$file_id]['max']) : urlencode(LOGS_MAX)) . '&timeout=' . urlencode(MAX_SEARCH_LOG_TIME) . '&search=' . urlencode(@$_POST['search']);
$current_user = Sentinel::attempt($files);
// We authenticate the url if a user is logged in
// -> if log is anonymous, the request will be authenticated and if an admin remove
// the anonymous log, this user will always be able to get it
// -> if the log file is protected, this user will be able to get ot according to its rights
if (!is_null($current_user)) {
$username = Sentinel::getCurrentUsername();
$user = Sentinel::getUser($username);
$token = $user['at'];
$hash = Sentinel::sign(array('f' => $_POST['file']), $username);
$url = $url . '&t=' . urlencode($token) . '&h=' . urlencode($hash);
}
$u = parse_url($url);
$ip = $u['host'];
if (filter_var($ip, FILTER_VALIDATE_IP)) {
$return['war'] = !is_not_local_ip($ip);
} else {
if ($ip === 'localhost') {
$return['war'] = true;
} else {
$return['war'] = false;
}
}
$return['url'] = $url;
$return['met'] = $method;