本文整理汇总了PHP中edit_form函数的典型用法代码示例。如果您正苦于以下问题:PHP edit_form函数的具体用法?PHP edit_form怎么用?PHP edit_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edit_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_unfreeze_action
function plugin_unfreeze_action()
{
global $script, $vars, $function_freeze;
global $_title_isunfreezed, $_title_unfreezed, $_title_unfreeze;
global $_msg_invalidpass, $_msg_unfreezing, $_btn_unfreeze;
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (!is_freeze($page)) {
// Unfreezed already
$msg =& $_title_isunfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), '<p>' . $_title_isunfreezed . '</p>');
} else {
if ($pass !== NULL && pkwk_login($pass)) {
// Unfreeze
$postdata = get_source($page);
array_shift($postdata);
$postdata = join('', $postdata);
file_write(DATA_DIR, $page, $postdata, TRUE);
// Update
is_freeze($page, TRUE);
if (PLUGIN_UNFREEZE_EDIT) {
$vars['cmd'] = 'read';
// To show 'Freeze' link
$msg =& $_title_unfreezed;
$body = edit_form($page, $postdata);
} else {
$vars['cmd'] = 'read';
$msg =& $_title_unfreezed;
$body = '';
}
} else {
// Show unfreeze form
// kazuwaya
$msg =& $_title_unfreeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_unfreezing}</p>
<form action="{$script}" method="post">
<p>
<input type="hidden" name="cmd" value="unfreeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_unfreeze}" />
</p>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}
示例2: plugin_add_action
function plugin_add_action()
{
global $get, $post, $vars, $_title_add, $_msg_add;
if (PKWK_READONLY) {
die_message('PKWK_READONLY prohibits editing');
}
$page = isset($vars['page']) ? $vars['page'] : '';
check_editable($page);
$get['add'] = $post['add'] = $vars['add'] = TRUE;
return array('msg' => $_title_add, 'body' => '<ul>' . "\n" . ' <li>' . $_msg_add . '</li>' . "\n" . '</ul>' . "\n" . edit_form($page, ''));
}
示例3: plugin_add_action
function plugin_add_action()
{
global $get, $post, $vars;
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
if (auth::check_role('readonly')) {
die_message('PKWK_READONLY prohibits editing');
}
$page = isset($vars['page']) ? $vars['page'] : '';
check_editable($page);
$get['add'] = $post['add'] = $vars['add'] = TRUE;
return array('msg' => _("Add to \$1"), 'body' => '<ul>' . "\n" . ' <li>' . _('Two and the contents of an input are added for a new-line to the contents of a page of present addition.') . '</li>' . "\n" . '</ul>' . "\n" . edit_form($page, ''));
}
示例4: plugin_add_action
function plugin_add_action()
{
global $get, $post, $vars;
$qm = get_qm();
if (PKWK_READONLY) {
die_message('PKWK_READONLY prohibits editing');
}
$page = isset($vars['page']) ? $vars['page'] : '';
check_editable($page);
$get['add'] = $post['add'] = $vars['add'] = TRUE;
return array('msg' => $qm->m['plg_add']['title'], 'body' => '<ul>' . "\n" . ' <li>' . $qm->m['plg_add']['note'] . '</li>' . "\n" . '</ul>' . "\n" . edit_form($page, ''));
}
示例5: create_forum
function create_forum($user, $team)
{
$f = BoincForum::lookup("parent_type=1 and category={$team->id}");
if ($f) {
error_page("Team already has a forum");
}
$id = BoincForum::insert("(category, parent_type) values ({$team->id}, 1)");
$forum = BoincForum::lookup_id($id);
if (!$forum) {
error_page("Couldn't create forum");
}
edit_form($user, $team, $forum, true);
}
示例6: mysql_error
echo mysql_error();
}
}
}
}
}
//$sql = "SELECT reagent_name,reagent_status,sum(`pack_size`) FROM `reagent`group by reagent_name,reagent_status LIMIT 0, 30 ";
//SELECT reagent_name,reagent_status,sum(`pack_size`) FROM `reagent`group by reagent_name,reagent_status
main_menu();
save_reagent($_POST);
delete_reagent($_POST);
save_inserted($_POST);
group_save($_POST);
if (isset($_POST['submit'])) {
if ($_POST['submit'] == 'edit') {
edit_form($_POST['id']);
}
}
show_reagent($_POST);
echo '<table><tr><td>';
search_form();
echo '</td><td>';
group_edit();
echo '</td><tr><td colspan=2>';
insert_reagent();
echo '</td></tr>';
view_data(17);
/*
echo '<pre>';
print_r($GLOBALS);
echo '</pre>';
示例7: array
$row = $result->fetch_assoc();
if (!$row) {
// MySQLi returns null
$row = false;
}
if (isset($_GET["select"]) && (!$row || $result->fetch_assoc())) {
// $result->num_rows != 1 isn't available in all drivers
$row = null;
}
}
}
if (!support("table") && !$fields) {
if (!$where) {
// insert
$result = $driver->adminer_select($TABLE, array("*"), $where, array("*"));
$row = $result ? $result->fetch_assoc() : false;
if (!$row) {
$row = array($driver->primary => "");
}
}
if ($row) {
foreach ($row as $key => $val) {
if (!$where) {
$row[$key] = null;
}
$fields[$key] = array("field" => $key, "null" => $key != $driver->primary, "auto_increment" => $key == $driver->primary);
}
}
}
edit_form($TABLE, $fields, $row, $update);
示例8: plugin_edit_write
function plugin_edit_write()
{
global $vars, $trackback;
global $_title_collided, $_msg_collided_auto, $_msg_collided, $_title_deleted;
global $notimeupdate, $_msg_invalidpass, $do_update_diff_table;
$page = isset($vars['page']) ? $vars['page'] : '';
$add = isset($vars['add']) ? $vars['add'] : '';
$digest = isset($vars['digest']) ? $vars['digest'] : '';
$vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']);
$msg =& $vars['msg'];
// Reference
$retvars = array();
// Collision Detection
$oldpagesrc = join('', get_source($page));
$oldpagemd5 = md5($oldpagesrc);
if ($digest != $oldpagemd5) {
$vars['digest'] = $oldpagemd5;
// Reset
$original = isset($vars['original']) ? $vars['original'] : '';
list($postdata_input, $auto) = do_update_diff($oldpagesrc, $msg, $original);
$retvars['msg'] = $_title_collided;
$retvars['body'] = ($auto ? $_msg_collided_auto : $_msg_collided) . "\n";
$retvars['body'] .= $do_update_diff_table;
$retvars['body'] .= edit_form($page, $postdata_input, $oldpagemd5, FALSE);
return $retvars;
}
// Action?
if ($add) {
// Add
if (isset($vars['add_top']) && $vars['add_top']) {
$postdata = $msg . "\n\n" . @join('', get_source($page));
} else {
$postdata = @join('', get_source($page)) . "\n\n" . $msg;
}
} else {
// Edit or Remove
$postdata =& $msg;
// Reference
}
// NULL POSTING, OR removing existing page
if ($postdata == '') {
page_write($page, $postdata);
$retvars['msg'] = $_title_deleted;
$retvars['body'] = str_replace('$1', htmlspecialchars($page), $_title_deleted);
if ($trackback) {
tb_delete($page);
}
return $retvars;
}
// $notimeupdate: Checkbox 'Do not change timestamp'
$notimestamp = isset($vars['notimestamp']) && $vars['notimestamp'] != '';
if ($notimeupdate > 1 && $notimestamp && !pkwk_login($vars['pass'])) {
// Enable only administrator & password error
$retvars['body'] = '<p><strong>' . $_msg_invalidpass . '</strong></p>' . "\n";
$retvars['body'] .= edit_form($page, $msg, $digest, FALSE);
return $retvars;
}
page_write($page, $postdata, $notimeupdate != 0 && $notimestamp);
pkwk_headers_sent();
header('Location: ' . get_script_uri() . '?' . rawurlencode($page));
exit;
}
示例9: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//include module files
include_once "modules/{$module_name}/configs/default.conf.php";
global $arrConf;
$arrConf['cadena_dsn'] = "mysql://root:palosanto@localhost/hispana";
// _pre($arrConf);
// _pre($_SESSION);
/*
global $arrLang;
#incluir el archivo de idioma de acuerdo al que este seleccionado
#si el archivo de idioma no existe incluir el idioma por defecto
$lang=get_language();
$script_dir=dirname($_SERVER['SCRIPT_FILENAME']);
// Include language file for EN, then for local, and merge the two.
include_once("modules/$module_name/lang/en.lang");
$lang_file="modules/$module_name/lang/$lang.lang";
if (file_exists("$script_dir/$lang_file")) {
$arrLangModuleEN = $arrLangModule;
include_once($lang_file);
$arrLangModule = array_merge($arrLangModuleEN, $arrLangModule);
}
*/
load_language_module($module_name);
require_once "modules/{$module_name}/libs/paloSantoDataForm.class.php";
//folder path for custom templates
$base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
$templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
$local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
// Definición del formulario de nueva formulario
$smarty->assign("MODULE_NAME", $module_name);
$smarty->assign("REQUIRED_FIELD", _tr('Required field'));
$smarty->assign("CANCEL", _tr('Cancel'));
$smarty->assign("APPLY_CHANGES", _tr('Apply changes'));
$smarty->assign("SAVE", _tr('Save'));
$smarty->assign("EDIT", _tr('Edit'));
$smarty->assign("DESCATIVATE", _tr('Desactivate'));
$smarty->assign("DELETE", _tr('Delete'));
$smarty->assign("CONFIRM_CONTINUE", _tr('Are you sure you wish to continue?'));
$smarty->assign("new_field", _tr('New Field'));
$smarty->assign("add_field", _tr('Add Field'));
$smarty->assign("update_field", _tr('Update Field'));
$smarty->assign("CONFIRM_DELETE", _tr('Are you sure you wish to delete form?'));
//Definicion de campos
$formCampos = array('form_nombre' => array("LABEL" => _tr('Form Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "60"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), 'form_description' => array("LABEL" => _tr('Form Description'), "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "33", "ROWS" => "2"), 'field_nombre' => array("LABEL" => _tr('Field Name'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "", "COLS" => "50", "ROWS" => "2"), "order" => array("LABEL" => _tr('Order'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("size" => "3"), "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""));
$smarty->assign("type", _tr('Type'));
$smarty->assign("select_type", "type");
$arr_type = array("VALUE" => array("TEXT", "LIST", "DATE", "TEXTAREA", "LABEL"), "NAME" => array(_tr('Type Text'), _tr('Type List'), _tr('Type Date'), _tr('Type Text Area'), _tr('Type Label')), "SELECTED" => "TEXT");
$smarty->assign("option_type", $arr_type);
$smarty->assign("item_list", _tr('List Item'));
$smarty->assign("agregar", _tr('Add Item'));
$smarty->assign("quitar", _tr('Remove Item'));
$oForm = new paloForm($smarty, $formCampos);
// print_r($_SESSION['ayuda']);
$xajax = new xajax();
$xajax->registerFunction("agregar_campos_formulario");
$xajax->registerFunction("cancelar_formulario_ingreso");
$xajax->registerFunction("guardar_formulario");
$xajax->registerFunction("eliminar_campos_formulario");
$xajax->registerFunction("editar_campo_formulario");
$xajax->registerFunction("update_campo_formulario");
$xajax->registerFunction("cancel_campo_formulario");
$xajax->registerFunction("desactivar_formulario");
$xajax->processRequests();
$smarty->assign("xajax_javascript", $xajax->printJavascript("libs/xajax/"));
$pDB = new paloDB($arrConf['cadena_dsn']);
if (!is_object($pDB->conn) || $pDB->errMsg != "") {
$smarty->assign("mb_message", _tr('Error when connecting to database') . " " . $pDB->errMsg);
}
if (isset($_POST['submit_create_form'])) {
$contenidoModulo = new_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
if (isset($_POST['edit'])) {
$contenidoModulo = edit_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
if (isset($_POST['delete'])) {
$contenidoModulo = delete_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "view") {
$contenidoModulo = view_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "activar") {
$contenidoModulo = activar_form($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "editarCampo") {
$contenidoModulo = editar_campo_status($pDB, $smarty, $module_name, $local_templates_dir, $formCampos, $oForm);
} else {
$contenidoModulo = listadoForm($pDB, $smarty, $module_name, $local_templates_dir);
}
}
}
}
}
}
return $contenidoModulo;
}
示例10: plugin_guiedit_edit_form
function plugin_guiedit_edit_form($page, $postdata, $digest = FALSE, $b_template = TRUE)
{
global $vars;
global $load_template_func, $whatsnew;
global $_button;
global $notimeupdate;
global $js_tags, $link_tags, $js_blocks;
global $guiedit_use_fck;
$script = get_script_uri();
// Newly generate $digest or not
if ($digest === FALSE) {
$digest = md5(get_source($page, TRUE, TRUE));
}
$s_id = isset($vars['id']) ? Utility::htmlsc($vars['id']) : '';
if (!$guiedit_use_fck) {
$body = edit_form($page, $postdata, $digest, $b_template);
$pattern = "/(<input\\s+type=\"hidden\"\\s+name=\"cmd\"\\s+value=\")edit(\"\\s*\\/?>)/";
$replace = "\$1guiedit\$2\n" . ' <input type="hidden" name="id" value="' . $s_id . '" />' . ' <input type="hidden" name="text" value="1" />';
$body = preg_replace($pattern, $replace, $body);
return $body;
}
// require_once(GUIEDIT_CONF_PATH . 'guiedit.ini.php');
// フォームの値の設定
$s_digest = Utility::htmlsc($digest);
$s_page = Utility::htmlsc($page);
$s_original = Utility::htmlsc($vars['original']);
$s_ticket = md5(MUTIME);
if (function_exists('pkwk_session_start') && pkwk_session_start() != 0) {
// BugTrack/95 fix Problem: browser RSS request with session
$_SESSION[$s_ticket] = md5(get_ticket() . $digest);
$_SESSION['origin' . $s_ticket] = md5(get_ticket() . str_replace("\r", '', $s_original));
}
// テンプレート
$template = '';
if ($load_template_func) {
global $guiedit_non_list;
$pages = array();
foreach (get_existpages() as $_page) {
if ($_page == $whatsnew || check_non_list($_page)) {
continue;
}
foreach ($guiedit_non_list as $key) {
$pos = strpos($_page . '/', $key . '/');
if ($pos !== FALSE && $pos == 0) {
continue 2;
}
}
$_s_page = Utility::htmlsc($_page);
$pages[$_page] = ' <option value="' . $_s_page . '">' . $_s_page . '</option>';
}
ksort($pages);
$s_pages = join("\n", $pages);
$template = <<<EOD
<select name="template_page">
\t<option value="">-- {$_button['template']} --</option>
{$s_pages}
</select>
<br />
EOD;
}
// チェックボックス「タイムスタンプを変更しない」
$add_notimestamp = '';
if ($notimeupdate != 0) {
$checked_time = isset($vars['notimestamp']) ? ' checked="checked"' : '';
// if ($notimeupdate == 2) {
if ($notimeupdate == 2 && Auth::check_role('role_contents_admin')) {
$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">' . $_button['notchangetimestamp'] . '</span></label>' . "\n" . $add_notimestamp . ' ';
}
// フォーム
$body = <<<EOD
<div id="guiedit">
\t<form id="guiedit_form" action="{$script}" method="post" style="margin-bottom:0px;">
\t{$template}
\t\t<input type="hidden" name="cmd" value="guiedit" />
\t\t<input type="hidden" name="page" value="{$s_page}" />
\t\t<input type="hidden" name="digest" value="{$s_digest}" />
\t\t<input type="hidden" name="ticket" value="{$s_ticket}" />
\t\t<input type="hidden" name="id" value="{$s_id}" />
\t\t<textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea>
\t\t<textarea name="msg" id="editor"></textarea>
\t\t<div class="pull-left">
\t\t<button type="submit" name="write" accesskey="s" class="btn btn-primary">{$_button['update']}</button>
\t\t<button type="button" name="preview" accesskey="p" class="btn btn-secondary">{$_button['preview']}</button>
\t\t{$add_notimestamp}
\t\t</div>
\t</form>
\t<form action="{$script}" method="post">
\t\t<input type="hidden" name="cmd" value="guiedit" />
\t\t<input type="hidden" name="page" value="{$s_page}" />
\t\t<input type="submit" name="cancel" value="{$_button['cancel']}" class="btn btn-warning" accesskey="c" />
\t</form>
</div>
EOD;
$js_tags[] = array('type' => 'text/javascript', 'src' => COMMON_URI . 'js/ckeditor/ckeditor.js', 'defer' => 'defer');
$js_tags[] = array('type' => 'text/javascript', 'src' => COMMON_URI . 'js/ckeditor/adapters/jquery.js', 'defer' => 'defer');
$js_tags[] = array('type' => 'text/javascript', 'src' => COMMON_URI . 'js/plugin/guiedit/guiedit.js', 'defer' => 'defer');
return $body;
}
示例11: plugin_template_action
function plugin_template_action()
{
global $script, $vars;
// global $_title_edit;
// global $_msg_template_start, $_msg_template_end, $_msg_template_page, $_msg_template_refer;
// global $_btn_template_create, $_title_template;
// global $_err_template_already, $_err_template_invalid, $_msg_template_force;
$_title_edit = _('Edit of $1');
$_msg_template_start = _('Start:<br />');
$_msg_template_end = _('End:<br />');
$_msg_template_page = _('$1/copy');
$_msg_template_refer = _('Page:');
$_msg_template_force = _('Edit with a page name which already exists');
$_err_template_already = _(' $1 already exists.');
$_err_template_invalid = _(' $1 is not a valid page name.');
$_btn_template_create = _('Create');
$_title_template = _('create a new page, using $1 as a template.');
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
// if (auth::check_role('readonly')) die_message('PKWK_READONLY prohibits editing');
if (auth::check_role('safemode') || auth::check_role('readonly')) {
die_message(_('Prohibited'));
}
if (!isset($vars['refer']) || !is_page($vars['refer'])) {
return FALSE;
}
if (!is_page($vars['refer']) || !check_readable($vars['refer'], false, false)) {
return array('msg' => _(' $1 was not found.'), 'body' => _('cannot display the page source.'));
}
$lines = get_source($vars['refer']);
auth::is_role_page($lines);
// Remove '#freeze'
if (!empty($lines) && strtolower(rtrim($lines[0])) == '#freeze') {
array_shift($lines);
}
$begin = isset($vars['begin']) && is_numeric($vars['begin']) ? $vars['begin'] : 0;
$end = isset($vars['end']) && is_numeric($vars['end']) ? $vars['end'] : count($lines) - 1;
if ($begin > $end) {
$temp = $begin;
$begin = $end;
$end = $temp;
}
$page = isset($vars['page']) ? $vars['page'] : '';
$is_page = is_page($page);
// edit
if ($is_pagename = is_pagename($page) && (!$is_page || !empty($vars['force']))) {
$postdata = join('', array_splice($lines, $begin, $end - $begin + 1));
$retvar['msg'] = $_title_edit;
$retvar['body'] = edit_form($vars['page'], $postdata);
$vars['refer'] = $vars['page'];
return $retvar;
}
$begin_select = $end_select = '';
for ($i = 0; $i < count($lines); $i++) {
$line = htmlspecialchars(mb_strimwidth($lines[$i], 0, MAX_LEN, '...'));
$tag = $i == $begin ? ' selected="selected"' : '';
$begin_select .= "<option value=\"{$i}\"{$tag}>{$line}</option>\n";
$tag = $i == $end ? ' selected="selected"' : '';
$end_select .= "<option value=\"{$i}\"{$tag}>{$line}</option>\n";
}
$_page = htmlspecialchars($page);
$msg = $tag = '';
if ($is_page) {
$msg = $_err_template_already;
$tag = '<input type="checkbox" name="force" value="1" />' . $_msg_template_force;
} else {
if ($page != '' && !$is_pagename) {
$msg = str_replace('$1', $_page, $_err_template_invalid);
}
}
$s_refer = htmlspecialchars($vars['refer']);
$s_page = $page == '' ? str_replace('$1', $s_refer, $_msg_template_page) : $_page;
$ret = <<<EOD
<form action="{$script}" method="post">
<div>
<input type="hidden" name="plugin" value="template" />
<input type="hidden" name="refer" value="{$s_refer}" />
{$_msg_template_start} <select name="begin" size="10">{$begin_select}</select><br /><br />
{$_msg_template_end} <select name="end" size="10">{$end_select}</select><br /><br />
<label for="_p_template_refer">{$_msg_template_refer}</label>
<input type="text" name="page" id="_p_template_refer" value="{$s_page}" />
<input type="submit" name="submit" value="{$_btn_template_create}" /> {$tag}
</div>
</form>
EOD;
$retvar['msg'] = $msg == '' ? $_title_template : $msg;
$retvar['body'] = $ret;
return $retvar;
}
示例12: plugin_guiedit_edit_form
function plugin_guiedit_edit_form($page, $postdata, $digest = FALSE, $b_template = TRUE)
{
global $vars;
global $load_template_func, $whatsnew;
global $_button;
global $notimeupdate;
global $head_tags, $javascript;
global $guiedit_use_fck;
// Newly generate $digest or not
if ($digest === FALSE) {
$digest = md5(get_source($page, TRUE, TRUE));
}
$s_id = isset($vars['id']) ? htmlspecialchars($vars['id']) : '';
if (!$guiedit_use_fck) {
$body = edit_form($page, $postdata, $digest, $b_template);
$pattern = "/(<input\\s+type=\"hidden\"\\s+name=\"cmd\"\\s+value=\")edit(\"\\s*\\/?>)/";
$replace = "\$1guiedit\$2\n" . ' <input type="hidden" name="id" value="' . $s_id . '" />' . ' <input type="hidden" name="text" value="1" />';
$body = preg_replace($pattern, $replace, $body);
return $body;
}
require_once GUIEDIT_LIB_PATH . 'guiedit.ini.php';
// フォームの値の設定
$s_digest = htmlspecialchars($digest);
$s_page = htmlspecialchars($page);
$s_original = htmlspecialchars($vars['original']);
$s_ticket = md5(MUTIME);
if (function_exists('pkwk_session_start') && pkwk_session_start() != 0) {
// BugTrack/95 fix Problem: browser RSS request with session
$_SESSION[$s_ticket] = md5(get_ticket() . $digest);
$_SESSION['origin' . $s_ticket] = md5(get_ticket() . str_replace("\r", '', $s_original));
}
// テンプレート
$template = '';
if ($load_template_func) {
global $guiedit_non_list;
$pages = array();
foreach (get_existpages() as $_page) {
if ($_page == $whatsnew || check_non_list($_page)) {
continue;
}
foreach ($guiedit_non_list as $key) {
$pos = strpos($_page . '/', $key . '/');
if ($pos !== FALSE && $pos == 0) {
continue 2;
}
}
$_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" onchange="Template()">
<option value="">-- {$_button['template']} --</option>
{$s_pages}
</select>
<br />
EOD;
}
// チェックボックス「タイムスタンプを変更しない」
$add_notimestamp = '';
if ($notimeupdate != 0) {
$checked_time = isset($vars['notimestamp']) ? ' checked="checked"' : '';
// if ($notimeupdate == 2) {
if ($notimeupdate == 2 && auth::check_role('role_adm_contents')) {
$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">' . $_button['notchangetimestamp'] . '</span></label>' . "\n" . $add_notimestamp . ' ';
}
// フォーム
$body = <<<EOD
<div class="edit_form">
<form id="edit_form" action="{$script}" method="post" style="margin-bottom:0px;">
{$template}
<input type="hidden" name="cmd" value="guiedit" />
<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 name="msg" rows="1" cols="1" style="display:none"></textarea>
<div style="float:left;">
<input type="submit" name="write" value="{$_button['update']}" accesskey="s" onclick="Write()" />
<input type="button" name="preview" value="{$_button['preview']}" accesskey="p" onclick="Preview()" />
{$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="guiedit" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="submit" name="cancel" value="{$_button['cancel']}" accesskey="c" />
</form>
</div>
<div id="preview_indicator" style="display:none"></div>
<div id="preview_area" style="display:none"></div>
EOD;
// JavaScript を有効にする
$javascript = 1;
//.........这里部分代码省略.........
示例13: plugin_edit_write
function plugin_edit_write()
{
global $vars, $trackback, $layout_pages;
global $notimeupdate, $do_update_diff_table;
global $qblog_defaultpage, $date_format, $qblog_menubar;
$qm = get_qm();
$page = isset($vars['page']) ? $vars['page'] : '';
$add = isset($vars['add']) ? $vars['add'] : '';
$digest = isset($vars['digest']) ? $vars['digest'] : '';
$vars['msg'] = preg_replace(PLUGIN_EDIT_FREEZE_REGEX, '', $vars['msg']);
$msg =& $vars['msg'];
// Reference
$retvars = array();
// Collision Detection
$oldpagesrc = join('', get_source($page));
$oldpagemd5 = md5($oldpagesrc);
if ($digest != $oldpagemd5) {
$vars['digest'] = $oldpagemd5;
// Reset
$original = isset($vars['original']) ? $vars['original'] : '';
list($postdata_input, $auto) = do_update_diff($oldpagesrc, $msg, $original);
$retvars['msg'] = $qm->m['fmt_title_collided'];
$retvars['body'] = ($auto ? $qm->m['fmt_msg_collided_auto'] : $qm->m['fmt_msg_collided']) . "\n";
$retvars['body'] .= $do_update_diff_table;
$retvars['body'] .= edit_form($page, $postdata_input, $oldpagemd5, FALSE);
return $retvars;
}
// Action?
if ($add) {
// Add
if (isset($vars['add_top']) && $vars['add_top']) {
$postdata = $msg . "\n\n" . @join('', get_source($page));
} else {
$postdata = @join('', get_source($page)) . "\n\n" . $msg;
}
} else {
// Edit or Remove
$postdata =& $msg;
// Reference
}
//ブログの時は、タイトルを足す
if ($page !== $qblog_defaultpage && is_qblog()) {
global $qblog_default_cat;
$title = trim($vars['title']);
$image = trim($vars['image']);
$cat = trim($vars['category']);
$cat = $cat === '' ? $qblog_default_cat : $cat;
if ($postdata !== '') {
$postdata = 'TITLE:' . $title . "\n" . $postdata;
}
}
// NULL POSTING, OR removing existing page
if ($postdata == '') {
page_write($page, $postdata);
$retvars['msg'] = $qm->m['fmt_title_deleted'];
$retvars['body'] = str_replace('$1', htmlspecialchars($page), $qm->m['fmt_title_deleted']);
if ($trackback) {
tb_delete($page);
}
return $retvars;
}
// $notimeupdate: Checkbox 'Do not change timestamp'
$notimestamp = isset($vars['notimestamp']) && $vars['notimestamp'] != '';
if ($notimeupdate > 1 && $notimestamp && !pkwk_login($vars['pass'])) {
// Enable only administrator & password error
$retvars['body'] = '<p><strong>' . $qm->m['fmt_msg_invalidpass'] . '</strong></p>' . "\n";
$retvars['body'] .= edit_form($page, $msg, $digest, FALSE);
return $retvars;
}
page_write($page, $postdata, $notimeupdate != 0 && $notimestamp);
//ブログの場合
if ($page !== $qblog_defaultpage && is_qblog()) {
// 日付の変更があったら、ページ名の変更
$page_date = get_qblog_date($date_format, $page);
if ($page_date and $vars['qblog_date'] != $page_date) {
// ページ名の変更
if (exist_plugin('rename')) {
// ! renameのために $vasの値を変更
$vars['page'] = $newpage = qblog_get_newpage($vars['qblog_date']);
$vars['refer'] = $refer = $page;
$vars['exist'] = 1;
$pages = array();
$pages[encode($refer)] = encode($newpage);
$files = plugin_rename_get_files($pages);
$exists = array();
foreach ($files as $_page => $arr) {
foreach ($arr as $old => $new) {
if (file_exists($new)) {
$exists[$_page][$old] = $new;
}
}
}
plugin_rename_proceed($pages, $files, $exists, FALSE);
//保留コメントリスト内のページ名を変更
$datafile = CACHEQBLOG_DIR . 'qblog_pending_comments.dat';
$pending_comments = unserialize(file_get_contents($datafile));
foreach ($pending_comments as $i => $comment) {
if ($comment['page'] == $page) {
$pending_comments[$i]['page'] = $newpage;
}
//.........这里部分代码省略.........
示例14: dirname
<?php
require_once dirname(__FILE__) . "/../html.php";
require_once dirname(__FILE__) . "/../file.php";
require_once dirname(__FILE__) . "/edit.php";
if (defined('EDIT_FILE')) {
if ($REQUEST_METHOD == 'POST') {
if (edit_save(EDIT_FILE, $data)) {
print "Saved";
} else {
die("Couldn't save file");
}
} else {
print edit_form(EDIT_FILE);
}
} else {
die("No file specified.");
}
示例15: plugin_unfreeze_action
function plugin_unfreeze_action()
{
global $script, $vars, $function_freeze;
$_title_isunfreezed = _(' $1 is not frozen');
$_title_unfreezed = _(' $1 has been unfrozen.');
$_title_unfreeze = _('Unfreeze $1');
$_msg_invalidpass = _('Invalid password.');
$_msg_unfreezing = _('Please input the password for unfreezing.');
$_btn_unfreeze = _('Unfreeze');
$page = isset($vars['page']) ? $vars['page'] : '';
if (!$function_freeze || is_cantedit($page) || !is_page($page)) {
return array('msg' => '', 'body' => '');
}
$pass = isset($vars['pass']) ? $vars['pass'] : NULL;
$msg = $body = '';
if (!is_freeze($page)) {
// Unfreezed already
$msg = $_title_isunfreezed;
$body = str_replace('$1', htmlspecialchars(strip_bracket($page)), $_title_isunfreezed);
} else {
if (!auth::check_role('role_adm_contents') || $pass !== NULL && pkwk_login($pass)) {
// BugTrack2/255
check_readable($page, true, true);
// Unfreeze
$postdata = get_source($page);
array_shift($postdata);
$postdata = join('', $postdata);
file_write(DATA_DIR, $page, $postdata, TRUE);
// Update
is_freeze($page, TRUE);
if (PLUGIN_UNFREEZE_EDIT) {
// BugTrack2/255
check_editable($page, true, true);
// $vars['cmd'] = 'read'; // To show 'Freeze' link
$vars['cmd'] = 'edit';
$msg = $_title_unfreezed;
$body = edit_form($page, $postdata);
} else {
$vars['cmd'] = 'read';
$msg = $_title_unfreezed;
$body = '';
}
} else {
// Show unfreeze form
$msg = $_title_unfreeze;
$s_page = htmlspecialchars($page);
$body = $pass === NULL ? '' : "<p><strong>{$_msg_invalidpass}</strong></p>\n";
$body .= <<<EOD
<p>{$_msg_unfreezing}</p>
<form action="{$script}" method="post">
<div>
<input type="hidden" name="cmd" value="unfreeze" />
<input type="hidden" name="page" value="{$s_page}" />
<input type="password" name="pass" size="12" />
<input type="submit" name="ok" value="{$_btn_unfreeze}" />
</div>
</form>
EOD;
}
}
return array('msg' => $msg, 'body' => $body);
}