/**
 * GreyBox (gb_pageset) プラグイン
 *
 * @copyright   Copyright &copy; 2009, Katsumi Saito <*****@*****.**>
 * @version     $Id: gb_pageset.inc.php,v 0.1 2009/03/31 00:37:00 upk Exp $
 * @link	http://orangoo.com/labs/GreyBox/
 */
function plugin_gb_pageset_convert()
{
    global $script, $vars;
    static $get_greybox = true;
    if ($get_greybox) {
        $get_greybox = false;
        if (exist_plugin('greybox')) {
            greybox_set_head_tags();
        } else {
            die_message('greybox plugin not found.');
        }
    }
    $argv = func_get_args();
    $argc = func_num_args();
    $field = array('page_set_name', 'caption', 'url');
    for ($i = 0; $i < $argc; $i++) {
        ${$field}[$i] = htmlspecialchars($argv[$i], ENT_QUOTES);
    }
    if (empty($page_set_name) || empty($url)) {
        return 'usage: #gb_pageset(page_set_name, caption, url)';
    }
    if (empty($caption)) {
        $caption = 'no title';
    }
    $caption = str_replace('&amp;#039;', '\'', $caption);
    // ' の対応
    return '<a href="' . $url . '" title="' . $caption . '" rel="gb_pageset[' . $page_set_name . ']">' . $caption . "</a>\n";
}
示例#2
0
/**
 *   Facebook Inframe Page Plugin
 *   -------------------------------------------
 *   fb_page.inc.php
 *   
 *   Copyright (c) 2011 hokuken
 *   http://hokuken.com/
 *   
 *   created  : 2011-07-26
 *   modified :
 *   
 *   「いいね!」ボタンを押した人だけ見られるページにできる
 *   
 *   Usage :
 *   
 */
function plugin_fb_page_init()
{
    if (!exist_plugin("fb_root")) {
        die('Cannot find fb_root plugin');
    }
    do_plugin_init("fb_root");
}
示例#3
0
文件: file.php 项目: lolo3-sight/wiki
function page_write($page, $postdata, $notimestamp = FALSE)
{
    global $trackback;
    if (PKWK_READONLY) {
        return;
    }
    // Do nothing
    $postdata = make_str_rules($postdata);
    // Create and write diff
    $oldpostdata = is_page($page) ? join('', get_source($page)) : '';
    $diffdata = do_diff($oldpostdata, $postdata);
    file_write(DIFF_DIR, $page, $diffdata);
    // Create backup
    make_backup($page, $postdata == '');
    // Is $postdata null?
    // Create wiki text
    file_write(DATA_DIR, $page, $postdata, $notimestamp);
    if ($trackback) {
        // TrackBack Ping
        $_diff = explode("\n", $diffdata);
        $plus = join("\n", preg_replace('/^\\+/', '', preg_grep('/^\\+/', $_diff)));
        $minus = join("\n", preg_replace('/^-/', '', preg_grep('/^-/', $_diff)));
        tb_send($page, $plus, $minus);
    }
    links_update($page);
    // kazuwaya
    if (exist_plugin('ajaxtree')) {
        plugin_ajaxtree_write_after();
    }
}
示例#4
0
/**
 *   Facebook LikeBox Plugin
 *   -------------------------------------------
 *   ./plugin/fb_likebox.inc.php
 *
 *   Copyright (c) 2015 hokuken
 *   http://hokuken.com/
 *
 *   created  : 2015-06-11
 *   modified :
 *
 *   Put Facebook Page Plugin
 *
 *   Usage : #fb_pagebox
 *
 */
function plugin_fb_pagebox_init()
{
    if (!exist_plugin("fb_root")) {
        die('Fatal error: fb_root plugin not found');
    }
    do_plugin_init("fb_root");
}
示例#5
0
function plugin_fb_comments_convert()
{
    global $script, $vars;
    $page = $vars['page'];
    $r_page = rawurlencode($page);
    $qm = get_qm();
    $qt = get_qt();
    $args = func_get_args();
    if (!exist_plugin("fb_root")) {
        die('Fatal error: fb_root plugin not found');
    }
    $orders = array('social', 'reverse_time', 'time');
    // scaffold
    $def_attrs = array('href' => '', 'width' => FALSE, 'numposts' => '2', 'colorscheme' => 'light', 'mobile' => FALSE, 'order-by' => array(FALSE, $orders));
    $attrs = plugin_fb_root_parse_args($args, $def_attrs);
    //default URL set
    if ($attrs['href'] == '') {
        if ($page === $defaultpage) {
            $attrs['href'] = dirname($script . 'dummy');
        } else {
            $attrs['href'] = $script . '?' . $r_page;
        }
    }
    plugin_fb_root_set_jsapi(TRUE);
    $tag = plugin_fb_root_create_tag('fb-comments', $attrs);
    $body = $tag;
    return $tag;
}
function plugin_monobook_toolbox_convert()
{
    global $vars, $_monobook_toolbox_messages;
    $items = func_get_args();
    if (empty($items)) {
        $items = array('add', 'backup', 'copy', 'diff', 'edit', 'filelist', 'freeze', 'help', 'list', 'new', 'rdf', 'recent', 'refer', 'related', 'reload', 'rename', 'rss', 'rss10', 'rss20', 'search', 'source', 'top', 'trackback', 'upload', 'attachlist', 'attachlistall', 'yetlist');
    }
    if (!exist_plugin('monobook_getlink')) {
        return;
    }
    $body = '<div class="toolbox"><ul>';
    foreach ($items as $item) {
        if (!$item && $body !== '<div class="toolbox"><ul>') {
            $body .= '</ul><hr /><ul>';
            continue;
        }
        $link = plugin_monobook_getlink($item, $_monobook_toolbox_messages);
        if ($link) {
            $body .= '<li>' . $link . '</li>';
        }
    }
    if (substr($body, -15) === '</ul><hr /><ul>') {
        $body = substr($body, 0, -15);
    }
    $body .= '</ul></div>';
    return $body;
}
示例#7
0
/** $Id: l.inc.php 227 2007-01-13 15:35:48Z sonots $
 * multilang wrapper. Shorten the word 'multilang' to 'l'
 * Usage: See multilang plugin
 */
function plugin_l_init()
{
    exist_plugin('multilang');
    // to require_once
    if (function_exists('plugin_multilang_init')) {
        plugin_multilang_init();
    }
}
示例#8
0
function exist_plugin_inline($name)
{
	if (!exist_plugin($name))
	{
		return FALSE;
	}
	return function_exists('plugin_'.$name.'_inline');
}
示例#9
0
/**
 *   トップに戻るリンク
 *   -------------------------------------------
 *   scrollup.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 14/08/26
 *   modified :
 *
 *   Usage :
 *     #scrollup
 *
 */
function plugin_scrollup_convert()
{
    $args = func_get_args();
    $qt = get_qt();
    $target = 'body';
    $title = 'トップ';
    if (count($args) > 0) {
        $target = h(trim($args[0]));
        if (isset($args[1])) {
            $title = h(trim($args[1]));
        }
    }
    if (exist_plugin('icon')) {
        plugin_icon_set_font_awesome();
    }
    $add_style = <<<EOD
<style data-qhm-plugin="scrollup">
.qhm-plugin-scrollup {
  color: inherit;
  bottom: 10px;
  right: 10px;
  cursor: pointer;
}
.qhm-plugin-scrollup.affix:hover {
  color: inherit;
  opacity: .8;
}
</style>
EOD;
    $qt->appendv_once('plugin_scrollup_style', 'beforescript', $add_style);
    $add_script = <<<EOD
<script data-qhm-plugin="scrollup">
\$(function() {
    \$("body").append('<a class="qhm-plugin-scrollup"></a>').find(".qhm-plugin-scrollup")
    .html('<i class="fa fa-arrow-up fa-2x"></i>')
    .attr({
      'data-target': "{$target}",
      'title': "{$title}"
    })
    .affix({
      offset: {
        top: 50
      }
    });

    \$(".qhm-plugin-scrollup").on("click", function(e){
      QHM.scroll(\$(this).data("target"));
      e.preventDefault();
      return false;
    });
});
</script>
EOD;
    $qt->appendv_once('plugin_scrollup_script', 'lastscript', $add_script);
    return;
}
示例#10
0
/**
 *   Bootstrap Thumbnails Plugin
 *   -------------------------------------------
 *   /plugin/thumbnails.inc.php
 *   
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *   
 *   created  : 14/06/10
 *   modified :
 *   
 *   Description
 *   
 *   Usage :
 *   
 */
function plugin_thumbnails_convert()
{
    if (!exist_plugin('cols')) {
        return '';
    }
    plugin_cols_type('set', 'thumbnails');
    $args = func_get_args();
    $body = call_user_func_array('plugin_cols_convert', $args);
    plugin_cols_type('set', 'normal');
    return $body;
}
示例#11
0
function plugin_navibar2_convert()
{
    global $vars, $hr;
    $page = strip_bracket($vars['page']);
    $navi_page = plugin_navibar2_search_navipage($page);
    if (!empty($navi_page)) {
        return plugin_navibar2_makehtml($navi_page);
    }
    exist_plugin('navibar');
    return do_plugin_convert('navibar', NAVIBAR2_DEFAULT_PARM) . $hr;
}
function plugin_monobook_navigation($wikinote, $tabs, $background)
{
    global $vars, $plugin, $_monobook_navigation_messages;
    if (!exist_plugin('monobook_getlink')) {
        die('monobook_getlink plugin not found');
    }
    do_plugin_init('monobook_navigation');
    $main_tabs = '';
    if ($wikinote->is_effect()) {
        $main_tabs = str_replace(array('<ul class="wikinote">', '</ul>', "\n"), '', $wikinote->show_tabs(array(array('cmd' => 'main', 'label' => $_monobook_navigation_messages['article']), array('cmd' => 'note', 'label' => $_monobook_navigation_messages['discuss']))));
    }
    $sub_tabs = '';
    $selected_flag = FALSE;
    foreach ($tabs as $tab) {
        if ($tab === 'edit' && is_freeze($vars['page']) && !in_array('source', $tabs)) {
            $tab = 'source';
        }
        if ($tab === 'edit' && $plugin === 'paraedit') {
            $tab = 'paraedit';
        }
        if ($tab === 'edit' && exist_plugin('revert') && plugin_revert_getlink()) {
            $tab = 'revert';
        }
        list($link, $selected) = plugin_monobook_getlink($tab, $_monobook_navigation_messages, TRUE);
        if (!$link) {
            continue;
        }
        if ($selected) {
            $sub_tabs .= '<li class="selected">' . $link . '</li>';
            $selected_flag = TRUE;
        } else {
            $sub_tabs .= '<li>' . $link . '</li>';
        }
    }
    if (!$selected_flag) {
        $link = plugin_monobook_getlink('nowplugin', $_monobook_navigation_messages);
        if (!$main_tabs) {
            if ($link) {
                $sub_tabs = '<li class="selected" id="separate">' . $link . '</li>' . $sub_tabs;
            } else {
                $sub_tabs = '<li class="selected"><a href="' . get_script_uri() . strrchr($_SERVER['REQUEST_URI'], '?') . '">' . $_monobook_navigation_messages['undefined'] . '</a></li>';
            }
        } elseif ($main_tabs && !arg_check('read') && $link) {
            $sub_tabs = '<li class="selected">' . $link . '</li>' . $sub_tabs;
        }
    }
    return '<div id="navigator"><ul' . $background . '>' . $main_tabs . $sub_tabs . '</ul></div>' . "\n";
}
function plugin_rewritemap_url($page)
{
    global $defaultpage;
    $script = get_script_uri();
    $baseurl = substr($script, 0, strrpos($script, '/')) . '/';
    if ($page == $defaultpage) {
        return $baseurl;
    }
    $alias = plugin_rewritemap_get_alias($page);
    if (empty($alias)) {
        if (exist_plugin('statichtml')) {
            $alias = PluginStatichtml::encode($page);
        } else {
            $alias = str_replace('%2F', '/', rawurlencode($page));
        }
    }
    return $baseurl . $alias . PLUGIN_REWRITEMAP_POSTFIX;
}
示例#14
0
function plugin_brokenlink_action()
{
    global $vars, $_brokenlink_msg;
    $retval = array('msg' => $_brokenlink_msg['msg_title'], 'body' => '');
    if (empty($vars['page'])) {
        $retval['body'] = $_brokenlink_msg['msg_param_error'];
        return $retval;
    }
    // ユーザ認証されていない
    $id = Auth::check_auth();
    if (empty($id)) {
        $retval['body'] = $_brokenlink_msg['msg_not_access'];
        return $retval;
    }
    if (!exist_plugin('xbel')) {
        $retval['body'] = $_brokenlink_msg['msg_not_found_xbel'];
        return $retval;
    }
    $links = xbel::get_link_list($vars['page']);
    $data = '';
    foreach ($links as $href => $aname) {
        $rc = http_request($href, 'HEAD');
        switch ($rc['rc']) {
            case 200:
                // Ok
            // Ok
            case 301:
                // Moved Permanently
            // Moved Permanently
            case 401:
                // Unauthorized
                continue;
            default:
                $data .= '-[[' . $aname . '>' . $href . ']] (' . $rc['rc'] . ")\n";
        }
    }
    if ($data == '') {
        $data = $_brokenlink_msg['msg_all_ok'];
    }
    $retval['body'] = RendererFactorty::factory($data);
    return $retval;
}
function plugin_gcounter_init_gcounter()
{
    if (is_page(PLUGIN_GCOUNTER_PAGE)) {
        return;
    }
    if (!exist_plugin('counter')) {
        return;
    }
    $pages = get_existpages();
    $gtotal = $gtoday = $gyesterday = 0;
    $gdate = $gip = '';
    foreach ($pages as $file => $page) {
        $counter = COUNTER_DIR . encode($page) . PLUGIN_COUNTER_SUFFIX;
        $lines = file($counter);
        $lines = array_map('rtrim', $lines);
        $total = $lines[0];
        $date = $lines[1];
        $today = $lines[2];
        $yesterday = $lines[3];
        $ip = $lines[4];
        $gtotal += $total;
        // Ignore today, yesterday because they must take into account
        // $date (when is today), but will be deleted tomorrow.
        // date and ip are also not important.
    }
    $counter = COUNTER_DIR . encode(PLUGIN_GCOUNTER_PAGE) . PLUGIN_COUNTER_SUFFIX;
    $source = "{$gtotal}\n{$gdate}\n{$gtoday}\n{$gyesterday}\n{$gip}\n";
    if (!($fp = fopen($counter, "w"))) {
        return FALSE;
    }
    if (!fwrite($fp, $source)) {
        return FALSE;
    }
    fclose($fp);
    page_write(PLUGIN_GCOUNTER_PAGE, "Log Page for Global Counter\n#counter");
}
示例#16
0
/**
 *   eyecatch setting
 *   -------------------------------------------
 *   eyecatch.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 13/02/14
 *   modified : 14/01/09
 *
 *   Description
 *
 *   Usage :
 *
 */
function plugin_eyecatch_convert()
{
    // アイキャッチのslideプラグインで判別するため
    // true: タイトルがh1に、false: タイトルがh3に
    global $is_eyecatch;
    static $exclusive = FALSE;
    $args = func_get_args();
    if (!$exclusive) {
        if (($idx = array_search('force', $args)) !== FALSE) {
            $exclusive = TRUE;
            array_splice($args, $idx, 1);
        }
        $html = '';
        $is_eyecatch = TRUE;
        if (exist_plugin('section')) {
            array_unshift($args, 'eyecatch');
            $html = call_user_func_array('plugin_section_convert', $args);
        }
        $is_eyecatch = FALSE;
        $qt = get_qt();
        $qt->setv('main_visual', '<div id="qhm_eyecatch" class="qhm-eyecatch">' . $html . '</div>');
    }
    return '';
}
示例#17
0
<?php

exist_plugin('iframe');
$plugin_iframe = new PluginIframe();
$plugin_iframe->accept_regurl = array('^' . preg_quote('http://www.google.com') . '$', '^' . preg_quote('http://pukiwiki.sourceforge.jp/dev/'));
$plugin_iframe->accept_url = array('http://pukiwiki.sourceforge.jp');
示例#18
0
function plugin_login_action()
{
    global $vars, $auth_type, $auth_users, $realm;
    $api = empty($vars['api']) ? 'plus' : $vars['api'];
    if ($api != 'plus') {
        if (!exist_plugin($vars['api'])) {
            return;
        }
        $call_api = 'plugin_' . $vars['api'] . '_jump_url';
        header('Location: ' . $call_api());
        die;
    }
    // NTLM, Negotiate 認証 (IIS 4.0/5.0)
    $srv_soft = defined('SERVER_SOFTWARE') ? SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'];
    if (substr($srv_soft, 0, 9) == 'Microsoft') {
        auth::auth_ntlm();
        login_return_page();
    }
    switch ($auth_type) {
        case 1:
            if (!auth::auth_pw($auth_users)) {
                unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
                header('HTTP/1.0 401 Unauthorized');
                header('WWW-Authenticate: Basic realm="' . $realm . '"');
            } else {
                // FIXME
                // 認証成功時は、もともとのページに戻れる
                // 下に記述すると認証すら行えないなぁ
                login_return_page();
            }
            break;
        case 2:
            if (!auth::auth_digest($auth_users)) {
                header('HTTP/1.1 401 Unauthorized');
                header('WWW-Authenticate: Digest realm="' . $realm . '", qop="auth", nonce="' . uniqid() . '", opaque="' . md5($realm) . '"');
            } else {
                login_return_page();
            }
            break;
    }
}
示例#19
0
<?php

require_once dirname(__FILE__) . '/sonots/sonots.class.php';
require_once dirname(__FILE__) . '/sonots/option.class.php';
require_once dirname(__FILE__) . '/sonots/pagelist.class.php';
require_once dirname(__FILE__) . '/sonots/metapage.class.php';
require_once dirname(__FILE__) . '/sonots/tag.class.php';
exist_plugin('new');
// new option
exist_plugin('contentsx');
// contents option
exist_plugin('includex');
// include option
//error_reporting(E_ALL);
/**
 * List Tagged Pages Plugin
 *
 * @package    plugin
 * @license    http://www.gnu.org/licenses/gpl.html GPL v2
 * @author     sonots <http://lsx.sourceforge.jp>
 * @link       http://lsx.sourceforge.jp/?Plugin%2Ftag.inc.php
 * @version    $Id: taglist.inc.php,v 2.0 2008-07-18 07:23:17Z sonots $
 * @require    sonots/sonots     v 1.13
 * @require    sonots/option     v 1.8
 * @require    sonots/pagelist   v 1.4
 * @require    sonots/metapage   v 1.11
 * @require    sonots/tag        v 1.0
 * @require    contentsx         v 2.0
 * @require    includex          v 2.0
 * @compatible tagcloud.inc.php  v 2.0
 * @compatible tag.inc.php       v 2.0
function plugin_commentx_convert()
{
    global $vars, $digest;
    //, $_btn_comment, $_btn_name, $_msg_comment;
    static $numbers = array();
    static $all_numbers = 0;
    $_btn_name = _("Name: ");
    $_btn_comment = _("Post Comment");
    $_msg_comment = _("Comment: ");
    $auth_guide = '';
    if (PKWK_READONLY == ROLE_AUTH) {
        // Plus!
        if (exist_plugin('login')) {
            $auth_guide = do_plugin_inline('login');
        }
    }
    if (is_callable(array('auth', 'check_role'))) {
        // Plus!
        if (auth::check_role('readonly')) {
            return $auth_guide;
        }
    } else {
        if (PKWK_READONLY) {
            return '';
        }
    }
    if (!isset($numbers[$vars['page']])) {
        $numbers[$vars['page']] = 0;
    }
    $comment_no = $numbers[$vars['page']]++;
    $comment_all_no = $all_numbers++;
    $options = func_num_args() ? func_get_args() : array();
    $noname = in_array('noname', $options);
    $nodate = in_array('nodate', $options) ? '1' : '0';
    $above = in_array('above', $options) ? '1' : (in_array('below', $options) ? '0' : PLUGIN_COMMENTX_DIRECTION_DEFAULT);
    $textarea = in_array('textarea', $options) ? TRUE : (in_array('textfield', $options) ? FALSE : PLUGIN_COMMENTX_TEXTAREA);
    list($user, $link, $disabled) = plugin_commentx_get_nick();
    if ($noname) {
        $nametags = '<label for="_p_comment_comment_' . $comment_all_no . '">' . $_msg_comment . '</label>';
    } else {
        if ($textarea) {
            $nametags = '<label for="_p_comment_name_' . $comment_all_no . '">' . $_btn_name . '</label>' . '<input type="text" name="name" id="_p_comment_name_' . $comment_all_no . '" size="' . PLUGIN_COMMENTX_SIZE_TEXTAREA_NAME . '" value="' . $user . '"' . $disabled . ' /><br />' . "\n";
        } else {
            $nametags = '<label for="_p_comment_name_' . $comment_all_no . '">' . $_btn_name . '</label>' . '<input type="text" name="name" id="_p_comment_name_' . $comment_all_no . '" size="' . PLUGIN_COMMENTX_SIZE_NAME . '" value="' . $user . '"' . $disabled . ' />' . "\n";
        }
    }
    if ($textarea) {
        $comment_box = '<textarea name="msg" id="_p_comment_comment_{' . $comment_all_no . '}" rows="' . PLUGIN_COMMENTX_SIZE_TEXTAREA_ROWS . '" style="width:' . PLUGIN_COMMENTX_SIZE_TEXTAREA_COLS . ';" /></textarea>';
    } else {
        $comment_box = '<input type="text"   name="msg" id="_p_comment_comment_{' . $comment_all_no . '}" style="width:' . PLUGIN_COMMENTX_SIZE_MSG . ';" />';
    }
    if (function_exists('edit_form_assistant')) {
        // Plus!
        $helptags = edit_form_assistant();
    }
    $refpage = '';
    $script = get_script_uri();
    $s_page = htmlspecialchars($vars['page']);
    $r_page = htmlspecialchars(rawurlencode($vars['page']));
    $ticket = md5(MUTIME);
    if (function_exists('pkwk_session_start') && pkwk_session_start() != 0) {
        $keyword = $ticket;
        $_SESSION[$keyword] = md5(get_ticket() . $digest);
    }
    $string = <<<EOD
<br />
{$auth_guide}
<form action="{$script}?{$r_page}" method="post">
 <div class="commentform" onmouseup="pukiwiki_pos()" onkeyup="pukiwiki_pos()">
  <input type="hidden" name="refpage" value="{$refpage}" />
  <input type="hidden" name="plugin" value="commentx" />
  <input type="hidden" name="refer"  value="{$s_page}" />
  <input type="hidden" name="comment_no" value="{$comment_no}" />
  <input type="hidden" name="nodate" value="{$nodate}" />
  <input type="hidden" name="above"  value="{$above}" />
  <input type="hidden" name="digest" value="{$digest}" />
  <input type="hidden" name="ticket" value="{$ticket}" />
  {$nametags}
  {$comment_box}
  <input type="submit" name="comment" value="{$_btn_comment}" />
  {$helptags}
 </div>
</form>
EOD;
    return $string;
}
示例#21
0
}
?>


<?php 
echo $hr;
if (exist_plugin_convert('footarea') && do_plugin_convert('footarea') != '') {
    ?>
<div id="footer">
<?php 
    echo do_plugin_convert('footarea');
    ?>
</div>
<?php 
} else {
    if (exist_plugin('toolbar')) {
        echo do_plugin_convert('toolbar', 'reload,|,new,edit,freeze,diff,upload,copy,rename,|,top,list,search,recent,backup,refer,|,help,|,mixirss');
    }
    if ($lastmodified) {
        ?>
<div id="lastmodified">
 Last-modified: <?php 
        echo $lastmodified;
        ?>
</div>
<?php 
    }
    ?>


<?php 
示例#22
0
function plugin_guiedit_write()
{
    global $vars;
    global $guiedit_use_fck;
    if (!isset($vars['page'])) {
        Utility::dieMessage('Pagename is missing!');
    }
    if ($guiedit_use_fck) {
        $vars['msg'] = Xhtml2WikiFactory::factory($vars['msg']);
    }
    if (isset($vars['id']) && $vars['id']) {
        $source = preg_split('/([^\\n]*\\n)/', $vars['original'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        if (plugin_guiedit_parts($vars['id'], $source, $vars['msg']) !== FALSE) {
            $vars['msg'] = join("\n", $source);
        } else {
            $vars['msg'] = rtrim($vars['original']) . "\n\n" . $vars['msg'];
        }
    }
    //	書き込み
    exist_plugin('edit');
    return plugin_edit_write();
}
示例#23
0
function plugin_paint_action()
{
    global $script, $vars, $pkwk_dtd, $_paint_messages;
    // if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
    if (auth::check_role('readonly')) {
        die_message('PKWK_READONLY prohibits editing');
    }
    //戻り値を初期化
    $retval['msg'] = $_paint_messages['msg_title'];
    $retval['body'] = '';
    if (array_key_exists('attach_file', $_FILES) and array_key_exists('refer', $vars)) {
        $file = $_FILES['attach_file'];
        //BBSPaiter.jarは、shift-jisで内容を送ってくる。面倒なのでページ名はエンコードしてから送信させるようにした。
        $vars['page'] = $vars['refer'] = decode($vars['refer']);
        $filename = $vars['filename'];
        $filename = mb_convert_encoding($filename, SOURCE_ENCODING, 'auto');
        //ファイル名置換
        $attachname = preg_replace('/^[^\\.]+/', $filename, $file['name']);
        //すでに存在した場合、 ファイル名に'_0','_1',...を付けて回避(姑息)
        $count = '_0';
        while (file_exists(UPLOAD_DIR . encode($vars['refer']) . '_' . encode($attachname))) {
            $attachname = preg_replace('/^[^\\.]+/', $filename . $count++, $file['name']);
        }
        $file['name'] = $attachname;
        if (!exist_plugin('attach') or !function_exists('attach_upload')) {
            return array('msg' => 'attach.inc.php not found or not correct version.');
        }
        $retval = attach_upload($file, $vars['refer'], TRUE);
        if ($retval['result'] == TRUE) {
            $retval = paint_insert_ref($file['name']);
        }
    } else {
        $message = '';
        $refer = $s_refer = '';
        if (array_key_exists('refer', $vars)) {
            $refer = $vars['refer'];
            $s_refer = htmlspecialchars($vars['refer']);
        }
        $url = get_page_uri($refer);
        $link = "<p><a href=\"{$url}\">{$s_refer}</a></p>";
        $w = PAINT_APPLET_WIDTH;
        $h = PAINT_APPLET_HEIGHT;
        //ウインドウモード :)
        if ($w < 50 and $h < 50) {
            $w = $h = 0;
            $retval['msg'] = '';
            $vars['page'] = $vars['refer'];
            $vars['cmd'] = 'read';
            $retval['body'] = convert_html(get_source($vars['refer']));
            $link = '';
        }
        //XSS脆弱性問題 - 外部から来た変数をエスケープ
        $width = empty($vars['width']) ? PAINT_DEFAULT_WIDTH : $vars['width'];
        $height = empty($vars['height']) ? PAINT_DEFAULT_HEIGHT : $vars['height'];
        $f_w = (is_numeric($width) and $width > 0) ? $width : PAINT_DEFAULT_WIDTH;
        $f_h = (is_numeric($height) and $height > 0) ? $height : PAINT_DEFAULT_HEIGHT;
        $f_refer = array_key_exists('refer', $vars) ? encode($vars['refer']) : '';
        // BBSPainter.jarがshift-jisに変換するのを回避
        $f_digest = array_key_exists('digest', $vars) ? htmlspecialchars($vars['digest']) : '';
        $f_no = (array_key_exists('paint_no', $vars) and is_numeric($vars['paint_no'])) ? $vars['paint_no'] + 0 : 0;
        if ($f_w > PAINT_MAX_WIDTH) {
            $f_w = PAINT_MAX_WIDTH;
        }
        if ($f_h > PAINT_MAX_HEIGHT) {
            $f_h = PAINT_MAX_HEIGHT;
        }
        $retval['body'] .= <<<EOD
 <div>
 {$link}
 {$message}
 <applet codebase="." archive="BBSPainter.jar" code="Main.class" width="{$w}" height="{$h}">
 <param name="size" value="{$f_w},{$f_h}" />
 <param name="action" value="{$script}" />
 <param name="image" value="attach_file" />
 <param name="form1" value="filename={$_paint_messages['field_filename']}=!" />
 <param name="form2" value="yourname={$_paint_messages['field_name']}" />
 <param name="comment" value="msg={$_paint_messages['field_comment']}" />
 <param name="param1" value="plugin=paint" />
 <param name="param2" value="refer={$f_refer}" />
 <param name="param3" value="digest={$f_digest}" />
 <param name="param4" value="max_file_size=1000000" />
 <param name="param5" value="paint_no={$f_no}" />
 <param name="enctype" value="multipart/form-data" />
 <param name="return.URL" value="{$url}" />
 </applet>
 </div>
EOD;
        // XHTML 1.0 Transitional
        if (!isset($pkwk_dtd) || $pkwk_dtd == PKWK_DTD_XHTML_1_1) {
            $pkwk_dtd = PKWK_DTD_XHTML_1_0_TRANSITIONAL;
        }
    }
    return $retval;
}
示例#24
0
function plugin_auth_mixi_action()
{
    global $vars, $auth_api, $_auth_mixi_msg;
    if (!isset($auth_api['openid']['use'])) {
        return '';
    }
    if (!$auth_api['openid']['use']) {
        die($_auth_mixi_msg['msg_invalid']);
    }
    // マイミク認証のみ許可
    list($openid_url, $icon_img) = auth_mixi_set_loginuri('friends', '', PLUGIN_AUTH_MIXI_MY_ID);
    exist_plugin('openid');
    $vars['action'] = 'verify';
    $vars['openid_url'] = $openid_url;
    $vars['author'] = 'auth_mixi';
    return do_plugin_action('openid');
}
示例#25
0
function plugin_search2_form($s_word = '', $type = '', $bases = array())
{
    global $script;
    $qm = get_qm();
    $qt = get_qt();
    $cols = 12;
    $offset = 0;
    $show_type_selector = false;
    $btn_type = 'default';
    $form_type = '';
    foreach ($bases as $base) {
        $base = trim($base);
        switch ($base) {
            case 'showtype':
                $show_type_selector = true;
                break;
            case preg_match('/^(\\d+)(?:\\+(\\d+))?$/', $base, $mts) ? true : false:
                $cols = $mts[1];
                $offset = isset($mts[2]) && $mts[2] ? $mts[2] : $offset;
                break;
            case 'primary':
            case 'success':
            case 'info':
            case 'warning':
            case 'danger':
            case 'default':
                $btn_type = $base;
                break;
            case 'compact':
                $form_type = $base;
                break;
        }
    }
    $width_class = 'col-sm-' . $cols;
    if ($offset) {
        $width_class .= ' col-sm-offset-' . $offset;
    }
    $and_check = $or_check = '';
    if ($type == 'OR') {
        $or_check = ' checked="checked"';
    } else {
        $and_check = ' checked="checked"';
    }
    $type_selector_html = '<input type="hidden" name="type" value="AND" />';
    if ($show_type_selector) {
        $type_selector_html = <<<EOD
<div class="form-group">
  <label class="radio-inline" style="display:inline-block;">
    <input type="radio" name="type" value="AND" {$and_check} /> {$qm->m['plg_search']['lbl_and']}
  </label>
  <label class="radio-inline" style="display:inline-block;">
    <input type="radio" name="type" value="OR"  {$or_check}  /> {$qm->m['plg_search']['lbl_or']}
  </label>
</div>
EOD;
    }
    if ($form_type === 'compact') {
        $html = '
<form action="' . $script . '" method="get" class="qhm-search2 form-inline" data-plugin="search2">
  <input type="hidden" name="cmd" value="search2" />
  <input type="hidden" name="type" value="AND" />
  <div class="form-group">
    <input type="text"  name="word" value="' . h($s_word) . '" class="form-control" placeholder="検索ワード" />
  </div>
</form>
';
    } else {
        $html = '
<form action="' . $script . '" method="get" class="qhm-search2 form-inline" data-plugin="search2">
  <input type="hidden" name="cmd" value="search2" />
  <div class="input-group ' . $width_class . '">
    <input type="text"  name="word" value="' . h($s_word) . '" class="form-control" placeholder="検索ワード" />
    <div class="input-group-btn">
      <input class="btn btn-' . $btn_type . '" type="submit" value="検索" />
    </div>
  </div>
  ' . $type_selector_html . '
</form>
';
    }
    $style = '';
    if (exist_plugin('icon')) {
        plugin_icon_set_font_awesome();
        $style = '
<style>
[data-plugin=search2] > div.input-group,
[data-plugin=search2] > div.form-group {
    position: relative;
}
[data-plugin=search2] > div.input-group:before,
[data-plugin=search2] > div.form-group:before {
    font-family: FontAwesome;
    content: "\\f002";
    position:absolute;
    top:8px;
    left:10px;
    z-index: 3;
    color: #999;
    line-height: 1.42857143;
}
[data-plugin=search2] input[type=text] {
    padding-left:30px;
}
</style>
';
    }
    $qt->appendv_once("plugin_search2_style", "beforescript", $style);
    return $html;
}
示例#26
0
/**
 *   convert haik to qhm
 *   -------------------------------------------
 *   convert_haik.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 14/06/17
 *   modified :
 *
 *   Description
 *   
 *   
 *   Usage :
 *   
 */
function plugin_convert_haik_init()
{
    if (!exist_plugin('qhmsetting')) {
        die("error: There is no qhmsetting.");
    }
}
 function narrow_lines()
 {
     $parser = new PluginIncludexOptionParser();
     if (!empty($this->options['section'][1]) && exist_plugin('contentsx')) {
         $this->section_lines();
     }
     $this->filter_lines();
     $this->except_lines();
     $num = sizeof($this->lines);
     $this->options['num'][1] = $parser->parse_numoption($this->options['num'][1], 1, $num);
     if ($parser->error !== "") {
         $this->error = $parser->error;
         return;
     }
     $this->num_filter_lines();
     $this->cut_head_lines();
 }
示例#28
0
    } else {
        $msg = 'plugin=' . htmlspecialchars($plugin) . ' is not implemented.';
        $retvars = array('msg' => $msg, 'body' => $msg);
        $base =& $defaultpage;
    }
}
// Location で飛ぶようなプラグインの対応のため
// 上のアクションプラグインの実行後に処理を実施
if ($is_protect) {
    if (exist_plugin_convert('protect')) {
        do_plugin_convert('protect');
    }
    die('PLUS_PROTECT_MODE is set.');
}
// WebDAV
if (is_webdav() && exist_plugin('dav')) {
    do_plugin_action('dav');
    exit;
}
// Set Home
$auth_key = auth::get_user_info();
if (!empty($auth_key['home'])) {
    if ($base == $defaultpage || $base == $auth_key['home']) {
        $base = $defaultpage = $auth_key['home'];
    }
}
// Page output
$title = htmlspecialchars(strip_bracket($base));
$page = make_search($base);
if (isset($retvars['msg']) && $retvars['msg'] != '') {
    $title = str_replace('$1', $title, $retvars['msg']);
示例#29
0
/**
* Determine Facebook social plugin is deprecated
*
* @param string $fb_plugin_name Facebook Social Plugin Name
* @return false|callable when enable alt plugin
*/
function plugin_fb_root_is_deprecated($fb_plugin_name)
{
    $expired = strtotime('2015-06-23') < time();
    if (!$expired) {
        return FALSE;
    }
    $show_deprecated = 'plugin_fb_root_deprecated';
    switch ($fb_plugin_name) {
        case 'likebox':
            if (exist_plugin('fb_pagebox')) {
                return 'plugin_fb_pagebox_convert';
            } else {
                return $show_deprecated;
            }
        case 'recommends':
            return $show_deprecated;
    }
    return FALSE;
}
/*<script type="text/javascript" src="<?php echo SKIN_URI ?>greybox/greybox.js"></script>*/
/*<link rel="stylesheet" href="<?php echo SKIN_URI ?>greybox/greybox.css" type="text/css" media="all" charset="<?php echo $css_charset ?>" />*/
echo $head_tag;
?>
</head>

<body>
<div id="wrapper"><!-- BEGIN id:wrapper -->

<!-- Navigator  ======================================================= -->
<div id="popUpContainer">
<?php 
if (exist_plugin('navibar2')) {
    echo do_plugin_convert('navibar2');
} else {
    if (exist_plugin('navibar')) {
        echo do_plugin_convert('navibar', 'top,list,search,recent,help,|,new,edit,upload,|,trackback');
        echo $hr;
    }
}
?>
</div>

<!-- Content ========================================================= -->
<div id="main"><!-- BEGIN id:main -->
<div id="wrap_content"><!-- BEGIN id:wrap_content -->
<div id="content"><!-- BEGIN id:content -->

<?php 
if ($wikinote->is_effect()) {
    echo $wikinote_navi;