本文整理匯總了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;