Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
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, ''));
}
Exemplo n.º 3
0
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, ''));
}
Exemplo n.º 4
0
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, ''));
}
Exemplo n.º 5
0
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);
}
Exemplo n.º 6
0
                    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>';
Exemplo n.º 7
0
        $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);
Exemplo n.º 8
0
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;
}
Exemplo n.º 9
0
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    global $arrConf;
    $arrConf['cadena_dsn'] = "mysql://*****:*****@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;
}
Exemplo n.º 10
0
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 . '&nbsp;';
    }
    //	フォーム
    $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;
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
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 . '&nbsp;';
    }
    //	フォーム
    $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;
    $root = get_baseuri('abs');
    //	ヘッダの設定
    $head_tags[] = ' <link rel="stylesheet" type="text/css" href="' . GUIEDIT_LIB_PATH . 'guiedit.css" charset="UTF-8" />';
    $head_tags[] = ' <script type="text/javascript" src="' . GUIEDIT_FCK_PATH . 'fckeditor.js" charset="UTF-8"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . GUIEDIT_LIB_PATH . 'ajax.js" charset="UTF-8"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . GUIEDIT_LIB_PATH . 'guiedit.js" charset="UTF-8"></script>';
    $head_tags[] = ' <script type="text/javascript">';
    $head_tags[] = ' <!-- <![CDATA[';
    $head_tags[] = ' var SMILEY_PATH="' . $root . IMAGE_URI . "face/" . '";';
    $head_tags[] = ' var FCK_PATH="' . $root . GUIEDIT_FCK_PATH . '";';
    $head_tags[] = ' var GUIEDIT_PATH="' . $root . GUIEDIT_LIB_PATH . '";';
    $head_tags[] = ' //]]>-->';
    $head_tags[] = ' </script>';
    return $body;
}
Exemplo n.º 13
0
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;
                    }
                }
                file_put_contents($datafile, serialize($pending_comments), LOCK_EX);
                //最新コメントリスト内のページ名を変更
                $datafile = CACHEQBLOG_DIR . 'qblog_recent_comments.dat';
                file_put_contents($datafile, str_replace($page, $newpage, file_get_contents($datafile)), LOCK_EX);
                //変数を格納し直す
                $page = $newpage;
            }
        }
        //ブログの時は、ポストキャッシュを書き換える
        $option = array('category' => $cat, 'image' => $image);
        qblog_update_post($force, $page, $option);
        //Ping送信を行う
        if (!$notimestamp) {
            send_qblog_ping();
        }
    }
    pkwk_headers_sent();
    //ブログメニューの場合、ブログトップへ移動する
    if ($page === $qblog_menubar) {
        header('Location: ' . get_script_uri() . '?' . $qblog_defaultpage);
    } else {
        if (array_key_exists($page, $layout_pages)) {
            header('Location: ' . get_script_uri());
        } else {
            header('Location: ' . get_script_uri() . '?' . rawurlencode($page));
        }
    }
    exit;
}
Exemplo n.º 14
0
<?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.");
}
Exemplo n.º 15
0
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);
}
Exemplo n.º 16
0
 function process()
 {
     global $do_update_diff_table, $notimeupdate;
     $qm = get_qm();
     $this->init();
     $this->check();
     if (substr($this->postdata, -1) !== "\n") {
         $this->postdata .= "\n";
     }
     $this->sections->set_section($this->id, $this->postdata, $this->level);
     $postdata = $this->sections->get_source();
     $current_src = get_source($this->page, true, true);
     $current_md5 = md5($current_src);
     if ($this->digest !== $current_md5) {
         list($postdata, $auto) = do_update_diff($current_src, $postdata, $this->original);
         $this->s_postdata = htmlspecialchars($postdata);
         $this->s_digest = htmlspecialchars($current_md5);
         $body = ($auto ? $qm->m['fmt_msg_collided_auto'] : $qm->m['fmt_msg_collided']) . "\n";
         $body .= $do_update_diff_table . edit_form($this->page, $postdata, $current_md5, false);
         return array('msg' => $qm->m['fmt_title_collided'], 'body' => $body);
     }
     if ($postdata === '') {
         page_write($this->page, $postdata);
         return array('msg' => $qm->m['fmt_title_deleted'], 'body' => str_replace('$1', $this->s_page, $qm->m['fmt_title_deleted']));
     }
     if ($notimeupdate > 1 && $this->notimestamp && !pkwk_login($this->pass)) {
         return array('msg' => $qm->m['fmt_title_edit'], 'body' => "<p><strong>{$qm->m['fmt_msg_invalidpass']}</strong></p>\n" . $this->form());
     }
     if (md5($postdata) === $current_md5) {
         $this->redirect($this->page);
     }
     page_write($this->page, $postdata, $notimeupdate != 0 && $this->notimestamp);
     $this->redirect($this->page);
 }
Exemplo n.º 17
0
        break;
    case "update":
        $lastop = $data->set_scscf($_POST);
        $result = $data->get_scscf($_POST);
        edit_form($result);
        break;
    case "new":
        $lastop = $data->new_scscf($_POST);
        $result = $data->get_scscf($_POST);
        edit_form($result);
        break;
    case "del":
        $lastop = $data->del_scscf($_POST);
        $result = $data->get_scscf_list($_POST);
        search_result($result);
        break;
    case "addcap":
        $lastopcap = $data->set_scscf_capability($_POST);
        $result = $data->get_scscf($_POST);
        edit_form($result);
        break;
    case "delcap":
        $lastopcap = $data->del_scscf_capability($_POST, 1);
        $result = $data->get_scscf($_POST);
        edit_form($result);
        break;
    default:
        search_form();
}
page_close();
include "post.inc";
Exemplo n.º 18
0
function plugin_edit_write()
{
    global $post, $vars, $trackback;
    global $notimeupdate, $do_update_diff_table;
    global $use_trans_sid_address;
    //	global $_title_collided, $_msg_collided_auto, $_msg_collided, $_title_deleted;
    //	global $_msg_invalidpass;
    $_title_deleted = _(' $1 was deleted');
    $_msg_invalidpass = _('Invalid password.');
    $page = isset($vars['page']) ? $vars['page'] : '';
    $add = isset($vars['add']) ? $vars['add'] : '';
    $digest = isset($vars['digest']) ? $vars['digest'] : '';
    $partid = isset($vars['id']) ? $vars['id'] : '';
    $notimestamp = isset($vars['notimestamp']) && $vars['notimestamp'] != '';
    // Check Validate and Ticket
    if ($notimestamp && !is_page($page)) {
        return plugin_edit_honeypot();
    }
    // SPAM Check (Client(Browser)-Server Ticket Check)
    if (isset($post['encode_hint']) && $post['encode_hint'] != PKWK_ENCODING_HINT) {
        return plugin_edit_honeypot();
    }
    if (!isset($post['encode_hint']) && PKWK_ENCODING_HINT != '') {
        return plugin_edit_honeypot();
    }
    // Validate
    if (is_spampost(array('msg'))) {
        return plugin_edit_honeypot();
    }
    // Paragraph edit mode
    if ($partid) {
        $source = preg_split('/([^\\n]*\\n)/', $vars['original'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        if (plugin_edit_parts($partid, $source, $vars['msg']) !== FALSE) {
            $vars['msg'] = join('', $source);
        } else {
            $vars['msg'] = rtrim($vars['original']) . "\n\n" . $vars['msg'];
        }
    }
    // Delete "#freeze" command for form edit.
    $vars['msg'] = preg_replace('/^#freeze\\s*$/im', '', $vars['msg']);
    $msg =& $vars['msg'];
    // Reference
    $retvars = array();
    // Collision Detection
    $oldpagesrc = get_source($page, TRUE, TRUE);
    $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);
        $_msg_collided_auto = _('It seems that someone has already updated this page while you were editing it.<br />') . _('The collision has been corrected automatically, but there may still be some problems with the page.<br />') . _('To confirm the changes to the page, press [Update].<br />');
        $_msg_collided = _('It seems that someone has already updated this page while you were editing it.<br />') . _(' + is placed at the beginning of a line that was newly added.<br />') . _(' ! is placed at the beginning of a line that has possibly been updated.<br />') . _(' Edit those lines, and submit again.');
        $retvars['msg'] = _('On updating  $1, a collision has occurred.');
        $retvars['body'] = ($auto ? $_msg_collided_auto : $_msg_collided) . "\n";
        $retvars['body'] .= $do_update_diff_table;
        unset($vars['id']);
        // Change edit all-text of pages(from para-edit)
        $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'])) {
    if ($notimeupdate > 1 && $notimestamp && auth::check_role('role_adm_contents') && !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, $notimestamp);
    pkwk_headers_sent();
    if (isset($vars['refpage']) && $vars['refpage'] != '') {
        if ($partid) {
            header('Location: ' . get_page_location_uri($vars['refpage'], '', rawurlencode($partid)));
        } else {
            header('Location: ' . get_page_location_uri($vars['refpage']));
        }
    } else {
        if ($partid) {
            header('Location: ' . get_page_location_uri($page, '', rawurlencode($partid)));
        } else {
            header('Location: ' . get_page_location_uri($page));
        }
    }
    exit;
}
Exemplo n.º 19
0
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;
    if (PKWK_READONLY) {
        die_message('PKWK_READONLY prohibits editing');
    }
    if (!isset($vars['refer']) || !is_page($vars['refer'])) {
        return false;
    }
    $lines = get_source($vars['refer']);
    // 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 = htmlsc(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 = htmlsc($page);
    $msg = $tag = '';
    if ($is_page) {
        $msg = $_err_template_already;
        $tag = '<input type="checkbox" name="force" value="1" />' . $_msg_template_force;
    } elseif ($page != '' && !$is_pagename) {
        $msg = str_replace('$1', $_page, $_err_template_invalid);
    }
    $s_refer = htmlsc($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;
}
Exemplo n.º 20
0
                     break;
                 }
                 $affected += $connection->affected_rows;
             }
         }
     }
     $message = lang('%d item(s) have been affected.', $affected);
     if ($_POST["clone"] && $result && $affected == 1) {
         $last_id = last_id();
         if ($last_id) {
             $message = lang('Item%s has been inserted.', " {$last_id}");
         }
     }
     queries_adminer_redirect(remove_from_uri($_POST["all"] && $_POST["delete"] ? "page" : ""), $message, $result);
     if (!$_POST["delete"]) {
         edit_form($TABLE, $fields, (array) $_POST["fields"], !$_POST["clone"]);
         page_footer();
         exit;
     }
 } elseif (!$_POST["import"]) {
     // modify
     if (!$_POST["val"]) {
         $error = lang('Ctrl+click on a value to modify it.');
     } else {
         $result = true;
         $affected = 0;
         foreach ($_POST["val"] as $unique_idf => $row) {
             $set = array();
             foreach ($row as $key => $val) {
                 $key = bracket_escape($key, 1);
                 // 1 - back
Exemplo n.º 21
0
<?php

bb_get_header();
?>
<h3 class="bbcrumb"><a href="<?php 
bb_option('uri');
?>
"><?php 
bb_option('name');
?>
</a> &raquo; <?php 
_e('Edit Post');
?>
</h3>

<?php 
edit_form();
?>

<?php 
bb_get_footer();
Exemplo n.º 22
0
function plugin_template_action()
{
    global $vars;
    global $_template_msg;
    if (Auth::check_role('safemode') || Auth::check_role('readonly')) {
        die_message($_template_msg['msg_template_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' => $_template_msg['title_page_notfound'], 'body' => $_template_msg['msg_page_notfound']);
    }
    $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'] = $_template_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 = htmlsc(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 = htmlsc($page);
    $msg = $tag = '';
    if ($is_page) {
        $msg = $_template_msg['err_template_already'];
        $tag = '<input type="checkbox" name="force" value="1" id="_p_template_force" /><label for="_p_template_force">' . $_template_msg['msg_template_force'] . '</label>';
    } else {
        if ($page != '' && !$is_pagename) {
            $msg = str_replace('$1', $_page, $_template_msg['err_template_invalid']);
        }
    }
    $s_refer = htmlsc($vars['refer']);
    $s_page = $page == '' ? str_replace('$1', $s_refer, $_template_msg['msg_template_page']) : $_page;
    $script = get_script_uri();
    $ret = <<<EOD
<form action="{$script}" method="post" class="form-horizontal plugin-template-form">
\t<input type="hidden" name="cmd" value="template" />
\t<input type="hidden" name="refer" value="{$s_refer}" />
\t<div class="form-group">
\t\t<label for="_p_template_begin" class="col-md-2 control-label">{$_template_msg['msg_template_start']}</label>
\t\t<div class="col-md-10">
\t\t\t<select name="begin" size="10" id="_p_template_begin" class="form-control">{$begin_select}</select>
\t\t</div>
\t</div>
\t<div class="form-group">
\t\t<label for="_p_template_end" class="col-md-2 control-label">{$_template_msg['msg_template_end']}</label>
\t\t<div class="col-md-10">
\t\t\t<select name="end"   size="10" id="_p_template_end" class="form-control">{$end_select}</select>
\t\t</div>
\t</div>
\t<div class="form-group">
\t\t<label for="_p_template_refer" class="col-md-2 control-label">{$_template_msg['msg_template_refer']}</label>
\t\t<div class="col-md-10">
\t\t\t<input type="text" name="page" id="_p_template_refer" class="form-control" value="{$s_page}" />
\t\t</div>
\t</div>
\t<div class="form-group">
\t\t<div class="col-md-offset-2 col-md-10">
\t\t\t<input type="submit" class="btn btn-primary" name="submit" value="{$_template_msg['btn_template_create']}" />
\t\t</div>
\t</div>
\t{$tag}
</form>
EOD;
    $retvar['msg'] = $msg == '' ? $_template_msg['title_template'] : $msg;
    $retvar['body'] = $ret;
    return $retvar;
}