Пример #1
0
function do_plugin_action($name)
{
    if (!exist_plugin_action($name)) {
        return array();
    }
    if (do_plugin_init($name) === FALSE) {
        die_message('Plugin init failed: ' . $name);
    }
    $retvar = call_user_func('plugin_' . $name . '_action');
    // Insert a hidden field, supports idenrtifying text enconding
    if (PKWK_ENCODING_HINT != '') {
        $retvar = preg_replace('/(<form[^>]*>)/', '$1' . "\n" . '<div><input type="hidden" name="encode_hint" value="' . PKWK_ENCODING_HINT . '" /></div>', $retvar);
    }
    return $retvar;
}
Пример #2
0
/////////////////////////////////////////////////
// Main
$retvars = array();
$is_cmd = FALSE;
if (isset($vars['cmd'])) {
    $is_cmd = TRUE;
    $plugin =& $vars['cmd'];
} else {
    if (isset($vars['plugin'])) {
        $plugin =& $vars['plugin'];
    } else {
        $plugin = '';
    }
}
if ($plugin != '') {
    if (exist_plugin_action($plugin)) {
        // Found and exec
        $retvars = do_plugin_action($plugin);
        if ($retvars === FALSE) {
            exit;
        }
        // Done
        if ($is_cmd) {
            $base = isset($vars['page']) ? $vars['page'] : '';
        } else {
            $base = isset($vars['refer']) ? $vars['refer'] : '';
        }
    } else {
        // Not found
        $msg = 'plugin=' . htmlsc($plugin) . ' is not implemented.';
        $retvars = array('msg' => $msg, 'body' => $msg);
Пример #3
0
function catbody($title, $page, $body)
{
    global $script, $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $cantedit, $function_freeze;
    global $search_word_color, $_msg_word, $foot_explain, $note_hr, $head_tags;
    global $trackback, $trackback_javascript, $referer, $javascript;
    global $nofollow;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    if (!file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        die_message('SKIN_FILE is not found');
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if ($trackback && $trackback_javascript) {
        $javascript = 1;
    }
    // Set something If you want
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    // Set $_LINK for skin
    $_LINK['add'] = "{$script}?cmd=add&amp;page={$r_page}";
    $_LINK['backup'] = "{$script}?cmd=backup&amp;page={$r_page}";
    $_LINK['copy'] = "{$script}?plugin=template&amp;refer={$r_page}";
    $_LINK['diff'] = "{$script}?cmd=diff&amp;page={$r_page}";
    $_LINK['edit'] = "{$script}?cmd=edit&amp;page={$r_page}";
    $_LINK['filelist'] = "{$script}?cmd=filelist";
    $_LINK['freeze'] = "{$script}?cmd=freeze&amp;page={$r_page}";
    $_LINK['help'] = "{$script}?" . rawurlencode($help_page);
    $_LINK['list'] = "{$script}?cmd=list";
    $_LINK['new'] = "{$script}?plugin=newpage&amp;refer={$r_page}";
    $_LINK['rdf'] = "{$script}?cmd=rss&amp;ver=1.0";
    $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew);
    $_LINK['refer'] = "{$script}?plugin=referer&amp;page={$r_page}";
    $_LINK['reload'] = "{$script}?{$r_page}";
    $_LINK['rename'] = "{$script}?plugin=rename&amp;refer={$r_page}";
    $_LINK['rss'] = "{$script}?cmd=rss";
    $_LINK['rss10'] = "{$script}?cmd=rss&amp;ver=1.0";
    // Same as 'rdf'
    $_LINK['rss20'] = "{$script}?cmd=rss&amp;ver=2.0";
    $_LINK['search'] = "{$script}?cmd=search";
    $_LINK['top'] = "{$script}?" . rawurlencode($defaultpage);
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = "{$script}?plugin=tb&amp;__mode=view&amp;tb_id={$tb_id}";
    }
    $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&amp;page={$r_page}";
    $_LINK['upload'] = "{$script}?plugin=attach&amp;pcmd=upload&amp;page={$r_page}";
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_new =& $_LINK['new'];
    // New!
    $link_edit =& $_LINK['edit'];
    $link_diff =& $_LINK['diff'];
    $link_top =& $_LINK['top'];
    $link_list =& $_LINK['list'];
    $link_filelist =& $_LINK['filelist'];
    $link_search =& $_LINK['search'];
    $link_whatsnew =& $_LINK['recent'];
    $link_backup =& $_LINK['backup'];
    $link_help =& $_LINK['help'];
    $link_trackback =& $_LINK['trackback'];
    // New!
    $link_rdf =& $_LINK['rdf'];
    // New!
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    // New!
    $link_rss20 =& $_LINK['rss20'];
    // New!
    $link_freeze =& $_LINK['freeze'];
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    $link_template =& $_LINK['copy'];
    $link_refer =& $_LINK['refer'];
    // New!
    $link_rename =& $_LINK['rename'];
    // Init flags
    $is_page = is_pagename($_page) && !arg_check('backup') && $_page != $whatsnew;
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? format_date(get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = $attach_link && $is_read && exist_plugin_action('attach') ? attach_filelist() : '';
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_msg_word . htmlsc($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        // with array_splice(), array_flip()
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlsc($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    require SKIN_FILE;
}
Пример #4
0
function catbody($title, $page, $body)
{
    global $script;
    // MUST BE SKIN.FILE. Do not delete line.
    global $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $function_freeze;
    global $search_word_color, $foot_explain, $note_hr, $head_tags, $foot_tags;
    global $trackback, $referer, $javascript;
    global $newtitle, $newbase, $language, $use_local_time;
    // Plus! skin extension
    global $nofollow;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    global $skin_file, $menubar, $sidebar;
    global $_string;
    if (!defined('SKIN_FILE') || !file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        if (!file_exists($skin_file) || !is_readable($skin_file)) {
            die_message(SKIN_FILE . '(skin file) is not found.');
        } else {
            define('SKIN_FILE', $skin_file);
        }
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    // Set $_LINK for skin
    $_LINK['add'] = get_cmd_uri('add', $_page);
    $_LINK['backup'] = get_cmd_uri('backup', $_page);
    $_LINK['brokenlink'] = get_cmd_uri('brokenlink', $_page);
    $_LINK['copy'] = get_cmd_uri('template', '', '', 'refer=' . $r_page);
    $_LINK['diff'] = get_cmd_uri('diff', $_page);
    $_LINK['edit'] = get_cmd_uri('edit', $_page);
    $_LINK['guiedit'] = get_cmd_uri('guiedit', $_page);
    $_LINK['filelist'] = get_cmd_uri('filelist');
    $_LINK['freeze'] = get_cmd_uri('freeze', $_page);
    $_LINK['help'] = get_cmd_uri('help');
    $_LINK['linklist'] = get_cmd_uri('linklist', $_page);
    $_LINK['list'] = get_cmd_uri('list');
    $_LINK['log_login'] = get_cmd_uri('logview', '', '', 'kind=login');
    $_LINK['log_browse'] = get_cmd_uri('logview', $_page, '', 'kind=browse');
    $_LINK['log_update'] = get_cmd_uri('logview', $_page);
    $_LINK['log_down'] = get_cmd_uri('logview', $_page, '', 'kind=download');
    $_LINK['log_check'] = get_cmd_uri('logview', $_page, '', 'kind=check');
    $_LINK['menu'] = get_page_uri($menubar);
    $_LINK['new'] = get_cmd_uri('newpage', '', '', 'refer=' . $r_page);
    $_LINK['newsub'] = get_cmd_uri('newpage_subdir', '', '', 'directory=' . $r_page);
    $_LINK['print'] = get_cmd_uri('print', $_page);
    $_LINK['full'] = get_cmd_uri('print', $_page) . '&amp;nohead&amp;nofoot';
    $_LINK['read'] = get_page_uri($_page);
    $_LINK['recent'] = get_page_uri($whatsnew);
    $_LINK['refer'] = get_cmd_uri('referer', $_page);
    $_LINK['reload'] = get_page_absuri($_page);
    // 本当は、get_script_uri でいいけど、絶対パスでないと、スキンに影響が出る
    $_LINK['reload_rel'] = get_page_uri($_page);
    $_LINK['rename'] = get_cmd_uri('rename', '', '', 'refer=' . $r_page);
    $_LINK['skeylist'] = get_cmd_uri('skeylist', $_page);
    $_LINK['search'] = get_cmd_uri('search');
    $_LINK['side'] = get_page_uri($sidebar);
    $_LINK['source'] = get_cmd_uri('source', $_page);
    $_LINK['template'] = get_cmd_uri('template', '', '', 'refer=' . $r_page);
    $_LINK['top'] = get_page_uri($defaultpage);
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = get_cmd_uri('tb', '', '', '__mode=view&tb_id=' . $tb_id);
    }
    $_LINK['unfreeze'] = get_cmd_uri('unfreeze', $_page);
    $_LINK['upload'] = get_cmd_uri('attach', $_page, '', 'pcmd=upload');
    // link rel="alternate" にも利用するため absuri にしておく
    $_LINK['rdf'] = get_cmd_absuri('rss', '', 'ver=1.0');
    $_LINK['rss'] = get_cmd_absuri('rss');
    $_LINK['rss10'] = get_cmd_absuri('rss', '', 'ver=1.0');
    // Same as 'rdf'
    $_LINK['rss20'] = get_cmd_absuri('rss', '', 'ver=2.0');
    $_LINK['mixirss'] = get_cmd_absuri('mixirss');
    // Same as 'rdf' for mixi
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_backup =& $_LINK['backup'];
    $link_brokenlink =& $_LINK['brokenlink'];
    $link_template =& $_LINK['copy'];
    $link_diff =& $_LINK['diff'];
    $link_edit =& $_LINK['edit'];
    $link_guiedit =& $_LINK['guiedit'];
    $link_filelist =& $_LINK['filelist'];
    $link_freeze =& $_LINK['freeze'];
    $link_help =& $_LINK['help'];
    $link_linklist =& $_LINK['linklist'];
    $link_list =& $_LINK['list'];
    $link_log_login =& $_LINK['log_login'];
    $link_log_browse =& $_LINK['log_browse'];
    $link_log_update =& $_LINK['log_update'];
    $link_log_down =& $_LINK['log_down'];
    $link_log_check =& $_LINK['log_check'];
    $link_menu =& $_LINK['menu'];
    $link_new =& $_LINK['new'];
    $link_newsub =& $_LINK['newsub'];
    $link_print =& $_LINK['print'];
    $link_full =& $_LINK['full'];
    $link_read =& $_LINK['read'];
    $link_whatsnew =& $_LINK['recent'];
    $link_refer =& $_LINK['refer'];
    $link_reload =& $_LINK['reload'];
    $link_reload_rel =& $_LINK['reload_rel'];
    $link_rename =& $_LINK['rename'];
    $link_skeylist =& $_LINK['skeylist'];
    $link_search =& $_LINK['search'];
    $link_side =& $_LINK['side'];
    $link_source =& $_LINK['source'];
    $link_top =& $_LINK['top'];
    if ($trackback) {
        $link_trackback =& $_LINK['trackback'];
    }
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    //
    $link_rdf =& $_LINK['rdf'];
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    $link_rss20 =& $_LINK['rss20'];
    $link_mixirss =& $_LINK['mixirss'];
    // Init flags
    $is_page = is_pagename($_page) && !arg_check('backup') && !is_cantedit($_page);
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? get_date('D, d M Y H:i:s T', get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = '';
    if ($attach_link && $is_read && exist_plugin_action('attach')) {
        if (do_plugin_init('attach') !== FALSE) {
            $attaches = attach_filelist();
        }
    }
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    $foot_tag = !empty($foot_tags) ? join("\n", $foot_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_string['word'] . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlspecialchars($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    // Compat: 'HTML convert time' without time about MenuBar and skin
    $taketime = elapsedtime();
    require SKIN_FILE;
}
Пример #5
0
function edit_form($page, $postdata, $digest = FALSE, $b_template = TRUE)
{
    global $script, $vars, $rows, $cols, $hr, $function_freeze;
    global $_btn_preview, $_btn_repreview, $_btn_update, $_btn_cancel, $_msg_help;
    global $whatsnew, $_btn_template, $_btn_load, $load_template_func;
    global $notimeupdate;
    global $qhm_access_key;
    global $qblog_defaultpage, $style_name, $date_format, $qblog_default_cat;
    $qt = get_qt();
    //accesskey setting
    $accesskey = array();
    foreach (array('r', 'p', 's', 'c') as $v) {
        $accesskey[$v] = $qhm_access_key ? 'accesskey="' . $v . '"' : '';
    }
    // Newly generate $digest or not
    if ($digest === FALSE) {
        $digest = md5(join('', get_source($page)));
    }
    $refer = $template = $headertitle = '';
    // Add plugin
    $addtag = $add_top = '';
    if (isset($vars['add'])) {
        global $_btn_addtop;
        $addtag = '<input type="hidden" name="add"    value="true" />';
        $add_top = isset($vars['add_top']) ? ' checked="checked"' : '';
        $add_top = '<input type="checkbox" name="add_top" ' . 'id="_edit_form_add_top" value="true"' . $add_top . ' />' . "\n" . '  <label for="_edit_form_add_top" class="checkbox">' . '<span class="small">' . $_btn_addtop . '</span>' . '</label>';
    }
    if ($load_template_func && $b_template) {
        $pages = array();
        foreach (get_existpages() as $_page) {
            if ($_page == $whatsnew || check_non_list($_page)) {
                continue;
            }
            $s_page = htmlspecialchars($_page);
            $pages[$_page] = '   <option value="' . $s_page . '">' . $s_page . '</option>';
        }
        ksort($pages);
        $s_pages = join("\n", $pages);
        $template = <<<EOD
  <select name="template_page">
   <option value="">-- {$_btn_template} --</option>
{$s_pages}
  </select>
  <input type="submit" name="template" value="{$_btn_load}" {$accesskey['r']} />
  <br />
EOD;
    }
    //新規作成の場合、ページ名を大見出しとして挿入する
    if (isset($vars['refer']) && $vars['refer'] != '') {
        $headertitle = "\n\n" . '* ' . strip_bracket($page) . "\n\n";
    }
    $r_page = rawurlencode($page);
    $s_page = htmlspecialchars($page);
    $s_digest = htmlspecialchars($digest);
    $s_postdata = htmlspecialchars($refer . $headertitle . $postdata);
    $s_original = isset($vars['original']) ? htmlspecialchars($vars['original']) : $s_postdata;
    $b_preview = isset($vars['preview']);
    // TRUE when preview
    $btn_preview = $b_preview ? $_btn_repreview : $_btn_preview;
    // Checkbox 'do not change timestamp'
    $add_notimestamp = '';
    if ($notimeupdate != 0) {
        global $_btn_notchangetimestamp;
        $checked_time = isset($vars['notimestamp']) ? ' checked="checked"' : '';
        // Only for administrator
        if ($notimeupdate == 2) {
            $add_notimestamp = '   ' . '<input type="password" name="pass" size="12" />' . "\n";
        }
        $add_notimestamp = '<label for="_edit_form_notimestamp" class="checkbox"><input type="checkbox" name="notimestamp" ' . 'id="_edit_form_notimestamp" value="true"' . $checked_time . ' tabindex="9" />' . "\n" . '   ' . '<span class="small">' . $_btn_notchangetimestamp . '</span></label>' . "\n" . $add_notimestamp . '&nbsp;';
    }
    $buttons_align = 'left';
    $blog_cancel_button = 'right';
    if (is_bootstrap_skin()) {
        $buttons_align = 'right';
        $blog_cancel_button = 'left';
    } else {
        //Bootstrap の読み込み
        $include_bs = '
<link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" />
<script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>';
        $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs);
    }
    // !ブログ用編集フォーム
    if ($page !== $qblog_defaultpage && is_qblog()) {
        //メタデータを取得
        $data = get_qblog_post_data($page);
        $data['title'] = isset($vars['title']) ? $vars['title'] : $data['title'];
        $data['category'] = isset($vars['category']) ? $vars['category'] : $data['category'];
        $data['image'] = isset($vars['image']) ? $vars['image'] : $data['image'];
        $date = get_qblog_date($date_format, $page);
        if (isset($vars['qblog_date']) && $date !== trim($vars['qblog_date'])) {
            $dates = array_pad(explode('-', $vars['qblog_date'], 3), 3, 0);
            $valid = checkdate($dates[1], $dates[2], $dates[0]);
            $date = $valid ? trim($vars['qblog_date']) : $date;
        }
        $category = isset($data['category']) && strlen(trim($data['category'])) > 0 ? $data['category'] : '';
        $qblog_categories = array_keys(get_qblog_categories());
        $qblog_cat_json = json_encode($qblog_categories);
        $h_qblog_cat_json = h(json_encode($qblog_categories));
        $qblog_cat_list = '<ul id="qblog_categories_selector" class="qblog_categories collapse">';
        foreach ($qblog_categories as $cat) {
            $qblog_cat_list .= '<li>' . h($cat) . '</li>';
        }
        $qblog_cat_list .= '</ul>';
        $h2title = '新規投稿';
        if (is_page($page)) {
            $h2title = $data['title'] . 'の編集';
        }
        $s_h2title = h($h2title);
        $s_blog_title = h($data['title']);
        $body = <<<EOD
<link rel="stylesheet" href="js/datepicker/css/datepicker.css" />
<link rel="stylesheet" href="plugin/qblog/qblog.css" />
<script src="js/datepicker/js/bootstrap-datepicker.js"></script>
<script tyle="text/javascript">
\$(function(){
\t\$('#qblog_datepicker').datepicker({
\t\tlanguage: "japanese"
//\t\tformat: "yyyy/mm/dd"
\t});
\tif (\$("input[name=category]").val().length == 0) {
\t\t\$('#qblog_cat_trigger').click();
\t}

\tif (\$('h2.title').length == 0) {
\t\t\$("#edit_form_main").before('<h2 class="title">{$s_h2title}</h2>');
\t}
\t\$('h2.title').text('{$s_h2title}');

\t\$('a.show-thumbnail').click(function(){
\t\tif (\$(this).next().is(':visible')) {
\t\t\t\$(this).next().hide();
\t\t}
\t\telse {
\t\t\t\$(this).next().show();
\t\t}
\t\treturn false;
\t});

});
</script>

<div class="qblog_edit_form">
<form action="{$script}" method="post" class="form-horizontal" id="edit_form_main">
{$template}
  {$addtag}
  <input type="hidden" name="cmd"    value="edit" />
  <input type="hidden" name="page"   value="{$s_page}" />
  <input type="hidden" name="digest" value="{$s_digest}" />
  <fieldset>
    <div class="form-group">
      <label class="control-label col-sm-2">日付</label>
      <div class="controls col-sm-10"><input type="text" name="qblog_date" id="qblog_datepicker" tabindex="1" class="datepicker form-control" size="16" value="{$date}"  data-date="{$date}"  data-date-format="yyyy-mm-dd" class="form-control" /></div>
    </div>
    <div class="form-group">
      <label class="control-label col-sm-2">タイトル</label>
      <div class="controls col-sm-10"><input type="text" name="title" value="{$s_blog_title}" tabindex="2" class="form-control" /></div>
  \t</div>
    <div class="form-group">
      <label class="control-label col-sm-2">カテゴリ</label>
      <div class="controls col-sm-10">
        <div class="input-group">
          <input type="text" name="category" value="{$category}" placeholder="{$qblog_default_cat}" tabindex="3" class="form-control" data-provide="typeahead" data-source="{$h_qblog_cat_json}" autocomplete="off" />
          <span class="input-group-btn">
            <button type="button" id="qblog_cat_trigger" class="btn btn-default qhm-btn-default" data-toggle="collapse" data-target="#qblog_categories_selector" style="color:#333">
              カテゴリ
              <span class="caret"></span>
            </button>
          </span>
        </div>
        {$qblog_cat_list}
      </div>
    </div>
      <div class="form-group">
          <label class="control-label col-sm-2">記事の内容</label>
          <div class="controls col-sm-10">
              <textarea name="msg" id="msg" tabindex="4" rows="20" class="form-control">{$s_postdata}</textarea>
  \t\t</div>
  \t</div>
      <div class="form-group">
          <div class="controls col-sm-10 col-sm-offset-2">
\t  \t\t<a class="show-thumbnail" href="#">サムネイルを指定する &gt;&gt;</a>
  \t\t\t<div class="set-thumbnail">
  \t\t\t\t<small>自動で本文の画像が使われます。<br />特別に指定したい場合、画像を画像名またはURLで指定してください。</small>
                  <p style="color:#333;">画像名またはURL:<input type="text" name="image" value="{$data['image']}" tabindex="5" class="form-control" /></p>
  \t\t\t\t<p><small><span class="swfu"><a href="swfu/index_child.php">&gt;&gt;QHMのファイル管理(SWFU)を使って画像をアップする</a></span></small></p>
  \t\t\t</div>
<!--  \t\t\t<span class="swfu"><a href="swfu/index_child.php"><i class="icon-picture"></i>SWFU</a><span>
\t\t\t<p class="help-block">SWFUの画像を使う場合、画像詳細画面の<b>URL</b>をコピペしてください。</p>
-->
  \t\t</div>
  \t</div>
      <div class="form-group">
        <div class="col-sm-10 col-sm-offset-2">
          <div style="float:{$buttons_align};">
            <input type="submit" name="preview" value="{$btn_preview}" tabindex="6" class="qhm-btn-default"/>
            <input type="submit" name="write"   value="{$_btn_update}" tabindex="7" class="qhm-btn-primary"/>
        \t\t{$add_notimestamp}
            {$add_top}
        \t\t<textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea>
          </div>
          <div style="float:{$buttons_align};">
            <input type="submit" name="cancel" value="{$_btn_cancel}" tabindex="8" class="btn-link"/>
          </div>
      </div>
  \t</div>
  </fieldset>
</form>
</div>

EOD;
    } else {
        $body = <<<EOD

<div class="edit_form">
 <form action="{$script}" method="post" style="margin-bottom:0px;" id="edit_form_main">
{$template}
  {$addtag}
  <input type="hidden" name="cmd"    value="edit" />
  <input type="hidden" name="page"   value="{$s_page}" />
  <input type="hidden" name="digest" value="{$s_digest}" />
  <div class="form-group">
    <textarea name="msg" id="msg" rows="{$rows}" cols="{$cols}" tabindex="2" class="form-control">{$s_postdata}</textarea>
  </div>
  <div style="float:{$buttons_align};">
   <input type="submit" name="preview" value="{$btn_preview}" tabindex="4" class="qhm-btn-default"/>
   <input type="submit" name="write"   value="{$_btn_update}" tabindex="5" class="qhm-btn-primary"/>
   {$add_top}
   {$add_notimestamp}
  </div>
  <textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea>
 </form>
 <form action="{$script}" method="post" style="margin-top:0px;margin-left:5px;float:{$buttons_align};" id="edit_form_cancel">
  <input type="hidden" name="cmd"    value="edit" />
  <input type="hidden" name="page"   value="{$s_page}" />
  <input type="submit" name="cancel" value="{$_btn_cancel}" tabindex="6" class="btn-link"/>
 </form>
 <div style="clear:both;"></div>
</div>
EOD;
    }
    $addscript = <<<EOD
<script data-qhm-plugin="edit">
\$(function(){

  if (\$("h2.title").length == 0) {
    \$(".edit_form").before('<h2 class="title">{$s_page} の編集</h2>');
  }
  \$("h2.title").css({fontSize: "14px", marginBottom: '15px'});

  \$("#editboxlink").on("click", function(){
    if (\$(".qblog_edit_form").length) {
      QHM.scroll(".qblog_edit_form", 300);
    }
    else {
      QHM.scroll("h2.title", 300);
    }
    \$("#msg").focus();
    return false;
  });

  if (\$("#preview_body").length) {
  }
  else {
    \$(".qhm-eyecatch").hide();

    setTimeout(function(){
      \$("html, body").animate({scrollTop: \$("h2.title").offset().top}, 300);
      \$("#msg").focus();
    }, 25);
  }
});
</script>
EOD;
    $qt->appendv_once("plugin_edit_form_script", 'lastscript', $addscript);
    // List of attached files to the page by hokuken.com
    $attaches = exist_plugin_action('attach') ? attach_filelist(true) : '';
    if ($attaches !== '') {
        $body .= <<<EOD
<script type="text/javascript" src="js/yahoo.js"></script>
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript" src="js/dom.js"></script>

<style type="text/css">
.yui-tt {
\tposition: absolute;
\tpadding: 5px;
\tbackground-color:#eee;
\tborder:1px solid #aaa;
}
</style>
<script type="text/javascript" src="js/container.js"></script>
<script type="text/javascript">
    function init() {
        var el = document.getElementById('attachlist');
        if(el != null){

\t        var list = el.getElementsByTagName('a');
\t        for( var i=0; i<list.length; i++ ) {
\t            if( list[i].getAttribute("rel") == "attachhref" ){
\t\t\t\t\tvar el = 'tooltip'+i;
\t\t\t\t\tvar url = list[i].href;
\t\t\t\t\tvar title = '<img src="'+list[i].href+'">';
\t\t\t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML;
\t\t\t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } );
\t\t\t\t}
\t        }

        }

        var el = document.getElementById('swfulist');
        if(el != null){
        \tvar list = el.getElementsByTagName('a');

\t        for( var i=0; i<list.length; i++ ) {
\t            if( list[i].getAttribute("rel") == "attachhref" ){
\t\t\t\t\tvar el = 'tooltip'+i;
\t\t\t\t\tvar url = list[i].getAttribute("url");
\t\t\t\t\tvar title = '<img src="'+url+'">';
\t\t\t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML;
\t\t\t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } );
\t\t\t\t}
\t        }
\t\t}
  }
  YAHOO.util.Event.addListener(window, "load", init);
</script>
EOD;
        $body .= '<br /><div id="attachlist" style="border: 2px dashed #666;padding:5px 10px;background-color:#eee">' . $attaches . '</div>';
    }
    $qm = get_qm();
    $helpstr = $qm->m['html']['view_help_message'];
    //list up swfu files
    if (has_swfu()) {
        require_once SWFU_TEXTSQL_PATH;
        $db = new CTextDB(SWFU_IMAGEDB_PATH);
        $imgtitle = $qm->m['html']['img_title'];
        $imgtitle2 = $qm->m['html']['img_title2'];
        $attcstr = $qm->m['html']['attach_message'];
        //! swfuの画像データを取得して表示をする
        $rs = $db->select('$page_name=="' . $page . '"', 'created desc');
        if (count($rs) > 0) {
            $body .= '<div id="swfulist" style="border:1px #aaa dashed;margin-top:10px;padding:10px;font-size:12px">';
            $body .= '<b><a href="./swfu/index_child.php?page=FrontPage&KeepThis=true&TB_iframe=true&height=450&width=650" class="thickbox">' . $attcstr . '(SWFU)</a> : </b>';
            foreach ($rs as $k => $v) {
                $path = SWFU_IMAGE_DIR . $v['name'];
                $prop = SWFU_DIR . 'view.php?id=' . $v['id'] . '&page=FrontPage&KeepThis=true&TB_iframe=true&height=450&width=650';
                $body .= '<span style="padding:2px;margin-right:5px">';
                $atitle1 = $qm->replace("html.insert_title", $v['name']);
                $atitle2 = $qm->replace("html.ar_insert_title", $v['name']);
                if (preg_match('/\\.(png|jpeg|jpg|gif)$/i', $v['name'])) {
                    $title = h($v['name']);
                    $body .= '<a href="' . $prop . '" url="' . $path . '" rel="attachhref" class="thickbox" title="' . $title . '"><img src="image/file.png" width="20" height="20" alt="file" style="border-width:0" />' . $v['name'] . '</a>';
                    $body .= <<<EOD
<a href="#" title="{$atitle1}" onclick="javascript:jQuery.clickpad.cpInsert('&show({$v['name']},,{$v['description']});'); return false;"><img src="image/ins-img.png" alt="{$imgtitle}"/></a><a href="#" title="{$atitle2}" onclick="javascript:jQuery.clickpad.cpInsert('\\n#show({$v['name']},aroundl,{$v['description']})\\n'); return false;"><img src="image/ins-img2.png" alt="{$imgtitle2}" /></a>
EOD;
                } else {
                    $body .= '<a href="' . $path . '"><img src="image/file.png" width="20" height="20" alt="file" style="border-width:0" />' . $v['name'] . '</a>';
                    $body .= <<<EOD
<a href="#" title="{$v['name']}" onclick="javascript:insert('&dlbutton({$path});'); return false;"><img src="image/ins-btn.png" alt="{$imgtitle}"/></a>
EOD;
                }
                $body .= '</span>';
            }
            $body .= '</div>';
        }
    }
    return $body;
}
Пример #6
0
function catbody($title,$page,$body)
{
	global $script,$vars,$arg,$defaultpage,$whatsnew,$help_page,$hr;
	global $related_link,$cantedit,$function_freeze,$search_word_color,$_msg_word;
	global $foot_explain,$note_hr,$head_tags;
	
	global $html_transitional; // FALSE:XHTML1.1 TRUE:XHTML1.0 Transitional
	global $page_title;        // ホームページのタイトル
	global $do_backup;         // バックアップを行うかどうか
	global $modifier;          // 編集者のホームページ
	global $modifierlink;      // 編集者の名前

	$_page = $vars['page'];
	$r_page = rawurlencode($_page);
	
	$link_add      = "$script?cmd=add&amp;page=$r_page";
	$link_edit     = "$script?cmd=edit&amp;page=$r_page";
	$link_diff     = "$script?cmd=diff&amp;page=$r_page";
	$link_top      = "$script?".rawurlencode($defaultpage);
	$link_list     = "$script?cmd=list";
	$link_filelist = "$script?cmd=filelist";
	$link_search   = "$script?cmd=search";
	$link_whatsnew = "$script?".rawurlencode($whatsnew);
	$link_backup   = "$script?cmd=backup&amp;page=$r_page";
	$link_help     = "$script?".rawurlencode($help_page);
	$link_rss      = "$script?cmd=rss10";
	$link_freeze   = "$script?cmd=freeze&amp;page=$r_page";
	$link_unfreeze = "$script?cmd=unfreeze&amp;page=$r_page";
	$link_upload   = "$script?plugin=attach&amp;pcmd=upload&amp;page=$r_page";
	$link_template = "$script?plugin=template&amp;refer=$r_page";
	$link_rename   = "$script?plugin=rename&amp;refer=$r_page";
	
	// ページの表示時TRUE(バックアップの表示、RecentChangesの表示を除く)
	$is_page = (is_pagename($_page) and !arg_check('backup') and $_page != $whatsnew);
	
	// ページの読み出し時TRUE
	$is_read = (arg_check('read') and is_page($_page));
	
	// ページが凍結されているときTRUE
	$is_freeze = is_freeze($_page);
	
	// ページの最終更新時刻(文字列)
	$lastmodified = $is_read ?
		get_date('D, d M Y H:i:s T',get_filetime($_page)).' '.get_pg_passage($_page,FALSE) : '';
	
	// 関連するページのリスト
	$related = ($is_read and $related_link) ? make_related($_page) : '';
	
	// 添付ファイルのリスト
	$attaches = ($is_read and exist_plugin_action('attach')) ? attach_filelist() : '';
	
	// 注釈のリスト
	ksort($foot_explain,SORT_NUMERIC);
	$notes = count($foot_explain) ? $note_hr.join("\n",$foot_explain) : '';
	
	// <head>内に追加するタグ
	$head_tag = count($head_tags) ? join("\n",$head_tags)."\n" : '';
	
	// 1.3.x compat
	// ページの最終更新時刻(UNIX timestamp)
	$fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;

	//単語検索
	if ($search_word_color and array_key_exists('word',$vars))
	{
		$body = '<div class="small">'.$_msg_word.htmlspecialchars($vars['word'])."</div>$hr\n$body";
		$words = array_flip(array_splice(preg_split('/\s+/',$vars['word'],-1,PREG_SPLIT_NO_EMPTY),0,10));
		$keys = array();
		foreach ($words as $word=>$id)
		{
			$keys[$word] = strlen($word);
		}
		arsort($keys,SORT_NUMERIC);
		$keys = get_search_words(array_keys($keys),TRUE);
		$id = 0;
		foreach ($keys as $key=>$pattern)
		{
			$s_key = htmlspecialchars($key);
			$pattern = "/(<[^>]*>)|($pattern)/";
			$callback = create_function(
				'$arr',
				'return $arr[1] ? $arr[1] : "<strong class=\"word'.$id++.'\">{$arr[2]}</strong>";'
			);
			$body = preg_replace_callback($pattern,$callback,$body);
			$notes = preg_replace_callback($pattern,$callback,$notes);
		}
	}
	
	$longtaketime = getmicrotime() - MUTIME;
	$taketime = sprintf('%01.03f',$longtaketime);
	
	if (!file_exists(SKIN_FILE)||!is_readable(SKIN_FILE))
	{
		die_message(SKIN_FILE.'(skin file) is not found.');
	}
	require(SKIN_FILE);
}
Пример #7
0
    function form()
    {
        global $rows, $cols, $notimeupdate, $hr;
        $qm = get_qm();
        $qt = get_qt();
        $script = get_script_uri();
        $r_page = rawurlencode($this->page);
        $btn_preview = strpos(get_class($this), 'Preview') ? $qm->m['fmt_btn_repreview'] : $qm->m['fmt_btn_preview'];
        $buttons_align = 'right';
        if (!is_bootstrap_skin()) {
            $buttons_align = 'left';
            $beforescript = <<<EOD
    <script src="skin/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" />
EOD;
            $qt->appendv_once('plugin_secedit_edit', 'beforescript', $beforescript);
        }
        $level = $this->level ? '<input type="hidden" name="level"  value="true" />' : '';
        $add_notimestamp = '';
        if ($notimeupdate) {
            $checked = $this->notimestamp ? ' checked="checked"' : '';
            $pass_form = $notimeupdate == 2 ? '   <input type="password" name="pass" size="12" />' : '';
            $add_notimestamp = <<<EOD
\t<label for="_edit_form_notimestamp" class="checkbox">
\t\t<input type="checkbox" name="notimestamp" id="_edit_form_notimestamp" value="true"{$checked} />
\t\t<span class="small">{$qm->m['fmt_btn_notchangetimestamp']}</span>
\t</label>
{$pass_form}
EOD;
        }
        $helpstr = $qm->m['html']['view_help_message'];
        $body = <<<EOD
<div class="edit_form">
  <form action="{$script}" method="post" style="margin-bottom:0px;">
    <input type="hidden" name="cmd"    value="secedit" />
    <input type="hidden" name="page"   value="{$this->s_page}" />
    <input type="hidden" name="id"     value="{$this->id}" />
    {$level}
    <input type="hidden" name="digest" value="{$this->s_digest}" />
    <div class="form-group">
      <textarea name="msg" id="msg" rows="{$rows}" cols="{$cols}" tabindex="2" class="form-control">{$this->s_postdata}</textarea>
    </div>
    <div style="float:{$buttons_align};">
      <input type="submit" name="preview" value="{$btn_preview}" class="qhm-btn-default" />
      <input type="submit" name="write"   value="{$qm->m['fmt_btn_update']}" class="qhm-btn-primary" />
      {$add_notimestamp}
      <textarea name="original" rows="1" cols="1" style="display:none">{$this->s_original}</textarea>
   </div>
   <div style="margin-top:0px;margin-left:5px;float:{$buttons_align};">
      <input type="submit" name="cancel"  value="{$qm->m['fmt_btn_cancel']}" class="btn-link" />
   </div>
   <div style="clear:both;"></div>
 </form>
</div>
{$help}
EOD;
        $addscript = <<<EOD
<script data-qhm-plugin="secedit">
\$(function(){
  if (\$("#preview_body").length) {
  }
  else {
    \$(".qhm-eyecatch").hide();

    setTimeout(function(){
      \$("html, body").animate({scrollTop: \$("#msg").offset().top-10}, 300);
      \$("#msg").focus();
    }, 25);
  }
});
</script>
EOD;
        $qt->appendv_once("plugin_secedit_script", "lastscript", $addscript);
        // List of attached files to the page by hokuken.com
        $attaches = exist_plugin_action('attach') ? attach_filelist() : '';
        if ($attaches !== '') {
            $body .= <<<EOD
<script type="text/javascript" src="js/yahoo.js"></script>
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript" src="js/dom.js"></script>

<style type="text/css"><!--
.yui-tt {
position: absolute;
padding: 5px;
background-color:#edf;
border:1px solid #aaf;
}
--></style>
<script type="text/javascript" src="js/container.js"></script>
<script type="text/javascript">
function init() {
\tvar list = document.getElementById('attachlist').getElementsByTagName('a');
\tfor( var i=0; i<list.length; i++ ) {
\t\tif( list[i].getAttribute("rel") == "attachhref" ){
\t\t\tvar el = 'tooltip'+i;
\t\t\tvar url = list[i].href;
\t\t\tvar title = '<img src="'+list[i].href+'">';
\t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML;
\t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } );
\t\t}
\t}
}
YAHOO.util.Event.addListener(window, "load", init);
</script>
EOD;
            $body .= '<br /><div id="attachlist" style="border: 2px dashed #666;padding:5px 10px;background-color:#eee">' . $attaches . '</div>';
        }
        return $body;
    }
Пример #8
0
function do_plugin_action($name)
{
	if (!exist_plugin_action($name))
	{
		return array();
	}
	
	do_plugin_init($name);
	$retvar = call_user_func('plugin_'.$name.'_action');
	
	// 文字エンコーディング検出用 hidden フィールドを挿入する
	return preg_replace('/(<form[^>]*>)/',"$1\n<div><input type=\"hidden\" name=\"encode_hint\" value=\"ぷ\" /></div>",$retvar);
}
Пример #9
0
 function submitham_action()
 {
     global $vars, $post, $get;
     $error = NULL;
     if (PLUGIN_AKISMET_USE_RECAPTCHA) {
         // was there a reCAPTCHA response?
         if (isset($post["recaptcha_response_field"])) {
             $resp = recaptcha_check_answer(PLUGIN_AKISMET_RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $post["recaptcha_challenge_field"], $post["recaptcha_response_field"]);
             $error = $resp->error;
             $captcha_valid = $resp->is_valid;
             // If no response from reCAPTCHA, Assume as valid.
         } else {
             $captcha_valid = TRUE;
             if (PLUGIN_AKISMET_RECAPTCHA_LOG) {
                 PluginAkismet::spamlog_write($vars, array('body' => 'reCaptcha invalid'), LOG_DIR . 'captchalog.txt');
             }
         }
     }
     $comment = $vars['comment'];
     $vars = $vars['vars'];
     if ($captcha_valid) {
         if (PLUGIN_AKISMET_RECAPTCHA_LOG) {
             PluginAkismet::spamlog_write($vars, array('body' => 'break'), LOG_DIR . 'captchalog.txt');
         }
         // Memorize the user is human because he could pass captcha
         $use_authlevel = PLUGIN_AKISMET_THROUGH_IF_ENROLLEE ? ROLE_AUTH : (PLUGIN_AKISMET_THROUGH_IF_ADMIN ? ROLE_ADM_CONTENTS : 0);
         is_human(TRUE, PLUGIN_AKISMET_USE_SESSION, $use_authlevel);
         // set to session
         // submitHam
         if (PLUGIN_AKISMET_USE_AKISMET) {
             $akismet = new Akismet(get_script_uri(), PLUGIN_AKISMET_API_KEY, $comment);
             $akismet->submitHam();
         }
         // autopost
         if (PLUGIN_AKISMET_AUTOPOST_AFTER_SUBMITHAM) {
             // throw to originally called plugin
             // refer lib/pukiwiki.php
             $cmd = isset($vars['cmd']) ? $vars['cmd'] : (isset($vars['plugin']) ? $vars['plugin'] : 'read');
             if (exist_plugin_action($cmd)) {
                 $post = $vars;
                 $get = array();
                 do_plugin_init($cmd);
                 return do_plugin_action($cmd);
             } else {
                 $msg = 'plugin=' . htmlspecialchars($cmd) . ' is not implemented.';
                 return array('msg' => $msg, 'body' => $msg);
             }
         } else {
             $body = '<p>スパム取り消し報告を行いました。以下がスパムと判断された投稿内容です。再度投稿してください。</p>' . "\n";
             $body .= '<div class="ie5"><table class="style_table" cellspacing="1" border="0"><tbody>' . "\n";
             foreach ($vars as $key => $val) {
                 $body .= '<tr>' . "\n";
                 $body .= ' <td class="style_td">' . htmlspecialchars($key) . '<td>' . "\n";
                 $body .= ' <td class="style_td">' . htmlspecialchars($val) . '<td>' . "\n";
                 $body .= '</tr>' . "\n";
             }
             $body .= '</tbody></table></div>' . "\n";
             return array('msg' => 'キャプチャ認証', 'body' => $body);
         }
     } else {
         $form = PluginAkismet::get_captcha_form($vars, $comment, $error);
         return array('msg' => 'キャプチャ認証', 'body' => $form);
     }
 }