本文整理汇总了PHP中auth::is_role_page方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::is_role_page方法的具体用法?PHP auth::is_role_page怎么用?PHP auth::is_role_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::is_role_page方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_diff_view
function plugin_diff_view($page)
{
global $script, $hr;
// global $_msg_notfound, $_msg_goto, $_msg_deleted, $_msg_addline, $_msg_delline;
// global $_title_diff, $_title_diff_delete;
if (auth::check_role('safemode')) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$_msg_notfound = _('The page was not found.');
$_msg_addline = _('The added line is <span class="diff_added">THIS COLOR</span>.');
$_msg_delline = _('The deleted line is <span class="diff_removed">THIS COLOR</span>.');
$_msg_goto = _('Go to $1.');
$_msg_deleted = _(' $1 has been deleted.');
$_title_diff = _('Diff of $1');
$_title_diff_delete = _('Deleting diff of $1');
$r_page = rawurlencode($page);
$s_page = htmlspecialchars($page);
$menu = array('<li>' . $_msg_addline . '</li>', '<li>' . $_msg_delline . '</li>');
$is_page = is_page($page);
if ($is_page) {
$menu[] = ' <li>' . str_replace('$1', '<a href="' . get_page_uri($page) . '">' . $s_page . '</a>', $_msg_goto) . '</li>';
} else {
$menu[] = ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . '</li>';
}
$filename = DIFF_DIR . encode($page) . '.txt';
if (file_exists($filename)) {
// if (! PKWK_READONLY) {
if (!auth::check_role('readonly')) {
$menu[] = '<li><a href="' . $script . '?cmd=diff&action=delete&page=' . $r_page . '">' . str_replace('$1', $s_page, $_title_diff_delete) . '</a></li>';
}
$source = join('', file($filename));
auth::is_role_page($source);
$msg = '<pre>' . diff_style_to_css(htmlspecialchars($source)) . '</pre>' . "\n";
} else {
if ($is_page) {
$source = join('', get_source($page));
auth::is_role_page($source);
$diffdata = trim(htmlspecialchars($source));
$msg = '<pre><span class="diff_added">' . $diffdata . '</span></pre>' . "\n";
} else {
return array('msg' => $_title_diff, 'body' => $_msg_notfound);
}
}
$menu = join("\n", $menu);
$body = <<<EOD
<ul>
{$menu}
</ul>
{$hr}
EOD;
return array('msg' => $_title_diff, 'body' => $body . $msg);
}
示例2: plugin_source_action
function plugin_source_action()
{
global $vars;
//, $_source_messages;
// if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibits this');
if (auth::check_role('safemode')) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$page = isset($vars['page']) ? $vars['page'] : '';
$vars['refer'] = $page;
if (!is_page($page) || !check_readable($page, false, false)) {
return array('msg' => _(' $1 was not found.'), 'body' => _('cannot display the page source.'));
}
$source = join('', get_source($page));
auth::is_role_page($source);
return array('msg' => _('Source of $1'), 'body' => '<pre id="source">' . htmlspecialchars($source) . '</pre>');
}
示例3: plugin_edit_action
function plugin_edit_action()
{
// global $vars, $_title_edit, $load_template_func;
global $vars, $load_template_func;
// if (PKWK_READONLY) die_message( _('PKWK_READONLY prohibits editing') );
if (auth::check_role('readonly')) {
die_message(_('PKWK_READONLY prohibits editing'));
}
if (PKWK_READONLY == ROLE_AUTH && auth::get_role_level() > ROLE_AUTH) {
die_message(_('PKWK_READONLY prohibits editing'));
}
if (isset($vars['realview'])) {
return plugin_edit_realview();
}
$page = isset($vars['page']) ? $vars['page'] : '';
check_editable($page, true, true);
if (!is_page($page) && auth::is_check_role(PKWK_CREATE_PAGE)) {
die_message(_('PKWK_CREATE_PAGE prohibits editing'));
}
if (isset($vars['preview']) || $load_template_func && isset($vars['template'])) {
return plugin_edit_preview();
} else {
if (isset($vars['write'])) {
return plugin_edit_write();
} else {
if (isset($vars['cancel'])) {
return plugin_edit_cancel();
}
}
}
$source = get_source($page);
auth::is_role_page($source);
$postdata = $vars['original'] = join('', $source);
if (!empty($vars['id'])) {
$postdata = plugin_edit_parts($vars['id'], $source);
if ($postdata === FALSE) {
unset($vars['id']);
// なかったことに :)
$postdata = $vars['original'];
}
}
if ($postdata == '') {
$postdata = auto_template($page);
}
return array('msg' => _('Edit of $1'), 'body' => edit_form($page, $postdata));
}
示例4: plugin_template_action
function plugin_template_action()
{
global $script, $vars;
// global $_title_edit;
// global $_msg_template_start, $_msg_template_end, $_msg_template_page, $_msg_template_refer;
// global $_btn_template_create, $_title_template;
// global $_err_template_already, $_err_template_invalid, $_msg_template_force;
$_title_edit = _('Edit of $1');
$_msg_template_start = _('Start:<br />');
$_msg_template_end = _('End:<br />');
$_msg_template_page = _('$1/copy');
$_msg_template_refer = _('Page:');
$_msg_template_force = _('Edit with a page name which already exists');
$_err_template_already = _(' $1 already exists.');
$_err_template_invalid = _(' $1 is not a valid page name.');
$_btn_template_create = _('Create');
$_title_template = _('create a new page, using $1 as a template.');
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
// if (auth::check_role('readonly')) die_message('PKWK_READONLY prohibits editing');
if (auth::check_role('safemode') || auth::check_role('readonly')) {
die_message(_('Prohibited'));
}
if (!isset($vars['refer']) || !is_page($vars['refer'])) {
return FALSE;
}
if (!is_page($vars['refer']) || !check_readable($vars['refer'], false, false)) {
return array('msg' => _(' $1 was not found.'), 'body' => _('cannot display the page source.'));
}
$lines = get_source($vars['refer']);
auth::is_role_page($lines);
// Remove '#freeze'
if (!empty($lines) && strtolower(rtrim($lines[0])) == '#freeze') {
array_shift($lines);
}
$begin = isset($vars['begin']) && is_numeric($vars['begin']) ? $vars['begin'] : 0;
$end = isset($vars['end']) && is_numeric($vars['end']) ? $vars['end'] : count($lines) - 1;
if ($begin > $end) {
$temp = $begin;
$begin = $end;
$end = $temp;
}
$page = isset($vars['page']) ? $vars['page'] : '';
$is_page = is_page($page);
// edit
if ($is_pagename = is_pagename($page) && (!$is_page || !empty($vars['force']))) {
$postdata = join('', array_splice($lines, $begin, $end - $begin + 1));
$retvar['msg'] = $_title_edit;
$retvar['body'] = edit_form($vars['page'], $postdata);
$vars['refer'] = $vars['page'];
return $retvar;
}
$begin_select = $end_select = '';
for ($i = 0; $i < count($lines); $i++) {
$line = htmlspecialchars(mb_strimwidth($lines[$i], 0, MAX_LEN, '...'));
$tag = $i == $begin ? ' selected="selected"' : '';
$begin_select .= "<option value=\"{$i}\"{$tag}>{$line}</option>\n";
$tag = $i == $end ? ' selected="selected"' : '';
$end_select .= "<option value=\"{$i}\"{$tag}>{$line}</option>\n";
}
$_page = htmlspecialchars($page);
$msg = $tag = '';
if ($is_page) {
$msg = $_err_template_already;
$tag = '<input type="checkbox" name="force" value="1" />' . $_msg_template_force;
} else {
if ($page != '' && !$is_pagename) {
$msg = str_replace('$1', $_page, $_err_template_invalid);
}
}
$s_refer = htmlspecialchars($vars['refer']);
$s_page = $page == '' ? str_replace('$1', $s_refer, $_msg_template_page) : $_page;
$ret = <<<EOD
<form action="{$script}" method="post">
<div>
<input type="hidden" name="plugin" value="template" />
<input type="hidden" name="refer" value="{$s_refer}" />
{$_msg_template_start} <select name="begin" size="10">{$begin_select}</select><br /><br />
{$_msg_template_end} <select name="end" size="10">{$end_select}</select><br /><br />
<label for="_p_template_refer">{$_msg_template_refer}</label>
<input type="text" name="page" id="_p_template_refer" value="{$s_page}" />
<input type="submit" name="submit" value="{$_btn_template_create}" /> {$tag}
</div>
</form>
EOD;
$retvar['msg'] = $msg == '' ? $_title_template : $msg;
$retvar['body'] = $ret;
return $retvar;
}
示例5: plugin_backup_action
function plugin_backup_action()
{
global $vars, $do_backup, $hr, $script;
// global $_msg_backuplist, $_msg_diff, $_msg_nowdiff, $_msg_source, $_msg_backup;
// global $_msg_view, $_msg_goto, $_msg_deleted;
// global $_msg_visualdiff;
// global $_title_backupdiff, $_title_backupnowdiff, $_title_backupsource;
// global $_title_backup, $_title_pagebackuplist, $_title_backuplist;
$_msg_backuplist = _('Backup list');
$_msg_diff = _('diff');
$_msg_nowdiff = _('diff current');
$_msg_source = _('source');
$_msg_backup = _('backup');
$_msg_visualdiff = _('diff for visual');
$_msg_view = _('View the $1.');
$_msg_goto = _('Go to $1.');
$_msg_deleted = _(' $1 has been deleted.');
$_title_backupdiff = _('Backup diff of $1(No. $2)');
$_title_backupnowdiff = _('Backup diff of $1 vs current(No. $2)');
$_title_backupsource = _('Backup source of $1(No. $2)');
$_title_backup = _('Backup of $1(No. $2)');
$_title_pagebackuplist = _('Backup list of $1');
$_title_backuplist = _('Backup list');
if (!$do_backup) {
return;
}
$page = isset($vars['page']) ? $vars['page'] : '';
if ($page == '') {
return array('msg' => $_title_backuplist, 'body' => plugin_backup_get_list_all());
}
check_readable($page, true, true);
$s_page = htmlspecialchars($page);
$r_page = rawurlencode($page);
$action = isset($vars['action']) ? $vars['action'] : '';
if ($action == 'delete') {
return plugin_backup_delete($page);
}
$s_action = $r_action = '';
if ($action != '') {
$s_action = htmlspecialchars($action);
$r_action = rawurlencode($action);
}
$s_age = isset($vars['age']) && is_numeric($vars['age']) ? $vars['age'] : 0;
if ($s_age <= 0) {
return array('msg' => $_title_pagebackuplist, 'body' => plugin_backup_get_list($page));
}
$body = '<ul>' . "\n";
$body .= ' <li><a href="' . $script . '?cmd=backup">' . $_msg_backuplist . '</a></li>' . "\n";
$href = $script . '?cmd=backup&page=' . $r_page . '&age=' . $s_age;
$is_page = is_page($page);
if ($is_page && $action != 'diff') {
$body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=diff">' . $_msg_diff . '</a>', $_msg_view) . '</li>' . "\n";
}
if ($is_page && $action != 'nowdiff') {
$body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=nowdiff">' . $_msg_nowdiff . '</a>', $_msg_view) . '</li>' . "\n";
}
if ($is_page && $action != 'visualdiff') {
$body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=visualdiff">' . $_msg_visualdiff . '</a>', $_msg_view) . '</li>' . "\n";
}
if ($action != 'source') {
$body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=source">' . $_msg_source . '</a>', $_msg_view) . '</li>' . "\n";
}
if (!PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING && $action) {
$body .= ' <li>' . str_replace('$1', '<a href="' . $href . '">' . $_msg_backup . '</a>', $_msg_view) . '</li>' . "\n";
}
if ($is_page) {
$body .= ' <li>' . str_replace('$1', '<a href="' . get_page_uri($page) . '">' . $s_page . '</a>', $_msg_goto) . "\n";
} else {
$body .= ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . "\n";
}
$backups = get_backup($page);
$backups_count = count($backups);
if ($s_age > $backups_count) {
$s_age = $backups_count;
}
if ($backups_count > 0 && $action != 'visualdiff') {
$body .= ' <ul>' . "\n";
foreach ($backups as $age => $val) {
$time = isset($val['real']) ? $val['real'] : $val['time'];
$date = format_date($time, TRUE);
$body .= $age == $s_age ? ' <li><em>' . $age . ' ' . $date . '</em></li>' . "\n" : ' <li><a href="' . $script . '?cmd=backup&action=' . $r_action . '&page=' . $r_page . '&age=' . $age . '">' . $age . ' ' . $date . '</a></li>' . "\n";
}
$body .= ' </ul>' . "\n";
}
$body .= ' </li>' . "\n";
$body .= '</ul>' . "\n";
if ($action == 'diff') {
if (auth::check_role('safemode')) {
die_message(_('PKWK_SAFE_MODE prohibits this'));
}
$title =& $_title_backupdiff;
$old = $s_age > 1 ? join('', $backups[$s_age - 1]['data']) : '';
$cur = join('', $backups[$s_age]['data']);
auth::is_role_page($old);
auth::is_role_page($cur);
$body .= plugin_backup_diff(do_diff($old, $cur));
} else {
if ($s_action == 'nowdiff') {
if (auth::check_role('safemode')) {
die_message(_('PKWK_SAFE_MODE prohibits this'));
//.........这里部分代码省略.........