本文整理汇总了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);
}