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_expand_action() { global $post; $postdata = $post['fullcontents']; $postdata = make_str_rules($postdata); $postdata = drop_submit(convert_html($postdata)); return array('msg' => _('View all contents'), 'body' => $postdata); }
function plugin_guiedit_preview() { global $vars; // global $_title_preview, $_msg_preview, $_msg_preview_delete; global $note_hr, $foot_explain; global $guiedit_use_fck; //FIXME $_msg_preview = _('To confirm the changes, click the button at the bottom of the page'); $_msg_preview_delete = _('(The contents of the page are empty. Updating deletes this page.)'); if ($guiedit_use_fck) { $postdata = Xhtml2WikiFactory::factory($vars['msg']); } if ($postdata) { $postdata = make_str_rules($postdata); $postdata = explode("\n", $postdata); $postdata = drop_submit(RendererFactory::factory($postdata, true)); } // テキスト編集の場合 if (!$guiedit_use_fck) { $body = $_msg_preview . '<br />' . "\n"; if ($postdata == '') { $body .= '<strong>' . $_msg_preview_delete . '</strong><br />' . "\n"; } else { $body .= '<br />' . "\n"; $body .= '<div id="preview">' . $postdata . '</div>' . "\n"; } $body .= plugin_guiedit_edit_form($vars['page'], $vars['msg'], $vars['digest'], FALSE); return array('msg' => $_title['preview'], 'body' => $body); } // 注釈 ksort($foot_explain, SORT_NUMERIC); $postdata .= !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : ''; // 通常の編集フォーム if (DEBUG) { $postdata .= '<hr />' . Utility::editForm($vars['page'], $vars['msg']); } plugin_guiedit_send_ajax($postdata); }
function plugin_backup_action() { global $vars, $do_backup, $hr, $script; global $layout_pages, $style_name; $qm = get_qm(); $editable = edit_auth($page, FALSE, FALSE); if (!$editable) { header("Location: {$script}"); exit; } if (!$do_backup) { return; } $page = isset($vars['page']) ? $vars['page'] : ''; if ($page == '') { return array('msg' => $qm->m['plg_backup']['title_backuplist'], 'body' => plugin_backup_get_list_all()); } //レイアウト部品の場合、スタイルを変更する $is_layout = FALSE; if (isset($layout_pages) && isset($layout_pages[$page])) { $style_name = '..'; $is_layout = TRUE; } check_readable($page, true, true); $s_page = htmlspecialchars($page); $r_page = rawurlencode($page); $action = isset($vars['action']) ? $vars['action'] : ''; if ($action == 'delete') { return plugin_backup_delete($page); } $s_action = $r_action = ''; if ($action != '') { $s_action = htmlspecialchars($action); $r_action = rawurlencode($action); } $s_age = isset($vars['age']) && is_numeric($vars['age']) ? $vars['age'] : 0; if ($s_age <= 0) { $title = $is_layout ? h($layout_pages[$page]) . 'のバックアップ一覧' : $qm->m['plg_backup']['title_pagebackuplist']; return array('msg' => $title, 'body' => plugin_backup_get_list($page)); } $script = get_script_uri(); $body = '<ul>' . "\n"; if (!$is_layout) { $body .= ' <li><a href="' . $script . '?cmd=backup">' . $qm->m['plg_backup']['backuplist'] . '</a></li>' . "\n"; } $href = $script . '?cmd=backup&page=' . $r_page . '&age=' . $s_age; $is_page = is_page($page); if ($is_page && $action != 'diff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=diff">' . $qm->m['plg_backup']['diff'] . '</a>', $qm->m['plg_backup']['view']) . '</li>' . "\n"; } if ($is_page && $action != 'nowdiff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=nowdiff">' . $qm->m['plg_backup']['nowdiff'] . '</a>', $qm->m['plg_backup']['view']) . '</li>' . "\n"; } if ($action != 'source') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=source">' . $qm->m['plg_backup']['source'] . '</a>', $qm->m['plg_backup']['view']) . '</li>' . "\n"; } if (!PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING && $action) { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '">' . $qm->m['plg_backup']['backup'] . '</a>', $qm->m['plg_backup']['view']) . '</li>' . "\n"; } if ($is_page && $is_layout) { $body .= ' <li><a href="' . $script . '?cmd=edit&page=' . $r_page . '">' . h($layout_pages[$page]) . 'を編集する</a>'; } else { if ($is_page) { $body .= ' <li>' . str_replace('$1', '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>', $qm->m['fmt_msg_goto']) . "\n"; } else { $body .= ' <li>' . str_replace('$1', $s_page, $qm->m['plg_backup']['deleted']) . "\n"; } } $backups = get_backup($page); $backups_count = count($backups); if ($s_age > $backups_count) { $s_age = $backups_count; } if ($backups_count > 0) { $body .= ' <ul>' . "\n"; foreach ($backups as $age => $val) { $date = format_date($val['time'], TRUE); $body .= $age == $s_age ? ' <li><em>' . $age . ' ' . $date . '</em></li>' . "\n" : ' <li><a href="' . $script . '?cmd=backup&action=' . $r_action . '&page=' . $r_page . '&age=' . $age . '">' . $age . ' ' . $date . '</a></li>' . "\n"; } $body .= ' </ul>' . "\n"; } $body .= ' </li>' . "\n"; $body .= '</ul>' . "\n"; if ($action == 'diff') { $title = $is_layout ? h($layout_pages[$page]) . ' のバックアップ差分(No.$2)' : $qm->m['plg_backup']['title_backupdiff']; $old = $s_age > 1 ? join('', $backups[$s_age - 1]['data']) : ''; $cur = join('', $backups[$s_age]['data']); $body .= plugin_backup_diff(do_diff($old, $cur)); } else { if ($s_action == 'nowdiff') { $title = $is_layout ? h($layout_pages[$page]) . ' のバックアップの現在との差分(No.$2)' : $qm->m['plg_backup']['title_backupnowdiff']; $old = join('', $backups[$s_age]['data']); $cur = join('', get_source($page)); $body .= plugin_backup_diff(do_diff($old, $cur)); } else { if ($s_action == 'source') { $title = $is_layout ? h($layout_pages[$page]) . ' のバックアップソース(No.$2)' : $qm->m['plg_backup']['title_backupsource']; $body .= '<pre>' . htmlspecialchars(join('', $backups[$s_age]['data'])) . '</pre>' . "\n"; } else { if (PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) { die_message($qm->m['fmt_err_prohibited']); } else { $title = $is_layout ? h($layout_pages[$page]) . ' のバックアップ(No.$2)' : $qm->m['plg_backup']['title_backup']; $body .= $hr . "\n" . drop_submit(convert_html($backups[$s_age]['data'])); } } } } return array('msg' => str_replace('$2', $s_age, $title), 'body' => $body); }
function plugin_edit_preview() { global $vars, $_edit_msg; $_msg_preview = T_('To confirm the changes, click the button at the bottom of the page'); $_msg_preview_delete = T_('(The contents of the page are empty. Updating deletes this page.)'); $page = isset($vars['page']) ? $vars['page'] : ''; // Loading template if (isset($vars['template_page']) && $wiki->isValied()) { $wiki = Factory::Wiki($vars['template_page']); $vars['msg'] = $wiki->get(true); // Cut fixed anchors $vars['msg'] = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z0-9][\\w-]+\\](.*)$/m', '$1$2', $vars['msg']); } else { $wiki = Factory::Wiki($page); } $vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']); $postdata = $vars['msg']; // Compat: add plugin and adding contents if (isset($vars['add']) && $vars['add']) { if (isset($vars['add_top']) && $vars['add_top']) { $postdata .= "\n\n" . $wiki->get(true); } else { $postdata = $wiki->get(true) . "\n\n" . $postdata; } } $body = '<p class="alert alert-info">' . $_edit_msg['msg_preview'] . '<br />' . "\n"; if ($postdata == '') { $body .= '<strong>' . $_edit_msg['msg_preview_delete'] . '</strong>'; } $body .= '</p>' . "\n"; if ($postdata) { $postdata = Rules::make_str_rules($postdata); $postdata = explode("\n", $postdata); $postdata = drop_submit(RendererFactory::factory($postdata)); $body .= '<div id="preview">' . $postdata . '</div>' . "\n"; } $body .= Utility::editForm($page, $vars['msg'], $vars['digest'], FALSE); return array('msg' => sprintf($_edit_msg['title_preview'], $page), 'body' => $body); }
function plugin_backup_action() { global $vars, $do_backup, $hr, $script; // global $_msg_backuplist, $_msg_diff, $_msg_nowdiff, $_msg_source, $_msg_backup; // global $_msg_view, $_msg_goto, $_msg_deleted; // global $_msg_visualdiff; // global $_title_backupdiff, $_title_backupnowdiff, $_title_backupsource; // global $_title_backup, $_title_pagebackuplist, $_title_backuplist; $_msg_backuplist = _('Backup list'); $_msg_diff = _('diff'); $_msg_nowdiff = _('diff current'); $_msg_source = _('source'); $_msg_backup = _('backup'); $_msg_visualdiff = _('diff for visual'); $_msg_view = _('View the $1.'); $_msg_goto = _('Go to $1.'); $_msg_deleted = _(' $1 has been deleted.'); $_title_backupdiff = _('Backup diff of $1(No. $2)'); $_title_backupnowdiff = _('Backup diff of $1 vs current(No. $2)'); $_title_backupsource = _('Backup source of $1(No. $2)'); $_title_backup = _('Backup of $1(No. $2)'); $_title_pagebackuplist = _('Backup list of $1'); $_title_backuplist = _('Backup list'); if (!$do_backup) { return; } $page = isset($vars['page']) ? $vars['page'] : ''; if ($page == '') { return array('msg' => $_title_backuplist, 'body' => plugin_backup_get_list_all()); } check_readable($page, true, true); $s_page = htmlspecialchars($page); $r_page = rawurlencode($page); $action = isset($vars['action']) ? $vars['action'] : ''; if ($action == 'delete') { return plugin_backup_delete($page); } $s_action = $r_action = ''; if ($action != '') { $s_action = htmlspecialchars($action); $r_action = rawurlencode($action); } $s_age = isset($vars['age']) && is_numeric($vars['age']) ? $vars['age'] : 0; if ($s_age <= 0) { return array('msg' => $_title_pagebackuplist, 'body' => plugin_backup_get_list($page)); } $body = '<ul>' . "\n"; $body .= ' <li><a href="' . $script . '?cmd=backup">' . $_msg_backuplist . '</a></li>' . "\n"; $href = $script . '?cmd=backup&page=' . $r_page . '&age=' . $s_age; $is_page = is_page($page); if ($is_page && $action != 'diff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=diff">' . $_msg_diff . '</a>', $_msg_view) . '</li>' . "\n"; } if ($is_page && $action != 'nowdiff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=nowdiff">' . $_msg_nowdiff . '</a>', $_msg_view) . '</li>' . "\n"; } if ($is_page && $action != 'visualdiff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=visualdiff">' . $_msg_visualdiff . '</a>', $_msg_view) . '</li>' . "\n"; } if ($action != 'source') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=source">' . $_msg_source . '</a>', $_msg_view) . '</li>' . "\n"; } if (!PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING && $action) { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '">' . $_msg_backup . '</a>', $_msg_view) . '</li>' . "\n"; } if ($is_page) { $body .= ' <li>' . str_replace('$1', '<a href="' . get_page_uri($page) . '">' . $s_page . '</a>', $_msg_goto) . "\n"; } else { $body .= ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . "\n"; } $backups = get_backup($page); $backups_count = count($backups); if ($s_age > $backups_count) { $s_age = $backups_count; } if ($backups_count > 0 && $action != 'visualdiff') { $body .= ' <ul>' . "\n"; foreach ($backups as $age => $val) { $time = isset($val['real']) ? $val['real'] : $val['time']; $date = format_date($time, TRUE); $body .= $age == $s_age ? ' <li><em>' . $age . ' ' . $date . '</em></li>' . "\n" : ' <li><a href="' . $script . '?cmd=backup&action=' . $r_action . '&page=' . $r_page . '&age=' . $age . '">' . $age . ' ' . $date . '</a></li>' . "\n"; } $body .= ' </ul>' . "\n"; } $body .= ' </li>' . "\n"; $body .= '</ul>' . "\n"; if ($action == 'diff') { if (auth::check_role('safemode')) { die_message(_('PKWK_SAFE_MODE prohibits this')); } $title =& $_title_backupdiff; $old = $s_age > 1 ? join('', $backups[$s_age - 1]['data']) : ''; $cur = join('', $backups[$s_age]['data']); auth::is_role_page($old); auth::is_role_page($cur); $body .= plugin_backup_diff(do_diff($old, $cur)); } else { if ($s_action == 'nowdiff') { if (auth::check_role('safemode')) { die_message(_('PKWK_SAFE_MODE prohibits this')); } $title =& $_title_backupnowdiff; $old = join('', $backups[$s_age]['data']); $cur = join('', get_source($page)); auth::is_role_page($old); auth::is_role_page($cur); $body .= plugin_backup_diff(do_diff($old, $cur)); } else { if ($s_action == 'visualdiff') { $old = join('', $backups[$s_age]['data']); $cur = join('', get_source($page)); auth::is_role_page($old); auth::is_role_page($cur); $source = do_diff($old, $cur); $source = plugin_backup_visualdiff($source); $body .= "{$hr}\n" . drop_submit(convert_html($source)); $body = preg_replace('#<p>\\#spandel(.*?)(</p>)#si', '<span class="remove_word">$1', $body); $body = preg_replace('#<p>\\#spanadd(.*?)(</p>)#si', '<span class="add_word">$1', $body); $body = preg_replace('#<p>\\#spanend(.*?)(</p>)#si', '$1</span>', $body); $body = preg_replace('#&spandel;#i', '<span class="remove_word">', $body); $body = preg_replace('#&spanadd;#i', '<span class="add_word">', $body); $body = preg_replace('#&spanend;#i', '</span>', $body); $title =& $_title_backupnowdiff; } else { if ($s_action == 'source') { if (auth::check_role('safemode')) { die_message(_('PKWK_SAFE_MODE prohibits this')); } $title =& $_title_backupsource; auth::is_role_page($backups[$s_age]['data']); $body .= '<pre>' . htmlspecialchars(join('', $backups[$s_age]['data'])) . '</pre>' . "\n"; } else { if (PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) { die_message(_('This feature is prohibited')); } else { $title =& $_title_backup; auth::is_role_page($backups[$s_age]['data']); $body .= $hr . "\n" . drop_submit(convert_html($backups[$s_age]['data'])); } } } } } return array('msg' => str_replace('$2', $s_age, $title), 'body' => $body); }
function plugin_backup_action() { global $vars, $do_backup, $_string, $_button; global $_backup_messages; if (!$do_backup) { return; } $page = isset($vars['page']) ? $vars['page'] : null; $action = isset($vars['action']) ? $vars['action'] : null; $s_age = isset($vars['age']) && is_numeric($vars['age']) ? $vars['age'] : 0; /** * if page is not set, show list of backup files */ if (!$page) { return array('msg' => $_backup_messages['title_backuplist'], 'body' => plugin_backup_get_list_all()); } $wiki = Factory::Wiki($page); $is_page = $wiki->has(); $s_page = Utility::htmlsc($page); $r_page = rawurlencode($page); $backups = Factory::Backup($page)->get(); $msg = $_backup_messages['msg_backup']; if ($s_age > count($backups)) { $s_age = count($backups); } $body = ''; $wiki->checkReadable(); if ($s_age <= 0) { return array('msg' => $_backup_messages['title_pagebackuplist'], 'body' => plugin_backup_get_list($page)); } $body .= '<div class="panel panel-default">'; $body .= plugin_backup_get_list($page); $body .= '</div>' . "\n"; if ($action) { $data = join("\n", $backups[$s_age]['data']); Auth::is_role_page($data); switch ($action) { case 'delete': /** * 指定された世代を確認。指定されていなければ、一覧のみ表示 */ // checkboxが選択されずにselectdeleteを実行された場合は、削除処理をしない if (!isset($vars['selectages']) && isset($vars['selectdelete'])) { // 選択削除ボタンが押された // 何もしない } else { if (!isset($vars['selectages'])) { // 世代引数がない場合は全削除 return plugin_backup_delete($page); } return plugin_backup_delete($page, $vars['selectages']); } case 'rollback': return plugin_backup_rollback($page, $s_age); break; case 'diff': if (Auth::check_role('safemode')) { Utility::dieMessage($_string['prohibit']); } $title =& $_backup_messages['title_backupdiff']; $past_data = $s_age > 1 ? join("\n", $backups[$s_age - 1]['data']) : ''; Auth::is_role_page($past_data); $body .= plugin_backup_diff($past_data, $data); break; case 'nowdiff': if (Auth::check_role('safemode')) { die_message($_string['prohibit']); } $title =& $_backup_messages['title_backupnowdiff']; $now_data = Factory::Wiki($page)->get(true); Auth::is_role_page($now_data); $body .= plugin_backup_diff($data, $now_data); break; case 'visualdiff': $old = join('', $backups[$s_age]['data']); $now_data = get_source($page, TRUE, TRUE); Auth::is_role_page($now_data); // <ins> <del>タグを使う形式に変更。 $diff = new Diff($data, $now_data); $source = plugin_backup_visualdiff($diff->getDiff()); $body .= drop_submit(RendererFactory::factory($source)); $body = preg_replace('#<p>\\#del(.*?)(</p>)#si', '<del class="remove_block">$1', $body); $body = preg_replace('#<p>\\#ins(.*?)(</p>)#si', '<ins class="add_block">$1', $body); $body = preg_replace('#<p>\\#delend(.*?)(</p>)#si', '$1</del>', $body); $body = preg_replace('#<p>\\#insend(.*?)(</p>)#si', '$1</ins>', $body); // ブロック型プラグインの処理が無いよ~! $body = preg_replace('#&del;#i', '<del class="remove_word">', $body); $body = preg_replace('#&ins;#i', '<ins class="add_word">', $body); $body = preg_replace('#&delend;#i', '</del>', $body); $body = preg_replace('#&insend;#i', '</ins>', $body); $title =& $_backup_messages['title_backupnowdiff']; break; case 'source': if (Auth::check_role('safemode')) { die_message($_string['prohibit']); } $title =& $_backup_messages['title_backupsource']; $body .= '<pre class="sh" data-blush="plain">' . htmlsc($data) . '</pre>' . "\n"; break; default: if (PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) { die_message(T_('This feature is prohibited')); } else { $title =& $_backup_messages['title_backup']; $body .= drop_submit(RendererFactory::factory($data)); } break; } $msg = str_replace('$2', $s_age, $title); } if (!Auth::check_role('readonly')) { $body .= '<a class="button" href="' . $wiki->uri('backup', $page, null, array('action' => 'delete')) . '">' . str_replace('$1', $s_page, $_backup_messages['title_backup_delete']) . '</a>'; } return array('msg' => $msg, 'body' => $body); }
function plugin_mceedit_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']); } // 手書きの#freezeを削除 $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 = _('To confirm the changes, click the button at the bottom of the page') . "<br />\n"; if ($postdata == '') { $body .= "<strong>" . _('(The contents of the page are empty. Updating deletes this page.)') . "</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 .= plugin_mceedit_edit_form($page, $vars['msg'], $vars['digest'], FALSE); return array('msg' => _('Preview of $1'), 'body' => $body); }
function plugin_backup_action() { global $vars, $do_backup, $hr; global $_msg_backuplist, $_msg_diff, $_msg_nowdiff, $_msg_source, $_msg_backup; global $_msg_view, $_msg_goto, $_msg_deleted; global $_title_backupdiff, $_title_backupnowdiff, $_title_backupsource; global $_title_backup, $_title_pagebackuplist, $_title_backuplist; if (!$do_backup) { return; } $page = isset($vars['page']) ? $vars['page'] : ''; if ($page == '') { return array('msg' => $_title_backuplist, 'body' => plugin_backup_get_list_all()); } check_readable($page, true, true); $s_page = htmlsc($page); $r_page = rawurlencode($page); $action = isset($vars['action']) ? $vars['action'] : ''; if ($action == 'delete') { return plugin_backup_delete($page); } $s_action = $r_action = ''; if ($action != '') { $s_action = htmlsc($action); $r_action = rawurlencode($action); } $s_age = isset($vars['age']) && is_numeric($vars['age']) ? $vars['age'] : 0; if ($s_age <= 0) { return array('msg' => $_title_pagebackuplist, 'body' => plugin_backup_get_list($page)); } $script = get_script_uri(); $body = '<ul>' . "\n"; $body .= ' <li><a href="' . $script . '?cmd=backup">' . $_msg_backuplist . '</a></li>' . "\n"; $href = $script . '?cmd=backup&page=' . $r_page . '&age=' . $s_age; $is_page = is_page($page); if ($is_page && $action != 'diff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=diff">' . $_msg_diff . '</a>', $_msg_view) . '</li>' . "\n"; } if ($is_page && $action != 'nowdiff') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=nowdiff">' . $_msg_nowdiff . '</a>', $_msg_view) . '</li>' . "\n"; } if ($action != 'source') { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '&action=source">' . $_msg_source . '</a>', $_msg_view) . '</li>' . "\n"; } if (!PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING && $action) { $body .= ' <li>' . str_replace('$1', '<a href="' . $href . '">' . $_msg_backup . '</a>', $_msg_view) . '</li>' . "\n"; } if ($is_page) { $body .= ' <li>' . str_replace('$1', '<a href="' . $script . '?' . $r_page . '">' . $s_page . '</a>', $_msg_goto) . "\n"; } else { $body .= ' <li>' . str_replace('$1', $s_page, $_msg_deleted) . "\n"; } $backups = get_backup($page); $backups_count = count($backups); if ($s_age > $backups_count) { $s_age = $backups_count; } if ($backups_count > 0) { $body .= ' <ul>' . "\n"; foreach ($backups as $age => $val) { $date = format_date($val['time'], true); $body .= $age == $s_age ? ' <li><em>' . $age . ' ' . $date . '</em></li>' . "\n" : ' <li><a href="' . $script . '?cmd=backup&action=' . $r_action . '&page=' . $r_page . '&age=' . $age . '">' . $age . ' ' . $date . '</a></li>' . "\n"; } $body .= ' </ul>' . "\n"; } $body .= ' </li>' . "\n"; $body .= '</ul>' . "\n"; if ($action == 'diff') { $title =& $_title_backupdiff; $old = $s_age > 1 ? join('', $backups[$s_age - 1]['data']) : ''; $cur = join('', $backups[$s_age]['data']); $body .= plugin_backup_diff(do_diff($old, $cur)); } elseif ($s_action == 'nowdiff') { $title =& $_title_backupnowdiff; $old = join('', $backups[$s_age]['data']); $cur = join('', get_source($page)); $body .= plugin_backup_diff(do_diff($old, $cur)); } elseif ($s_action == 'source') { $title =& $_title_backupsource; $body .= '<pre>' . htmlsc(join('', $backups[$s_age]['data'])) . '</pre>' . "\n"; } else { if (PLUGIN_BACKUP_DISABLE_BACKUP_RENDERING) { die_message('This feature is prohibited'); } else { $title =& $_title_backup; $body .= $hr . "\n" . drop_submit(convert_html($backups[$s_age]['data'])); } } return array('msg' => str_replace('$2', $s_age, $title), 'body' => $body); }
function plugin_guiedit_preview() { global $vars; // global $_title_preview, $_msg_preview, $_msg_preview_delete; global $note_hr, $foot_explain; global $guiedit_use_fck; //FIXME $_msg_preview = _('To confirm the changes, click the button at the bottom of the page'); $_msg_preview_delete = _('(The contents of the page are empty. Updating deletes this page.)'); if ($guiedit_use_fck) { // 構文の変換 require_once GUIEDIT_LIB_PATH . 'xhtml2wiki.php'; // $source = $vars['msg']; $vars['msg'] = xhtml2wiki($vars['msg']); } $postdata = $vars['msg']; if ($postdata) { $postdata = make_str_rules($postdata); $postdata = explode("\n", $postdata); $postdata = drop_submit(convert_html($postdata)); } // テキスト編集の場合 if (!$guiedit_use_fck) { $body = $_msg_preview . '<br />' . "\n"; if ($postdata == '') { $body .= '<strong>' . $_msg_preview_delete . '</strong><br />' . "\n"; } else { $body .= '<br />' . "\n"; $body .= '<div id="preview">' . $postdata . '</div>' . "\n"; } $body .= plugin_guiedit_edit_form($vars['page'], $vars['msg'], $vars['digest'], FALSE); return array('msg' => $_title['preview'], 'body' => $body); } // 注釈 ksort($foot_explain, SORT_NUMERIC); $postdata .= !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : ''; // 通常の編集フォーム if (GUIEDIT_DEBUG) { global $hr; $postdata .= $hr . edit_form($vars['page'], $vars['msg']); } plugin_guiedit_send_xml($postdata); }
function plugin_edit_preview() { global $vars, $layout_pages; global $qblog_defaultpage; $qm = get_qm(); $qt = get_qt(); $page = isset($vars['page']) ? $vars['page'] : ''; $layout_name = ''; if (array_key_exists($page, $layout_pages)) { $layout_name = $layout_pages[$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; } } $msgstyle = ' <style type="text/css"> #preview_notice { background-color: #ff9; padding: 2px 0; font-weight: bold; text-align: center; border-radius: 10px 10px 0 0; -moz-border-radius: 10px 10px 0 0; -ms-filter: "alpha( opacity=20 )"; /* IE8 */ filter: alpha( opacity=20 ); /* IE7 */ opacity: 0.8; position: fixed; width: 550px; bottom: 0; left: 50%; margin-left: -275px; z-index: 30; } ul.toolbar_menu li.preview_notice, ul.toolbar_menu_min li.preview_notice { padding: 0 2px; margin: 0 auto; background-color: #ff9; color: #000; font-weight: bold; background-image: none; cursor: auto; text-align: center; } </style> '; if ($layout_name !== '') { $msgstyle .= ' <style type="text/css"> #preview_body { display: none; } </style> '; } $qt->appendv_once('plugin_edit_preview', 'beforescript', $msgstyle); $addscript = ' <script type="text/javascript"> $(function(){ $("div.toolbar_upper ul.toolbar_menu, div.toolbar_upper ul.toolbar_menu_min").prepend("<li class=\\"preview_notice\\">' . $qm->m['plg_edit']['label_preview'] . '</li>") .children(":nth-child(2)").remove(); $("#preview_notice") .css("cursor", "pointer") .click(function(){ $("#msg").focus(); }); }); </script> '; if ($layout_name !== '') { $addscript .= ' <script type="text/javascript"> $(function(){ var $layout = $("div.preview_highlight").parent(), $div = $("<div></div>"), $div2 = $("<div>' . h($layout_name) . 'のプレビュー</div>"); var paddingWidth = parseInt($layout.css("padding-left").match(/\\d+/)[0]) + parseInt($layout.css("padding-right").match(/\\d+/)[0]), paddingHeight = parseInt($layout.css("padding-top").match(/\\d+/)[0]) + parseInt($layout.css("padding-bottom").match(/\\d+/)[0]); $div.css({ width: $layout.width() + paddingWidth + 10, height: $layout.height() + paddingHeight + 10, position: "absolute", left: $layout.offset().left - 8, top: $layout.offset().top -8, border: "3px solid #FF6600", zIndex: 999, opacity: 0 }); $("body").append($div); $div2.css({ width: 160, height: 30, position: "absolute", left: $div.offset().left + $div.width() + 10 - 160, top: $div.offset().top -22, backgroundColor: "#FF6600", color: "white", textAlign: "center", fontSize: 14, lineHeight: "30px", zIndex: 1000, opacity: 0 }); $("body").append($div2); $("html, body").animate({scrollTop: $div2.offset().top}, 400, function(){ $div.animate({opacity: 1}, 600); $div2.animate({opacity: 1}, 600); }); }); </script> '; } $qt->appendv_once('plugin_edit_preview_js', 'beforescript', $addscript); $preview_notice = '<div id="preview_notice">' . $qm->m['fmt_msg_preview'] . '</div>' . "\n"; $qt->appendv_once('plugin_edit_preview_block', 'lastscript', $preview_notice); $body = '<div id="preview_body">'; if ($postdata == '') { $body .= '<strong>' . $qm->m['fmt_msg_preview_delete'] . '</strong>'; } $body .= '<br />' . "\n"; if ($postdata) { if ($page !== $qblog_defaultpage && is_qblog()) { $postdata = "#qblog_head\n" . $postdata; } $postdata = make_str_rules($postdata); $postdata = explode("\n", $postdata); $postdata = drop_submit(convert_html($postdata)); $body .= $postdata; } $body .= '</div>' . "\n"; $body .= edit_form($page, $vars['msg'], $vars['digest'], FALSE); return array('msg' => $qm->m['fmt_title_preview'], 'body' => $body); }
function process() { $qm = get_qm(); $qt = get_qt(); $this->init(); $this->check(); $this->sections->set_section($this->id, $this->postdata, $this->level); $msgstyle = ' <style type="text/css"> #preview_notice { background-color: #ff9; padding: 2px 0; font-weight: bold; text-align: center; border-radius: 10px 10px 0 0; -moz-border-radius: 10px 10px 0 0; -ms-filter: "alpha( opacity=20 )"; /* IE8 */ filter: alpha( opacity=20 ); /* IE7 */ opacity: 0.8; position: fixed; width: 550px; bottom: 0; left: 50%; margin-left: -275px; z-index: 30; } ul.toolbar_menu li.preview_notice, ul.toolbar_menu_min li.preview_notice { padding: 0 2px; margin: 0 auto; background-color: #ff9; color: #000; font-weight: bold; background-image: none; cursor: auto; text-align: center; } </style> '; $qt->appendv_once('plugin_secedit_preview', 'beforescript', $msgstyle); $addscript = ' <script type="text/javascript"> $(function(){ $("div.toolbar_upper ul.toolbar_menu, div.toolbar_upper ul.toolbar_menu_min").prepend("<li class=\\"preview_notice\\">' . $qm->m['plg_edit']['label_preview'] . '</li>") .children(":nth-child(2)").remove(); $("#preview_notice") .css("cursor", "pointer") .click(function(){ $("#msg").focus(); }); }); </script> '; $qt->appendv_once('plugin_secedit_preview_js', 'beforescript', $addscript); $preview_notice = '<div id="preview_notice">' . $qm->m['fmt_msg_preview'] . '</div>' . "\n"; $qt->appendv_once('plugin_secedit_preview_block', 'lastscript', $preview_notice); $body = ''; if ($this->postdata == '') { $body .= '<strong>' . $qm->m['fmt_msg_preview_delete'] . '</strong>'; } $body .= '<br />' . "\n"; if ($this->postdata) { $src = make_str_rules($this->postdata); $src = explode("\n", $src); $src = drop_submit(convert_html($src)); $body .= $src; } $body = '<div id="preview_body">' . "\n" . $body . "\n" . '</div>'; $body .= $this->form(); return array('msg' => $qm->m['fmt_title_preview'], 'body' => $body); }
function process() { global $_title_preview, $_msg_preview, $_msg_preview_delete; $this->init(); $this->check(); $this->sections->set_section($this->id, $this->postdata, $this->level); $msg = $_msg_preview . "<br />\n"; $msg .= $this->sections->get_source() === '' ? "<strong>{$_msg_preview_delete}</strong>" : ''; $msg .= "<br />\n"; $preview = ''; if ($this->postdata !== '') { $src = preg_replace(PLUGIN_SECEDIT_FREEZE_REGEX, '', $this->postdata); $src = make_str_rules($src); $preview = '<div id="preview">' . drop_submit(convert_html($src)) . "</div>\n"; } return array('msg' => $_title_preview, 'body' => $msg . $preview . $this->form()); }