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; // Newly generate $digest or not if ($digest === FALSE) { $digest = md5(join('', get_source($page))); } $refer = $template = ''; // 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">' . '<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 = htmlsc($_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'] != '') { $refer = '[[' . strip_bracket($vars['refer']) . ']]' . "\n\n"; } } $r_page = rawurlencode($page); $s_page = htmlsc($page); $s_digest = htmlsc($digest); $s_postdata = htmlsc($refer . $postdata); $s_original = isset($vars['original']) ? htmlsc($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 = '<input type="checkbox" name="notimestamp" ' . 'id="_edit_form_notimestamp" value="true"' . $checked_time . ' />' . "\n" . ' ' . '<label for="_edit_form_notimestamp"><span class="small">' . $_btn_notchangetimestamp . '</span></label>' . "\n" . $add_notimestamp . ' '; } // 'margin-bottom', 'float:left', and 'margin-top' // are for layout of 'cancel button' $body = <<<EOD <div class="edit_form"> <form action="{$script}" method="post" style="margin-bottom:0px;"> {$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}" /> <textarea name="msg" rows="{$rows}" cols="{$cols}">{$s_postdata}</textarea> <br /> <div style="float:left;"> <input type="submit" name="preview" value="{$btn_preview}" accesskey="p" /> <input type="submit" name="write" value="{$_btn_update}" accesskey="s" /> {$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;"> <input type="hidden" name="cmd" value="edit" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="submit" name="cancel" value="{$_btn_cancel}" accesskey="c" /> </form> </div> EOD; if (isset($vars['help'])) { $body .= $hr . catrule(); } else { $body .= '<ul><li><a href="' . $script . '?cmd=edit&help=true&page=' . $r_page . '">' . $_msg_help . '</a></li></ul>'; } return $body; }
function form() { global $rows, $cols, $notimeupdate, $hr, $_msg_help; global $_btn_preview, $_btn_repreview, $_btn_update, $_btn_cancel, $_btn_notchangetimestamp; $script = get_script_uri(); $r_page = rawurlencode($this->page); $btn_preview = strpos(get_class($this), 'Preview') ? $_btn_repreview : $_btn_preview; $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 <input type="checkbox" name="notimestamp" id="_edit_form_notimestamp" value="true"{$checked} /> <label for="_edit_form_notimestamp"><span class="small">{$_btn_notchangetimestamp}</span></label> {$pass_form} EOD; } $help = $script . '?cmd=secedit&help=true&page=' . $r_page . '&id=' . $this->id; $help .= $this->level ? '&level=true' : ''; $help = $this->help ? $hr . catrule() : '<ul><li><a href="' . $help . '">' . $_msg_help . '</a></li></ul>'; return <<<EOD <p class="backNav"><a href="javascript:history.back()">本文に戻る</a></p> <div class="edit_form"> <form action="{$script}" method="post" style="margin-bottom:0px;"> <div> <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}" /> <textarea name="msg" rows="{$rows}" cols="{$cols}" id="editor">{$this->s_postdata}</textarea> <br /> <input type="submit" name="preview" value="{$btn_preview}" accesskey="p" /> <input type="submit" name="write" value="{$_btn_update}" accesskey="s" /> {$add_notimestamp} <input type="submit" name="cancel" value="{$_btn_cancel}" accesskey="c" /> <textarea name="original" rows="1" cols="1" style="display:none">{$this->s_original}</textarea> </div> </form> </div> {$help} EOD; }
function edit_form($page,$postdata,$digest = 0,$b_template = TRUE) { global $script,$vars,$rows,$cols,$hr,$function_freeze; global $_btn_addtop,$_btn_preview,$_btn_repreview,$_btn_update,$_btn_freeze,$_msg_help,$_btn_notchangetimestamp; global $whatsnew,$_btn_template,$_btn_load,$non_list,$load_template_func; $refer = $template = $addtag = $add_top = ''; if ($digest == 0) { $digest = md5(join('',get_source($page))); } $checked_top = array_key_exists('add_top',$vars) ? ' checked="checked"' : ''; $checked_time = array_key_exists('notimestamp',$vars) ? ' checked="checked"' : ''; if(array_key_exists('add',$vars)) { $addtag = '<input type="hidden" name="add" value="true" />'; $add_top = "<input type=\"checkbox\" name=\"add_top\" value=\"true\"$checked_top /><span class=\"small\">$_btn_addtop</span>"; } if($load_template_func and $b_template) { $_pages = get_existpages(); $pages = array(); foreach($_pages as $_page) { if ($_page == $whatsnew or preg_match("/$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 (array_key_exists('refer',$vars) and $vars['refer'] != '') { $refer = '[['.strip_bracket($vars['refer'])."]]\n\n"; } } $r_page = rawurlencode($page); $s_page = htmlspecialchars($page); $s_digest = htmlspecialchars($digest); $s_postdata = htmlspecialchars($refer.$postdata); $s_original = array_key_exists('original',$vars) ? htmlspecialchars($vars['original']) : $s_postdata; $b_preview = array_key_exists('preview',$vars); // プレビュー中TRUE $btn_preview = $b_preview ? $_btn_repreview : $_btn_preview; $body = <<<EOD <form action="$script" method="post"> <div class="edit_form"> $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" /> <textarea name="msg" rows="$rows" cols="$cols">$s_postdata</textarea> <br /> <input type="submit" name="preview" value="$btn_preview" accesskey="p" /> <input type="submit" name="write" value="$_btn_update" accesskey="s" /> $add_top <input type="checkbox" name="notimestamp" value="true"$checked_time /> <span style="small">$_btn_notchangetimestamp</span> <textarea name="original" rows="1" cols="1" style="display:none">$s_original</textarea> </div> </form> EOD; if (array_key_exists('help',$vars)) { $body .= $hr.catrule(); } else { $body .= <<<EOD <ul> <li><a href="$script?cmd=edit&help=true&page=$r_page">$_msg_help</a></li> </ul> EOD; } return $body; }
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; // Newly generate $digest or not if ($digest === FALSE) { $digest = md5(join('', get_source($page))); } $refer = $template = ''; // 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">' . '<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'] != '') { $refer = '[[' . strip_bracket($vars['refer']) . ']]' . "\n\n"; } } $r_page = rawurlencode($page); $s_page = htmlspecialchars($page); $s_digest = htmlspecialchars($digest); $s_postdata = htmlspecialchars($refer . $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 = '<input type="checkbox" name="notimestamp" ' . 'id="_edit_form_notimestamp" value="true"' . $checked_time . ' />' . "\n" . ' ' . '<label for="_edit_form_notimestamp"><span class="small">' . $_btn_notchangetimestamp . '</span></label>' . "\n" . $add_notimestamp . ' '; } // 'margin-bottom', 'float:left', and 'margin-top' // are for layout of 'cancel button' $body = <<<EOD <div id="realview_outer"><div id="realview"></div></div> <form action="{$script}" method="post"> <div id="tab_parent" class="edit_form show_list"> <p>{$template}</p> <ol> <li id="l1"><a href="#l1" onclick="tab('e1');">編集画面</a></li> <li id="l2"><a href="#l2" onclick="tab('e2');">ファイルのアップロード</a></li> <li id="l3"><a href="#l3" onclick="tab('e3');">Pukiwikiクイック記法リスト</a></li> </ol> <br /> <h3>編集画面</h3> <div id="e1" class="edit-mode"> <div class="edit_form"> <input type="hidden" name="cmd" value="edit" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="digest" value="{$s_digest}" /> <input type="hidden" name="ticket" value="{$s_ticket}" /> <input type="hidden" name="id" value="{$s_id}" /> <textarea id="msg" name="msg" rows="{$rows}" cols="{$cols}">{$s_postdata}</textarea> <div class="options"> <p> {$add_assistant} {$add_notimestamp} {$add_top} <input type="submit" name="preview" value="{$btn_preview}" accesskey="p" /> <input type="submit" name="write" value="{$_btn_update}" accesskey="s" /> </p> </div> <textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea> </div> </div> <h3>添付ファイルのアップロード</h3> <div id="e2" class="edit-mode"> <ul> <li><a href="{$script}?plugin=attach&pcmd=upload&page={$r_page}" title="添付ファイルをアップロードします">このウィンドウ内から添付</a></li> <li><a href="javascript:void(0);" onclick="window.open('{$script}?plugin=attach&pcmd=upload&page={$r_page}','attachment');" title="添付ファイルをアップロードします">別ウィンドウを開いて添付</a></li> </ul> <dl> <dt>アップロードしたファイルを表示する書式</dt> <dd><dl> <dt>編集中のページにファイルがある場合</dt> <dd>#ref(./<em>添付ファイル名</em>,nolink,<em>ファイルが表示されない時の説明</em>)</dd> <dt>別のページにファイルがある場合</dt> <dd>#ref(<span class="memo">ページ名</span>/<em>添付ファイル名</em>,nolink,<em>ファイルが表示されない時の説明</em>)</dd> </dl></dd> </dl> </div> <h3>Pukiwiki クイック記法リスト</h3> <div id="e3" class="edit-mode"> <p>詳しく、全部見たい場合は、<a href="{$script}?%C0%B0%B7%C1%A5%EB%A1%BC%A5%EB">記法のページ</a>で確認して下さい</p> <dl> <dt>ページの目次</dt> <dd><strong>#contents</strong></dd> <dt>見出し</dt> <dd><ul> <li><strong>*</strong>見出し・レベル1</li> <li><strong>**</strong>見出し・レベル2</li> <li><strong>***</strong>見出し・レベル3</li> <li><strong>****</strong>見出し・レベル4</li> </ul></dd> <dt>リスト(順序無し)</dt> <dd><ul> <li><strong>-</strong>リスト・レベル1</li> <li><strong>--</strong>リスト・レベル2</li> <li><strong>---</strong>リスト・レベル3</li> </ul></dd> <dt>リスト(順序有り)</dt> <dd><ul> <li><strong>+</strong>リスト・レベル1</li> <li><strong>++</strong>リスト・レベル2</li> <li><strong>+++</strong>リスト・レベル3</li> </ul></dd> <dt>段落</dt> <dd><strong>~</strong>勇者は薬草を手に入れた</dd> <dt>定義と説明</dt> <dd><strong>:</strong>○○って何?<strong>|</strong>××のことだよ</dd> <dt>表組み</dt> <dd><strong>|</strong>ああこう<strong>|</strong>どうこう<strong>|</strong> とするか <strong>,</strong>ああこう<strong>,</strong>どうこう</dd> <dt>コード</dt> <dd>コードの初めを <strong><pre></strong> で、終わりを <strong></pre></strong> でくくる</dd> <dt>URLリンク</dt><dd><strong>[[</strong>タイトル<strong>:</strong>リンク先のURL<strong>]]</strong></dd> <dt>サイト内リンク</dt> <dd><ul> <li><strong>[[</strong>ページの名前<strong>]]</strong></li> <li><strong>[[</strong>タイトル<strong>></strong>ページの名前<strong>]]</strong></li> </ul></dd> <dt>強調</dt> <dd><ul> <li><strong>'''</strong>強調<strong>'''</strong></li> <li><strong>''</strong>もっと強調<strong>''</strong></li> </ul></dd> <dt>注釈</dt> <dd><strong>((</strong>ただし、○○すること<strong>))</strong></dd> </dl> </div> \t </div> </form> EOD; if (isset($vars['help'])) { $body .= $hr . catrule(); } else { $body .= '<ul><li><a href="' . $script . '?cmd=edit&help=true&page=' . $r_page . '">' . $_msg_help . '</a></li></ul>'; } return $body; }