예제 #1
0
function plugin_edit_action()
{
    global $vars, $_title_edit, $load_template_func;
    if (PKWK_READONLY) {
        die_message('PKWK_READONLY prohibits editing');
    }
    $page = isset($vars['page']) ? $vars['page'] : '';
    check_editable($page, true, true);
    if (isset($vars['preview']) || $load_template_func && isset($vars['template'])) {
        return plugin_edit_preview();
    } else {
        if (isset($vars['write'])) {
            return plugin_edit_write();
        } else {
            if (isset($vars['cancel'])) {
                return plugin_edit_cancel();
            }
        }
    }
    $postdata = @join('', get_source($page));
    if ($postdata == '') {
        $postdata = auto_template($page);
    }
    return array('msg' => $_title_edit, 'body' => edit_form($page, $postdata));
}
예제 #2
0
function plugin_blog_edit_action()
{
    global $vars, $load_template_func;
    $qm = get_qm();
    if (PKWK_READONLY) {
        die_message($qm->m['fmt_err_pkwk_readonly']);
    }
    $page = isset($vars['page']) ? $vars['page'] : '';
    check_editable($page, true, true);
    if (isset($vars['preview']) || $load_template_func && isset($vars['template'])) {
        return plugin_edit_preview();
    } else {
        if (isset($vars['write'])) {
            return plugin_edit_write();
        } else {
            if (isset($vars['cancel'])) {
                return plugin_edit_cancel();
            }
        }
    }
    $postdata = @join('', get_source($page));
    if ($postdata == '') {
        $postdata = auto_template($page);
    }
    if ($postdata == '') {
        $postdata = <<<EOD
//--------- {$qm->m['plg_blog_edit']['ntc_post_conf']} --------------
#topicpath
// {$qm->m['plg_blog_edit']['ntc_post_tag']}

//---------- {$qm->m['plg_blog_edit']['ntc_post_body']} -------------
#blog_body

{$qm->m['plg_blog_edit']['post_body']}

//--------- {$qm->m['plg_blog_edit']['ntc_post_more']} ------------------
{$qm->m['plg_blog_edit']['post_more']}



//------- {$qm->m['plg_blog_edit']['ntc_post_comment']} --------
&br;
#blog_comment
----
{$qm->m['plg_blog_edit']['post_comment']}

#comment2(textarea,10)
EOD;
    }
    return array('msg' => $qm->m['fmt_title_edit'], 'body' => edit_form($page, $postdata));
}
예제 #3
0
function plugin_edit_honeypot()
{
    if (isset($vars['ajax'])) {
        $headers = Header::getHeaders('application/json');
        Header::writeResponse($headers, 200, Json::encode(array('posted' => false, 'message' => 'Sorry your post has been prohibited.', 'taketime' => Time::getTakeTime())));
        exit;
    }
    // SPAM Logging
    Utility::dump();
    // Same as "Cancel" action
    return plugin_edit_cancel();
}
예제 #4
0
function plugin_edit_honeypot()
{
    // SPAM Logging
    honeypot_write();
    // Same as "Cancel" action
    return plugin_edit_cancel();
}
예제 #5
0
파일: edit.inc.php 프로젝트: big2men/qhm
function plugin_edit_action()
{
    global $vars, $load_template_func, $style_name, $layout_pages;
    global $qblog_defaultpage;
    $qm = get_qm();
    $qt = get_qt();
    if (PKWK_READONLY) {
        die_message($qm->m['fmt_err_pkwk_readonly']);
    }
    $page = isset($vars['page']) ? $vars['page'] : '';
    $prefix = '';
    //メニューやナビの編集はスタイルを変える
    if (array_key_exists($page, $layout_pages) && !isset($vars['preview'])) {
        $prefix = '<h2 class="title">' . h($layout_pages[$page]) . 'の編集</h2>';
        if (is_bootstrap_skin()) {
            if (exist_plugin("noeyecatch")) {
                do_plugin_convert("noeyecatch");
            }
        } else {
            $style_name = '../';
            $addscript = <<<EOD
<script type="text/javascript">
\$(function(){

  if (window != parent)
  {
\t\t\$("input:submit").click(function(e){
\t\t\twindow.onbeforeunload = null;
\t\t\tvar name = \$(this).attr("name");
\t\t\t\$(this).before('<input type="hidden" name="'+name+'" value="'+\$(this).val()+'">').prop("disabled", true);

\t\t\tvar \$form = \$(this).closest("form");
\t\t\tvar \$parent = \$(window.parent.document).find("body");
\t
\t\t\tvar params = \$form.serialize().split('&');
\t\t\tvar \$fm = \$('<form></form>');
\t\t\tfor (var i = 0; i < params.length; i++)
\t\t\t{
\t\t\t\tvar param = params[i].split('=');

\t\t\t\t\$fm.append(\$('<input type="hidden" name="'+param[0]+'" value="" />').val(decodeURIComponent(param[1].replace(/\\+/g, ' '))));
\t\t\t}
\t\t\t\$fm.attr('action', \$form.attr('action'));
\t\t\t\$fm.attr('method', \$form.attr('method'));
\t\t\t\$parent.append(\$fm).find("form:last").submit();
\t\t\treturn false;
\t\t});
\t}
});
</script>
EOD;
            $qt->appendv('beforescript', $addscript);
        }
    }
    check_editable($page, true, true);
    if (isset($vars['preview']) || $load_template_func && isset($vars['template'])) {
        return plugin_edit_preview();
    } else {
        if (isset($vars['write'])) {
            return plugin_edit_write();
        } else {
            if (isset($vars['cancel'])) {
                return plugin_edit_cancel();
            }
        }
    }
    $postdata = @join('', get_source($page));
    if ($postdata == '') {
        $postdata = auto_template($page);
    }
    return array('msg' => $qm->m['fmt_title_edit'], 'body' => $prefix . edit_form($page, $postdata));
}