">
' . htmlspecialchars($field["field"]) . '', $field); } /** Links after select heading * @param array result of SHOW TABLE STATUS * @return string */ function adminer_select_links($table_status) { global $SELF; return call_adminer('select_links', '' . lang('Table structure') . '', $table_status); } /** Find backward keys for table * @param string * @return array $return[$target_table][$key_name][$target_column] = $source_column; */ function adminer_backward_keys($table) { return call_adminer('backward_keys', array(), $table); } /** Query printed in select before execution * @param string query to be executed * @return string */ function adminer_select_query($query) { global $SELF; // it would be nice if $query can be passed by reference and printed value would be returned but call_user() doesn't allow reference parameters return call_adminer('select_query', "

" . htmlspecialchars($query) . " " . lang('Edit') . "\n", $query); } /** Description of a row in a table * @param string * @return string SQL expression, empty string for no description */ function adminer_row_description($table) { return call_adminer('row_description', "", $table); } /** Get descriptions of selected data * @param array all data to print * @param array * @return array */ function adminer_row_descriptions($rows, $foreign_keys) { return call_adminer('row_descriptions', $rows, $rows, $foreign_keys); } /** Value printed in select table * @param string escaped value to print * @param string link to foreign key * @param array single field returned from fields() * @return string */ function adminer_select_val($val, $link, $field) { $return = ($field["type"] == "char" ? "$val" : $val); if (ereg('blob|binary', $field["type"]) && !is_utf8($val)) { $return = lang('%d byte(s)', strlen($val)); } return call_adminer('select_val', ($link ? "$return" : $return), $val, $link); } /** Query printed after execution in the message * @param string executed query * @return string */ function adminer_message_query($query) { global $SELF; $id = "sql-" . count($_SESSION["messages"]); $_SESSION["history"][$_GET["server"]][$_GET["db"]][] = $query; return call_adminer('message_query', " " . lang('SQL command') . "

', $query); } /** Functions displayed in edit form * @param array single field from fields() * @return array */ function adminer_edit_functions($field) { $return = array(""); if (!isset($_GET["default"])) { if (ereg('char|date|time', $field["type"])) { $return = (ereg('char', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now")); //! JavaScript for disabling maxlength } if (!isset($_GET["call"]) && (isset($_GET["select"]) || where($_GET))) { // relative functions if (ereg('int|float|double|decimal', $field["type"])) { $return = array("", "+", "-"); } if (ereg('date', $field["type"])) { $return[] = "+ interval"; $return[] = "- interval"; } if (ereg('time', $field["type"])) { $return[] = "addtime"; $return[] = "subtime"; } } } if ($field["null"] || isset($_GET["default"])) { array_unshift($return, "NULL"); } return call_adminer('edit_functions', (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $return, $field); } /** Get options to display edit field * @param string table name * @param array single field from fields() * @return array options for */ function adminer_edit_input($table, $field) { return call_adminer('edit_input', false, $table, $field); } /** Process sent input * @param string field name * @param array single field from fields() * @return string expression to use in a query */ function adminer_process_input($name, $field) { global $dbh; $idf = bracket_escape($name); $function = $_POST["function"][$idf]; $value = $_POST["fields"][$idf]; $return = $dbh->quote($value); if (ereg('^(now|uuid)$', $function)) { $return = "$function()"; } elseif (ereg('^[+-]$', $function)) { $return = idf_escape($name) . " $function $return"; } elseif (ereg('^[+-] interval$', $function)) { $return = idf_escape($name) . " $function " . (preg_match("~^([0-9]+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return); } elseif (ereg('^(addtime|subtime)$', $function)) { $return = "$function(" . idf_escape($name) . ", $return)"; } elseif (ereg('^(md5|sha1|password)$', $function)) { $return = "$function($return)"; } elseif (ereg('date|time', $field["type"]) && $value == "CURRENT_TIMESTAMP") { $return = $value; } return call_adminer('process_input', $return, $name, $field); } /** Prints navigation after Adminer title * @param string can be "auth" if there is no database connection or "db" if there is no database selected * @return bool true if default navigation should be printed */ function adminer_navigation($missing) { global $SELF, $dbh; if (call_adminer('navigation', true, $missing) && $missing != "auth") { ob_flush(); flush(); $databases = get_databases(); ?>

"> ">

"> "> >

query("SHOW TABLES"); if (!$result->num_rows) { echo "

" . lang('No tables.') . "\n"; } else { echo "

\n"; while ($row = $result->fetch_row()) { echo '' . lang('select') . ' '; echo '' . adminer_table_name(array("Name" => $row[0])) . "
\n"; //! Adminer::table_name may work with full table status } } $result->free(); echo '

' . lang('Create new table') . "\n"; } } }