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)); }
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)); }
function plugin_edit_action() { // global $vars, $_title_edit, $load_template_func; global $vars, $load_template_func; // if (PKWK_READONLY) die_message( _('PKWK_READONLY prohibits editing') ); if (auth::check_role('readonly')) { die_message(_('PKWK_READONLY prohibits editing')); } if (PKWK_READONLY == ROLE_AUTH && auth::get_role_level() > ROLE_AUTH) { die_message(_('PKWK_READONLY prohibits editing')); } if (isset($vars['realview'])) { return plugin_edit_realview(); } $page = isset($vars['page']) ? $vars['page'] : ''; check_editable($page, true, true); if (!is_page($page) && auth::is_check_role(PKWK_CREATE_PAGE)) { die_message(_('PKWK_CREATE_PAGE prohibits editing')); } 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(); } } } $source = get_source($page); auth::is_role_page($source); $postdata = $vars['original'] = join('', $source); if (!empty($vars['id'])) { $postdata = plugin_edit_parts($vars['id'], $source); if ($postdata === FALSE) { unset($vars['id']); // なかったことに :) $postdata = $vars['original']; } } if ($postdata == '') { $postdata = auto_template($page); } return array('msg' => _('Edit of $1'), 'body' => edit_form($page, $postdata)); }
function plugin_guiedit_edit_data($page) { global $vars; $source = get_source($vars['page']); $postdata = $vars['original'] = join('', $source); if (!empty($vars['id'])) { exist_plugin('edit'); $postdata = plugin_edit_parts($vars['id'], $source); if ($postdata === FALSE) { unset($vars['id']); $postdata = $vars['original']; } } if ($postdata == '') { $postdata = auto_template($page); } // 構文の変換 require_once GUIEDIT_LIB_PATH . 'wiki2xhtml.php'; $postdata = guiedit_convert_html($postdata); plugin_guiedit_send_xml($postdata); }
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)); }
/** * Get a modified template html * * @param string $page Page name * @return string html */ function show_template_html($page) { $contents = auto_template($page); if ($contents == '') { $contents = $this->default_template_contents; } $html = convert_html($contents); $html = preg_replace_callback('/<form.+?<\\/form>/s', array($this, '_replace_form'), $html); return array('msg' => htmlspecialchars($this->get_title($page)), 'body' => $html); }
/** * Create a wikinote page automatically * * @param string $page * @param boolean created or not */ function autocreate_notepage($page = '') { global $vars; if ($vars['cmd'] != 'read') { return FALSE; } $page = $page === '' ? $vars['page'] : $page; list($mainpage, $notepage) = $this->get_mainpage_notepage($page); if (!$this->is_effect($mainpage)) { return FALSE; } if (is_page($notepage)) { return FALSE; } $contents = auto_template($notepage); if ($contents == '') { $contents = $this->default_template_contents; } if (file_put_contents(get_filename($notepage), $contents) === FALSE) { return FALSE; } update_recent($notepage); return TRUE; }