Пример #1
0
function plugin_multilang_inline_link($option, $args)
{
    global $vars;
    $body = array();
    $page = $vars['page'];
    $url = get_cmd_uri('multilang', $page, '', 'lang');
    $obj_l2c = new lang2country();
    foreach ($args as $arg) {
        $arg = htmlspecialchars($arg);
        @(list($lang, $style) = split('\\+', $arg));
        // en_US=English+flag=us
        @(list($lang, $title) = split('=', $lang));
        @(list($style, $country) = split('=', $style));
        if ($style != 'text') {
            // flag or text : default is flag
            if (empty($country)) {
                @(list($lng, $country) = split('_', $lang));
                // en_US -> en, US
                if (empty($country)) {
                    $country = $obj_l2c->get_lang2country(strtolower($lng));
                }
            }
            if (!empty($country)) {
                $country = strtolower($country);
                $title = '<img src="' . IMAGE_URI . 'icon/flags/' . $country . '.png" alt="' . $title . '" title="' . $title . '" />';
            }
        }
        array_push($body, '<a href="' . $url . $lang . '">' . $title . '</a>');
    }
    if ($option == 'delim') {
        // default: nodelim
        return PLUGIN_MULTILANG_INLINE_BEFORE . join(PLUGIN_MULTILANG_INLINE_DELIMITER, $body) . PLUGIN_MULTILANG_INLINE_AFTER;
    }
    return join(' ', $body);
}
Пример #2
0
function plugin_ls2_convert()
{
    global $vars;
    if (!isset($vars['page'])) {
        return '';
    }
    $params = array('link' => FALSE, 'title' => FALSE, 'include' => FALSE, 'reverse' => FALSE, 'compact' => PLUGIN_LS2_LIST_COMPACT, '_args' => array(), '_done' => FALSE);
    $args = func_get_args();
    $prefix = '';
    if (!empty($args)) {
        $prefix = array_shift($args);
    }
    if ($prefix == '') {
        $prefix = strip_bracket($vars['page']) . '/';
    }
    foreach ($args as $arg) {
        plugin_ls2_check_arg($arg, $params);
    }
    $title = !empty($params['_args']) ? join(',', $params['_args']) : str_replace('$1', htmlsc($prefix), T_("List of pages which begin with ' \$1'"));
    // Auto
    if (!$params['link']) {
        return '<div class="list_pages">' . plugin_ls2_show_lists($prefix, $params) . '</div>';
    }
    $tmp = array();
    if (isset($params['title'])) {
        $tmp[] = 'title=1';
    }
    if (isset($params['include'])) {
        $tmp[] = 'include=1';
    }
    return '<p><a href="' . get_cmd_uri('ls2', $prefix) . join('&amp;', $tmp) . '">' . $title . '</a></p>' . "\n";
}
Пример #3
0
function plugin_auth_mixi_inline()
{
    global $vars, $auth_api, $_auth_mixi_msg;
    if (!isset($auth_api['openid']['use'])) {
        return '';
    }
    if (!$auth_api['openid']['use']) {
        return $_auth_mixi_msg['msg_invalid'];
    }
    if (!PLUGIN_AUTH_MIXI_USE_AGREEMENT) {
        return $_auth_mixi_msg['msg_agreement'];
    }
    $argv = func_get_args();
    $parm = auth_mixi_set_parm($argv);
    exist_plugin('openid');
    list($idp, $icon_botton, $icon_mini) = auth_mixi_set_loginuri($parm['type'], $parm['icon'], $parm['id']);
    // 認証済みの扱い
    $icon = '<img src="' . IMAGE_URI . 'plus/openid/mixi/icon.gif"' . ' width="16" height="16" alt="mixi" title="mixi" />';
    $msg = plugin_openid_logoff_msg('auth_mixi', $icon);
    if ($msg === false) {
        return '';
    }
    // 他認証
    if (!empty($msg)) {
        return $msg;
    }
    // 未認証時の扱い
    $page = empty($vars['page']) ? '' : $vars['page'];
    if ($parm['type'] == 'friends' && empty($parm['id'])) {
        $redirect_url = get_cmd_uri('auth_mixi', $page);
    } else {
        $redirect_url = get_cmd_uri('openid', $page, '', array('action' => 'verify', 'openid_url' => $idp, 'author' => 'auth_mixi'));
    }
    return '<a href="' . $redirect_url . '">' . $icon_botton . '</a>';
}
Пример #4
0
/**
 * PukiWiki Plus! Anchor Plugin
 *
 * @copyright   Copyright &copy; 2008, Katsumi Saito <*****@*****.**>
 * @version     $Id: a.inc.php,v 0.2 2008/02/24 18:47:00 upk Exp $
 * @license     http://opensource.org/licenses/gpl-license.php GNU Public License (GPL2)
 *
 */
function plugin_a_inline()
{
    global $_symbol_innanchor, $_symbol_extanchor;
    list($href, $name, $opt) = func_get_args();
    $href = trim($href);
    if (empty($href)) {
        return;
    }
    $name = trim($name);
    if (empty($name)) {
        $name = $href;
    }
    $opt = trim($opt);
    if (!empty($opt)) {
        $opt = ' ' . $opt;
    }
    $is_url = is_url($href);
    if (!$is_url && !a_rel_check($href)) {
        return $href;
    }
    $is_ext = $is_url && !is_inside_uri($href);
    $symbol = $is_ext ? $_symbol_extanchor : $_symbol_innanchor;
    $r_href = PKWK_USE_REDIRECT && $is_ext ? get_cmd_uri('redirect', '', '', 'u=') . rawurlencode($href) : htmlspecialchars($href);
    if (!$is_url) {
        return '<a href="' . $r_href . '"' . $opt . '>' . $name . '</a>';
    } else {
        return '<a class="inn" href="' . $r_href . '" rel="nofollow"' . $opt . '>' . $name . str_replace('$1', $r_href, str_replace('$2', '_blank', $symbol)) . '</a>';
    }
}
Пример #5
0
function plugin_yetlist_action()
{
    //	global $_title_yetlist, $_err_notexist, $_symbol_noexists, $non_list;
    global $_symbol_noexists, $non_list, $whatsdeleted;
    $retval = array('msg' => 'yetlist', 'body' => T_('List of pages which have not yet been created.'));
    // Diff
    $pages = array_diff(Auth::get_existpages(CACHE_DIR, '.ref'), Auth::get_existpages());
    if (empty($pages)) {
        $retval['body'] = T_('All pages have been created.');
        return $retval;
    }
    $empty = TRUE;
    // Load .ref files and Output
    $refer_regex = '/' . $non_list . '|^' . preg_quote($whatsdeleted, '/') . '$/S';
    asort($pages, SORT_STRING);
    foreach ($pages as $file => $page) {
        $refer = array();
        foreach (file(CACHE_DIR . $file) as $line) {
            list($_page) = explode("\t", rtrim($line));
            $refer[] = $_page;
        }
        // Diff
        $refer = array_diff($refer, preg_grep($refer_regex, $refer));
        if (!empty($refer)) {
            $empty = FALSE;
            $refer = array_unique($refer);
            sort($refer, SORT_STRING);
            $r_refer = '';
            $link_refs = array();
            foreach ($refer as $_refer) {
                $r_refer = rawurlencode($_refer);
                $link_refs[] = '<a href="' . get_page_uri($_refer) . '">' . htmlsc($_refer) . '</a>';
            }
            $link_ref = join(' ', $link_refs);
            unset($link_refs);
            $s_page = htmlsc($page);
            //			if (PKWK_READONLY) {
            if (Auth::check_role('readonly')) {
                $href = $s_page;
            } else {
                // Dangling link
                $href = '<span class="noexists">' . $s_page . '<a href="' . get_cmd_uri('edit', $page, '', 'refer=' . $r_refer) . '">' . $_symbol_noexists . '</a></span>';
            }
            $retval['body'] .= '<li>' . $href . ' <em>(' . $link_ref . ')</em></li>' . "\n";
        }
    }
    if ($empty) {
        $retval['body'] = $_err_notexist;
        return $retval;
    }
    if ($retval['body'] != '') {
        $retval['body'] = '<ul>' . "\n" . $retval['body'] . '</ul>' . "\n";
    }
    return $retval;
}
Пример #6
0
function plugin_referer_action()
{
    global $vars, $referer, $use_pingback;
    global $_referer_msg;
    // Setting: Off
    if (!$referer) {
        return array('msg' => $_referer_msg['msg_referer'], 'body' => $_referer_msg['msg_disabled']);
    }
    $page = isset($vars['page']) ? $vars['page'] : null;
    $kind = isset($vars['kind']) ? $vars['kind'] : null;
    $max = isset($vars['max']) ? (int) $vars['max'] : -1;
    if (empty($page)) {
        return array('msg' => $_referer_msg['msg_referer'], 'body' => $_referer_msg['msg_notfound']);
    }
    if (empty($kind)) {
        return array('msg' => $_referer_msg['msg_H0_Refer'], 'body' => join("\n", array('<div class="tabs" role="application">' . "\n" . '<ul role="tablist">' . "\n" . '<li role="tab"><a href="' . get_cmd_uri('referer', $page, null, array('kind' => 'referer')) . '">' . $_referer_msg['msg_referer'] . '</a></li>', '<li role="tab"><a href="' . get_cmd_uri('referer', $page, null, array('kind' => 'searchkey')) . '">' . $_referer_msg['msg_searchkey'] . '</a></li>', '<li role="tab"><a href="' . get_cmd_uri('referer', $page, null, array('kind' => 'mutual')) . '">' . $_referer_msg['msg_mutual'] . '</a></li>', $use_pingback ? '<li role="tab"><a href="' . get_cmd_uri('referer', $page, null, array('kind' => 'pingback')) . '">' . $_referer_msg['msg_pingback'] . '</a></li>' : null, '</ul>', '</div>')));
    }
    $wiki = Factory::Wiki($page);
    if ($wiki->isValied() && $wiki->isReadable()) {
        if ($kind === 'pingback') {
            return array('msg' => sprintf($_referer_msg['msg_pingback_title'], $page), 'body' => plugin_referer_pingback($page));
        }
        $data = Factory::Referer($page)->get();
        if (!isset($data)) {
            return '<p class="alert alert-warning">' . $_referer_msg['msg_no_data'] . '</p>';
        }
        switch ($kind) {
            case 'skeylist':
                // searchkeylist.inc.phpのなごり
            // searchkeylist.inc.phpのなごり
            case 'searchkey':
                return array('msg' => sprintf($_referer_msg['msg_searchkey_title'], $page), 'body' => plugin_referer_searchkeylist($data, $max));
                break;
            case 'linklist':
                // linklist.inc.phpのなごり
            // linklist.inc.phpのなごり
            case 'mutual':
                return array('msg' => sprintf($_referer_msg['msg_mutual_title'], $page), 'body' => plugin_referer_mutual($data, $max));
                break;
            case 'referer':
                return array('msg' => $_referer_msg['msg_H0_Refer'], 'body' => plugin_referer_body($data));
                break;
            default:
                return array('msg' => $_referer_msg['msg_referer'], 'body' => plugin_referer_body($data));
                break;
        }
    }
    $pages = Auth::get_existpages(REFERER_DIR, '.ref');
    if (empty($pages)) {
        return array('msg' => $_referer_msg['msg_referer'], 'body' => $_referer_msg['msg_notfound']);
    } else {
        return array('msg' => $_referer_msg['msg_referer_list'], 'body' => page_list($pages, 'referer', FALSE));
    }
}
Пример #7
0
function plugin_random_convert()
{
    global $vars;
    $title = '[Random Link]';
    // default
    if (func_num_args()) {
        $args = func_get_args();
        $title = $args[0];
    }
    return '<p><a href="' . get_cmd_uri('random', null, null, array('refer' => $vars['page'])) . '">' . htmlsc($title) . '</a></p>';
}
Пример #8
0
function plugin_loglist_convert()
{
    global $script, $log;
    global $vars;
    global $_loglist_messages;
    list($kind) = func_get_args();
    $kind = empty($kind) ? 'update' : htmlsc($kind, ENT_QUOTES);
    if (!$log[$kind]['use']) {
        return $_loglist_messages['not_active'];
    }
    if (!empty($log[$kind]['file'])) {
        $vars['kind'] = $kind;
        $rc = do_plugin_action('logview');
        return $rc['body'];
    }
    $dir = log::get_filename($kind, '', '');
    $pages = Auth::get_existpages($dir);
    if (count($pages) == 0) {
        return $_loglist_messages['msg_not_found'];
    }
    $data = array();
    foreach ($pages as $_real => $_page) {
        $data[] = array(filemtime($dir . '/' . $_real), $_page, log_count($kind, $_page));
    }
    usort($data, function ($a, $b) {
        return $b[0] - $a[0];
    });
    // D
    // usort($data,create_function('$a,$b','return $a[0] - $b[0];')); // A
    //$str_view = $script.'?plugin=logview&kind='.$kind.'&page=';
    $str_view = get_cmd_uri('logview', $_page, null, array('kind' => $kind));
    $rc = '';
    $rc .= '|' . $_loglist_messages['fld_UTIME'] . '|' . $_loglist_messages['fld_PAGE'] . '|' . $_loglist_messages['fld_COUNT'] . "|h\n";
    foreach ($data as $_line) {
        $i = 0;
        foreach ($_line as $_field) {
            $rc .= '|';
            switch ($i) {
                case 0:
                    $rc .= get_date('Y-m-d H:i:s', $_field) . ' ' . get_passage($_field);
                    continue;
                case 1:
                    $rc .= '[' . $str_view . rawurlencode($_field) . ' ' . $_field . ']';
                    continue;
                default:
                    $rc .= $_field;
            }
            $i++;
        }
        $rc .= "|\n";
    }
    return RendererFactory::factory($rc);
}
Пример #9
0
function limit_plugin($name)
{
    global $vars;
    static $count = array();
    $name = strtolower($name);
    if (!isset($count[$name])) {
        $count[$name] = 1;
    }
    if (++$count[$name] > PKWK_PLUGIN_CALL_TIME_LIMIT) {
        die('Alert: plugin "' . htmlspecialchars($name) . '" was called over ' . PKWK_PLUGIN_CALL_TIME_LIMIT . ' times. SPAM or someting?<br />' . "\n" . '<a href="' . get_cmd_uri('edit', $vars['page']) . '">Try to edit this page</a><br />' . "\n" . '<a href="' . get_cmd_uri() . '">Return to frontpage</a>');
    }
    return TRUE;
}
Пример #10
0
function plugin_livedoor_convert()
{
    global $vars, $auth_api, $_livedoor_msg;
    if (!$auth_api['livedoor']['use']) {
        return '<p>' . $_livedoor_msg['msg_invalid'] . '</p>';
    }
    $obj = new AuthLivedoor();
    $name = $obj->getSession();
    if (isset($name['livedoor_id'])) {
        /*
        $logout_url = $script.'?plugin=livedoor';
        if (! empty($vars['page'])) {
        	$logout_url .= '&amp;page='.rawurlencode($vars['page']).'&amp;logout';
        }
        */
        $logout_url = Router::get_cmd_uri('livedoor', $vars['page']) . '&amp;logout';
        return <<<EOD
<div>
\t<label>livedoor</label>:
\t{$name['livedoor_id']}
\t(<a href="{$logout_url}">{$_livedoor_msg['msg_logout']}</a>)
</div>

EOD;
    }
    // 他でログイン
    $auth_key = Auth::get_user_name();
    if (!empty($auth_key['nick'])) {
        return '';
    }
    // ボタンを表示するだけ
    /*
    $login_url = $script.'?plugin=livedoor';
    if (! empty($vars['page'])) {
    	$login_url .= '&amp;page='.rawurlencode($vars['page']);
    }
    $login_url .= '&amp;login';
    */
    $login_url = get_cmd_uri('livedoor', $vars['page']) . '&amp;login';
    return <<<EOD
<form action="{$login_url}" method="post">
\t<div>
\t\t<input type="submit" class="btn btn-success" value="{$_livedoor_msg['btn_login']}" />
\t</div>
</form>

EOD;
}
Пример #11
0
function plugin_diff_view($page)
{
    global $hr, $_string;
    //	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 = T_('The page was not found.');
    $_msg_addline = T_('The added line is <span class="diff_added">THIS COLOR</span>.');
    $_msg_delline = T_('The deleted line is <span class="diff_removed">THIS COLOR</span>.');
    $_msg_goto = T_('Go to $1.');
    $_msg_deleted = T_(' $1 has been deleted.');
    $_title_diff = T_('Diff of $1');
    $_title_diff_delete = T_('Deleting diff of $1');
    $r_page = rawurlencode($page);
    $s_page = htmlsc($page);
    $menu = array('<li class="no-js">' . $_msg_addline . '</li>', '<li class="no-js">' . $_msg_delline . '</li>');
    $is_page = Factory::Wiki($page)->isValied();
    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>';
    }
    $diff = FileFactory::Diff($page);
    if ($diff->has() && ($is_page || Auth::is_role_page($diff))) {
        // if (! PKWK_READONLY) {
        if (!Auth::check_role('readonly')) {
            $menu[] = '<li><a href="' . get_cmd_uri('diff', $page, null, array('action' => 'delete')) . '">' . str_replace('$1', $s_page, $_title_diff_delete) . '</a></li>';
        }
        Auth::is_role_page($diff);
        $msg = $diff->render();
    } 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);
}
function plugin_calendar_viewer_convert()
{
    global $vars, $get, $post, $weeklabels;
    //	global $_msg_calendar_viewer_right, $_msg_calendar_viewer_left;
    //	global $_msg_calendar_viewer_restrict, $_err_calendar_viewer_param2;
    $_err_calendar_viewer_param2 = _('Wrong second parameter.');
    $_msg_calendar_viewer_right = _('Next %d&gt;&gt;');
    $_msg_calendar_viewer_left = _('&lt;&lt; Prev %d');
    $_msg_calendar_viewer_restrict = _('Due to the blocking, the calendar_viewer cannot refer to $1.');
    static $viewed = array();
    if (func_num_args() < 2) {
        return PLUGIN_CALENDAR_VIEWER_USAGE . '<br />' . "\n";
    }
    $func_args = func_get_args();
    // Default values
    $pagename = $func_args[0];
    // 基準となるページ名
    $page_YM = '';
    // 一覧表示する年月
    $limit_base = 0;
    // 先頭から数えて何ページ目から表示するか (先頭)
    $limit_pitch = 0;
    // 何件づつ表示するか
    $limit_page = 0;
    // サーチするページ数
    $mode = 'past';
    // 動作モード
    $date_sep = '-';
    // 日付のセパレータ calendar2なら '-', calendarなら ''
    // Check $func_args[1]
    $matches = array();
    if (preg_match('/[0-9]{4}' . $date_sep . '[0-9]{2}/', $func_args[1])) {
        // 指定年月の一覧表示
        $page_YM = $func_args[1];
        $limit_page = 31;
    } else {
        if (preg_match('/this/si', $func_args[1])) {
            // 今月の一覧表示
            $page_YM = get_date('Y' . $date_sep . 'm');
            $limit_page = 31;
        } else {
            if (preg_match('/^[0-9]+$/', $func_args[1])) {
                // n日分表示
                $limit_pitch = $func_args[1];
                $limit_page = $func_args[1];
            } else {
                if (preg_match('/(-?[0-9]+)\\*([0-9]+)/', $func_args[1], $matches)) {
                    // 先頭より数えて x ページ目から、y件づつ表示
                    $limit_base = $matches[1];
                    $limit_pitch = $matches[2];
                    $limit_page = $matches[1] + $matches[2];
                    // 読み飛ばす + 表示する
                } else {
                    return '#calendar_viewer(): ' . $_err_calendar_viewer_param2 . '<br />' . "\n";
                }
            }
        }
    }
    // $func_args[2]: Mode setting
    if (isset($func_args[2]) && preg_match('/^(past|view|future)$/si', $func_args[2])) {
        $mode = $func_args[2];
    }
    // $func_args[3]: Change default delimiter
    if (isset($func_args[3])) {
        $date_sep = $func_args[3];
    }
    // Avoid Loop etc.
    if (isset($viewed[$pagename])) {
        $s_page = htmlspecialchars($pagename);
        return "#calendar_viewer(): You already view: {$s_page}<br />";
    } else {
        $viewed[$pagename] = TRUE;
        // Valid
    }
    // 一覧表示するページ名とファイル名のパターン ファイル名には年月を含む
    if ($pagename == '') {
        // pagename無しのyyyy-mm-ddに対応するための処理
        $pagepattern = '';
        $pagepattern_len = 0;
        $filepattern = encode($page_YM);
        $filepattern_len = strlen($filepattern);
    } else {
        $pagepattern = strip_bracket($pagename) . '/';
        $pagepattern_len = strlen($pagepattern);
        $filepattern = encode($pagepattern . $page_YM);
        $filepattern_len = strlen($filepattern);
    }
    // ページリストの取得
    $pagelist = array();
    if ($dir = @opendir(DATA_DIR)) {
        $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
        $page_date = '';
        while ($file = readdir($dir)) {
            if ($file == '..' || $file == '.') {
                continue;
            }
            if (substr($file, 0, $filepattern_len) != $filepattern) {
                continue;
            }
            $page = decode(trim(preg_replace('/\\.txt$/', ' ', $file)));
            $page_date = substr($page, $pagepattern_len);
            // Verify the $page_date pattern (Default: yyyy-mm-dd).
            // Past-mode hates the future, and
            // Future-mode hates the past.
            if (plugin_calendar_viewer_isValidDate($page_date, $date_sep) == FALSE || $page_date > $_date && $mode == 'past' || $page_date < $_date && $mode == 'future') {
                continue;
            }
            $pagelist[] = $page;
        }
    }
    closedir($dir);
    if ($mode == 'past') {
        rsort($pagelist, SORT_STRING);
        // New => Old
    } else {
        sort($pagelist, SORT_STRING);
        // Old => New
    }
    // Include start
    $tmppage = $vars['page'];
    $return_body = '';
    // $limit_page の件数までインクルード
    $tmp = max($limit_base, 0);
    // Skip minus
    while ($tmp < $limit_page) {
        if (!isset($pagelist[$tmp])) {
            break;
        }
        $page = $pagelist[$tmp];
        $get['page'] = $post['page'] = $vars['page'] = $page;
        // 現状で閲覧許可がある場合だけ表示する
        if (check_readable($page, FALSE, FALSE)) {
            $body = convert_html(get_source($page));
        } else {
            $body = str_replace('$1', $page, $_msg_calendar_viewer_restrict);
        }
        if (PLUGIN_CALENDAR_VIEWER_DATE_FORMAT !== FALSE) {
            $time = strtotime(basepagename($page));
            // $date_sep must be assumed '-' or ''!
            if ($time == -1 || $time == FALSE) {
                $s_page = htmlspecialchars($page);
                // Failed. Why?
            } else {
                $week = $weeklabels[date('w', $time)];
                $s_page = htmlspecialchars(str_replace(array('$w'), array($week), date(PLUGIN_CALENDAR_VIEWER_DATE_FORMAT, $time)));
            }
        } else {
            $s_page = htmlspecialchars($page);
        }
        // if (PKWK_READONLY) {
        if (auth::check_role('readonly')) {
            $link = get_page_uri($page);
        } else {
            $link = get_cmd_uri('edit', $page);
        }
        $link = '<a href="' . $link . '">' . $s_page . '</a>';
        $head = '<h1>' . $link . '</h1>' . "\n";
        $return_body .= $head . $body;
        ++$tmp;
    }
    // ここで、前後のリンクを表示
    // ?plugin=calendar_viewer&file=ページ名&date=yyyy-mm
    $enc_pagename = rawurlencode(substr($pagepattern, 0, $pagepattern_len - 1));
    if ($page_YM != '') {
        // 年月表示時
        $date_sep_len = strlen($date_sep);
        $this_year = substr($page_YM, 0, 4);
        $this_month = substr($page_YM, 4 + $date_sep_len, 2);
        // 次月
        $next_year = $this_year;
        $next_month = $this_month + 1;
        if ($next_month > 12) {
            ++$next_year;
            $next_month = 1;
        }
        $next_YM = sprintf('%04d%s%02d', $next_year, $date_sep, $next_month);
        // 前月
        $prev_year = $this_year;
        $prev_month = $this_month - 1;
        if ($prev_month < 1) {
            --$prev_year;
            $prev_month = 12;
        }
        $prev_YM = sprintf('%04d%s%02d', $prev_year, $date_sep, $prev_month);
        if ($mode == 'past') {
            $right_YM = $prev_YM;
            $right_text = $prev_YM . '&gt;&gt;';
            // >>
            $left_YM = $next_YM;
            $left_text = '&lt;&lt;' . $next_YM;
            // <<
        } else {
            $left_YM = $prev_YM;
            $left_text = '&lt;&lt;' . $prev_YM;
            // <<
            $right_YM = $next_YM;
            $right_text = $next_YM . '&gt;&gt;';
            // >>
        }
    } else {
        // n件表示時
        if ($limit_base <= 0) {
            $left_YM = '';
            // 表示しない (それより前の項目はない)
        } else {
            $left_YM = $limit_base - $limit_pitch . '*' . $limit_pitch;
            $left_text = sprintf($_msg_calendar_viewer_left, $limit_pitch);
        }
        if ($limit_base + $limit_pitch >= count($pagelist)) {
            $right_YM = '';
            // 表示しない (それより後の項目はない)
        } else {
            $right_YM = $limit_base + $limit_pitch . '*' . $limit_pitch;
            $right_text = sprintf($_msg_calendar_viewer_right, $limit_pitch);
        }
    }
    // ナビゲート用のリンクを末尾に追加
    if ($left_YM != '' || $right_YM != '') {
        $s_date_sep = htmlspecialchars($date_sep);
        $left_link = $right_link = '';
        $link = get_cmd_uri('calendar_viewer', '', '', 'mode=' . $mode . '&file=' . $enc_pagename . '&date_sep=' . $s_date_sep);
        if ($left_YM != '') {
            $left_link = '<a href="' . $link . '&amp;date=' . $left_YM . '">' . $left_text . '</a>';
        }
        if ($right_YM != '') {
            $right_link = '<a href="' . $link . '&amp;date=' . $right_YM . '">' . $right_text . '</a>';
        }
        // past modeは<<新 旧>> 他は<<旧 新>>
        $return_body .= '<div class="calendar_viewer">' . '<span class="calendar_viewer_left">' . $left_link . '</span>' . '<span class="calendar_viewer_right">' . $right_link . '</span>' . '</div>';
    }
    $get['page'] = $post['page'] = $vars['page'] = $tmppage;
    return $return_body;
}
Пример #13
0
function attach_doupload($file, $page, $pass = NULL, $temp)
{
    global $_attach_messages, $_string;
    global $notify, $notify_subject, $notify_exclude, $spam;
    $filename = Utility::encode($page) . '_' . Utility::encode($file);
    $type = Utility::getMimeInfo($temp);
    $must_compress = PLUGIN_ATTACH_UNKNOWN_COMPRESS !== 0 ? attach_is_compress($type, PLUGIN_ATTACH_UNKNOWN_COMPRESS) : false;
    // 不明なファイルを圧縮するか?
    // ファイル名の長さをチェック
    $filename_length = strlen($filename);
    if ($filename_length >= 255 || $must_compress && $filename_length >= 251) {
        return array('result' => FALSE, 'msg' => $_attach_messages['err_filename']);
    }
    // スパムチェック
    if ($spam !== 0) {
        // ファイルの内容でスパムチェック
        // if attach spam, filtering attach file.
        $vars['uploadname'] = $file['name'];
        $vars['uploadtext'] = attach_gettext($file['tmp_name']);
        if ($vars['uploadtext'] === '' || $vars['uploadtext'] === FALSE) {
            return FALSE;
        }
        if (isset($spam['method']['attach'])) {
            $_method =& $spam['method']['attach'];
        } else {
            if (isset($spam['method']['_default'])) {
                $_method =& $spam['method']['_default'];
            } else {
                $_method = array();
            }
        }
        $exitmode = isset($spam['exitmode']) ? $spam['exitmode'] : '';
        Spam::pkwk_spamfilter('File Attach', $page, $vars, $_method, $exitmode);
    }
    if ($must_compress) {
        // 添付ファイルを圧縮する
        switch (PLUGIN_ATTACH_COMPRESS_TYPE) {
            case 'GZ':
                if (!extension_loaded('zlib')) {
                    Utility::dieMessage('#attach: zlib extention has not loaded.');
                }
                $obj = new AttachFile($page, $file . '.gz');
                if ($obj->exist) {
                    return array('result' => FALSE, 'msg' => $_attach_messages['err_exists']);
                }
                $tp = fopen($file['tmp_name'], 'rb') or die_message($_attach_messages['err_load_file']);
                $zp = gzopen($obj->filename, 'wb') or die_message($_attach_messages['err_write_tgz']);
                while (!feof($tp)) {
                    gzwrite($zp, fread($tp, 8192));
                }
                gzclose($zp);
                fclose($tp);
                chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
                break;
            case 'ZIP':
                if (!class_exists('ZipArchive')) {
                    Utility::dieMessage('#attach: ZipArchive class has not defined.');
                }
                $obj = new AttachFile($page, $file . '.zip');
                if ($obj->exist) {
                    return array('result' => FALSE, 'msg' => $_attach_messages['err_exists']);
                }
                $zip = new ZipArchive();
                $zip->addFile($temp, $file);
                // if ($zip->status !== ZIPARCHIVE::ER_OK)
                if ($zip->status !== 0) {
                    die_message($_attach_messages['err_upload'] . '(' . $zip->status . ').');
                }
                $zip->close();
                chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
                break;
            case 'BZ2':
                if (!extension_loaded('bz2')) {
                    Utility::dieMessage('#attach: bz2 extention has not loaded.');
                }
                $obj = new AttachFile($page, $file . '.bz2');
                if ($obj->exist) {
                    return array('result' => FALSE, 'msg' => $_attach_messages['err_exists']);
                }
                $tp = fopen($file['tmp_name'], 'rb') or die_message($_attach_messages['err_load_file']);
                $zp = bzopen($obj->filename, 'wb') or die_message($_attach_messages['err_write_tgz']);
                while (!feof($tp)) {
                    bzwrite($zp, fread($tp, 8192));
                }
                bzclose($zp);
                fclose($tp);
                chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
                break;
            default:
                //miko
                $obj = new AttachFile($page, $file);
                if ($obj->exist) {
                    return array('result' => FALSE, 'msg' => $_attach_messages['err_exists']);
                }
                if (move_uploaded_file($temp, $obj->filename)) {
                    chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
                }
                break;
        }
    } else {
        // 通常添付
        $obj = new AttachFile($page, $file);
        if (isset($obj->exist)) {
            return array('result' => FALSE, 'msg' => $_attach_messages['err_exists']);
        }
        if (move_uploaded_file($temp, $obj->filename)) {
            chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
        }
    }
    if (file_exists($temp)) {
        unlink($temp);
    }
    // ページのタイムスタンプを更新
    Factory::Wiki($page)->touch();
    $obj->status['pass'] = $pass !== TRUE && $pass !== NULL ? md5($pass) : '';
    if ($notify) {
        $notify_exec = TRUE;
        foreach ($notify_exclude as $exclude) {
            $exclude = preg_quote($exclude);
            if (substr($exclude, -1) == '.') {
                $exclude .= '*';
            }
            if (preg_match('/^' . $exclude . '/', get_remoteip())) {
                $notify_exec = FALSE;
                break;
            }
        }
        $footer['ACTION'] = 'File attached';
        $footer['FILENAME'] = $file['name'];
        $footer['FILESIZE'] = $file['size'];
        $footer['PAGE'] = $page;
        $footer['URI'] = get_cmd_uri('attach', '', array('refer' => $page, 'pcmd' => 'info', 'file' => $file['name']));
        $footer['USER_AGENT'] = TRUE;
        $footer['REMOTE_ADDR'] = TRUE;
        pkwk_mail_notify($notify_subject, "\n", $footer);
    }
    return array('result' => TRUE, 'msg' => $_attach_messages['msg_uploaded']);
}
function plugin_minicalendar_viewer_convert()
{
    global $vars, $get, $post, $script, $weeklabels;
    global $_err_calendar_viewer_param, $_err_calendar_viewer_param2;
    global $_msg_calendar_viewer_right, $_msg_calendar_viewer_left;
    global $_msg_calendar_viewer_restrict;
    global $_symbol_paraedit, $trackback;
    static $viewed = array();
    if (func_num_args() < 2) {
        return PLUGIN_MINICALENDAR_VIEWER_USAGE . '<br />' . "\n";
    }
    $func_vars_array = func_get_args();
    // デフォルト値をセット
    $pagename = $func_vars_array[0];
    // 基準となるページ名
    $limit_page = 7;
    // 表示する件数制限
    $date_YM = '';
    // 一覧表示する年月
    $mode = 'past';
    // 動作モード
    $date_sep = '-';
    // 日付のセパレータ calendar2なら"-" calendarなら""
    // Check $func_args[1]
    if (preg_match("/[0-9]{4}" . $date_sep . "[0-9]{2}/", $func_vars_array[1])) {
        //指定年月の一覧表示
        $page_YM = $func_vars_array[1];
        $limit_base = 0;
        $limit_page = 31;
        //手抜き。31日分をリミットとする。
    } else {
        if (preg_match("/this/si", $func_vars_array[1])) {
            //今月の一覧表示
            $page_YM = get_date('Y' . $date_sep . 'm');
            $limit_base = 0;
            $limit_page = 31;
        } else {
            if (preg_match("/^[0-9]+\$/", $func_vars_array[1])) {
                //n日分表示
                $limit_pitch = $func_vars_array[1];
                $limit_page = $limit_pitch;
                $limit_base = 0;
                $page_YM = '';
            } else {
                if (preg_match("/([0-9]+)\\*([0-9]+)/", $func_vars_array[1], $reg_array)) {
                    $limit_pitch = $reg_array[2];
                    $limit_page = $reg_array[1] + $limit_pitch;
                    $limit_base = $reg_array[1];
                    $page_YM = '';
                } else {
                    return '#calendar_viewer(): ' . $_err_calendar_viewer_param2 . '<br />' . "\n";
                }
            }
        }
    }
    // $func_args[2]: Change default delimiter
    if (isset($func_vars_array[2]) && preg_match("/^(past|pastex|view|viewex|future|futureex)\$/si", $func_vars_array[2])) {
        $mode = $func_vars_array[2];
    }
    // $func_args[3]: Change default delimiter
    if (isset($func_vars_array[3])) {
        $date_sep = $func_vars_array[3];
    }
    // Avoid Loop etc.
    if (isset($viewed[$pagename])) {
        if ($viewed[$pagename] > PLUGIN_MINICALENDAR_MAX_VIEWS) {
            $s_page = htmlspecialchars($pagename);
            return '#calendar_viewer(): You already view: ' . $s_page . '<br />';
        }
        $viewed[$pagename]++;
        // Valid
    } else {
        $viewed[$pagename] = 1;
        // Valid
    }
    // 一覧表示するページ名とファイル名のパターン ファイル名には年月を含む
    if ($pagename == '') {
        // pagename無しのyyyy-mm-ddに対応するための処理
        $pagepattern = '';
        $pagepattern_len = 0;
        $filepattern = encode($page_YM);
        $filepattern_len = strlen($filepattern);
    } else {
        $pagepattern = strip_bracket($pagename) . '/';
        $pagepattern_len = strlen($pagepattern);
        $filepattern = encode($pagepattern . $page_YM);
        $filepattern_len = strlen($filepattern);
    }
    // ページリストの取得
    $pagelist = array();
    if ($dir = @opendir(DATA_DIR)) {
        $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
        $page_date = '';
        while ($file = readdir($dir)) {
            if ($file == '..' || $file == '.') {
                continue;
            }
            if (substr($file, 0, $filepattern_len) != $filepattern) {
                continue;
            }
            $page = decode(trim(preg_replace("/\\.txt\$/", " ", $file)));
            $page_date = substr($page, $pagepattern_len);
            // $pageがカレンダー形式なのかチェック デフォルトでは yyyy-mm-dd
            if (plugin_minicalendar_viewer_isValidDate($page_date, $date_sep) == FALSE) {
                continue;
            }
            // mode毎に別条件ではじく
            // pastex modeでは今日を含む未来のページはNG
            // futureex modeでは今日を含む過去のページはNG
            // past modeでは未来のページはNG
            // future modeでは過去のページはNG
            if ($page_date >= $_date && $mode == 'pastex') {
                continue;
            }
            if ($page_date <= $_date && $mode == 'futureex') {
                continue;
            }
            if ($page_date > $_date && $mode == 'past') {
                continue;
            }
            if ($page_date < $_date && $mode == 'future') {
                continue;
            }
            $pagelist[] = $page;
        }
    }
    closedir($dir);
    // まずソート
    if ($mode == 'past' || $mode == 'pastex' || $mode == 'viewex') {
        rsort($pagelist);
    } else {
        sort($pagelist);
    }
    // ここからインクルード
    $tmppage = $vars['page'];
    $return_body = '';
    // $limit_pageの件数までインクルード
    $tmp = max($limit_base, 0);
    // Skip minus
    while ($tmp < $limit_page) {
        if (!isset($pagelist[$tmp])) {
            break;
        }
        $page = $pagelist[$tmp];
        $get['page'] = $post['page'] = $vars['page'] = $page;
        // 現状で閲覧許可がある場合だけ表示する
        if (check_readable($page, FALSE, FALSE)) {
            if (function_exists('convert_filter')) {
                $body = convert_html(convert_filter(get_source($page)));
            } else {
                $body = convert_html(get_source($page));
            }
        } else {
            $body = str_replace('$1', $page, $_msg_calendar_viewer_restrict);
        }
        $r_page = rawurlencode($page);
        $s_page = htmlspecialchars($page);
        if (PLUGIN_MINICALENDAR_VIEWER_DATE_FORMAT !== FALSE) {
            $time = strtotime(basepagename($page));
            // $date_sep must be assumed '-' or ''!
            if ($time == -1 || $time == FALSE) {
                $s_page = htmlspecialchars($page);
                // Failed. Why?
            } else {
                $week = $weeklabels[date('w', $time)];
                $s_page = htmlspecialchars(str_replace(array('$w'), array($week), date(PLUGIN_CALENDAR_VIEWER_DATE_FORMAT, $time)));
            }
        }
        $refpage = rawurlencode($tmppage);
        $page_title = basepagename($page);
        $s_page_title = htmlspecialchars($page_title);
        // if (PKWK_READONLY) {
        if (auth::check_role('readonly')) {
            $link = get_page_uri($page);
        } else {
            $link = get_cmd_uri('edit', $page, '', 'refpage=' . $refpage);
        }
        $link = '<a class="anchor_super" href="' . $link . '">' . $_symbol_paraedit . '</a>';
        $head = '<h3 class="minicalendar">' . $s_page_title . ' ' . $link . '</h3>' . "\n";
        $tail = '';
        if (PLUGIN_MINICALENDAR_VIEWER_HOLIDAYVIEW === TRUE) {
            $time = strtotime($page_title);
            if ($time != -1) {
                $yy = intval(date('Y', $time));
                $mm = intval(date('n', $time));
                $dd = intval(date('d', $time));
                $monthlabel = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
                $mmstr = $monthlabel[$mm];
                $h_today = public_holiday($yy, $mm, $dd);
                if ($h_today['rc'] != 0) {
                    $classname = 'date_holiday';
                } else {
                    if ($h_today['w'] == 0) {
                        $classname = 'date_holiday';
                    } else {
                        if ($h_today['w'] == 6) {
                            $classname = 'date_weekend';
                        } else {
                            $classname = 'date_weekday';
                        }
                    }
                }
                $head = '<h3 class="' . $classname . '"><span class="day">' . sprintf('%02d', $dd) . '</span> <br />' . '<b>' . $mmstr . '</b>, <b>' . $yy . '</b>' . $link . '</h3>' . "\n";
            }
        }
        if (PLUGIN_MINICALENDAR_VIEWER_COMMENT === TRUE) {
            if (is_page(':config/plugin/addline/comment') && exist_plugin_inline('addline')) {
                $comm = convert_html(array('&addline(comment,above){comment};'));
                $comm = preg_replace(array("'<p>'si", "'</p>'si"), array("", ""), $comm);
                $tail .= str_replace('>comment', '><img src="' . IMAGE_URI . 'plus/comment.png" width="15" height="15" alt="Comment" title="Comment" />Comment', $comm);
            }
        }
        if (PLUGIN_MINICALENDAR_VIEWER_TRACKBACK === TRUE) {
            if ($trackback) {
                $tb_id = tb_get_id($page);
                $tail .= '<a href="' . $script . '?plugin=tb&amp;__mode=view&amp;tb_id=' . $tb_id . '">' . '<img src="' . IMAGE_URI . 'plus/trackback.png" width="15" height="15" alt="" title="" />Trackback(' . tb_count($page) . ')' . '</a>' . "\n";
            }
        }
        if ($tail != '') {
            $tail = '<div class="trackback">' . $tail . '</div>';
        }
        $return_body .= $head . '<div class="minicalendar_viewer">' . $body . '</div>' . $tail;
        ++$tmp;
    }
    //ここで、前後のリンクを表示
    //?plugin=minicalendar_viewer&file=ページ名&date=yyyy-mm
    $enc_pagename = rawurlencode(substr($pagepattern, 0, $pagepattern_len - 1));
    if ($page_YM != '') {
        // 年月表示時
        $date_sep_len = strlen($date_sep);
        $this_year = substr($page_YM, 0, 4);
        $this_month = substr($page_YM, 4 + $date_sep_len, 2);
        // 次月
        $next_year = $this_year;
        $next_month = $this_month + 1;
        if ($next_month > 12) {
            $next_year++;
            $next_month = 1;
        }
        $next_YM = sprintf('%04d%s%02d', $next_year, $date_sep, $next_month);
        $next_YMX = sprintf('%04d%02d', $next_year, $next_month);
        // 前月
        $prev_year = $this_year;
        $prev_month = $this_month - 1;
        if ($prev_month < 1) {
            $prev_year--;
            $prev_month = 12;
        }
        $prev_YM = sprintf('%04d%s%02d', $prev_year, $date_sep, $prev_month);
        $prev_YMX = sprintf('%04d%02d', $prev_year, $prev_month);
        //		if ($mode == "past" || $mode == "pastex") {
        //			$right_YM   = $prev_YM;
        //			$right_YMX  = $prev_YMX;
        //			$right_text = $prev_YM."&gt;&gt;";
        //			$left_YM    = $next_YM;
        //			$left_YMX   = $next_YMX;
        //			$left_text  = "&lt;&lt;".$next_YM;
        //		} else {
        $left_YM = $prev_YM;
        $left_YMX = $prev_YMX;
        $left_text = '&lt;&lt;' . $prev_YM;
        $right_YM = $next_YM;
        $right_YMX = $next_YMX;
        $right_text = $next_YM . '&gt;&gt;';
        //		}
    } else {
        // n件表示時
        if ($limit_base >= count($pagelist)) {
            $right_YM = '';
        } else {
            $right_base = $limit_base + $limit_pitch;
            $right_YM = $right_base . '*' . $limit_pitch;
            $right_text = sprintf($_msg_calendar_viewer_right, $limit_pitch);
        }
        $left_base = $limit_base - $limit_pitch;
        if ($left_base >= 0) {
            $left_YM = $left_base . '*' . $limit_pitch;
            $left_text = sprintf($_msg_calendar_viewer_left, $limit_pitch);
        } else {
            $left_YM = '';
        }
        $prev_YMX = '';
        $next_YMX = '';
    }
    // ナビゲート用のリンクを末尾に追加
    $s_date_sep = htmlspecialchars($date_sep);
    if ($left_YM != '') {
        if ($left_YMX != '') {
            $left_link = '<a href="' . $script . '?plugin=minicalendar&amp;file=' . $enc_pagename . '&amp;date=' . $left_YMX . '">' . $left_text . '</a>';
        } else {
            $left_link = '<a href="' . $script . '?plugin=minicalendar_viewer&amp;file=' . $enc_pagename . '&amp;date=' . $left_YM . '&amp;date_sep=' . $s_date_sep . '&amp;mode=' . $mode . '">' . $left_text . '</a>';
        }
    } else {
        $left_link = '';
    }
    if ($right_YM != '') {
        if ($right_YMX != '') {
            $right_link = '<a href="' . $script . '?plugin=minicalendar&amp;file=' . $enc_pagename . '&amp;date=' . $right_YMX . '">' . $right_text . '</a>';
        } else {
            $right_link = '<a href="' . $script . '?plugin=minicalendar_viewer&amp;file=' . $enc_pagename . '&amp;date=' . $right_YM . '&amp;date_sep=' . $s_date_sep . '&amp;mode=' . $mode . '">' . $right_text . '</a>';
        }
    } else {
        $right_link = '';
    }
    //past modeは<<新 旧>> 他は<<旧 新>>
    $return_body .= '<div class="prevnext">';
    $return_body .= '<div class="prevnext_r">' . $right_link . '</div>';
    $return_body .= '<div class="prevnext_l">' . $left_link . '</div>';
    $return_body .= '</div><br style="display:block;clear:both" />';
    $get['page'] = $post['page'] = $vars['page'] = $tmppage;
    return $return_body;
}
Пример #15
0
 protected function link_s($action, $icon, $csv_mode)
 {
     return '<a href="' . get_cmd_uri('table_edit2', null, null, array('refer' => $this->page, 'table_num' => $this->count, 'set_csv' => $csv_mode)) . '" class="button" nofollow="nofollow" data-text="false" data-ajax="false" data-icons-primary="' . $icon . '">' . $action . '</a>';
 }
Пример #16
0
function plugin_tb_mode_view_set($page)
{
    global $vars;
    $tb_id = tb_get_id($page);
    $body = '<div><fieldset><legend>' . _('TrackBack URL') . '</legend>' . '<p>' . get_script_absuri() . '?tb_id=' . $tb_id . '</p>' . '</fieldset></div>' . "\n";
    $_tb_header_Weblog = _('Blog:');
    $_tb_header_Tracked = _('Date:');
    $_tb_date = _('F j, Y, g:i A');
    $data = tb_get(tb_get_filename($page));
    // Sort: The first is the latest
    usort($data, create_function('$a,$b', 'return $b[0] - $a[0];'));
    foreach ($data as $x) {
        if (count($x) != 5) {
            continue;
        }
        // Ignore incorrect record
        list($time, $url, $title, $excerpt, $blog_name) = $x;
        if ($title == '') {
            $title = 'no title';
        }
        $time = get_date($_tb_date, $time);
        $body .= '<div><fieldset>' . '<legend><a class="ext" href="' . $url . '" rel="nofollow">' . $title . '<img src="' . IMAGE_URI . 'plus/ext.png" alt="" title="" class="ext" onclick="return open_uri(\'' . $url . '\', \'_blank\');" /></a></legend>' . "\n" . '<p>' . $excerpt . "</p>\n" . '<div style="text-align:right">' . '<strong>' . $_tb_header_Tracked . '</strong>' . $time . '&nbsp;&nbsp;' . '<strong>' . $_tb_header_Weblog . '</strong>' . $blog_name . '</div>' . "\n" . '</fieldset></div>' . "\n";
    }
    $body .= '<div style="text-align:right">' . '<a href="' . get_cmd_uri('tb', '', '', '__mode=view') . '">' . '<img src="' . IMAGE_URI . 'plus/trackback.png" alt="" title="" />' . 'Trackback List' . '</a>' . "</div>\n";
    return $body;
}
Пример #17
0
function make_search($page)
{
    return '<a href="' . get_cmd_uri('related', $page) . '">' . htmlspecialchars($page) . '</a> ';
}
Пример #18
0
function plugin_addline_inline()
{
    global $vars, $digest;
    global $_addline_messages;
    static $numbers = array();
    static $no_flag = 0;
    if (Auth::check_role('readonly')) {
        return '';
    }
    if (!array_key_exists($vars['page'], $numbers)) {
        $numbers[$vars['page']] = 0;
    }
    $addline_no = $numbers[$vars['page']]++;
    $above = ADDLINE_INS;
    $configname = 'default';
    $btn_text = $_addline_messages['btn_submit'];
    if (func_num_args()) {
        $args = func_get_args();
        $opt = array_pop($args);
        $btn_text = $opt ? htmlsc($opt) : $btn_text;
        foreach ($args as $opt) {
            if ($opt === 'before') {
                $above = 3;
            } else {
                if ($opt === 'after') {
                    $above = 2;
                } else {
                    if ($opt === 'above' || $opt === 'up') {
                        $above = 1;
                    } else {
                        if ($opt === 'below' || $opt === 'down') {
                            $above = 0;
                        } else {
                            if ($opt === 'number') {
                                $no_flag = 1;
                            } else {
                                if ($opt === 'nonumber') {
                                    $no_flag = 0;
                                } else {
                                    $configname = $opt;
                                }
                            }
                        }
                    }
                }
            }
        }
        if ($no_flag == 1) {
            $btn_text .= "[{$addline_no}]";
        }
    }
    $f_page = rawurlencode($vars['page']);
    $f_config = rawurlencode($configname);
    $link_uri = get_cmd_uri('addline', '', '', array('addline_inno' => $addline_no, 'above' => $above, 'refer' => $f_page, 'configname' => $f_config, 'digest' => $digest));
    // <a href="$script?plugin=addline&amp;addline_inno=$addline_no&amp;above=$above&amp;refer=$f_page&amp;configname=$f_config&amp;digest=$digest"></a>
    return '<a href="' . $link_uri . '">' . $btn_text . '</a>';
}
Пример #19
0
<?php

// PukiWiki Plus! - Yet another WikiWikiWeb clone.
// $Id: resource.php,v 0.8.3 2012/07/07 08:29:00 Logue Exp $
//
// Resource of String
// Warning: This file is PukiWiki "core" resource strings.
//          Please Without customizing it.
global $_labels, $_string, $_title, $_LANG, $_error_type;
$_labels = array('week' => array(array(T_('Sun'), T_('Sunday')), array(T_('Mon'), T_('Monday')), array(T_('Tue'), T_('Tuesday')), array(T_('Wed'), T_('Wednesday')), array(T_('Thu'), T_('Thursday')), array(T_('Fri'), T_('Friday')), array(T_('Sat'), T_('Saturday'))), 'month' => array(1 => array(T_('_Jan'), T_('January')), 2 => array(T_('_Feb'), T_('February')), 3 => array(T_('_Mar'), T_('March')), 4 => array(T_('_Apr'), T_('April')), 5 => array(T_('_May'), T_('May')), 6 => array(T_('_Jun'), T_('June')), 7 => array(T_('_Jul'), T_('July')), 8 => array(T_('_Aug'), T_('August')), 9 => array(T_('_Sep'), T_('September')), 10 => array(T_('_Oct'), T_('October')), 11 => array(T_('_Nov'), T_('November')), 12 => array(T_('_Dec'), T_('December'))));
$_string = array('freeze' => T_('Freeze'), 'unfreeze' => T_('Unfreeze'), 'symbol' => T_('Symbols'), 'other' => T_('Others'), 'andresult' => T_('In the page <strong>$2</strong>, <strong>$3</strong> pages that contain all the terms <var>$1</var> were found.'), 'orresult' => T_('In the page <strong>$2</strong>, <strong>$3</strong> pages that contain at least one of the terms <var>$1</var> were found.'), 'notfoundresult' => T_('No page which contains <var>$1</var> has been found.'), 'word' => T_('These search terms have been highlighted:'), 'help' => T_('View Text Formatting Rules'), 'updated' => T_('$1 was updated'), 'back' => T_('Back to %s'), 'invalidpass' => T_('Invalid password.'), 'invalidiwn' => T_('<var>$1</var> is not a valid <var>$2</var>.'), 'title_collided' => T_('On updating $1, a collision has occurred.'), 'msg_collided' => T_('It seems that someone has already updated this page while you were editing it.') . '<br />' . "\n" . T_('+ is placed at the beginning of a line that was newly added.') . '<br />' . "\n" . T_('! is placed at the beginning of a line that has possibly been updated.') . '<br />' . "\n" . T_('Edit those lines, and submit again.'), 'msg_collided_auto' => T_('It seems that someone has already updated this page while you were editing it.') . '<br />' . "\n" . T_('The collision has been corrected automatically, but there may still be some problems with the page.') . '<br />' . "\n" . T_('To confirm the changes to the page, press [Update].'), 'comment_collided' => T_('It seems that someone has already updated this page while you were editing it.') . '<br />' . "\n" . T_('The string was added, alhough it may be inserted in the wrong position.'), 'collided_caption' => T_('l : between backup data and stored page data.<br />r : between backup data and your post data.'), 'warning' => T_('WARNING'), 'error_msg' => T_('A runtime error has occurred.') . '<br />' . T_('Please contact to site admin. If you want more information, please change <var>PKWK_WARNING</var> value.'), 'debugmode' => T_('This program is running in debug mode.'), 'changeadminpass' => sprintf(T_('<var>$adminpass</var> is not changed! Click <a href="%s">here</a> to generate crypted password and modify auth.ini.php!'), get_cmd_uri('md5')), 'not_writable' => T_('<var>%s</var> is not found or not writable.'), 'not_found' => T_('Page <var>%s</var> was not found.'), 'not_found_msg1' => T_('Sorry, but the page you were trying to view does not exist or deleted.'), 'not_found_msg2' => T_('Please check <a href="%1s" rel="nofollow">backups</a> or <a href="%2s" rel="nofollow">create page</a>.'), 'require_auth' => T_('Authorization Required'), 'require_auth_msg' => T_('This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn\'t understand how to supply the credentials required.'), 'redirect' => T_('Page Redirect'), 'redirect_msg' => T_('The requested page has moved to a new URL. <br />Please click <a href="%s">here</a> if you do not want to move even after a while.'), 'header_sent' => T_('Headers already sent at <var>%s</var>, line: <var>%s</var>.'), 'illegal_chars' => T_('Illegal characters contained.'), 'script_error' => T_('A fatal error has occured at line <var>%1s</var> in file <var>%2s</var>.'), 'script_abort' => T_('Script execution has been aborted.'), 'error_prohibit' => T_('This Wiki is <var>%s</var> mode now. The action which you are trying to do is prohibited.'), 'prohibit_dnsbl' => T_('Sorry, Your host(<var>%s</var>) is prohibited by <strong>DNSBL</storng> (Blocking SPAM).'), 'prohibit_uribl' => T_('Sorry, Your host is prohibited by <strong>URIBL</storng> (Blocking SPAM).'), 'prohibit_akismet' => T_('Sorry, Your host is prohibited by <strong>Akismet</storng> (Blocking SPAM).'), 'prohibit_country' => T_('Sorry, access from your country is prohibited.'), 'prohibit_proxy' => T_('Sorry, access via proxy is prohibited.'), 'not_readable' => T_('You have no permission to read this page.'), 'not_editable' => T_('You have no permission to edit page or create page.'), 'not_found1' => T_('Sorry, but the page you were trying to view does not exist or deleted.'), 'not_found2' => T_('Please check <a href="%1s" rel="nofollow">backups</a> or <a href="%2s" rel="nofollow">create page</a>.'), 'redirect1' => T_('The requested page has moved to a new URL.'), 'redirect2' => T_('Please click <a href="%s">here</a> if you do not want to move even after a while.'), 'plugin_init_error' => T_('Plugin init failed: <var>%s</var>'), 'plugin_multiple_call' => T_('<var>%1s</var> was called over <var>%2s</var> times. SPAM or someting?'), 'plugin_postid_error' => T_('PostId is mismatched. Is it multi-post?'), 'plugin_encode_error' => T_('Incorrect encode. Please use a modern browser.'), 'plugin_not_implemented' => T_('Plugin <var>%s</var> is not implemented.'), 'feed_description' => T_('Recent changes of %s'), 'captcha_msg' => T_('Please enter the text that appears below.'), 'captcha_failure' => T_('Failed to authenticate.'));
$_button = array('preview' => T_('Preview'), 'repreview' => T_('Preview again'), 'update' => T_('Update'), 'cancel' => T_('Cancel'), 'add' => T_('Add'), 'search' => T_('Search'), 'load' => T_('Load'), 'edit' => T_('Edit'), 'guiedit' => T_('Edit(GUI)'), 'delete' => T_('Delete'), 'remove' => T_('Remove'), 'login' => T_('Login'), 'logout' => T_('Logout'), 'submit' => T_('Submit'), 'notchangetimestamp' => T_('Do not change timestamp'), 'addtop' => T_('Add to top of page'), 'template' => T_('Use page as template'), 'and' => T_('AND'), 'or' => T_('OR'), 'cookie' => T_('Save to cookie'), 'connect' => T_('Connect to %s'), 'back' => T_('Back'), 'try_edit' => T_('Try to edit this page'), 'return_home' => T_('Return to FrontPage'));
$_title = array('cannotedit' => T_('$1 is not editable'), 'cannotread' => T_('$1 is not readable'), 'collided' => T_('On updating $1, a collision has occurred.'), 'updated' => T_('$1 was updated'), 'preview' => T_('Preview of $1'), 'error' => T_('Runtime Error'), 'plugin_error' => T_('Plugin Error'), 'redirect' => T_('Moved Permanently'), 'prohibit' => T_('Access Prohibited'), 'page_not_found' => T_('Page not found'), 'not_implemented' => T_('Not Implemented'));
// Encoding hint
$_LANG['encode_hint'] = T_('encode_hint');
$_LANG['skin'] = array('add' => T_('Add'), 'backup' => T_('Backup'), 'brokenlink' => T_('Broken Link List'), 'copy' => T_('Copy'), 'diff' => T_('Diff'), 'edit' => T_('Edit'), 'filelist' => T_('List of page files'), 'freeze' => T_('Freeze'), 'unfreeze' => T_('Unfreeze'), 'full' => T_('Full screen'), 'guiedit' => T_('Edit(GUI)'), 'pdf' => T_('Export as PDF'), 'help' => T_('Help'), 'list' => T_('List of pages'), 'log' => T_('Log'), 'new' => T_('New'), 'newsub' => T_('Lower page making'), 'print' => T_('Image of print'), 'rename' => T_('Rename'), 'search' => T_('Search'), 'template' => T_('Template'), 'upload' => T_('Upload'), 'trackback' => T_('Trackback'), 'referer' => T_('Referer'), 'reload' => T_('Reload'), 'back' => T_('Back'), 'source' => T_('Source'), 'rss' => T_('RSS of recent changes'), 'rdf' => T_('RDF of recent changes'), 'atom' => T_('ATOM of recent changes'), 'logo' => T_('Logo'), 'formatrule' => T_('Text Formatting Rules'), 'login' => T_('Login'), 'logout' => T_('Logout'), 'top' => T_('Front page'), 'recent' => T_('Recent changes'), 'deleted' => T_('Recent deleted'), 'interwiki' => T_('Interwiki name'), 'alias' => T_('Auto alias name'), 'glossary' => T_('Glossary'), 'menu' => T_('MenuBar'), 'side' => T_('SideBar'), 'navigation' => T_('Navigation'), 'head' => T_('Header area'), 'foot' => T_('Footer area'), 'protect' => T_('Protected'), 'site' => T_('Site'), 'page' => T_('Pages'), 'manage' => T_('Management'), 'tool' => T_('Tools'), 'attach_title' => T_('Attaches :'), 'attach_info' => T_('File information'), 'attach_count' => T_('%s download'), 'related' => T_('Related pages: '));
$_error_type = array(1 => T_('Error'), 2 => T_('Warning'), 4 => T_('Parsing Error'), 8 => T_('Notice'), 16 => T_('Core Error'), 32 => T_('Core Warning'), 64 => T_('Compile Error'), 128 => T_('Compile Warning'), 256 => T_('User Error'), 512 => T_('User Warning'), 1024 => T_('User Notice'));
/* End of file resource.php */
/* Location: ./wiki-common/lib/resource.php */
Пример #20
0
 function get_imagelink()
 {
     if (empty($this->items['image'])) {
         $this->items['image'] = AMAZON_NO_IMAGE;
     } else {
         if (file_exists($this->items['image'])) {
             $filename_img = substr($this->items['image'], strlen(CACHE_DIR));
             $this->items['image'] = get_cmd_uri('cache_ref', '', '', array('src' => $filename_img));
         } else {
             $this->items['image'] = AMAZON_NO_IMAGE;
         }
     }
     return '<a href="' . $this->shop_url() . $this->asin . '/' . AMAZON_AID . '">' . '<img src="' . $this->items['image'] . '" alt="' . Utility::htmlsc($this->items['title']) . '"' . ' title="' . Utility::htmlsc($this->items['title']) . '" /></a>';
 }
function plugin_adm_auth_wkgrp_convert()
{
    global $script, $_adm_auth_wkgrp_msg, $_LANG;
    if (auth::check_role('role_adm')) {
        return '';
    }
    if (!PLUGIN_ADM_AUTH_WKGRP_USE_WRITE_FUNC) {
        return '';
    }
    $config_page_name = ':config/' . CONFIG_AUTH_WKGRP;
    $msg = '';
    $cmd_view = get_page_uri($config_page_name);
    $cmd_edit = get_cmd_uri('edit', $config_page_name);
    $cmd_guiedit = get_cmd_uri('guiedit', $config_page_name);
    $cmd_check = get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'check'));
    $cmd_import = get_cmd_uri('adm_auth_wkgrp', '', '', array('pcmd' => 'import'));
    $filetime_auth_wkgrp = filemtime(PKWK_AUTH_WKGRP_FILE);
    $date_auth_wkgrp = format_date($filetime_auth_wkgrp);
    if (is_page($config_page_name)) {
        $filetime_config_page = get_filetime($config_page_name);
        $date_config_page = format_date($filetime_config_page);
        $guide_msg = $filetime_config_page > $filetime_auth_wkgrp ? '<strong>' . $_adm_auth_wkgrp_msg['msg_gen'] . '</strong>' : '';
        $link_page = <<<EOD
      [<a href="{$cmd_edit}">{$_LANG['skin']['edit']}</a>]
      [<a href="{$cmd_guiedit}">{$_LANG['skin']['guiedit']}</a>]

EOD;
        $link_file = <<<EOD
      <form action="{$script}" method="post">
       <div>
        <input type="hidden" name="plugin" value="adm_auth_wkgrp" />
        <input type="hidden" name="pcmd" value="gen" />
        <input type="submit" value="{$_adm_auth_wkgrp_msg['btn_gen']}" />
{$guide_msg}
       </div>
      </form>

EOD;
    } else {
        $date_config_page = 'N/A';
        $link_page = <<<EOD
      [<a href="{$cmd_import}">{$_adm_auth_wkgrp_msg['msg_import']}</a>]

EOD;
        $link_file = '';
    }
    $rc = <<<EOD
<div>
 <fieldset>
  <legend>{$_adm_auth_wkgrp_msg['head_title']}</legend>
   <table class="style_table" border="0" cellspacing="1" style="width:100%;">
   <thead>
    <tr>
     <td class="style_td" style="width:50%;">
       {$_adm_auth_wkgrp_msg['msg_head_page']}
       (<a href="{$cmd_view}">{$_adm_auth_wkgrp_msg['msg_view']}</a>)
     </td>
     <td class="style_td" style="width:50%;">
       {$_adm_auth_wkgrp_msg['msg_head_file']}
       (<a href="{$cmd_check}">{$_adm_auth_wkgrp_msg['msg_check']}</a>)
     </td>
    </tr>
   </thead>

   <tbody>
    <tr>
     <td class="style_td" style="width:50%;">
      {$_adm_auth_wkgrp_msg['msg_head_update']}: {$date_config_page}
     </td>
     <td class="style_td" style="width:50%;">
      {$_adm_auth_wkgrp_msg['msg_head_gen']}: {$date_auth_wkgrp}
     </td>
    </tr>
    <tr>
     <td class="style_td" style="width:50%;">
{$link_page}
     </td>
     <td class="style_td" style="width:50%;">
{$link_file}
     </td>
    </tr>
   </tbody>
   </table>
 </fieldset>
</div>

EOD;
    return $rc;
}
Пример #22
0
function plugin_attachref_inline()
{
    global $vars, $digest;
    global $_attachref_messages;
    #	static $numbers = array();
    #	static $no_flag = 0;
    #	if (!array_key_exists($vars['page'],$numbers))
    #	{
    #		$numbers[$vars['page']] = 0;
    #	}
    #	$attachref_no = $numbers[$vars['page']]++;
    $ret = '';
    $dispattach = 1;
    $extra_options = array();
    $args = func_get_args();
    $btn_text = array_pop($args);
    $btn_text = $btn_text ? $btn_text : $_attachref_messages['btn_submit'];
    $options = plugin_attachref_options($extra_options, $args);
    $button = $extra_options['button'];
    $attachref_no = $extra_options['refnum'];
    $btn_text .= $extra_options['text'];
    #	$button = 0;
    $args = func_get_args();
    #   $btn_text = array_pop($args);
    #   $btn_text = $btn_text ? $btn_text : $_attachref_messages['btn_submit'];
    #   $options = array();
    #   foreach ( $args as $opt ){
    #	    if ( $opt === 'button' ){
    #	        $button = 1;
    #	    }
    #	    else if ( $opt === 'number' ){
    #		$no_flag = 1;
    #	    }
    #	    else if ( $opt === 'nonumber' ){
    #		$no_flag = 0;
    #	    }
    #	    else {
    #	        array_push($options, $opt);
    #	    }
    #	}
    #   $btn_text .= ( $no_flag == 1 ) ? "[$attachref_no]" : '';
    $args = $options;
    if (count($args) && $args[0] != '') {
        require_once PLUGIN_DIR . 'ref.inc.php';
        $params = plugin_ref_body($args, $vars['page']);
        if (isset($params['_error'])) {
            $ret = $params['_error'];
            $dispattach = 1;
        } else {
            $ret = $params['_body'];
            $dispattach = 0;
        }
    }
    if ($dispattach) {
        // Escape foreign value
        $s_args = trim(join(",", $args));
        if ($button) {
            $script = Router::get_script_uri();
            $s_args .= ',button';
            $f_page = Utility::htmlsc($vars['page']);
            $f_args = Utility::htmlsc($s_args);
            $ret = <<<EOD
<form action="{$script}" method="post" class="plugin-attacherf-form">
\t<input type="hidden" name="attachref_no" value="{$attachref_no}" />
\t<input type="hidden" name="attachref_opt" value="{$f_args}" />
\t<input type="hidden" name="digest" value="{$digest}" />
\t<input type="hidden" name="cmd" value="attachref" />
\t<input type="hidden" name="refer" value="{$f_page}" />
\t{$ret}
\t<input class="btn btn-secondary" type="submit" value="{$btn_text}" />
</form>
EOD;
        } else {
            $f_btn_text = preg_replace('/<[^<>]+>/', '', $btn_text);
            $btn_url = get_cmd_uri('attachref', $vars['page'], '', array('attachref_no' => $attachref_no, 'attachref_opt' => $s_args, 'refer' => $vars['page'], 'digest' => $digest));
            $ret .= '<a href="' . $btn_url . '" title="' . $f_btn_text . '"><small><span class="fa fa-paperclip">' . $btn_text . '</span></small></a>';
        }
    }
    return $ret;
}
Пример #23
0
function plugin_calendar_viewer_convert()
{
    global $vars, $get, $post, $_labels;
    //	global $_msg_calendar_viewer_right, $_msg_calendar_viewer_left;
    //	global $_msg_calendar_viewer_restrict, $_err_calendar_viewer_param2;
    global $_symbol_paraedit, $trackback;
    $_calendar_viewer_msg = array('_err_param2' => T_('Wrong second parameter.'), '_msg_right' => T_('Next %d &gt;&gt;'), '_msg_left' => T_('&lt;&lt; Prev %d'), '_msg_restrict' => T_('Due to the blocking, the calendar_viewer cannot refer to $1.'), '_title_format' => T_('%1s, %2s %3s %4s'));
    if (!isset($vars['page'])) {
        return '';
    }
    static $viewed = array();
    if (func_num_args() < 2) {
        return PLUGIN_CALENDAR_VIEWER_USAGE . '<br />' . "\n";
    }
    $func_args = func_get_args();
    // Default values
    $pagename = $func_args[0];
    // 基準となるページ名
    $page_YM = '';
    // 一覧表示する年月
    $limit_base = 0;
    // 先頭から数えて何ページ目から表示するか (先頭)
    $limit_pitch = 0;
    // 何件づつ表示するか
    $limit_page = 0;
    // サーチするページ数
    $mode = 'past';
    // 動作モード
    $date_sep = '-';
    // 日付のセパレータ calendar2なら '-', calendarなら ''
    // Check $func_args[1]
    $matches = array();
    if (preg_match('/[0-9]{4}' . $date_sep . '[0-9]{2}/', $func_args[1])) {
        // 指定年月の一覧表示
        $page_YM = $func_args[1];
        $limit_page = 31;
    } else {
        if (preg_match('/this/si', $func_args[1])) {
            // 今月の一覧表示
            $page_YM = get_date('Y' . $date_sep . 'm');
            $limit_page = 31;
        } else {
            if (preg_match('/^[0-9]+$/', $func_args[1])) {
                // n日分表示
                $limit_pitch = $func_args[1];
                $limit_page = $func_args[1];
            } else {
                if (preg_match('/(-?[0-9]+)\\*([0-9]+)/', $func_args[1], $matches)) {
                    // 先頭より数えて x ページ目から、y件づつ表示
                    $limit_base = $matches[1];
                    $limit_pitch = $matches[2];
                    $limit_page = $matches[1] + $matches[2];
                    // 読み飛ばす + 表示する
                } else {
                    return '#calendar_viewer(): ' . $_calendar_viewer_msg['_err_param2'] . '<br />' . "\n";
                }
            }
        }
    }
    // $func_args[2]: Mode setting
    if (isset($func_args[2]) && preg_match('/^(past|pastex|view|viewex|future|futureex)$/si', $func_args[2])) {
        $mode = $func_args[2];
    }
    // $func_args[3]: Change default delimiter
    if (isset($func_args[3])) {
        $date_sep = $func_args[3];
    }
    // Avoid Loop etc.
    if (isset($viewed[$pagename])) {
        if ($viewed[$pagename] > PLUGIN_CALENDAR_MAX_VIEWS) {
            $s_page = htmlsc($pagename);
            return '#calendar_viewer(): You already view: ' . $s_page . '<br />';
        }
        $viewed[$pagename]++;
        // Valid
    } else {
        $viewed[$pagename] = 1;
        // Valid
    }
    // 一覧表示するページ名とファイル名のパターン ファイル名には年月を含む
    if ($pagename == '') {
        // pagename無しのyyyy-mm-ddに対応するための処理
        $pagepattern = '';
        $pagepattern_len = 0;
        $filepattern = encode($page_YM);
        $filepattern_len = strlen($filepattern);
    } else {
        $pagepattern = strip_bracket($pagename) . '/';
        $pagepattern_len = strlen($pagepattern);
        $filepattern = encode($pagepattern . $page_YM);
        $filepattern_len = strlen($filepattern);
    }
    // ページリストの取得
    $pagelist = array();
    if ($dir = @opendir(DATA_DIR)) {
        $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
        $page_date = '';
        while ($file = readdir($dir)) {
            if ($file == '..' || $file == '.') {
                continue;
            }
            if (substr($file, 0, $filepattern_len) != $filepattern) {
                continue;
            }
            $page = decode(trim(preg_replace('/\\.txt$/', ' ', $file)));
            $page_date = substr($page, $pagepattern_len);
            // Verify the $page_date pattern (Default: yyyy-mm-dd).
            // Past-mode hates the future, and
            // Future-mode hates the past.
            if (plugin_calendar_viewer_isValidDate($page_date, $date_sep) == FALSE || $page_date > $_date && $mode == 'past' || $page_date < $_date && $mode == 'future' || $page_date >= $_date && $mode == 'pastex' || $page_date <= $_date && $mode == 'futureex') {
                continue;
            }
            $pagelist[] = $page;
        }
    }
    closedir($dir);
    if ($mode == 'past' || $mode == 'pastex' || $mode == 'viewex') {
        rsort($pagelist, SORT_STRING);
        // New => Old
    } else {
        sort($pagelist, SORT_STRING);
        // Old => New
    }
    // Include start
    $tmppage = $vars['page'];
    $return_body = '';
    // $limit_page の件数までインクルード
    $tmp = max($limit_base, 0);
    // Skip minus
    while ($tmp < $limit_page) {
        if (!isset($pagelist[$tmp])) {
            break;
        }
        $page = $pagelist[$tmp];
        $get['page'] = $post['page'] = $vars['page'] = $page;
        $wiki = Factory::Wiki($page);
        // 現状で閲覧許可がある場合だけ表示する
        if ($wiki->isReadable()) {
            if (function_exists('convert_filter')) {
                $body = RendererFactory::factory(convert_filter($wiki->get()));
            } else {
                $body = $wiki->render();
            }
        } else {
            $body = str_replace('$1', $page, $_calendar_viewer_msg['_msg_restrict']);
        }
        if (PLUGIN_CALENDAR_VIEWER_DATE_FORMAT !== FALSE) {
            $time = strtotime(basename($page));
            // $date_sep must be assumed '-' or ''!
            if ($time == -1) {
                $s_page = htmlsc($page);
                // Failed. Why?
            } else {
                $week = $_labels['week'][date('w', $time)][0];
                $month = $_labels['month'][preg_replace('/^0/', '', date('m', $time))][0];
                $s_page = htmlsc(str_replace(array('$w', '$m'), array($week, $month), date(PLUGIN_CALENDAR_VIEWER_DATE_FORMAT, $time)));
            }
        } else {
            $s_page = htmlsc($page);
        }
        // if (PKWK_READONLY) {
        if (Auth::check_role('readonly')) {
            $link = get_page_uri($page);
        } else {
            $link = get_cmd_uri('edit', $page, '', array('page' => $page));
        }
        $link = '<a class="anchor_super" href="' . $link . '">' . $_symbol_paraedit . '</a>';
        $head = '<h1>' . $s_page . $link . '</h1>' . "\n";
        $page_title = basepagename($page);
        $tail = '';
        if (PLUGIN_CALENDAR_VIEWER_HOLIDAYVIEW === TRUE) {
            $time = strtotime($page_title);
            if ($time != -1) {
                $yy = intval(date('Y', $time));
                $mm = intval(date('n', $time));
                $dd = intval(date('d', $time));
                $h_today = PublicHolidayFactory::factory('JP', $yy, $mm, $dd);
                if ($h_today['rc'] != 0) {
                    $classname = 'date_holiday';
                    $weekclass = 'week_sun';
                } else {
                    switch ($h_today['w']) {
                        case 0:
                            $classname = 'date_holiday';
                            $weekclass = 'week_sun';
                            break;
                        case 6:
                            $classname = 'date_weekend';
                            $weekclass = 'week_sat';
                        default:
                            $classname = 'date_weekday';
                            $weekclass = 'week_day';
                            break;
                    }
                }
            }
        }
        if (PLUGIN_CALENDAR_VIEWER_COMMENT === TRUE) {
            if (is_page(':config/plugin/addline/comment') && exist_plugin_inline('addline')) {
                $comm = RendererFactory::factory(array('&addline(comment,above){comment};'));
                $comm = preg_replace(array("'<p>'si", "'</p>'si"), array("", ""), $comm);
                $tail .= str_replace('>comment', '><img src="' . IMAGE_URI . 'plus/comment.png" width="15" height="15" alt="Comment" title="Comment" />Comment', $comm);
            }
        }
        if (PLUGIN_CALENDAR_VIEWER_TRACKBACK === TRUE && $trackback) {
            $tb_link = get_cmd_uri('tb', '', '', array('__mode' => 'view', 'tb_id' => tb_get_id($page)));
            $tail .= '<a class="pkwk-icon_linktext cmd-trackback" href="' . $tb_link . '">' . 'Trackback(' . tb_count($page) . ')' . '</a>' . "\n";
        }
        $page_id = str_replace('/', '_', $page);
        $return_body .= '<article id="' . $page_id . '">' . "\n";
        $return_body .= $head . $body;
        $return_body .= '</article>' . "\n";
        ++$tmp;
    }
    // ここで、前後のリンクを表示
    // ?plugin=calendar_viewer&file=ページ名&date=yyyy-mm
    $page = substr($pagepattern, 0, $pagepattern_len - 1);
    $r_page = rawurlencode($page);
    if ($page_YM != '') {
        // 年月表示時
        $date_sep_len = strlen($date_sep);
        $this_year = substr($page_YM, 0, 4);
        $this_month = substr($page_YM, 4 + $date_sep_len, 2);
        // 次月
        $next_year = $this_year;
        $next_month = $this_month + 1;
        if ($next_month > 12) {
            ++$next_year;
            $next_month = 1;
        }
        $next_YM = sprintf('%04d%s%02d', $next_year, $date_sep, $next_month);
        // 前月
        $prev_year = $this_year;
        $prev_month = $this_month - 1;
        if ($prev_month < 1) {
            --$prev_year;
            $prev_month = 12;
        }
        $prev_YM = sprintf('%04d%s%02d', $prev_year, $date_sep, $prev_month);
        if ($mode == 'past') {
            $right_YM = $prev_YM;
            $right_text = $prev_YM . '&gt;&gt;';
            // >>
            $left_YM = $next_YM;
            $left_text = '&lt;&lt;' . $next_YM;
            // <<
        } else {
            $left_YM = $prev_YM;
            $left_text = '&lt;&lt;' . $prev_YM;
            // <<
            $right_YM = $next_YM;
            $right_text = $next_YM . '&gt;&gt;';
            // >>
        }
    } else {
        // n件表示時
        if ($limit_base <= 0) {
            $left_YM = '';
            // 表示しない (それより前の項目はない)
        } else {
            $left_YM = $limit_base - $limit_pitch . '*' . $limit_pitch;
            $left_text = sprintf($_calendar_viewer_msg['_msg_left'], $limit_pitch);
        }
        if ($limit_base + $limit_pitch >= count($pagelist)) {
            $right_YM = '';
            // 表示しない (それより後の項目はない)
        } else {
            $right_YM = $limit_base + $limit_pitch . '*' . $limit_pitch;
            $right_text = sprintf($_calendar_viewer_msg['_msg_right'], $limit_pitch);
        }
    }
    // ナビゲート用のリンクを末尾に追加
    if ($left_YM != '' || $right_YM != '') {
        $s_date_sep = htmlsc($date_sep);
        $left_link = $right_link = '';
        if ($left_YM != '') {
            $left_link = '<a href="' . get_cmd_uri('calendar_viewer', '', '', array('mode' => $mode, 'file' => $page, 'date_sep' => $date_sep, 'date' => $left_YM)) . '">' . $left_text . '</a>';
        }
        if ($right_YM != '') {
            $right_link = '<a href="' . get_cmd_uri('calendar_viewer', '', '', array('mode' => $mode, 'file' => $page, 'date_sep' => $date_sep, 'date' => $right_YM)) . '">' . $right_text . '</a>';
        }
        $center_link = '<a href="' . get_page_uri($page) . '">' . $page . '</a>';
        // past modeは<<新 旧>> 他は<<旧 新>>
        $nav = '<nav class="calendar_viewer_navi">' . "\n";
        $nav .= <<<EOD
<ul class="navi">
\t<li class="navi_left">{$left_link}</li>
\t<li class="navi_none">{$center_link}</li>
\t<li class="navi_right">{$right_link}</li>
</ul>
<hr />
EOD;
        $nav .= '</nav>' . "\n";
    }
    $get['page'] = $post['page'] = $vars['page'] = $tmppage;
    return $nav . $return_body;
}
Пример #24
0
 function MapNode($page, $reverse = FALSE)
 {
     global $non_list, $script;
     static $_hide_pattern, $id = 0;
     if (!isset($_hide_pattern)) {
         $_hide_pattern = '/' . $non_list . '/';
     }
     $this->page = $page;
     $this->is_page = is_page($page);
     $this->cache = CACHE_DIR . encode($page);
     $this->done = !$this->is_page;
     $this->link = make_pagelink($page);
     $this->id = ++$id;
     $this->hide_pattern =& $_hide_pattern;
     $this->rels = $reverse ? $this->ref() : $this->rel();
     $mark = $reverse ? '' : '<sup>+</sup>';
     //$this->mark = '<a id="rel_' . $this->id . '" href="' . $script .
     //	'?plugin=map&amp;refer=' . rawurlencode($this->page) . '">' .
     //	$mark . '</a>';
     $this->mark = '<a id="rel_' . $this->id . '" href="' . get_cmd_uri('map', null, null, array('refer' => $this->page)) . '">' . $mark . '</a>';
 }
Пример #25
0
function plugin_qrcode_inline()
{
    if (!extension_loaded('gd')) {
        return '<span class="ui-state-error">&amp;qrcode(): GD2 extention was not loaded!</span>';
    }
    /**
     * $s サイズ,
     * $e 訂正方法,
     * $v バージョン,
     * $n 分割数
     * $d バーコード化する文字列(Adv.版は非サポート)
     */
    switch (func_num_args()) {
        //		case 5:
        //			list($s,$e,$v,$n,$d) = func_get_args();
        //			break;
        case 4:
            list($s, $e, $v, $d) = func_get_args();
            break;
        case 3:
            list($s, $e, $d) = func_get_args();
            break;
        case 2:
            list($s, $d) = func_get_args();
            break;
        case 1:
            list($d) = func_get_args();
            break;
    }
    // thx, nanashi and customized
    $s = isset($s) && $s <= 0 ? intval($s) : 0;
    $v = isset($v) && !($v <= 0 && $v > PHPQRCode\Constants::QRSPEC_VERSION_MAX) ? intval($v) : PHPQRCode\Constants::QRSPEC_VERSION_MAX;
    //	$n = (isset($n) && !( $n <= 0 && $n > 16 )) ? intval($n) : 0;
    $e = Utility::htmlsc(isset($e) ? $e : 'M');
    if (empty($d)) {
        $d = $d = isset($vars['page']) ? Factory::Wiki($vars['page'])->getUri() : Router::get_cmd_uri();
    }
    // thx, nao-pon
    $d = str_replace('<br />', "\r\n", $d);
    $d = strip_tags($d);
    // docomo is s-jis encoding
    $d = mb_convert_encoding($d, 'SJIS', SOURCE_ENCODING);
    $result = array();
    $result[] = '<figure class="qrcode">';
    //if ($n < 2 || $n > 16) {
    $href = get_cmd_uri('qrcode', '', '', array('d' => $d, 's' => 9, 'v' => $v, 'e' => $e));
    $src = get_cmd_uri('qrcode', '', '', array('d' => $d, 's' => $s, 'v' => $v, 'e' => $e));
    $alt = defined('UA_MOBILE') && UA_MOBILE != 0 ? 'Mobile' : rawurlencode($d);
    $result[] = '<a href="' . $href . '"><img src="' . $src . '" alt="' . $alt . '" title="' . $alt . '" /></a>';
    /*
    }
     else {
    	// パリティを計算
    	$l=strlen($d);
    	if ($l>1){
    		$p=0;
    		$i=0;
    		while ($i<$l){
    			$p=($p ^ ord(substr($d,$i,1)));
    			$i++;
    		}
    	}
    	// 並べる(本来ならPNGを合成するのがきれいでしょうけどね)
    	$i=0;
    	for ($j=1;$j<=$n;$j++) {
    		$splitdata = substr($d,$i,ceil($l/$n));
    		$i += ceil($l/$n);
    		$src = get_cmd_uri('qrcode', '', '', array(
    			'd' => $splitdata,
    			's' => $s,
    			'v' => $v,
    			'e' => $e,
    			'm' => $j
    		));
    		$alt = (defined('UA_MOBILE') && UA_MOBILE != 0) ? 'Mobile' : rawurlencode($splitdata);
    
    		$result[] = '<img src="'.$src.'" alt="'.$alt.'" title="'.$alt.'" />';
    		unset($src);
    	}
    }
    */
    $result[] = '</figure>';
    return join("\n", $result);
}
Пример #26
0
/**
 * アクションプラグイン処理
 */
function plugin_logview_action()
{
    global $vars, $_logview_msg;
    global $log, $sortable_tracker;
    static $count = 0;
    $kind = isset($vars['kind']) ? $vars['kind'] : 'update';
    $title = sprintf($_logview_msg['msg_title'], $kind);
    // タイトルを設定
    $page = isset($vars['page']) ? $vars['page'] : '';
    // ゲスト表示ができない場合は、認証を要求する
    if ($log[$kind]['guest'] == '') {
        $obj = new auth();
        $user = $obj->check_auth();
        if (empty($user)) {
            if (exist_plugin('login')) {
                do_plugin_action('login');
            }
            unset($obj);
            return array('msg' => $title, 'body' => $_logview_msg['msg_not_auth']);
        }
    }
    unset($obj);
    check_readable($page, false);
    // 保存データの項目名を取得
    $name = log::get_log_field($kind);
    $view = log::get_view_field($kind);
    // 表示したい項目設定
    if ($sortable_tracker && $count == 0) {
        global $head_tags;
        $head_tags[] = ' <script type="text/javascript" charset="utf-8" src="' . SKIN_URI . 'sortabletable.js"></script>';
    }
    $count++;
    $body = <<<EOD
<table id="logview{$count}" class="style_table" cellspacing="1" border="0">
<thead>
<tr>

EOD;
    $cols = 0;
    $is_role_adm = auth::check_role('role_adm');
    // タイトルの処理
    foreach ($view as $_view) {
        if ($_view === 'local_id' && $is_role_adm) {
            continue;
        }
        $body .= '<td class="style_td">' . $_logview_msg[$_view] . '</td>' . "\n";
        $cols++;
    }
    $body .= <<<EOD
</tr>
</thead>
<tbody>

EOD;
    // データを取得
    $fld = logview_get_data(log::set_filename($kind, $page), $name);
    if (empty($fld)) {
        return array('msg' => $title, 'body' => 'no data');
    }
    // USER-AGENT クラス
    $obj_ua = new user_agent(USE_UA_OPTION);
    $path_flag = IMAGE_URI . 'icon/flags/';
    $path_browser = IMAGE_URI . 'icon/browser/';
    $path_os = IMAGE_URI . 'icon/os/';
    $path_domain = IMAGE_URI . 'icon/option/domain/';
    $guess = $log['guess_user']['use'] ? log::read_guess() : log::summary_signature();
    $ctr = 0;
    // データの編集
    foreach ($fld as $data) {
        if (!VIEW_ROBOTS && $obj_ua->is_robots($data['ua'])) {
            continue;
        }
        // ロボットは対象外
        $body .= "<tr>\n";
        foreach ($view as $field) {
            switch ($field) {
                case 'ts':
                    // タイムスタンプ (UTIME)
                    $body .= ' <td class="style_td">' . get_date('Y-m-d H:i:s', $data['ts']) . ' ' . get_passage($data['ts']) . "</td>\n";
                    break;
                case '@guess_diff':
                case '@diff':
                    // 差分内容
                    $update = $field == '@diff' ? true : false;
                    // FIXME: バックアップ/差分 なしの新規の場合
                    // バックアップデータの確定
                    $body .= ' <td class="style_td">';
                    $age = log::get_backup_age($page, $data['ts'], $update);
                    switch ($age) {
                        case -1:
                            // データなし
                            $body .= '<a class="ext" href="' . get_page_uri($page) . '" rel="nofollow">none</a>';
                            break;
                        case 0:
                            // diff
                            $body .= '<a class="ext" href="';
                            $body .= log::diff_exist($page) ? get_cmd_uri('diff', $page) : get_page_uri($page);
                            $body .= '" rel="nofollow">now</a>';
                            break;
                        default:
                            // あり
                            $body .= '<a class="ext" href="' . get_cmd_uri('backup', $page, '', array('age' => $age, 'action' => 'visualdiff')) . '"' . ' rel="nofollow">' . $age . '</a>';
                            break;
                    }
                    $body .= "</td>\n";
                    break;
                case 'host':
                    // ホスト名 (FQDN)
                    $body .= ' <td class="style_td">';
                    if ($data['ip'] != $data['host']) {
                        // 国名取得
                        list($flag_icon, $flag_name) = $obj_ua->get_icon_flag($data['host']);
                        if (!empty($flag_icon) && $flag_icon != 'jp') {
                            $body .= '<img src="' . $path_flag . $flag_icon . '.png"' . ' alt="' . $flag_name . '" title="' . $flag_name . '" />';
                        }
                        // ドメイン取得
                        $domain = $obj_ua->get_icon_domain($data['host']);
                        if (!empty($domain)) {
                            $body .= '<img src="' . $path_domain . $domain . '.png"' . ' alt="' . $data['host'] . '" title="' . $data['host'] . '" />';
                        }
                    }
                    $body .= $data['host'] . "</td>\n";
                    break;
                case '@guess':
                    // 推測
                    $body .= ' <td class="style_td">' . htmlspecialchars(logview_guess_user($data, $guess), ENT_QUOTES) . "</td>\n";
                    break;
                case 'ua':
                    // ブラウザ情報 (USER-AGENT)
                    $body .= ' <td class="style_td">';
                    $os = $obj_ua->get_icon_os($data['ua']);
                    if (!empty($os)) {
                        $body .= '<img src="' . $path_os . $os . '.png"' . ' alt="' . $os . '" title="' . $os . '" />';
                    }
                    $browser = $obj_ua->get_icon_broeswes($data['ua']);
                    if (!empty($browser)) {
                        $body .= '<img src="' . $path_browser . $browser . '.png"' . ' alt="' . htmlspecialchars($data['ua'], ENT_QUOTES) . '" title="' . htmlspecialchars($data['ua'], ENT_QUOTES) . '" />';
                    }
                    $body .= "</td>\n";
                    break;
                case 'local_id':
                    if ($is_role_adm) {
                        continue;
                    }
                default:
                    $body .= ' <td class="style_td">' . htmlspecialchars($data[$field], ENT_QUOTES) . "</td>\n";
            }
        }
        $body .= "</tr>\n";
        $ctr++;
    }
    unset($obj_ua);
    if ($ctr == 0) {
        return array('msg' => $title, 'body' => 'no data');
    }
    $body .= <<<EOD
</tbody>
</table>

EOD;
    switch ($kind) {
        case 'login':
        case 'check':
            $body .= logview_user_list($fld, $page, $kind);
            break;
    }
    if ($sortable_tracker) {
        $logviewso = join(',', array_fill(0, $cols, '"String"'));
        $body .= <<<EOD
<script type="text/javascript">
<!-- <![CDATA[
var st = new SortableTable(document.getElementById('logview{$count}'),[{$logviewso}]);
//]]>-->
</script>
EOD;
    }
    return array('msg' => $title, 'body' => $body);
}
Пример #27
0
function plugin_flash_convert()
{
    global $flash_count, $js_blocks;
    $argc = func_num_args();
    if ($argc < 1) {
        return FALSE;
    }
    $argv = func_get_args();
    // @ インライン呼び出しかどうか
    $binline = 0;
    if ($argv[$argc - 1] == "inline") {
        $binline = 1;
        array_pop($argv);
    }
    // @ 第一引数の受け取り
    $swf = $argv[0];
    //	$swf = &::unescape(&flash::decode($swf));
    // @ 特殊変数
    $serverpath = "http://" . getenv('SERVER_NAME') . "/";
    $wikipath = str_replace("index.php", "", "http://" . getenv('SERVER_NAME') . getenv('SCRIPT_NAME'));
    // @ 削除
    $swf = str_replace("{server}", $serverpath, $swf);
    $swf = str_replace("{wikiroot}", $wikipath, $swf);
    //  @ デフォルト値読み込み
    $params = array('movie' => $swf, 'play' => '', 'loop' => 'false', 'menu' => '', 'quality' => 'high', 'scale' => '', 'salign' => '', 'wmode' => 'opaque', 'bgcolor' => 'transparent', 'base' => '', 'swliveconnect' => '', 'flashvars' => '', 'devicefont' => '', 'allowscriptaccess' => 'sameDomain', 'seamlesstabbing' => '', 'allowfullscreen' => '', 'allownetworking' => '');
    $width = '512';
    $height = '384';
    $align = "";
    //  @ 引数取り
    for ($i = 1; $i < $argc; $i++) {
        //@ 検出正規表現  英数文字=["]任意["]
        if (preg_match('/(\\w*)=\\"?([^\\"]*)\\"?/', $argv[$i], $match)) {
            $prop = strtolower($match[1]);
            /* 小文字化 */
            $prot = $match[1];
            if ($prop == 'flashvars') {
                $flashvars = $match[2];
                // @ varname =val の形に分解
                $aryVars = explode('&', $flashvars);
                for ($i = 0; $i < count($aryVars); $i++) {
                    // @ 名前と値に分解
                    $aryField = explode('=', $aryVars[$i]);
                    if (count($aryField) == 2) {
                        // @ 値の部分だけurlエンコード
                        $aryField[1] = urlencode($aryField[1]);
                        // @ 繋げて戻す
                        $aryVars[$i] = join('=', $aryField);
                    }
                }
                // @ &で繋げて戻す
                $params['flashvars'] = join('&amp;', $aryVars);
            } else {
                $params[$prop] = $match[2];
            }
            /* 幅x高さ  数字であり1ケタ以上4桁以下 */
        } else {
            if (preg_match('/([0-9]{1,4})x([0-9]{1,4})/i', $argv[$i], $match)) {
                $width = $match[1];
                $height = $match[2];
            }
        }
        //if
    }
    // <param>タグをセット
    foreach ($params as $param_name => $param_value) {
        if ($param_value != '') {
            $param_tags[] = '<param name="' . $param_name . '" value="' . $param_value . '" />';
        }
    }
    $param = join("\n", $param_tags);
    $ret = <<<EOD
<object id="flash_{$flash_count}" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{$width}" height="{$height}">
{$param}
<!--[if !IE]>-->
\t<object type="application/x-shockwave-flash" data="{$swf}" width="{$width}" height="{$height}">
<!--<![endif]-->
\t\t<p class="alert alert-warning">Error: Flash Player Cannot Installed.</p>
<!--[if !IE]>-->
\t</object>
<!--<![endif]-->
</object>
EOD;
    $js_blocks[] = 'swfobject.registerObject("flash_' . $flash_count . '", "9.0.0", "' . get_cmd_uri('flash', '', '', array('type' => '.swf')) . '");';
    $flash_count++;
    if ($binline == 1) {
        // インライン出力
        return '<span class="flash">' . $ret . '</span>' . "\n";
    } else {
        return '<div class="flash" style="text-align:center;margin-left:auto; margin-right:auto;">' . $ret . '</div>' . "\n";
    }
}
Пример #28
0
 function Link($start)
 {
     $this->start = $start;
     $this->redirect = PKWK_USE_REDIRECT ? get_cmd_uri('redirect', '', '', 'u=') : '';
 }
Пример #29
0
 /**
  * Get Vote Form HTML for inline plugin
  *
  * @static
  * @param array $vote
  * @param integer $vote_id vote form id
  * @global $vars
  * @global $vars['page']
  * @global $defaultpage
  * @global $digest
  * @var $options 'readonly'
  * @uses get_script_uri()
  * @return string
  */
 function get_vote_form_inline($votes, $vote_id)
 {
     global $vars, $defaultpage;
     global $digest;
     $page = isset($vars['page']) ? $vars['page'] : $defaultpage;
     /*
     		$r_page	= rawurlencode($page);
     		$r_digest  = rawurlencode($digest);
     		$r_vote_id = rawurlencode($vote_id);
     */
     $anchor = $this->get_anchor('inline', $vote_id);
     $form = '';
     $form .= '<span class="vote" id="' . $anchor . '">';
     foreach ($votes as $choice_id => $vote) {
         list($choice, $count) = $vote;
         /*
         			$r_choice_id = rawurlencode($choice_id);
         			$r_choice	= rawurlencode($choice);
         			$r_count	 = rawurlencode($count);
         */
         $s_choice = htmlsc($choice);
         $s_count = htmlsc($count);
         if ($this->options['readonly']) {
             $form .= $s_choice . '<var> ' . $s_count . ' </var>';
         } else {
             /*
             				$form .=
             					'<a href="' . get_script_uri() . '?cmd=vote' .
             					'&amp;pcmd=inline' .
             					'&amp;refer=' . $r_page .
             					'&amp;digest=' . $r_digest .
             					'&amp;vote_id=' . $r_vote_id .
             					'&amp;choice_id=' . $r_choice_id .
             					'">' . $s_choice . '</a>' .
             					'<span>&nbsp;' . $s_count . '&nbsp;</span>';
             */
             $form .= '<a href="' . get_cmd_uri('vote', null, null, array('pcmd' => 'inline', 'refer' => $page, 'digest' => $digest, 'vote_id' => $vote_id, 'choise_id' => $choise_id)) . '">' . $s_choice . '</a><var> ' . $s_count . ' </var>';
         }
     }
     $form .= '</span>' . "\n";
     return $form;
 }
Пример #30
0
function plugin_openid_inline()
{
    global $vars, $auth_api, $_openid_msg;
    if (!isset($auth_api['openid']['use'])) {
        return '';
    }
    if (!$auth_api['openid']['use']) {
        return $_openid_msg['msg_invalid'];
    }
    if (!function_exists('pkwk_session_start')) {
        return $_openid_msg['msg_not_found'];
    }
    if (pkwk_session_start() == 0) {
        return $_openid_msg['msg_not_start'];
    }
    $obj = new auth_openid_plus();
    $name = $obj->auth_session_get();
    if (!empty($name['api']) && $obj->auth_name !== $name['api']) {
        return;
    }
    $page = empty($vars['page']) ? '' : $vars['page'];
    $cmd = get_cmd_uri('openid', $page);
    if (!empty($name['nickname'])) {
        if (empty($name['local_id'])) {
            $link = $name['nickname'];
        } else {
            $link = '<a href="' . $name['local_id'] . '">' . $name['nickname'] . '</a>';
        }
        return sprintf($_openid_msg['msg_logined'], $link) . '(<a href="' . $cmd . '&amp;logout' . '">' . $_openid_msg['msg_logout'] . '</a>)';
    }
    $auth_key = auth::get_user_name();
    if (!empty($auth_key['nick'])) {
        return $_openid_msg['msg_openid'];
    }
    return '<a href="' . $cmd . '">' . $_openid_msg['msg_openid'] . '</a>';
}