="); var $_values = array(); function name() { return "" . lang('Editor') . ""; } //! driver, ns function credentials() { return array(SERVER, $_GET["username"], get_password()); } function permanentLogin($create = false) { return password_file($create); } function bruteForceKey() { return $_SERVER["REMOTE_ADDR"]; } function database() { global $connection; if ($connection) { $databases = $this->databases(false); return (!$databases ? $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1)") // username without the database list : $databases[(information_schema($databases[0]) ? 1 : 0)] // first available database ); } } function schemas() { return schemas(); } function databases($flush = true) { return get_databases($flush); } function queryTimeout() { return 5; } function headers() { } function csp() { return csp(); } function head() { return true; } function css() { $return = array(); $filename = "adminer.css"; if (file_exists($filename)) { $return[] = $filename; } return $return; } function loginForm() { ?>
" autocapitalize="off"> | |
' . lang('New item') . "\n";
}
}
function foreignKeys($table) {
return foreign_keys($table);
}
function backwardKeys($table, $tableName) {
$return = array();
foreach (get_rows("SELECT TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME, REFERENCED_COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = " . q($this->database()) . "
AND REFERENCED_TABLE_SCHEMA = " . q($this->database()) . "
AND REFERENCED_TABLE_NAME = " . q($table) . "
ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
}
foreach ($return as $key => $val) {
$name = $this->tableName(table_status($key, true));
if ($name != "") {
$search = preg_quote($tableName);
$separator = "(:|\\s*-)?\\s+";
$return[$key]["name"] = (preg_match("(^$search$separator(.+)|^(.+?)$separator$search\$)iu", $name, $match) ? $match[2] . $match[3] : $name);
} else {
unset($return[$key]);
}
}
return $return;
}
function backwardKeysPrint($backwardKeys, $row) {
foreach ($backwardKeys as $table => $backwardKey) {
foreach ($backwardKey["keys"] as $cols) {
$link = ME . 'select=' . urlencode($table);
$i = 0;
foreach ($cols as $column => $val) {
$link .= where_link($i++, $column, $row[$val]);
}
echo "" . h($backwardKey["name"]) . "";
$link = ME . 'edit=' . urlencode($table);
foreach ($cols as $column => $val) {
$link .= "&set" . urlencode("[" . bracket_escape($column) . "]") . "=" . urlencode($row[$val]);
}
echo "+ ";
}
}
}
function selectQuery($query, $start, $failed = false) {
return "\n";
}
function rowDescription($table) {
// first varchar column
foreach (fields($table) as $field) {
if (preg_match("~varchar|character varying~", $field["type"])) {
return idf_escape($field["field"]);
}
}
return "";
}
function rowDescriptions($rows, $foreignKeys) {
$return = $rows;
foreach ($rows[0] as $key => $val) {
if (list($table, $id, $name) = $this->_foreignColumn($foreignKeys, $key)) {
// find all used ids
$ids = array();
foreach ($rows as $row) {
$ids[$row[$key]] = q($row[$key]);
}
// uses constant number of queries to get the descriptions, join would be complex, multiple queries would be slow
$descriptions = $this->_values[$table];
if (!$descriptions) {
$descriptions = get_key_vals("SELECT $id, $name FROM " . table($table) . " WHERE $id IN (" . implode(", ", $ids) . ")");
}
// use the descriptions
foreach ($rows as $n => $row) {
if (isset($row[$key])) {
$return[$n][$key] = (string) $descriptions[$row[$key]];
}
}
}
}
return $return;
}
function selectLink($val, $field) {
}
function selectVal($val, $link, $field, $original) {
$return = ($val === null ? " " : $val);
$link = h($link);
if (preg_match('~blob|bytea~', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen($original));
if (preg_match("~^(GIF|\xFF\xD8\xFF|\x89PNG\x0D\x0A\x1A\x0A)~", $original)) { // GIF|JPG|PNG, getimagetype() works with filename
$return = "";
}
}
if (like_bool($field) && $return != " ") { // bool
$return = (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? lang('yes') : lang('no'));
}
if ($link) {
$return = "$return";
}
if (!$link && !like_bool($field) && preg_match(number_type(), $field["type"])) {
$return = "
\\d{1,2})', preg_quote(lang('$1-$3-$5')))) . '(.*))', $value, $match)) { $return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match); } $return = ($field["type"] == "bit" && preg_match('~^[0-9]+$~', $value) ? $return : q($return)); if ($value == "" && like_bool($field)) { $return = "0"; } elseif ($value == "" && ($field["null"] || !preg_match('~char|text~', $field["type"]))) { $return = "NULL"; } elseif (preg_match('~^(md5|sha1)$~', $function)) { $return = "$function($return)"; } return unconvert_field($field, $return); } function dumpOutput() { return array(); } function dumpFormat() { return array('csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV'); } function dumpDatabase($db) { } function dumpTable() { echo "\xef\xbb\xbf"; // UTF-8 byte order mark } function dumpData($table, $style, $query) { global $connection; $result = $connection->query($query, 1); // 1 - MYSQLI_USE_RESULT if ($result) { while ($row = $result->fetch_assoc()) { if ($style == "table") { dump_csv(array_keys($row)); $style = "INSERT"; } dump_csv($row); } } } function dumpFilename($identifier) { return friendly_url($identifier); } function dumpHeaders($identifier, $multi_table = false) { $ext = "csv"; header("Content-Type: text/csv; charset=utf-8"); return $ext; } function importServerPath() { } function homepage() { return true; } function navigation($missing) { global $VERSION; ?>
";
echo script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");
$first = false;
}
echo "" . ($username != "" ? h($username) : "" . lang('empty') . "") . "
\n";
}
}
}
} else {
$this->databasesPrint($missing);
if ($missing != "db" && $missing != "ns") {
$table_status = table_status('', true);
if (!$table_status) {
echo "