$views .= "{$print}\n"; } else { echo "{$print}<td align='right'><label class='block'><span id='Rows-" . h($name) . "'></span>" . adminer_checkbox("data[]", $name, $checked, "", "checkboxClick(event, this); formUncheck('check-data');") . "</label>\n"; } $prefixes[$prefix]++; } echo $views; if ($tables_list) { echo "<script type='text/javascript'>ajaxSetHtml('" . is_adminer_escape(ME) . "script=db');</script>\n"; } } else { echo "<thead><tr><th style='text-align: left;'><label class='block'><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n"; $databases = $adminer->databases(); if ($databases) { foreach ($databases as $db) { if (!information_schema($db)) { $prefix = preg_replace('~_.*~', '', $db); echo "<tr><td>" . adminer_checkbox("databases[]", $db, $TABLE == "" || $TABLE == "{$prefix}%", $db, "formUncheck('check-databases');", "block") . "\n"; $prefixes[$prefix]++; } } } else { echo "<tr><td><textarea name='databases' rows='10' cols='20'></textarea>"; } } ?> </table> </form> <?php $first = true; foreach ($prefixes as $key => $val) {
} } echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n"; if (is_ajax()) { if ($limit % 2 == 1 && $page % 2 == 1) { odd(); } ob_end_clean(); } foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) { $unique_array = unique_array($rows[$n], $indexes); $unique_idf = ""; foreach ($unique_array as $key => $val) { $unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key)); } echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . ($is_group || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>")); foreach ($row as $key => $val) { if (isset($names[$key])) { $field = $fields[$key]; if ($val != "" && (!isset($email_fields[$key]) || $email_fields[$key] != "")) { $email_fields[$key] = is_mail($val) ? $names[$key] : ""; //! filled e-mails can be contained on other pages } $link = ""; $val = $adminer->editVal($val, $field); if ($val !== null) { if (ereg('blob|bytea|raw|file', $field["type"]) && $val != "") { $link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf); } if ($val === "") { // === - may be int
/** Print import box in select * @return bool whether to print default import */ function selectImportPrint() { return !information_schema(DB); }
foreach (array("Engine" => array(), "Collation" => array(), "Data_length" => array("create", lang('Alter table')), "Index_length" => array("indexes", lang('Alter indexes')), "Data_free" => array("edit", lang('New item')), "Auto_increment" => array("auto_increment=1&create", lang('Alter table')), "Rows" => array("select", lang('Select data'))) as $key => $link) { $id = " id='{$key}-" . h($name) . "'"; echo $link ? "<td align='right'>" . (support("table") || $key == "Rows" || support("indexes") && $key != "Data_length" ? "<a href='" . h(ME . "{$link['0']}=") . urlencode($name) . "'{$id} title='{$link['1']}'>?</a>" : "<span{$id}>?</span>") : "<td id='{$key}-" . h($name) . "'> "; } $tables++; } echo support("comment") ? "<td id='Comment-" . h($name) . "'> " : ""; } echo "<tr><td> <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}'> "; } 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";
//! columns looking like functions $unique_array[$key] = $val; } } } $unique_idf = ""; foreach ($unique_array as $key => $val) { if (($jush == "sql" || $jush == "pgsql") && strlen($val) > 64) { $key = strpos($key, '(') ? $key : idf_escape($key); //! columns looking like functions $key = "MD5(" . ($jush == 'sql' && preg_match("~^utf8_~", $fields[$key]["collation"]) ? $key : "CONVERT({$key} USING " . charset($connection) . ")") . ")"; $val = md5($val); } $unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key)); } echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . ($is_group || information_schema(DB) ? "" : " <a data-toggle='tooltip' data-placement='top' title='" . lang('edit') . "' class='btn btn-xs btn-default' href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'><i class='fa fa-pencil fa-fw'></i></a>")); foreach ($row as $key => $val) { if (isset($names[$key])) { $field = $fields[$key]; if ($val != "" && (!isset($email_fields[$key]) || $email_fields[$key] != "")) { $email_fields[$key] = is_mail($val) ? $names[$key] : ""; //! filled e-mails can be contained on other pages } $link = ""; if (preg_match('~blob|bytea|raw|file~', $field["type"]) && $val != "") { $link = ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . $unique_idf; } if (!$link && $val !== null) { // link related items foreach ((array) $foreign_keys[$key] as $foreign_key) { if (count($foreign_keys[$key]) == 1 || end($foreign_key["source"]) == $key) {
/** Print command box in select * @return bool whether to print default commands */ function selectCommandPrint() { return !information_schema(DB); }