Esempio n. 1
0
 function display_add_field($recordid = 0)
 {
     global $CFG, $DB, $OUTPUT;
     $text = '';
     $format = 0;
     if ($recordid) {
         if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
             $text = $content->content;
             $format = $content->content1;
         }
     }
     $str = '<div title="' . $this->field->description . '">';
     if (can_use_html_editor()) {
         // Show a rich text html editor.
         $str .= $this->gen_textarea(true, $text);
         $str .= $OUTPUT->help_icon(moodle_help_icon::make("richtext2", get_string("helprichtext"), 'moodle', true));
         $str .= '<input type="hidden" name="field_' . $this->field->id . '_content1' . '" value="' . FORMAT_HTML . '" />';
     } else {
         // Show a normal textarea. Also let the user specify the format to be used.
         $str .= $this->gen_textarea(false, $text);
         // Get the available text formats for this field.
         $formatsForField = format_text_menu();
         $str .= '<br />';
         $select = html_select($formatsForField, 'field_' . $this->field->id . '_content1', $format);
         $select->nothingvalue = '';
         $str .= $OUTPUT->select($select);
         $str .= $OUTPUT->help_icon(moodle_help_icon::make('textformat', get_string('helpformatting'), 'moodle'));
     }
     $str .= '</div>';
     return $str;
 }
Esempio n. 2
0
function switch_lang()
{
    global $LANG, $langs;
    echo "<form action=''>\n<div id='lang'>";
    hidden_fields($_GET, array('lang'));
    echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "var loc = location.search.replace(/[?&]lang=[^&]*/, ''); location.search = loc + (loc ? '&' : '') + 'lang=' + this.value;");
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "</div>\n</form>\n";
}
Esempio n. 3
0
function switch_lang()
{
    global $LANG, $langs, $token;
    echo "<form action='' method='post'>\n<div id='lang'>";
    echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "this.form.submit();");
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "<input type='hidden' name='token' value='{$token}'>\n";
    echo "</div>\n</form>\n";
}
Esempio n. 4
0
function switch_lang()
{
    //Presenta la lista de seleccion de idiomas
    global $LANG, $langs;
    echo "<form action='' method='post'>\n\n\t\t<div id='lang'>\n\t\t\t<div class='input-group'>\n\t\t\t\t<span class='input-group-addon'>\n\t\t\t\t\t<i class='fa fa-language'></i> ";
    echo lang('Language') . "\n\t\t\t\t</span>\n\t\t\t" . html_select("lang", $langs, $LANG, "this.form.submit();", "btn-default btn-xs");
    echo " <input type='submit' value='" . lang('Use') . "' class='hidden'>\n";
    echo "<input type='hidden' name='token' value='" . get_token() . "'>\n";
    // $token may be empty in auth.inc.php
    echo "</div>\n\n\t\t</div>\n\t\t</form>\n";
}
Esempio n. 5
0
 public function getFilterInput($value)
 {
     $items = $this->getListItems();
     if (!$this->getOption('filter_multiple')) {
         $items = array('' => '') + $items;
         // array_pad($items, (sizeof($items)+1)*-1, '');
         return html_select($this->name, $items, $value);
     } else {
         $value = is_array($value) ? $value : array();
         return html_select_multiple($this->name, $items, $value);
     }
 }
Esempio n. 6
0
 function selectEmailPrint($emailFields, $columns)
 {
     if ($emailFields) {
         print_fieldset("email", 'E-mail');
         echo "<div onkeydown=\"eventStop(event); return bodyKeydown(event, 'email');\">\n";
         echo "<p>" . 'From' . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
         echo 'Subject' . ": <select name='email_id'><option>" . optionlist(get_key_vals("SELECT {$this->id}, {$this->title} FROM {$this->table} ORDER BY {$this->title}"), $_POST["email_id"], true) . "</select>\n";
         echo "<p>" . 'Attachments' . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
         echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
         echo "<input type='submit' name='email' value='" . 'Send' . "' onclick=\"return this.form['delete'].onclick();\">\n";
         echo "</div>\n";
         echo "</div></fieldset>\n";
         return true;
     }
 }
function dataERP($params)
{
    global $sugar_config, $mod_strings;
    require $sugar_config['path_parametros'] . "param_criterio_cotizacion.php";
    require_once "custom/opalo/lib/ERP/Utils.php";
    require_once "custom/opalo/lib/Utils.php";
    $account_field = isset($params['account_field']) ? $params['account_field'] : "account_id";
    //Campo para obtener el id del cliente
    $parametros = array(array('etiqueta' => 'LBL_REFERENCIA', 'html' => inputHtml('referencia', '', 'form-control')), array('etiqueta' => 'LBL_DESCRIPCION', 'html' => inputHtml('descripcion', '', 'form-control')));
    $js_params = array('referencia', 'descripcion');
    foreach ($criterio_cotizacion as $id_plan => $etiqueta) {
        $parametros[] = array('etiqueta' => $etiqueta, 'html' => html_select("criterios[{$id_plan}]", getCriterios($id_plan), '', false, 'form-control', true));
        $js_params[] = "criterios\\[{$id_plan}\\]";
    }
    $num_col = 6;
    $css = array("custom/opalo/Vendor/datatables/css/jquery.dataTables.css");
    $html .= "";
    foreach ($css as $incluir) {
        $html .= '<link rel="stylesheet" type="text/css" href="' . $incluir . '" />';
    }
    $html .= "<div class='panel panel-primary'>";
    $html .= "<div class='panel-heading'>\n              <h3 class='panel-title'>\n                Items ERP &nbsp;&nbsp;<a data-toggle='collapse' href='#wp_erp' class='btn_switch_panel'><span class='caret'></span></a> \n                <button type='button' class='close' aria-hidden='true'>&times;</button>\n              </h3>\n            </div>";
    $html .= "<div class='panel-body'>";
    $html .= "<div id='wp_erp' class='collapse text-center'>";
    $html .= "<div class='wp_filters row'>";
    while (count($parametros) > 0) {
        for ($contador = 0; $contador < $num_col; $contador++) {
            $porc = 100 / ($num_col * 2);
            $data = array_shift($parametros);
            $label = $data['etiqueta'];
            if (isset($mod_strings[$data['etiqueta']])) {
                $label = $mod_strings[$data['etiqueta']];
            }
            $html .= "<div class='col-md-3 form-group'><label>" . $label . "</label>" . $data['html'] . "</div>";
        }
    }
    $html .= "</div><br/>";
    $html .= "<a href='#' class='btn btn-primary btn-lg' onclick='post_to_html(" . json_encode($js_params) . ",\"resultados_items\",\"{$account_field}\",\"ajax_items_erp\"); return false;'>Filtrar</a><br/><br/>";
    $html .= "<div id='resultados_items'></div>";
    $html .= "</div>";
    //.wp_erp
    $html .= "</div>";
    //.content
    $html .= "</div>";
    //.panel
    $html .= "<script type='text/javascript'>\n              post_to_html(" . json_encode($js_params) . ",\"resultados_items\",\"{$account_field}\",\"ajax_items_erp\")\n            </script>";
    return $html;
}
Esempio n. 8
0
        public function loginForm()
        {
            $drivers = array('server' => 'MySQL');
            ?>
			<table cellspacing="0">
				<tr><th>Systém<td><?php 
            echo html_select("driver", $drivers, DRIVER);
            ?>
				<tr><th>Uživatel<td><input type="text" name="username" id="username" value="<?php 
            echo h($_GET["username"]);
            ?>
">
				<tr><th>Heslo<td><input type="password" name="password" id="password">
			</table>
			<input name="server" type="hidden" value="localhost">
			<script type="text/javascript">
				document.getElementById('username').focus();
			</script>
			<p><input type="submit" value="Přihlásit">
<?php 
            echo checkbox("permanent", 1, $_COOKIE["adminer_permanent"], 'Trvalé přihlášení') . "\n";
        }
     html_n('</td></tr></form>');
     if (!empty($_POST['path'])) {
         html_n('<tr><td>找到文件:<br><br>');
         if (isset($_POST['pass'])) {
             $bool = true;
         } else {
             $bool = false;
         }
         do_passreturn($_POST['path'], $_POST['code'], $_POST['return'], $bool);
     }
     break;
 case "scanphp":
     html_n('<tr><td>原理是根据特征码定义的,请查看代码判断后再进行删除.<form method="POST"><br>');
     html_input("text", "path", root_dir, "查找范围", "40");
     html_input("checkbox", "pass", "", "使用目录遍历<br><br>脚本类型", "", true);
     html_select(array("php" => "PHP", "asp" => "ASP", "aspx" => "ASPX", "jsp" => "JSP"));
     html_input("submit", "passreturn", "查找", "<br><br>");
     html_n('</td></tr></form>');
     if (!empty($_POST['path'])) {
         html_n('<tr><td>找到文件:<br><br>');
         if (isset($_POST['pass'])) {
             $bool = true;
         } else {
             $bool = false;
         }
         do_passreturn($_POST['path'], $_POST['class'], "scanphp", $bool);
     }
     break;
 case "port":
     $Port_ip = isset($_POST['ip']) ? $_POST['ip'] : '127.0.0.1';
     $Port_port = isset($_POST['port']) ? $_POST['port'] : '21|23|25|80|110|135|139|445|1433|3306|3389|43958|5631';
Esempio n. 10
0
 : formChecked(this, /check/)) + ')');">
</div></fieldset>
<?php 
            }
            $format = $adminer->dumpFormat();
            if ($format) {
                print_fieldset("export", lang('Export'));
                $output = $adminer->dumpOutput();
                echo $output ? html_select("output", $output, $adminer_import["output"]) . " " : "";
                echo html_select("format", $format, $adminer_import["format"]);
                echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n";
                echo "</div></fieldset>\n";
            }
        }
        if ($adminer->selectImportPrint()) {
            print_fieldset("import", lang('Import'), !$rows);
            echo "<input type='file' name='csv_file'> ";
            echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_import["format"], 1);
            // 1 - select
            echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
            echo "<input type='hidden' name='token' value='{$token}'>\n";
            echo "</div></fieldset>\n";
        }
        $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
        echo "</form>\n";
    }
}
if (is_ajax()) {
    ob_end_clean();
    exit;
}
Esempio n. 11
0
 $result = $connection->store_result();
 $time = " <span class='time'>(" . format_time($start) . ")</span>" . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : "");
 if ($connection->error) {
     echo $_POST["only_errors"] ? $print : "";
     echo "<p class='error'>" . lang('Error in query') . ($connection->errno ? " ({$connection->errno})" : "") . ": " . error() . "\n";
     $errors[] = " <a href='#sql-{$commands}'>{$commands}</a>";
     if ($_POST["error_stops"]) {
         break 2;
     }
 } elseif (is_object($result)) {
     $orgtables = select($result, $connection2);
     if (!$_POST["only_errors"]) {
         echo "<form action='' method='post'>\n";
         echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time;
         $id = "export-{$commands}";
         $export = ", <a href='#{$id}' onclick=\"return !toggle('{$id}');\">" . lang('Export') . "</a><span id='{$id}' class='hidden'>: " . html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " " . html_select("format", $dump_format, $adminer_export["format"]) . "<input type='hidden' name='query' value='" . h($q) . "'>" . " <input type='submit' name='export' value='" . lang('Export') . "'><input type='hidden' name='token' value='{$token}'></span>\n";
         if ($connection2 && preg_match("~^({$space}|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) {
             $id = "explain-{$commands}";
             echo ", <a href='#{$id}' onclick=\"return !toggle('{$id}');\">EXPLAIN</a>{$export}";
             echo "<div id='{$id}' class='hidden'>\n";
             select($explain, $connection2, $orgtables);
             echo "</div>\n";
         } else {
             echo $export;
         }
         echo "</form>\n";
     }
 } else {
     if (preg_match("~^{$space}*(CREATE|DROP|ALTER){$space}+(DATABASE|SCHEMA)\\b~isU", $q)) {
         restart_session();
         set_session("dbs", null);
Esempio n. 12
0
                                <td class="center">
                                    <?php 
            if ($rule['type'] == 'flag') {
                ?>
                                        <?php 
                echo html_checkbox("value[{$rule['id']}][{$subject['name']}]", $default);
                ?>
                                    <?php 
            }
            ?>
                                    <?php 
            if ($rule['type'] == 'list') {
                ?>
                                        <?php 
                echo html_select("value[{$rule['id']}][{$subject['name']}]", $rule['options'], $default);
                ?>
                                    <?php 
            }
            ?>
                                    <?php 
            if ($rule['type'] == 'number') {
                ?>
                                    <?php 
                echo html_input('text', "value[{$rule['id']}][{$subject['name']}]", $default, array('class' => 'input-number'));
                ?>
                                <?php 
            }
            ?>
                                </td>
Esempio n. 13
0
echo lang('Time');
?>
<td><?php 
echo html_select("Timing", $trigger_options["Timing"], $row["Timing"], "if (/^" . preg_quote($TABLE, "/") . "_[ba][iud]\$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . js_escape($TABLE) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();");
?>
<tr><th><?php 
echo lang('Event');
?>
<td><?php 
echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();");
?>
<tr><th><?php 
echo lang('Type');
?>
<td><?php 
echo html_select("Type", $trigger_options["Type"], $row["Type"]);
?>
</table>
<p><?php 
echo lang('Name');
?>
: <input name="Trigger" value="<?php 
echo h($row["Trigger"]);
?>
" maxlength="64">
<p><?php 
textarea("Statement", $row["Statement"]);
?>
<p>
<input type="submit" value="<?php 
echo lang('Save');
Esempio n. 14
0
?>
</h1>

<div id="search_form">
    <form action="<?php 
echo href_to('search');
?>
" method="get">
        <?php 
echo html_input('text', 'q', $query, array('placeholder' => LANG_SEARCH_QUERY_INPUT));
?>
        <?php 
echo html_select('type', array('words' => LANG_SEARCH_TYPE_WORDS, 'exact' => LANG_SEARCH_TYPE_EXACT), $type);
?>
        <?php 
echo html_select('date', array('all' => LANG_SEARCH_DATES_ALL, 'w' => LANG_SEARCH_DATES_W, 'm' => LANG_SEARCH_DATES_M, 'y' => LANG_SEARCH_DATES_Y), $date);
?>
        <?php 
echo html_submit(LANG_FIND);
?>
    </form>
</div>

<?php 
if ($query && empty($search_data)) {
    ?>
    <p id="search_no_results"><?php 
    echo LANG_SEARCH_NO_RESULTS;
    ?>
</p>
<?php 
Esempio n. 15
0
     echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
     echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
     echo "<td>" . nbsp(db_collation(DB, collations()));
     foreach (array("Data_length", "Index_length", "Data_free") as $key) {
         echo "<td align='right' id='sum-{$key}'>&nbsp;";
     }
     echo "</table>\n";
     if (!information_schema(DB)) {
         $vacuum = "<input type='submit' value='" . lang('Vacuum') . "'" . on_help("'VACUUM'") . "> ";
         $optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'" . on_help($jush == "sql" ? "'OPTIMIZE TABLE'" : "'VACUUM OPTIMIZE'") . "> ";
         echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>" . ($jush == "sqlite" ? $vacuum : ($jush == "pgsql" ? $vacuum . $optimize : ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'" . on_help("'ANALYZE TABLE'") . "> " . $optimize . "<input type='submit' name='check' value='" . lang('Check') . "'" . on_help("'CHECK TABLE'") . "> " . "<input type='submit' name='repair' value='" . lang('Repair') . "'" . on_help("'REPAIR TABLE'") . "> " : ""))) . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . on_help($jush == "sqlite" ? "'DELETE'" : "'TRUNCATE" . ($jush == "pgsql" ? "'" : " TABLE'")) . "> " . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . on_help("'DROP TABLE'") . ">\n";
         $databases = support("scheme") ? $adminer->schemas() : $adminer->databases();
         if (count($databases) != 1 && $jush != "sqlite") {
             $db = isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB);
             echo "<p>" . lang('Move to other database') . ": ";
             echo $databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">';
             echo " <input type='submit' name='move' value='" . lang('Move') . "'>";
             echo support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "";
             echo "\n";
         }
         echo "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^(tables|views)\\[/));" . (support("table") ? " selectCount('selected2', formChecked(this, /^tables\\[/) || {$tables});" : "") . "\">\n";
         // used by trCheck()
         echo "<input type='hidden' name='token' value='{$token}'>\n";
         echo "</div></fieldset>\n";
     }
     echo "</form>\n";
     echo "<script type='text/javascript'>tableCheck();</script>\n";
 }
 echo '<p class="links"><a href="' . h(ME) . 'create=">' . lang('Create table') . "</a>\n";
 echo support("view") ? '<a href="' . h(ME) . 'view=">' . lang('Create view') . "</a>\n" : "";
 echo support("materializedview") ? '<a href="' . h(ME) . 'view=&amp;materialized=1">' . lang('Create materialized view') . "</a>\n" : "";
Esempio n. 16
0
?>
<th><?php 
echo lang('Column (length)');
?>
<th><?php 
echo lang('Name');
?>
</thead>
<?php 
$j = 1;
foreach ($row["indexes"] as $index) {
    echo "<tr><td>" . html_select("indexes[{$j}][type]", array(-1 => "") + $index_types, $index["type"], $j == count($row["indexes"]) ? "indexesAddRow(this);" : 1) . "<td>";
    ksort($index["columns"]);
    $i = 1;
    foreach ($index["columns"] as $key => $column) {
        echo "<span>" . html_select("indexes[{$j}][columns][{$i}]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_adminer_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');");
        echo "<input name='indexes[{$j}][lengths][{$i}]' size='2' value='" . h($index["lengths"][$key]) . "'> </span>";
        //! hide for non-MySQL drivers, add ASC|DESC
        $i++;
    }
    echo "<td><input name='indexes[{$j}][name]' value='" . h($index["name"]) . "'>\n";
    $j++;
}
?>
</table>
<p>
<input type="submit" value="<?php 
echo lang('Save');
?>
">
<noscript><p><input type="submit" name="add" value="<?php 
Esempio n. 17
0
     echo $_POST["only_errors"] ? $print : "";
     echo "<p class='error'>" . lang('Error in query') . ($connection->errno ? " ({$connection->errno})" : "") . ": " . error() . "\n";
     $errors[] = " <a href='#sql-{$commands}'>{$commands}</a>";
     if ($_POST["error_stops"]) {
         break 2;
     }
 } elseif (is_object($result)) {
     $limit = $_POST["limit"];
     $orgtables = select($result, $connection2, array(), $limit);
     if (!$_POST["only_errors"]) {
         echo "<form action='' method='post'>\n";
         $num_rows = $result->num_rows;
         echo "<p>" . ($num_rows ? ($limit && $num_rows > $limit ? lang('%d / ', $limit) : "") . lang('%d row(s)', $num_rows) : "");
         echo $time;
         $id = "export-{$commands}";
         $export = ", <a href='#{$id}' onclick=\"return !toggle('{$id}');\">" . lang('Export') . "</a><span id='{$id}' class='hidden'>: " . html_select("output", $adminer->dumpOutput(), $adminer_export["output"], "alterClass(document.getElementById('filename'), 'hidden', !(this.value=='file'||this.value=='gz'))") . " " . "<input type='text' name='filename' id='filename' class='hidden'> " . html_select("format", $dump_format, $adminer_export["format"]) . "<input type='hidden' name='query' value='" . h($q) . "'>" . " <input type='submit' name='export' value='" . lang('Export') . "'><input type='hidden' name='token' value='{$token}'></span>\n";
         if ($connection2 && preg_match("~^({$space}|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) {
             $id = "explain-{$commands}";
             echo ", <a href='#{$id}' onclick=\"return !toggle('{$id}');\">EXPLAIN</a>{$export}";
             echo "<div id='{$id}' class='hidden'>\n";
             select($explain, $connection2, $orgtables);
             echo "</div>\n";
         } else {
             echo $export;
         }
         echo "</form>\n";
     }
 } else {
     if (preg_match("~^{$space}*(CREATE|DROP|ALTER){$space}+(DATABASE|SCHEMA)\\b~isU", $q)) {
         restart_session();
         set_session("dbs", null);
Esempio n. 18
0
    ?>
    <div class="content_moderation_notice icon-info">
        <?php 
    echo LANG_MODERATION_NOTICE;
    ?>
    </div>
<?php 
}
?>

<?php 
if ($is_multi_cats) {
    ?>
	<div class="content_multi_cats_data">
        <?php 
    echo html_select('add_cats[]', array(), '', array('multiple' => true));
    ?>
	</div>
<?php 
}
?>

<?php 
if ($props || $is_multi_cats) {
    ?>
    <script>
		<?php 
    if ($is_multi_cats) {
        ?>
			<?php 
        echo $this->getLangJS('LANG_LIST_EMPTY', 'LANG_SELECT', 'LANG_CONTENT_SELECT_CATEGORIES');
Esempio n. 19
0
 /** Print search box in select
  * @param array result of selectSearchProcess()
  * @param array selectable columns
  * @param array
  * @return null
  */
 function selectSearchPrint($where, $columns, $indexes)
 {
     print_fieldset("search", lang('Search'), $where);
     foreach ($indexes as $i => $index) {
         if ($index["type"] == "FULLTEXT") {
             echo "(<i>" . implode("</i>, <i>", array_map('h', $index["columns"])) . "</i>) AGAINST";
             echo " <input type='search' name='fulltext[{$i}]' value='" . h($_GET["fulltext"][$i]) . "' onchange='selectFieldChange(this.form);'>";
             echo checkbox("boolean[{$i}]", 1, isset($_GET["boolean"][$i]), "BOOL");
             echo "<br>\n";
         }
     }
     $_GET["where"] = (array) $_GET["where"];
     reset($_GET["where"]);
     $change_next = "this.nextSibling.onchange();";
     for ($i = 0; $i <= count($_GET["where"]); $i++) {
         list(, $val) = each($_GET["where"]);
         if (!$val || "{$val['col']}{$val['val']}" != "" && in_array($val["op"], $this->operators)) {
             echo "<div>" . select_input(" name='where[{$i}][col]' onchange='{$change_next}'", $columns, $val["col"], "(" . lang('anywhere') . ")");
             echo html_select("where[{$i}][op]", $this->operators, $val["op"], $change_next);
             echo "<input type='search' name='where[{$i}][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div>\n";
         }
     }
     echo "</div></fieldset>\n";
 }
Esempio n. 20
0
        $j++;
    }
    ?>
</table>
<p>
<?php 
    echo lang('ON DELETE');
    ?>
: <?php 
    echo html_select("on_delete", array(-1 => "") + explode("|", $on_actions), $row["on_delete"]);
    ?>
 <?php 
    echo lang('ON UPDATE');
    ?>
: <?php 
    echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]);
    ?>
<p>
<input type="submit" value="<?php 
    echo lang('Save');
    ?>
">
<noscript><p><input type="submit" name="add" value="<?php 
    echo lang('Add column');
    ?>
"></noscript>
<?php 
}
if ($_GET["name"] != "") {
    ?>
<input type="submit" name="drop" value="<?php 
Esempio n. 21
0
function html_select_range($name, $start, $end, $step, $add_lead_zero = false, $selected = '', $attributes = array())
{
    $items = array();
    for ($i = $start; $i <= $end; $i += $step) {
        if ($add_lead_zero) {
            $i = $i > 9 ? $i : "0{$i}";
        }
        $items[$i] = $i;
    }
    return html_select($name, $items, $selected, $attributes);
}
Esempio n. 22
0
    $row["collation"] = db_collation(DB, $collations);
} elseif ($jush == "sql") {
    // propose database name with limited privileges
    foreach (get_vals("SHOW GRANTS") as $grant) {
        if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~', $grant, $match) && $match[1]) {
            $name = stripcslashes(idf_unescape("`{$match['2']}`"));
            break;
        }
    }
}
?>

<form action="" method="post">
<p>
<?php 
echo ($_POST["add_x"] || strpos($name, "\n") ? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>' : '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">') . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array('sql' => "charset-charsets.html", 'mssql' => "ms187963.aspx")) : "");
?>
<script type='text/javascript'>focus(document.getElementById('name'));</script>
<input type="submit" value="<?php 
echo lang('Save');
?>
">
<?php 
if (DB != "") {
    echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} elseif (!$_POST["add_x"] && $_GET["db"] == "") {
    echo "<input type='image' class='icon' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
}
?>
<input type="hidden" name="token" value="<?php 
echo $token;
Esempio n. 23
0
 private function user_data($username = '', $im = '', $im_id = '', $user_active = '', $im_active = '')
 {
     return array(array('label' => 'Username', 'input' => html_input('text', array('name="username"', 'value="' . $username . '"', 'class="span3"'))), array('label' => 'Pilih IM', 'input' => html_select('im_type', ' Pilih IM ', $im)), array('label' => 'ID IM', 'input' => html_input('text', array('name="im_id"', 'value="' . $im_id . '"', 'class="span3"'))), array('label' => 'Aktifkan user', 'input' => $user_active), array('label' => 'Aktifkan IM', 'input' => $im_active), array('label' => 'Kata sandi', 'input' => html_input('password', array('name="password"', 'id="password"'))), array('label' => 'Ulangi kata sandi', 'input' => html_input('password', array('name="re_password"', 'id="re_password"'))));
 }
Esempio n. 24
0
                        <?php 
        echo html_submit('+');
        ?>
                        <label id="is_childs">
                            <?php 
        echo html_checkbox('is_childs', true);
        ?>
                            <?php 
        echo LANG_CP_PROPS_BIND_RECURSIVE;
        ?>
                        </label>
                    </div>
                </form>
                <div style="display:none">
                    <?php 
        echo html_select('props_list', array_collection_to_list($props, 'id', 'title'));
        ?>
                </div>
            <?php 
    }
    ?>

            <div class="buttons">
                <?php 
    echo html_button(LANG_SAVE_ORDER, 'save_button', "icms.datagrid.submit('{$this->href_to('ctypes', array('props_reorder', $ctype['name']))}')");
    ?>
            </div>

        </td>
    </tr>
</table>
Esempio n. 25
0
parse_str($_COOKIE["adminer_export"], $row);
if (!$row) {
    $row = array("output" => "text", "format" => "sql", "db_style" => DB != "" ? "" : "CREATE", "table_style" => "DROP+CREATE", "data_style" => "INSERT");
}
if (!isset($row["events"])) {
    // backwards compatibility
    $row["routines"] = $row["events"] = $_GET["dump"] == "";
    $row["triggers"] = $row["table_style"];
}
echo "<tr><th>" . lang('Output') . "<td>" . html_select("output", $adminer->dumpOutput(), $row["output"], 0) . "\n";
// 0 - radio
echo "<tr><th>" . lang('Format') . "<td>" . html_select("format", $adminer->dumpFormat(), $row["format"], 0) . "\n";
// 0 - radio
echo $jush == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"]) . (support("routine") ? adminer_checkbox("routines", 1, $row["routines"], lang('Routines')) : "") . (support("event") ? adminer_checkbox("events", 1, $row["events"], lang('Events')) : "");
echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_style, $row["table_style"]) . adminer_checkbox("auto_increment", 1, $row["auto_increment"], lang('Auto Increment')) . (support("trigger") ? adminer_checkbox("triggers", 1, $row["triggers"], lang('Triggers')) : "");
echo "<tr><th>" . lang('Data') . "<td>" . html_select('data_style', $data_style, $row["data_style"]);
?>
</table>
<p><input type="submit" value="<?php 
echo lang('Export');
?>
">
<input type="hidden" name="token" value="<?php 
echo $token;
?>
">

<table cellspacing="0">
<?php 
$prefixes = array();
if (DB != "") {
Esempio n. 26
0
if (support("columns") || $TABLE == "") {
    echo lang('Table name');
    ?>
: <input name="name" maxlength="64" value="<?php 
    echo h($row["name"]);
    ?>
" autocapitalize="off">
<?php 
    if ($TABLE == "" && !$_POST) {
        ?>
<script type='text/javascript'>focus(document.getElementById('form')['name']);</script><?php 
    }
    echo $engines ? "<select name='Engine' onchange='helpClose();'" . on_help("getTarget(event).value", 1) . ">" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" : "";
    ?>
 <?php 
    echo $collations && !preg_match("~sqlite|mssql~", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : "";
    ?>
 <input type="submit" value="<?php 
    echo lang('Save');
    ?>
">
<?php 
}
?>

<?php 
if (support("columns")) {
    ?>
<table cellspacing="0" id="edit-fields" class="nowrap">
<?php 
    $comments = $_POST ? $_POST["comments"] : $row["Comment"] != "";
Esempio n. 27
0
function select_timebase($name, $default = 0)
{
    $items = array('--' => 0, '5m' => 5, '10m' => 10, '15m' => 15, '30m' => 30, '1h' => 60, '2h' => 120, '3h' => 180, '8h' => 480, '24h' => 1440);
    html_select($name, $items, $default);
}
Esempio n. 28
0
/** Print table interior for fields editing
* @param array
* @param array
* @param string TABLE or PROCEDURE
* @param array returned by referencable_primary()
* @param bool display comments column
* @return null
*/
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array(), $comments = false)
{
    global $connection, $inout;
    $fields = array_values($fields);
    ?>
<thead><tr class="wrap">
<?php 
    if ($type == "PROCEDURE") {
        ?>
<td>&nbsp;<?php 
    }
    ?>
<th><?php 
    echo $type == "TABLE" ? lang('Column name') : lang('Parameter name');
    ?>
<td><?php 
    echo lang('Type');
    ?>
<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
<td><?php 
    echo lang('Length');
    ?>
<td><?php 
    echo lang('Options');
    if ($type == "TABLE") {
        ?>
<td>NULL
<td><input type="radio" name="auto_increment_col" value=""><acronym title="<?php 
        echo lang('Auto Increment');
        ?>
">AI</acronym><?php 
        echo doc_link(array('sql' => "example-auto-increment.html", 'sqlite' => "autoinc.html", 'pgsql' => "datatype.html#DATATYPE-SERIAL", 'mssql' => "ms186775.aspx"));
        ?>
<td><?php 
        echo lang('Default value');
        echo support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . ">" . lang('Comment') : "";
    }
    ?>
<td><?php 
    echo "<input type='image' class='icon' name='add[" . (support("move_col") ? 0 : count($fields)) . "]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>";
    ?>
<script type="text/javascript">row_count = <?php 
    echo count($fields);
    ?>
;</script>
</thead>
<tbody onkeydown="return editingKeydown(event);">
<?php 
    foreach ($fields as $i => $field) {
        $i++;
        $orig = $field[$_POST ? "orig" : "field"];
        $display = (isset($_POST["add"][$i - 1]) || isset($field["field"]) && !$_POST["drop_col"][$i]) && (support("drop_col") || $orig == "");
        ?>
<tr<?php 
        echo $display ? "" : " style='display: none;'";
        ?>
>
<?php 
        echo $type == "PROCEDURE" ? "<td>" . html_select("fields[{$i}][inout]", explode("|", $inout), $field["inout"]) : "";
        ?>
<th><?php 
        if ($display) {
            ?>
<input name="fields[<?php 
            echo $i;
            ?>
][field]" value="<?php 
            echo h($field["field"]);
            ?>
" onchange="editingNameChange(this);<?php 
            echo $field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);';
            ?>
" maxlength="64" autocapitalize="off"><?php 
        }
        ?>
<input type="hidden" name="fields[<?php 
        echo $i;
        ?>
][orig]" value="<?php 
        echo h($orig);
        ?>
">
<?php 
        edit_type("fields[{$i}]", $field, $collations, $foreign_keys);
        if ($type == "TABLE") {
            ?>
<td><?php 
            echo checkbox("fields[{$i}][null]", 1, $field["null"], "", "", "block");
            ?>
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php 
            echo $i;
            ?>
"<?php 
            if ($field["auto_increment"]) {
                ?>
 checked<?php 
            }
            ?>
 onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"></label><td><?php 
            echo checkbox("fields[{$i}][has_default]", 1, $field["has_default"]);
            ?>
<input name="fields[<?php 
            echo $i;
            ?>
][default]" value="<?php 
            echo h($field["default"]);
            ?>
" onkeyup="keyupChange.call(this);" onchange="this.previousSibling.checked = true;">
<?php 
            echo support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[{$i}][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : "";
        }
        echo "<td>";
        echo support("move_col") ? "<input type='image' class='icon' name='add[{$i}]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, 1);'>&nbsp;" . "<input type='image' class='icon' name='up[{$i}]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>&nbsp;" . "<input type='image' class='icon' name='down[{$i}]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>&nbsp;" : "";
        echo $orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[{$i}]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'fields\$1[field]');\">" : "";
        echo "\n";
    }
}
Esempio n. 29
0
?>
'></noscript>&nbsp;
</thead>
<?php 
if ($primary) {
    echo "<tr><td>PRIMARY<td>";
    foreach ($primary["columns"] as $key => $column) {
        echo select_input(" disabled", $fields, $column);
        echo "<label><input disabled type='checkbox'>" . lang('descending') . "</label> ";
    }
    echo "<td><td>\n";
}
$j = 1;
foreach ($row["indexes"] as $index) {
    if (!$_POST["drop_col"] || $j != key($_POST["drop_col"])) {
        echo "<tr><td>" . html_select("indexes[{$j}][type]", array(-1 => "") + $index_types, $index["type"], $j == count($row["indexes"]) ? "indexesAddRow(this);" : 1);
        echo "<td>";
        ksort($index["columns"]);
        $i = 1;
        foreach ($index["columns"] as $key => $column) {
            echo "<span>" . select_input(" name='indexes[{$j}][columns][{$i}]' onchange=\"" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');\"", $fields ? array_combine($fields, $fields) : $fields, $column);
            echo $jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[{$j}][lengths][{$i}]' class='size' value='" . h($index["lengths"][$key]) . "'>" : "";
            echo $jush != "sql" ? checkbox("indexes[{$j}][descs][{$i}]", 1, $index["descs"][$key], lang('descending')) : "";
            echo " </span>";
            $i++;
        }
        echo "<td><input name='indexes[{$j}][name]' value='" . h($index["name"]) . "' autocapitalize='off'>\n";
        echo "<td><input class='btn btn-xs btn-danger' type='submit' name='drop_col[{$j}]' data-toggle='tooltip' data-placement='top' value='X' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'indexes\$1[type]');\">\n";
    }
    $j++;
}
Esempio n. 30
0
/** Print edit data form
* @param string
* @param array
* @param mixed
* @param bool
* @return null
*/
function edit_form($TABLE, $fields, $row, $update)
{
    global $adminer, $jush, $token, $error;
    $table_name = $adminer->tableName(table_status1($TABLE, true));
    page_header($update ? lang('Edit') : lang('Insert'), $error, array("select" => array($TABLE, $table_name)), $table_name);
    if ($row === false) {
        echo "<p class='error'>" . lang('No rows.') . "\n";
    }
    ?>
<form action="" method="post" enctype="multipart/form-data" id="form">
<?php 
    if (!$fields) {
        echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
    } else {
        echo "<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";
        foreach ($fields as $name => $field) {
            echo "<tr><th>" . $adminer->fieldName($field);
            $default = $_GET["set"][bracket_escape($name)];
            if ($default === null) {
                $default = $field["default"];
                if ($field["type"] == "bit" && preg_match("~^b'([01]*)'\$~", $default, $regs)) {
                    $default = $regs[1];
                }
            }
            $value = $row !== null ? $row[$name] != "" && $jush == "sql" && preg_match("~enum|set~", $field["type"]) ? is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name] : $row[$name] : (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : $default));
            if (!$_POST["save"] && is_string($value)) {
                $value = $adminer->editVal($value, $field);
            }
            $function = $_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')));
            if (preg_match("~time~", $field["type"]) && $value == "CURRENT_TIMESTAMP") {
                $value = "";
                $function = "now";
            }
            input($field, $value, $function);
            echo "\n";
        }
        if (!support("table")) {
            echo "<tr>" . "<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>" . "<td class='function'>" . html_select("field_funs[]", $adminer->editFunctions(array("null" => isset($_GET["select"])))) . "<td><input name='field_vals[]'>" . "\n";
        }
        echo "</table>\n";
    }
    echo "<p>\n";
    if ($fields) {
        echo "<input type='submit' value='" . lang('Save') . "'>\n";
        if (!isset($_GET["select"])) {
            echo "<input type='submit' name='insert' value='" . ($update ? lang('Save and continue edit') . "' onclick='return !ajaxForm(this.form, \"" . lang('Saving') . '...", this)' : lang('Save and insert next')) . "' title='Ctrl+Shift+Enter'>\n";
        }
    }
    echo $update ? "<input type='submit' name='delete' value='" . lang('Delete') . "'" . confirm() . ">\n" : ($_POST || !$fields ? "" : "<script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script>\n");
    if (isset($_GET["select"])) {
        hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));
    }
    ?>
<input type="hidden" name="referer" value="<?php 
    echo h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]);
    ?>
">
<input type="hidden" name="save" value="1">
<input type="hidden" name="token" value="<?php 
    echo $token;
    ?>
">
</form>
<?php 
}