Example #1
0
function plugin_group_convert()
{
    global $_group_msg;
    $auth_key = auth::get_user_info();
    if (empty($auth_key['group'])) {
        return '';
    }
    $argv = func_get_args();
    $i = count($argv);
    if ($i < 2) {
        return <<<EOD
<div>
        <label>{$_group_msg['group']}</label>:
        {$auth_key['group']}
</div>

EOD;
    }
    $msg = $argv[$i - 1];
    array_pop($argv);
    if (in_array($auth_key['group'], $argv)) {
        return convert_html(str_replace("\r", "\n", $msg));
    }
    return '';
}
/**
 * Submenu Plugin
 *
 * @author     sonots
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @link       http://lsx.sourceforge.jp/?Plugin%2Fsubmenu.inc.php
 * @version    $Id: submenu.inc.php,v 1.1 2007-02-24 16:28:39Z sonots $
 * @package    plugin
 */
function plugin_submenu_convert()
{
    global $vars;
    $args = func_get_args();
    $body = array_pop($args);
    $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
    $options = array('prefix' => '', 'filter' => '', 'except' => '');
    foreach ($args as $arg) {
        list($key, $val) = array_pad(explode('=', $arg), 2, '');
        $options[$key] = $val;
    }
    if ($options['prefix'] != '') {
        if (strpos($vars['page'], $options['prefix']) !== 0) {
            return '';
        }
    }
    if ($options['filter'] != '') {
        if (!preg_match('/' . str_replace('/', '\\/', $options['filter']) . '/', $vars['page'])) {
            return '';
        }
    }
    if ($options['except'] != '') {
        if (preg_match('/' . str_replace('/', '\\/', $options['except']) . '/', $vars['page'])) {
            return '';
        }
    }
    return convert_html($body);
}
Example #3
0
function plugin_showrss_action()
{
    global $vars, $cache;
    // if (PKWK_SAFE_MODE) die_message('PKWK_SAFE_MODE prohibit this');
    if (Auth::check_role('safemode')) {
        Utility::dieMessage('PKWK_SAFE_MODE prohibits this');
    }
    if ($vars['feed']) {
        // ajaxによる読み込み
        $target = $vars['feed'];
        list($data, $time, $reason) = plugin_showrss_get_rss($vars['feed'], 1, true);
        $header = Header::getHeaders('aplication/xml', $time);
        if (empty($reason)) {
            Header::writeResponse($header, Response::STATUS_CODE_200, $data);
        } else {
            // とりあえずXMLでエラー
            Header::writeResponse($header, Response::STATUS_CODE_200, '<?xml version="1.0" encoding="UTF-8"?><response><error>1</error><message>' . Utility::htmlsc($reason) . '</message></response>');
        }
        exit;
    }
    $body = '';
    foreach (array('xml', 'mbstring') as $extension) {
        ${$extension} = extension_loaded($extension) ? '&color(green){Found};' : '&color(red){Not found};';
        $body .= '| ' . $extension . ' extension | ' . ${$extension} . ' |' . "\n";
    }
    return array('msg' => 'showrss_info', 'body' => convert_html($body));
}
Example #4
0
function plugin_ls_convert()
{
    global $vars;
    $with_title = FALSE;
    if (func_num_args()) {
        $args = func_get_args();
        $with_title = in_array('title', $args);
    }
    $prefix = $vars['page'] . '/';
    $pages = array();
    foreach (get_existpages() as $page) {
        if (strpos($page, $prefix) === 0) {
            $pages[] = $page;
        }
    }
    natcasesort($pages);
    $ls = array();
    foreach ($pages as $page) {
        $comment = '';
        if ($with_title) {
            list($comment) = get_source($page);
            // 見出しの固有ID部を削除
            $comment = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $comment);
            $comment = '- ' . ereg_replace('^[-*]+', '', $comment);
        }
        $ls[] = "-[[{$page}]] {$comment}";
    }
    return convert_html($ls);
}
Example #5
0
function plugin_edit_preview()
{
    global $vars;
    global $_title_preview, $_msg_preview, $_msg_preview_delete;
    $page = isset($vars['page']) ? $vars['page'] : '';
    // Loading template
    if (isset($vars['template_page']) && is_page($vars['template_page'])) {
        $vars['msg'] = join('', get_source($vars['template_page']));
        // Cut fixed anchors
        $vars['msg'] = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', $vars['msg']);
    }
    $vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']);
    $postdata = $vars['msg'];
    if (isset($vars['add']) && $vars['add']) {
        if (isset($vars['add_top']) && $vars['add_top']) {
            $postdata = $postdata . "\n\n" . @join('', get_source($page));
        } else {
            $postdata = @join('', get_source($page)) . "\n\n" . $postdata;
        }
    }
    $body = $_msg_preview . '<br />' . "\n";
    if ($postdata == '') {
        $body .= '<strong>' . $_msg_preview_delete . '</strong>';
    }
    $body .= '<br />' . "\n";
    if ($postdata) {
        $postdata = make_str_rules($postdata);
        $postdata = explode("\n", $postdata);
        $postdata = drop_submit(convert_html($postdata));
        $body .= '<div id="preview">' . $postdata . '</div>' . "\n";
    }
    $body .= edit_form($page, $vars['msg'], $vars['digest'], FALSE);
    return array('msg' => $_title_preview, 'body' => $body);
}
function plugin_bubbles_convert()
{
    switch (func_num_args()) {
        case 2:
            list($title, $body) = func_get_args();
            $title = htmlspecialchars($title);
            break;
        case 1:
            list($body) = func_get_args();
            break;
        default:
            return FALSE;
    }
    $lines = preg_replace(array("[\\r|\\n]", "[\\r]"), array("\n", "\n"), $body);
    $lines = preg_replace(array("'<p>'si", "'</p>'si"), array("", ""), convert_html($lines));
    static $bubbles = FALSE;
    if ($bubbles === FALSE) {
        global $head_tags;
        $head_tags[] = ' <link rel="stylesheet" href="' . SKIN_URI . 'bubbles.css" type="text/css" media="screen" charset="utf-8" />';
        $head_tags[] = ' <script type="text/javascript" charset="utf-8" src="' . SKIN_URI . 'bubbles.js"></script>';
        $bubbles = TRUE;
    }
    return <<<EOD
  <div class="bubble">
    <div class="rounded">
      <blockquote>
        <p>{$lines}</p>
      </blockquote>
    </div>
    <cite class="rounded"><strong>{$title}</strong></cite>
  </div>
EOD;
}
Example #7
0
function plugin_expand_convert()
{
    global $script;
    $numargs = func_num_args();
    if ($numargs == 3) {
        list($width, $height, $source) = func_get_args();
        $width = intval($width);
        $height = intval($height);
    } else {
        if ($numargs == 2) {
            list($width, $source) = func_get_args();
            $width = intval($width);
        } else {
            if ($numargs == 1) {
                list($source) = func_get_args();
                $width = PLUGIN_EXPAND_DEFAULT_WIDTH;
            } else {
                return _('#expand: invalid arguments');
            }
        }
    }
    if (!isset($width) || $width < PLUGIN_EXPAND_MIN_WIDTH) {
        return _('#expand: too few width. ') . $width;
    }
    if (isset($height) && $height < PLUGIN_EXPAND_MIN_HEIGHT) {
        return _('#expand: too few height. ') . $height;
    }
    $lines = preg_replace(array("[\\r|\\n]", "[\\r]"), array("\n", "\n"), $source);
    $lines = preg_replace(array("'<p>'si", "'</p>'si"), array("", ""), convert_html($lines));
    return '<div style="width:' . $width . 'px;overflow:hidden;">' . $lines . '</div>' . '<form method="post" action="' . $script . '"><textarea name="fullcontents" rows="1" cols="1" style="display:none;">' . htmlspecialchars($source) . '</textarea><input type="image" name="submit" src="' . PLUGIN_EXPAND_ICON . '" style="float:right;" alt="' . _('Click to all views') . '" />' . '<input type="hidden" name="cmd" value="expand" /></form>';
}
Example #8
0
/**
 * Show Converted HTML Output as a Pre-formatted Text
 *
 * @author     sonots
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @link       http://lsx.sourceforge.jp/?Plugin%2Fepre.inc.php
 * @version    $Id: epre.inc.php,v 1.1 2007-02-24 16:28:39Z sonots $
 * @package    plugin
 */
function plugin_epre_convert()
{
    $args = func_get_args();
    $lines = array_pop($args);
    $lines = str_replace("\r", "\n", $lines);
    return '<pre>' . htmlspecialchars(convert_html($lines)) . '</pre>';
}
/**
 * CSS Style Plugin
 *  
 * @author     sonots
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @link       http://lsx.sourceforge.jp/?Plugin%2Fstyle.inc.hp
 * @version    $Id: style.inc.php,v 1.5 2008-01-04 19:02:47Z sonots $
 * @package    plugin
 */
function plugin_style_convert()
{
    $args = func_get_args();
    $end = end($args);
    if (substr($end, -1) == "\r") {
        $body = array_pop($args);
    }
    $options = array('style' => NULL, 'class' => NULL, 'addstyle' => NULL, 'addclass' => NULL, 'putclass' => NULL, 'putstyle' => NULL, 'end' => FALSE);
    foreach ($args as $arg) {
        list($key, $val) = array_pad(explode('=', $arg, 2), 2, TRUE);
        if (array_key_exists($key, $options)) {
            $options[$key] = $val;
        } else {
            // default
            $options['style'] = $arg;
        }
    }
    $open = '';
    $open .= !is_null($options['class']) ? ' class="' . htmlspecialchars($options['class']) . '"' : '';
    $open .= !is_null($options['style']) ? ' style="' . htmlspecialchars($options['style']) . '"' : '';
    $open = $open != '' ? '<div' . $open . '>' . "\n" : '';
    if (isset($body)) {
        $body = str_replace("\r", "\n", $body);
        $body = convert_html($body);
        plugin_style_replace_leadingtag($body, $options['addstyle'], $options['addclass'], $options['putstyle'], $options['putclass']);
    }
    $close = isset($body) && $open != '' || $options['end'] ? '</div>' : '';
    return $open . $body . $close;
}
function plugin_update_entities_action()
{
    global $script, $vars;
    global $_entities_messages;
    if (PKWK_READONLY) {
        die_message('PKWK_READONLY prohibits this');
    }
    $msg = $body = '';
    if (empty($vars['action']) || empty($vars['adminpass']) || !pkwk_login($vars['adminpass'])) {
        $msg =& $_entities_messages['title_update'];
        $items = plugin_update_entities_create();
        $body = convert_html(sprintf($_entities_messages['msg_usage'], join("\n" . '-', $items)));
        $body .= <<<EOD
<form method="POST" action="{$script}">
 <div>
  <input type="hidden" name="plugin" value="update_entities" />
  <input type="hidden" name="action" value="update" />
  <label for="_p_update_entities_adminpass">{$_entities_messages['msg_adminpass']}</label>
  <input type="password" name="adminpass" id="_p_update_entities_adminpass" size="20" value="" />
  <input type="submit" value="{$_entities_messages['btn_submit']}" />
 </div>
</form>
EOD;
    } else {
        if ($vars['action'] == 'update') {
            plugin_update_entities_create(TRUE);
            $msg =& $_entities_messages['title_update'];
            $body =& $_entities_messages['msg_done'];
        } else {
            $msg =& $_entities_messages['title_update'];
            $body =& $_entities_messages['err_invalid'];
        }
    }
    return array('msg' => $msg, 'body' => $body);
}
Example #11
0
function plugin_links_action()
{
    global $script, $post, $vars, $foot_explain;
    global $_links_messages;
    if (PKWK_READONLY) {
        die_message('PKWK_READONLY prohibits this');
    }
    $msg = $body = '';
    if (empty($vars['action']) || empty($post['adminpass']) || !pkwk_login($post['adminpass'])) {
        $msg =& $_links_messages['title_update'];
        $body = convert_html($_links_messages['msg_usage']);
        $body .= <<<EOD
<form method="POST" action="{$script}">
 <div>
  <input type="hidden" name="plugin" value="links" />
  <input type="hidden" name="action" value="update" />
  <label for="_p_links_adminpass">{$_links_messages['msg_adminpass']}</label>
  <input type="password" name="adminpass" id="_p_links_adminpass" size="20" value="" />
  <input type="submit" value="{$_links_messages['btn_submit']}" />
 </div>
</form>
EOD;
    } elseif ($vars['action'] == 'update') {
        links_init();
        $foot_explain = array();
        // Exhaust footnotes
        $msg =& $_links_messages['title_update'];
        $body =& $_links_messages['msg_done'];
    } else {
        $msg =& $_links_messages['title_update'];
        $body =& $_links_messages['err_invalid'];
    }
    return array('msg' => $msg, 'body' => $body);
}
Example #12
0
/**
 *   QHM Scroll Box Plugin
 *   -------------------------------------------
 *   plugin/scrollbox.inc.php
 *   
 *   Copyright (c) 2010 hokuken
 *   http://hokuken.com/
 *   
 *   Usage :
 *   
 */
function plugin_scrollbox_convert()
{
    $args = func_get_args();
    $last = func_num_args() - 1;
    if (strpos($args[$last], 'style=') === 0) {
    } elseif (strpos($args[$last], 'class=') === 0) {
    } else {
        $body = array_pop($args);
    }
    list($w, $h, $option) = array_pad($args, 3, '');
    $w = $w == '' ? '100%' : $w;
    $h = $h == '' ? '200px' : $h;
    $option = $option == '' ? 'overflow:auto;border:1px solid #dcdcdc;padding:5px 10px;margin-left:auto;margin-right:auto;text-align:justify;' : $option;
    $option = h($option);
    if (isset($body)) {
        $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
        $lines = explode("\n", $body);
        $body = convert_html($lines);
    } else {
        $body = '';
    }
    $ret = '<div style= "';
    $ret .= 'width:' . $w . ';';
    $ret .= 'height:' . $h . ';';
    $ret .= $option . ';"';
    $ret .= '>';
    $ret .= $body;
    $ret .= '</div>';
    return $ret;
}
Example #13
0
function plugin_enull_inline()
{
    $args = func_get_args();
    array_pop($args);
    $lines = implode(',', $args);
    convert_html($lines);
    return '';
}
Example #14
0
/**
 *   OpenGraphProtocol Plugin
 *   -------------------------------------------
 *   ogp.inc.php
 *
 *   Copyright (c) 2011 hokuken
 *   http://hokuken.com/
 *
 *   created  : 2011-10-28
 *   modified :
 *
 *   Description
 *
 *   Usage :
 *
 */
function plugin_ogp_convert()
{
    global $script, $vars, $ogp_tag;
    //$ogp_tag を有効にする
    $ogp_tag = 1;
    $qt = get_qt();
    $data = $qt->getv('plugin_ogp_tags');
    if (!$data) {
        $data = array();
    }
    //管理者かどうか
    $editable = edit_auth($page, FALSE, FALSE);
    //引数を解析する
    $args = func_get_args();
    $params = explode("\r", array_pop($args));
    $desc = '';
    $aliases = plugin_ogp_get_aliases();
    foreach ($params as $i => $param) {
        if (preg_match('/^([\\w:]+)=(.*)$/', $param, $mts)) {
            $key = $mts[1];
            $val = $mts[2];
            if (isset($aliases[$key])) {
                $key = $aliases[$key];
            }
            $data[$key] = $val;
        } else {
            $desc .= $param . "\n";
        }
    }
    if (trim($desc) != '') {
        $data['og:description'] = $desc;
    }
    if (!$qt->getv('plugin_ogp_tags')) {
        $qt->setv('plugin_ogp_tags', $data);
    }
    $html = '';
    if ($editable) {
        $editlink = $script . '?cmd=edit&page=' . rawurlencode($vars['page']);
        $conflink = $script . '?cmd=qhmsetting&phase=sns&mode=form';
        $fb_debugger_link = 'http://developers.facebook.com/tools/debug/og/object?q=' . rawurlencode($script . '?' . rawurlencode($vars['page']));
        $wiki = '
----
\'\'【お知らせ】Open Graph Protocol タグが変更されています。\'\'
変更するには[[このページを編集してください>' . $editlink . ']]

例えばFacebook での表示は以下のようになります。
#style(class=box_gray_ssm){{
#{ogp_preview}
}}
※Facebook のチェックツールは[[こちら>' . $fb_debugger_link . ']]
※画像がない場合、OGP設定のサイト画像が表示されます。
サイト画像の変更は[[こちら>' . $conflink . ']]
----
';
        $html .= str_replace('#{ogp_preview}', plugin_ogp_get_preview(), convert_html($wiki));
    }
    return $html;
}
Example #15
0
/**
 *   QHM Nav plugin
 *   -------------------------------------------
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 2014/06/11
 *   modified :
 *
 *   Switch Nav content and convert
 *
 *   Usage :
 *     #nav(OtherSiteNavigator)
 *
 */
function plugin_nav_convert()
{
    global $vars, $navbar;
    static $nav = NULL;
    $qm = get_qm();
    $qt = get_qt();
    $num = func_num_args();
    if ($num > 0) {
        // Try to change default 'SiteNavigator' page name (only)
        if ($num > 1) {
            return '#nav: 引数が多すぎます。' . "<br />\n";
        }
        if ($nav !== NULL) {
            return '#nav: 既に変更されています:' . h($nav) . "<br />\n";
        }
        if ($qt->getv('plugin_nav_source')) {
            return '#nav: 既にナビの内容を変更しています。' . "<br />\n";
        }
        $args = func_get_args();
        //ナビの内容を受け取る
        if (strpos($args[0], "\r") !== FALSE) {
            if (isset($vars['page_alt'])) {
                return '#nav: 利用できません。';
            }
            $source = str_replace("\r", "\n", $args[0]);
            $qt->setv_once('plugin_nav_source', $source);
            return '';
        }
        if (!is_page($args[0])) {
            return 'ページがみつかりません:' . h($args[0]) . "<br />\n";
        } else {
            $nav = $args[0];
            // Set
            return '';
        }
    } else {
        // Output navbar page data
        $page = $nav === NULL ? $navbar : $nav;
        if ($source = $qt->getv('plugin_nav_source')) {
            // Cut fixed anchors
            $source = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', $source);
            return convert_html($source);
        }
        if (!is_page($page)) {
            return '';
        } else {
            if (isset($vars['preview']) && $vars['page'] == $page) {
                // Cut fixed anchors
                $navtext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', $vars['msg']);
                return convert_html($navtext);
            } else {
                // Cut fixed anchors
                $navtext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
                return convert_html($navtext);
            }
        }
    }
}
Example #16
0
function plugin_fb_likegate_convert()
{
    global $vars, $script, $nowindow;
    $qm = get_qm();
    $qt = get_qt();
    $editable = edit_auth($page, FALSE, FALSE);
    //本文部分以外のページに設置した場合、無効にする
    if (isset($vars['page_alt']) && is_page($vars['page_alt'])) {
        if ($editable) {
            return 'error: #fb_likegate: 本文に設置してください。';
        } else {
            return '';
        }
    }
    $page = isset($vars['page']) ? $vars['page'] : '';
    //キャッシュ無効
    $qt->enable_cache = false;
    $args = func_get_args();
    if (count($args) === 0) {
        return $qm->replace('fmt_err_cvt', 'fb_likegate', $qm->m['plg_fb_likegate']['err_usage']);
    }
    list($unlike_page) = $args;
    $fb_apps_url = plugin_fb_root_get_apps_url();
    //Facebook からのアクセス
    if ($signed_request = plugin_fb_root_parse_request()) {
        $nowindow = 1;
        $edit_url = $script . '?cmd=edit&page=' . rawurlencode($page);
        plugin_fb_root_set_page();
        $liked = (isset($signed_request->page->liked) and !is_null($signed_request->page->liked)) ? $signed_request->page->liked : $signed_request->page['liked'];
        if ($liked) {
            $src = get_source($page);
            foreach ($src as $i => $line) {
                if (strpos($line, '#fb_likegate') === 0) {
                    unset($src[$i]);
                    break;
                }
            }
            $body = convert_html($src);
        } else {
            $src = get_source($unlike_page);
            foreach ($src as $i => $line) {
                if (strpos($line, '#fb_page') === 0) {
                    unset($src[$i]);
                }
            }
            $body = convert_html($src);
        }
        if ($editable) {
            $add_body = convert_html($qm->replace('plg_fb_likegate.ntc_admin_fb', $edit_url, $unlike_page, $fb_apps_url));
        }
        force_output_message('', '', $add_body . $body);
    } else {
        if ($editable) {
            return convert_html($qm->replace('plg_fb_likegate.ntc_admin', $unlike_page, $fb_apps_url));
        }
        force_output_message($qm->m['plg_fb_likegate']['ntc_title'], '', $qm->m['plg_fb_likegate']['ntc_msg']);
    }
}
Example #17
0
function plugin_checkagree_convert()
{
    static $s_chkagree_cnt = 0;
    //jquery ライブラリの読み込み
    $qt = get_qt();
    $qm = get_qm();
    $qt->setv('jquery_include', true);
    $body = '';
    $args = func_get_args();
    $body = array_pop($args);
    if (count($args) > 2) {
        return $qm->replace('fmt_err_iln', 'size', $qm->m['plg_checkagree']['err_usage']);
    }
    list($label, $align) = array_pad($args, 2, '');
    if (array_key_exists($label, array('left' => '', 'center' => '', 'right' => ''))) {
        $align = $label;
        $label = $qm->m['plg_checkagree']['label'];
    }
    $label = $label != '' ? $label : $qm->m['plg_checkagree']['label'];
    $align = $align != '' ? $align : $qm->m['plg_checkagree']['align'];
    if (!array_key_exists($align, array('left' => '', 'center' => '', 'right' => ''))) {
        $align = $qm->m['plg_checkagree']['align'];
    }
    //Convert multi-line args to HTML
    if (isset($body)) {
        $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
        $lines = explode("\n", $body);
        $body = convert_html($lines);
        $body = '<div style="text-align:' . $align . ';"><label><input type="checkbox" name="agreement" value="1" style="margin-right:3px;" />' . $label . '</label></div><div class="agree_box">' . $body . '</div>';
    } else {
        $body = '';
    }
    // はじめての定義の場合、javascriptを出力
    if ($s_chkagree_cnt == 0) {
        $head = '
<script type="text/javascript">
$(document).ready(function(){
	$("div.agree_box").css({display:"none"});
	$("input:checkbox[name=agreement]")
		.click(function(){
			if ($(this).is(":checked")) {
				$(this).parent().parent().next("div.agree_box").fadeIn();
			}
			else {
				$(this).parent().parent().next("div.agree_box").fadeOut();
			}
		});
});
</script>
<style type="text/css">
</style>
';
        $qt->appendv_once('plugin_checkagree', 'beforescript', $head);
    }
    return $body;
}
Example #18
0
function plugin_nolink_convert()
{
    $argv = func_get_args();
    $argc = func_num_args();
    if ($argc < 1) {
        return '';
    }
    $data = $argv[--$argc];
    return strip_a(convert_html(line2array($data)));
}
Example #19
0
function plugin_table_pagenate_convert()
{
    $argv = func_get_args();
    $argc = func_num_args();
    if ($argc < 1) {
        return '<p class="alert alert-warning">#pagenate() Please insert table</p>';
    }
    $data = $argv[--$argc];
    array_pop($argv);
    return preg_replace('/data-pagenate="false"/', 'data-pagenate="true"', convert_html(line2array($data)));
}
function plugin_showrss_action()
{
    $xml_extension = extension_loaded('xml');
    $mbstring_extension = extension_loaded('mbstring');
    $xml_msg = $xml_extension ? 'xml extension is loaded' : 'COLOR(RED){xml extension is not loaded}';
    $mbstring_msg = $mbstring_extension ? 'mbstring extension is loaded' : 'COLOR(RED){mbstring extension is not loaded}';
    $showrss_info = '';
    $showrss_info .= "| xml parser | {$xml_msg} |\n";
    $showrss_info .= "| multibyte | {$mbstring_msg} |\n";
    return array('msg' => 'showrss_info', 'body' => convert_html($showrss_info));
}
 function exec()
 {
     global $vars, $get, $post;
     $tmp = $vars['page'];
     $pages = $this->get_pages();
     foreach ($pages as $page) {
         $get['page'] = $post['page'] = $vars['page'] = $page;
         convert_html(get_source($page));
     }
     $get['page'] = $post['page'] = $vars['page'] = $tmp;
     return '<p><b>Exec was done. </b></p>';
 }
Example #22
0
function plugin_showrss_action()
{
    if (PKWK_SAFE_MODE) {
        die_message('PKWK_SAFE_MODE prohibit this');
    }
    $body = '';
    foreach (array('xml', 'mbstring') as $extension) {
        ${$extension} = extension_loaded($extension) ? '&color(green){Found};' : '&color(red){Not found};';
        $body .= '| ' . $extension . ' extension | ' . ${$extension} . ' |' . "\n";
    }
    return array('msg' => 'showrss_info', 'body' => convert_html($body));
}
Example #23
0
function plugin_showrss_action()
{
    $qm = get_qm();
    $xml_extension = extension_loaded('xml');
    $mbstring_extension = extension_loaded('mbstring');
    $xml_msg = $xml_extension ? $qm->m['plg_showrss']['ex_xml_loaded'] : 'COLOR(RED){' . $qm->m['plg_showrss']['err_ex_xml_load'] . '}';
    $mbstring_msg = $mbstring_extension ? $qm->m['plg_showrss']['ex_mbs_loaded'] : 'COLOR(RED){' . $qm->m['plg_showrss']['err_ex_mbs_load'] . '}';
    $showrss_info = '';
    $showrss_info .= "| xml parser | {$xml_msg} |\n";
    $showrss_info .= "| multibyte | {$mbstring_msg} |\n";
    return array('msg' => 'showrss_info', 'body' => convert_html($showrss_info));
}
Example #24
0
function plugin_span_convert()
{
    $argv = func_get_args();
    $argc = func_num_args();
    if ($argc < 1) {
        return '<p class="alert alert-warning">#span([1-12])</p>';
    }
    $data = $argv[--$argc];
    array_pop($argv);
    $colum = isset($argv[0]) && is_numeric($argv[0]) ? $argv[0] : 12;
    $size = isset($argv[1]) ? Utility::htmlsc($argv[1]) : 'md';
    return '<div class="col-' . $size . '-' . $colum . '">' . "\n" . convert_html(line2array($data)) . "\n" . '</div>' . "\n";
}
Example #25
0
function plugin_loglist_convert()
{
    global $script, $log;
    global $vars;
    global $_loglist_messages;
    @(list($kind) = func_get_args());
    $kind = empty($kind) ? 'update' : htmlspecialchars($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, create_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=';
    $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 convert_html($rc);
}
Example #26
0
function plugin_style2_convert()
{
    $args = func_get_args();
    $last = func_num_args() - 1;
    if (strpos($args[$last], 'style=') === 0) {
    } elseif (strpos($args[$last], 'class=') === 0) {
    } elseif ($args[$last] == "L") {
    } elseif ($args[$last] == "R") {
    } else {
        $body = array_pop($args);
    }
    $options = array();
    foreach ($args as $arg) {
        list($key, $val) = explode('=', $arg, 2);
        $options[$key] = htmlspecialchars($val);
    }
    if (isset($body)) {
        $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
        $lines = explode("\n", $body);
        $body = convert_html($lines);
    } else {
        $body = '';
    }
    $colstyle = "";
    if (isset($options['L'])) {
        $colstyle = "width:45%;float:left;text-align:left;";
    }
    if (isset($options['R'])) {
        $colstyle = "width:45%;float:left;text-align:left;margin-left:10px;";
    }
    if (isset($options['AL'])) {
        $colstyle = "float:left;text-align:left;margin-right:1em;";
    }
    if (isset($options['AR'])) {
        $colstyle = "float:right;text-align:left;margin-left:1em;";
    }
    $style = "";
    if ($colstyle != "" || isset($options['style'])) {
        $style = ' style="' . $colstyle;
        $style .= isset($options['style']) ? $options['style'] : '';
        $style .= '"';
    }
    $ret = '<div';
    $ret .= isset($options['class']) ? ' class="' . $options['class'] . ' qhm-block"' : '';
    $ret .= $style;
    $ret .= '>';
    $ret .= $body;
    $ret .= '</div>';
    return $ret;
}
Example #27
0
function plugin_gmapfun_action()
{
    global $vars;
    $page = $vars['page'];
    $body = '';
    if (is_page($page)) {
        $body = convert_html(get_source($page));
        $qt = get_qt();
        $before = $qt->getv('beforescript');
    }
    pkwk_common_headers();
    print $before . $body;
    exit;
}
Example #28
0
function plugin_menu_convert()
{
    global $vars, $menubar;
    static $menu = NULL;
    $num = func_num_args();
    if ($num > 0) {
        // Try to change default 'MenuBar' page name (only)
        if ($num > 1) {
            return '#menu(): Zero or One argument needed';
        }
        if ($menu !== NULL) {
            return '#menu(): Already set: ' . htmlspecialchars($menu);
        }
        $args = func_get_args();
        if (!is_page($args[0])) {
            return '#menu(): No such page: ' . htmlspecialchars($args[0]);
        } else {
            $menu = $args[0];
            // Set
            return '';
        }
    } else {
        // Output menubar page data
        $page = $menu === NULL ? $menubar : $menu;
        if (MENU_ENABLE_SUBMENU) {
            $path = explode('/', strip_bracket($vars['page']));
            while (!empty($path)) {
                $_page = join('/', $path) . '/' . MENU_SUBMENUBAR;
                if (is_page($_page)) {
                    $page = $_page;
                    break;
                }
                array_pop($path);
            }
        }
        if (!is_page($page)) {
            return '';
        } else {
            if ($vars['page'] == $page) {
                return '<!-- #menu(): You already view ' . htmlspecialchars($page) . ' -->';
            } else {
                // Cut fixed anchors
                $menutext = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/m', '$1$2', get_source($page));
                return preg_replace('/<ul[^>]*>/', '<ul>', convert_html($menutext));
            }
        }
    }
}
Example #29
0
function plugin_preview_action()
{
    global $vars;
    $page = isset($vars['page']) ? $vars['page'] : '';
    if (is_page($page)) {
        check_readable($page, true, true);
        $source = get_source($page);
        array_splice($source, 10);
        $body = convert_html($source);
        pkwk_common_headers();
        header('Content-type: text/xml');
        print '<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n";
        print $body;
    }
    exit;
}
function plugin_includesubmenu_convert()
{
    global $script, $vars;
    $ShowPageName = FALSE;
    if (func_num_args()) {
        $aryargs = func_get_args();
        if ($aryargs[0] == 'showpagename') {
            $ShowPageName = TRUE;
        }
    }
    $SubMenuPageName = '';
    $tmppage = strip_bracket($vars['page']);
    //下階層のSubMenuページ名
    $SubMenuPageName1 = $tmppage . '/SubMenu';
    //同階層のSubMenuページ名
    $LastSlash = strrpos($tmppage, '/');
    if ($LastSlash === FALSE) {
        $SubMenuPageName2 = 'SubMenu';
    } else {
        $SubMenuPageName2 = substr($tmppage, 0, $LastSlash) . '/SubMenu';
    }
    //echo "$SubMenuPageName1 <br />";
    //echo "$SubMenuPageName2 <br />";
    //下階層にSubMenuがあるかチェック
    //あれば、それを使用
    if (is_page($SubMenuPageName1)) {
        //下階層にSubMenu有り
        $SubMenuPageName = $SubMenuPageName1;
    } else {
        if (is_page($SubMenuPageName2)) {
            //同階層にSubMenu有り
            $SubMenuPageName = $SubMenuPageName2;
        } else {
            //SubMenu無し
            return "";
        }
    }
    $body = convert_html(get_source($SubMenuPageName));
    if ($ShowPageName) {
        $r_page = rawurlencode($SubMenuPageName);
        $s_page = htmlspecialchars($SubMenuPageName);
        $link = "<a href=\"{$script}?cmd=edit&amp;page={$r_page}\">{$s_page}</a>";
        $body = "<h1>{$link}</h1>\n{$body}";
    }
    return $body;
}