本文整理汇总了PHP中auth::is_page_readable方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::is_page_readable方法的具体用法?PHP auth::is_page_readable怎么用?PHP auth::is_page_readable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::is_page_readable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_existpages
function get_existpages($dir = DATA_DIR, $ext = '.txt')
{
$rc = array();
// ページ名の取得
$pages = get_existpages($dir, $ext);
// ユーザ名取得
$uname = auth::check_auth();
// コンテンツ管理者以上は、: のページも閲覧可能
$is_colon = auth::check_role('role_adm_contents');
// 役割の取得
// $now_role = auth::get_role_level();
foreach ($pages as $file => $page) {
if (!auth::is_page_readable($uname, $page)) {
continue;
}
if (substr($page, 0, 1) != ':') {
$rc[$file] = $page;
continue;
}
// colon page
if ($is_colon) {
continue;
}
$rc[$file] = $page;
}
return $rc;
}
示例2: plugin_recent_convert
function plugin_recent_convert()
{
global $vars, $date_format, $show_passage;
// , $_recent_plugin_frame;
static $exec_count = 1;
$_recent_plugin_frame_s = _('recent(%d)');
$_recent_plugin_frame = sprintf('<h5>%s</h5><div>%%s</div>', $_recent_plugin_frame_s);
$recent_lines = PLUGIN_RECENT_DEFAULT_LINES;
if (func_num_args()) {
$args = func_get_args();
if (!is_numeric($args[0]) || isset($args[1])) {
return PLUGIN_RECENT_USAGE . '<br />';
} else {
$recent_lines = $args[0];
}
}
// Show only N times
if ($exec_count > PLUGIN_RECENT_EXEC_LIMIT) {
return '#recent(): You called me too much' . '<br />' . "\n";
} else {
++$exec_count;
}
if (!file_exists(PLUGIN_RECENT_CACHE)) {
return '#recent(): Cache file of RecentChanges not found' . '<br />';
}
// Get latest N changes
$lines = file_head(PLUGIN_RECENT_CACHE, $recent_lines);
if ($lines == FALSE) {
return '#recent(): File can not open' . '<br />' . "\n";
}
$auth_key = auth::get_user_info();
$date = $items = '';
foreach ($lines as $line) {
list($time, $page) = explode("\t", rtrim($line));
if (!auth::is_page_readable($page, $auth_key['key'], $auth_key['group'])) {
continue;
}
$_date = get_date($date_format, $time);
if ($date != $_date) {
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
// New day
$date = $_date;
$items .= '<strong>' . $date . '</strong>' . "\n" . '<ul class="recent_list">' . "\n";
}
$s_page = htmlspecialchars($page);
if ($page === $vars['page']) {
// No need to link to the page you just read, or notify where you just read
$items .= ' <li>' . $s_page . '</li>' . "\n";
} else {
$passage = $show_passage ? ' ' . get_passage($time) : '';
$items .= ' <li><a href="' . get_page_uri($page) . '"' . ' title="' . $s_page . $passage . '">' . $s_page . '</a></li>' . "\n";
}
}
// End of the day
if ($date != '') {
$items .= '</ul>' . "\n";
}
return sprintf($_recent_plugin_frame, count($lines), $items);
}
示例3: read_auth
function read_auth($page, $auth_flag = TRUE, $exit_flag = TRUE)
{
global $read_auth, $read_auth_pages, $auth_api, $defaultpage, $_title;
if (!$read_auth) {
return true;
}
$info = auth::get_user_info();
if (!empty($info['key']) && auth::is_page_readable($page, $info['key'], $info['group'])) {
return true;
}
if (!$auth_api['plus']['use']) {
return auth::is_page_readable($page, '', '');
}
$auth_func_name = get_auth_func_name();
// 未認証時で認証不要($auth_flag)であっても、制限付きページかの判定が必要
if ($auth_flag && !$auth_func_name($page, $auth_flag, $exit_flag, $read_auth_pages, $_title['cannotread'])) {
return false;
}
return auth::is_page_readable($page, '', '');
if ($exit_flag) {
// 無応答
header('Location: ' . get_page_location_uri($defaultpage));
die;
}
return false;
}
示例4: logview_user_list
function logview_user_list(&$fld, $page, $kind)
{
global $_logview_msg;
// 登録ユーザ以上でなければ、他のユーザを知ることは禁止
if (auth::check_role('role_enrollee')) {
return '';
}
$all_user = auth::user_list();
$all_user_idx = 0;
$excludes_user = array();
foreach ($all_user as $auth_api => $val1) {
foreach ($val1 as $user => $val) {
$group = empty($val['group']) ? '' : $val['group'];
if ($kind != 'login' && !auth::is_page_readable($page, $user, $group)) {
$excludes_user[$auth_api][$user] = '';
continue;
}
$all_user_idx++;
}
}
$user_list = array();
foreach ($fld as $line) {
$user_list[$line['auth_api']][$line['user']] = '';
}
$check_list = array();
foreach ($all_user as $auth_api => $val1) {
foreach ($val1 as $user => $val) {
if (isset($user_list[$auth_api][$val['displayname']])) {
continue;
}
if (isset($excludes_user[$auth_api][$user])) {
continue;
}
$check_list[] = array('name' => $val['displayname'], 'auth_api' => $auth_api);
}
}
$ctr = count($check_list);
if ($ctr == 0) {
return '';
}
$ret = '<h4>' . $_logview_msg['info_unused'] . '</h4>' . "\n";
// 未確認者一覧
$ret .= '<div><fieldset>' . $_logview_msg['all_user'] . ': ' . $all_user_idx . ' ' . $_logview_msg['number_unused'] . ': ' . $ctr . ' ' . $_logview_msg['availability'] . ': ' . floor(100 - $ctr / $all_user_idx * 100) . '%</fieldset></div><div> </div>' . "\n";
// 人数
sort($check_list);
$ctr = 0;
foreach ($check_list as $user) {
$ctr++;
$ret .= '<small><strong>' . $ctr . '.</strong></small>' . $user['name'];
if (PLUGIN_LOGVIEW_DISPLAY_AUTH_API) {
$ret .= ' <small><span style="color: ' . PLUGIN_LOGVIEW_COLOR_AUTH_API . '">' . $user['auth_api'] . '</span></small>';
}
$ret .= "\n";
}
return $ret;
}