本文整理汇总了PHP中check_readable函数的典型用法代码示例。如果您正苦于以下问题:PHP check_readable函数的具体用法?PHP check_readable怎么用?PHP check_readable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_readable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_rewritemap_action
function plugin_rewritemap_action()
{
global $vars;
if (empty($vars['page'])) {
return;
}
if (exist_plugin('statichtml')) {
$vars['page'] = PluginStatichtml::decode($vars['page']);
}
$page = plugin_rewritemap_get_pagename($vars['page']);
if (is_page($page)) {
check_readable($page, true, true);
header_lastmod($page);
$vars['page'] = $page;
return array('msg' => '', 'body' => '');
}
$redirect = plugin_rewritemap_get_redirect($page);
$nextpage = plugin_rewritemap_get_pagename($redirect);
if (is_page($nextpage)) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: ' . plugin_rewritemap_url($nextpage));
exit;
} else {
header('HTTP/1.0 404 Not Found');
exit('404 - Not Found');
}
}
示例2: plugin_diff_action
function plugin_diff_action()
{
global $vars, $script;
global $layout_pages, $style_name;
$editable = edit_auth($page, FALSE, FALSE);
if (!$editable) {
header("Location: {$script}");
exit;
}
$page = isset($vars['page']) ? $vars['page'] : '';
check_readable($page, true, true);
//レイアウト部品の場合、スタイルを変更する
$is_layout = FALSE;
if (isset($layout_pages) && isset($layout_pages[$page])) {
$style_name = '..';
$is_layout = TRUE;
}
$action = isset($vars['action']) ? $vars['action'] : '';
switch ($action) {
case 'delete':
$retval = plugin_diff_delete($page);
break;
default:
$retval = plugin_diff_view($page);
break;
}
return $retval;
}
示例3: plugin_skeylist_convert
function plugin_skeylist_convert()
{
global $vars;
global $_skeylist_msg;
global $referer;
if (!$referer) {
return '';
}
list($page, $max) = func_get_args();
if (empty($page)) {
$page = htmlspecialchars($vars['page'], ENT_QUOTES);
}
check_readable($page, false);
$max = empty($max) ? 10 : htmlspecialchars($max, ENT_QUOTES);
// $data = tb_get(tb_get_filename($page,'.ref'));
$data = ref_get_data($page);
if (count($data) == 0) {
return '';
}
// データ無し
$data = skeylist_analysis($data);
// 0:検索キー 1:参照カウンタ
usort($data, create_function('$a,$b', 'return $b[1] - $a[1];'));
$data = skeylist_print($data, $max);
return '<div>' . $data . "</div>\n";
}
示例4: plugin_read_action
function plugin_read_action()
{
global $vars, $_title_invalidwn, $_msg_invalidiwn;
$page = isset($vars['page']) ? $vars['page'] : '';
if (is_page($page)) {
// ページを表示
check_readable($page, true, true);
header_lastmod($page);
return array('msg' => '', 'body' => '');
} else {
if (!PKWK_SAFE_MODE && is_interwiki($page)) {
return do_plugin_action('interwiki');
// InterWikiNameを処理
} else {
if (is_pagename($page)) {
$vars['cmd'] = 'edit';
return do_plugin_action('edit');
// 存在しないので、編集フォームを表示
} else {
// 無効なページ名
return array('msg' => $_title_invalidwn, 'body' => str_replace('$1', htmlsc($page), str_replace('$2', 'WikiName', $_msg_invalidiwn)));
}
}
}
}
示例5: plugin_read_action
function plugin_read_action()
{
global $vars, $_title_invalidwn, $_msg_invalidiwn;
$page = isset($vars['page']) ? $vars['page'] : '';
if (is_page($page)) {
// ページを表示
check_readable($page, true, true);
header_lastmod($page);
return array('msg' => '', 'body' => '');
// } else if (! PKWK_SAFE_MODE && is_interwiki($page)) {
} else {
if (!auth::check_role('safemode') && is_interwiki($page)) {
return do_plugin_action('interwiki');
// InterWikiNameを処理
} else {
if (is_pagename($page)) {
$realpages = get_autoaliases($page);
if (count($realpages) == 1) {
$realpage = $realpages[0];
if (is_page($realpage)) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: ' . get_page_location_uri($realpage));
return;
} elseif (is_url($realpage)) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: ' . $realpage);
return;
} elseif (is_interwiki($realpage)) {
header('HTTP/1.0 301 Moved Permanently');
$vars['page'] = $realpage;
return do_plugin_action('interwiki');
// header('Location');
} else {
// 存在しない場合、直接編集フォームに飛ばす // To avoid infinite loop
header('Location: ' . get_location_uri('edit', $realpage));
return;
}
} elseif (count($realpages) >= 2) {
$body = '<p>';
$body .= _('This pagename is an alias to') . '<br />';
$link = '';
foreach ($realpages as $realpage) {
$link .= '[[' . $realpage . '>' . $realpage . ']]&br;';
}
$body .= make_link($link);
$body .= '</p>';
return array('msg' => _('Redirect'), 'body' => $body);
}
$vars['cmd'] = 'edit';
return do_plugin_action('edit');
// 存在しないので、編集フォームを表示
} else {
// 無効なページ名
return array('msg' => $_title_invalidwn, 'body' => str_replace('$1', htmlspecialchars($page), str_replace('$2', 'WikiName', $_msg_invalidiwn)));
}
}
}
}
示例6: check_page
/**
* Check validity of page
*
* @access static
* @param string $page
* @param array $options
* @return $options
*/
function check_page($page, $current)
{
$page = get_fullname($page, $current);
if (!is_page($page)) {
sonots::mythrow('Page "' . htmlspecialchars($page) . '" does not exist.');
return;
}
if (!check_readable($page, FALSE, FALSE)) {
sonots::mythrow('Page "' . htmlspecialchars($page) . '" is not readable.');
return;
}
return $page;
}
示例7: plugin_source_action
function plugin_source_action()
{
global $vars, $_source_messages;
if (PKWK_SAFE_MODE) {
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' => $_source_messages['msg_notfound'], 'body' => $_source_messages['err_notfound']);
}
return array('msg' => $_source_messages['msg_title'], 'body' => '<pre id="source">' . htmlsc(join('', get_source($page))) . '</pre>');
}
示例8: plugin_code_action
function plugin_code_action()
{
global $vars;
global $_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');
}
$vars['refer'] = $vars['page'];
if (!is_page($vars['page']) || !check_readable($vars['page'], false, false)) {
return array('msg' => $_source_messages['msg_notfound'], 'body' => $_source_messages['err_notfound']);
}
return array('msg' => $_source_messages['msg_title'], 'body' => plugin_code_convert('pukiwiki', join('', get_source($vars['page'])) . "\n"));
}
示例9: plugin_read_action
function plugin_read_action()
{
global $vars, $script;
global $post;
$qm = get_qm();
$qt = get_qt();
$page = isset($vars['page']) ? $vars['page'] : '';
//キャッシュを無効化
if (isset($vars['word'])) {
$qt->enable_cache = false;
}
if (is_page($page)) {
// ページを表示
check_readable($page, true, true);
header_lastmod($page);
return array('msg' => '', 'body' => '');
} else {
if (!PKWK_SAFE_MODE && is_interwiki($page)) {
return do_plugin_action('interwiki');
// InterWikiNameを処理
} else {
if (is_pagename($page)) {
$vars['cmd'] = 'edit';
// 編集権限があれば、編集モードへ。なければ、メッセージを表示
$editable = edit_auth($page, FALSE, FALSE);
if ($editable) {
return do_plugin_action('edit');
// 存在しないので、編集フォームを表示
} else {
//404 NOT FOUND
header('HTTP/1.1 404 Not Found');
return array('msg' => $qm->m['fmt_err_notfoundpage_title'], 'body' => $qm->replace('fmt_err_notfoundpage', $script));
}
} else {
//EUCエンコーディングかチェック
if (mb_detect_encoding($post['page'], 'UTF-8,EUC-JP') == 'EUC-JP') {
$u_page = mb_convert_encoding($post['page'], 'UTF-8', 'EUC-JP');
$enc_page = rawurlencode($u_page);
//redirect
header("HTTP/1.1 301 Moved Permanently");
header('Location: ' . $script . '?' . $enc_page);
exit;
}
// 無効なページ名
return array('msg' => $qm->m['fmt_title_invalidiwn'], 'body' => $qm->replace('fmt_err_invalidiwn', h($page), 'WikiName'));
}
}
}
}
示例10: plugin_diff_action
function plugin_diff_action()
{
global $vars;
$page = isset($vars['page']) ? $vars['page'] : '';
check_readable($page, true, true);
$action = isset($vars['action']) ? $vars['action'] : '';
switch ($action) {
case 'delete':
$retval = plugin_diff_delete($page);
break;
default:
$retval = plugin_diff_view($page);
break;
}
return $retval;
}
示例11: plugin_preview_action
function plugin_preview_action()
{
global $vars;
$page = isset($vars['page']) ? $vars['page'] : '';
if (is_page($page)) {
check_readable($page, true, true);
$source = get_source($page);
array_splice($source, 10);
$body = convert_html($source);
pkwk_common_headers();
header('Content-type: text/xml');
print '<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n";
print $body;
}
exit;
}
示例12: 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>');
}
示例13: plugin_source_action
function plugin_source_action()
{
global $vars, $script;
if (PKWK_SAFE_MODE) {
die_message('PKWK_SAFE_MODE prohibits this');
}
$page = isset($vars['page']) ? $vars['page'] : '';
$vars['refer'] = $page;
$editable = ss_admin_check();
if (!$editable) {
header("Location: {$script}");
exit;
}
$qm = get_qm();
if (!is_page($page) || !check_readable($page, false, false)) {
return array('msg' => $qm->m['plg_source']['title_notfound'], 'body' => $qm->m['plg_source']['err_notfound']);
}
return array('msg' => $qm->m['plg_source']['title'], 'body' => '<pre id="source">' . htmlspecialchars(join('', get_source($page))) . '</pre>');
}
示例14: plugin_referer_action
function plugin_referer_action()
{
global $vars, $referer;
global $_referer_msg;
// Setting: Off
if (!$referer) {
return array('msg' => '', 'body' => '');
}
if (isset($vars['page']) && is_page($vars['page'])) {
check_readable($vars['page'], false);
$sort = empty($vars['sort']) ? '0d' : $vars['sort'];
return array('msg' => $_referer_msg['msg_H0_Refer'], 'body' => plugin_referer_body($vars['page'], $sort));
}
$pages = auth::get_existpages(REFERER_DIR, '.ref');
if (empty($pages)) {
return array('msg' => '', 'body' => '');
} else {
return array('msg' => 'referer list', 'body' => page_list($pages, 'referer', FALSE));
}
}
示例15: plugin_grepall_grep
function plugin_grepall_grep()
{
global $vars, $defaultpage;
$page = isset($vars['page']) ? $vars['page'] : $defultpage;
$filter = isset($vars['filter']) ? $vars['filter'] : '';
$grep = isset($vars['grep']) ? $vars['grep'] : '';
// page lists
if ($page !== '') {
if (!is_page($page)) {
$body = '<p>' . htmlspecialchars($page) . ' does not exist.</p>';
return $body;
}
$pages = (array) $page;
} else {
$pages = get_existpages();
if ($filter !== '') {
$pages = preg_grep('/' . preg_quote($filter, '/') . '/', $pages);
}
}
// grep
$body = '';
foreach ($pages as $page) {
if (!check_readable($page)) {
$body = '<p>' . htmlspecialchars($page) . ' is not readable.</p>';
return $body;
}
$lines = get_source($page);
$lines = preg_grep('/' . preg_quote($grep, '/') . '/', $lines);
if (empty($lines)) {
continue;
}
$contents = '';
foreach ($lines as $i => $line) {
$contents .= sprintf('%04d:', $i) . htmlspecialchars($line);
}
$body .= make_pagelink($page) . '<br />' . "\n";
$body .= '<pre>' . htmlspecialchars($contents) . '</pre>';
}
return $body;
}