本文整理匯總了PHP中Sentinel::userCanOnLogs方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sentinel::userCanOnLogs方法的具體用法?PHP Sentinel::userCanOnLogs怎麽用?PHP Sentinel::userCanOnLogs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sentinel
的用法示例。
在下文中一共展示了Sentinel::userCanOnLogs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: config_load
//.........這裏部分代碼省略.........
foreach ($new_paths as $path => $lastmodified) {
$ext = $i > 1 ? '_' . $i : '';
$files[$fileid . $ext] = $file;
$files[$fileid . $ext]['oid'] = $fileid;
$files[$fileid . $ext]['odisplay'] = $files[$fileid . $ext]['display'];
$files[$fileid . $ext]['path'] = $path;
$files[$fileid . $ext]['display'] .= ' > ' . basename($path);
if ($i >= $count) {
break;
}
$i++;
}
}
}
}
// Remove forbidden files
if (Sentinel::isAuthSet()) {
// authentication is enabled on this instance
$username = Sentinel::getCurrentUsername();
$final = array();
// Anonymous access only
if (is_null($username)) {
foreach ($files as $fileid => $file) {
$a = $fileid;
// glob file
if (isset($files[$fileid]['oid'])) {
$a = $files[$fileid]['oid'];
}
if (Sentinel::isLogAnonymous($a)) {
$final[$fileid] = $file;
}
}
} else {
foreach ($files as $fileid => $file) {
$a = $fileid;
// glob file
if (isset($files[$fileid]['oid'])) {
$a = $files[$fileid]['oid'];
}
if (Sentinel::userCanOnLogs($a, 'r', true, $username) || Sentinel::isLogAnonymous($a)) {
$final[$fileid] = $file;
}
}
}
$files = $final;
}
// Fix missing values with defaults
foreach ($files as $fileid => $file) {
foreach (array('max' => LOGS_MAX, 'refresh' => LOGS_REFRESH, 'notify' => NOTIFICATION) as $fix => $value) {
if (!isset($file[$fix])) {
$files[$fileid][$fix] = $value;
}
}
}
// Finally sort files
if (!function_exists('display_asc')) {
function display_asc($a, $b)
{
return strcmp($a["display"], $b["display"]);
}
}
if (!function_exists('display_desc')) {
function display_desc($a, $b)
{
return strcmp($b["display"], $a["display"]);
}
}
if (!function_exists('display_insensitive_asc')) {
function display_insensitive_asc($a, $b)
{
return strcmp($a["display"], $b["display"]);
}
}
if (!function_exists('display_insensitive_desc')) {
function display_insensitive_desc($a, $b)
{
return strcmp($b["display"], $a["display"]);
}
}
switch (trim(str_replace(array('-', '_', ' ', 'nsensitive'), '', SORT_LOG_FILES))) {
case 'display':
case 'displayasc':
usort($files, 'display_asc');
break;
case 'displayi':
case 'displayiasc':
usort($files, 'display_insensitive_asc');
break;
case 'displaydesc':
usort($files, 'display_desc');
break;
case 'displayidesc':
usort($files, 'display_insensitive_desc');
break;
default:
# do not sort
break;
}
return array($badges, $files);
}