mirror of
https://github.com/vrana/adminer.git
synced 2025-09-03 19:32:36 +02:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ba1bb263b3 | ||
|
82a63f335b | ||
|
50d2054e36 | ||
|
13f34d1ea9 | ||
|
2cf2021995 | ||
|
5f370927f1 | ||
|
c8248bb19c | ||
|
3a8191b7ac | ||
|
7dd454f0b4 | ||
|
e51640eb98 | ||
|
2e32bf1f97 | ||
|
27c7a218bd | ||
|
2e4a7121a9 | ||
|
81e134f872 | ||
|
e680d22023 | ||
|
aae2289095 | ||
|
4660ff852c | ||
|
f29a7cb140 | ||
|
64297aea60 | ||
|
41cde565d5 | ||
|
e80eb058e9 | ||
|
7dd90f56f1 | ||
|
8e0ead4678 | ||
|
c05e332ca3 | ||
|
717f4535a9 | ||
|
d100a1ed9a | ||
|
21756c492a | ||
|
26ad18bab2 | ||
|
e04be3a996 | ||
|
0869ff02c6 | ||
|
1dc9044ff4 | ||
|
5eb3eaa06e | ||
|
55c494b767 | ||
|
005c963e2d | ||
|
2c381345b4 | ||
|
15e698d302 |
@@ -9,10 +9,13 @@ foreach ($referencable_primary as $table_name => $field) {
|
||||
}
|
||||
|
||||
$orig_fields = array();
|
||||
$orig_status = array();
|
||||
$table_status = array();
|
||||
if ($TABLE != "") {
|
||||
$orig_fields = fields($TABLE);
|
||||
$orig_status = table_status($TABLE);
|
||||
$table_status = table_status($TABLE);
|
||||
if (!$table_status) {
|
||||
$error = lang('No tables.');
|
||||
}
|
||||
}
|
||||
|
||||
$row = $_POST;
|
||||
@@ -80,7 +83,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
|
||||
? " (" . implode(",", $partitions) . "\n)"
|
||||
: ($row["partitions"] ? " PARTITIONS " . (+$row["partitions"]) : "")
|
||||
);
|
||||
} elseif (support("partitioning") && ereg("partitioned", $orig_status["Create_options"])) {
|
||||
} elseif (support("partitioning") && ereg("partitioned", $table_status["Create_options"])) {
|
||||
$partitioning .= "\nREMOVE PARTITIONING";
|
||||
}
|
||||
|
||||
@@ -97,8 +100,8 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
|
||||
($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
|
||||
$foreign,
|
||||
$row["Comment"],
|
||||
($row["Engine"] && $row["Engine"] != $orig_status["Engine"] ? $row["Engine"] : ""),
|
||||
($row["Collation"] && $row["Collation"] != $orig_status["Collation"] ? $row["Collation"] : ""),
|
||||
($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
|
||||
($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""),
|
||||
($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),
|
||||
$partitioning
|
||||
));
|
||||
@@ -115,7 +118,7 @@ if (!$_POST) {
|
||||
);
|
||||
|
||||
if ($TABLE != "") {
|
||||
$row = $orig_status;
|
||||
$row = $table_status;
|
||||
$row["name"] = $TABLE;
|
||||
$row["fields"] = array();
|
||||
if (!$_GET["auto_increment"]) { // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids
|
||||
|
@@ -293,7 +293,7 @@ if (isset($_GET["mssql"])) {
|
||||
|
||||
function table_status($name = "") {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V')" . ($name != "" ? " AND name = " . q($name) : "")) as $row) {
|
||||
foreach (get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND type IN ('S', 'U', 'V') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
|
||||
if ($name != "") {
|
||||
return $row;
|
||||
}
|
||||
@@ -340,15 +340,17 @@ WHERE o.schema_id = SCHEMA_ID(" . q(get_schema()) . ") AND o.type IN ('S', 'U',
|
||||
function indexes($table, $connection2 = null) {
|
||||
$return = array();
|
||||
// sp_statistics doesn't return information about primary key
|
||||
foreach (get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name
|
||||
foreach (get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
|
||||
FROM sys.indexes i
|
||||
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
||||
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
|
||||
WHERE OBJECT_NAME(i.object_id) = " . q($table)
|
||||
, $connection2) as $row) {
|
||||
$return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
|
||||
$return[$row["name"]]["lengths"] = array();
|
||||
$return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"];
|
||||
$name = $row["name"];
|
||||
$return[$name]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
|
||||
$return[$name]["lengths"] = array();
|
||||
$return[$name]["columns"][$row["key_ordinal"]] = $row["column_name"];
|
||||
$return[$name]["descs"][$row["key_ordinal"]] = ($row["is_descending_key"] ? '1' : null);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -375,10 +377,6 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table)
|
||||
return nl_br(h(preg_replace('~^(\\[[^]]*])+~m', '', $connection->error)));
|
||||
}
|
||||
|
||||
function exact_value($val) {
|
||||
return q($val);
|
||||
}
|
||||
|
||||
function create_database($db, $collation) {
|
||||
return queries("CREATE DATABASE " . idf_escape($db) . (eregi('^[a-z0-9_]+$', $collation) ? " COLLATE $collation" : ""));
|
||||
}
|
||||
|
@@ -373,7 +373,7 @@ if (!defined("DRIVER")) {
|
||||
global $connection;
|
||||
$return = array();
|
||||
foreach (get_rows($fast && $connection->server_info >= 5
|
||||
? "SELECT TABLE_NAME AS Name, Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()" . ($name != "" ? " AND TABLE_NAME = " . q($name) : "")
|
||||
? "SELECT TABLE_NAME AS Name, Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() " . ($name != "" ? "AND TABLE_NAME = " . q($name) : "ORDER BY Name")
|
||||
: "SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")
|
||||
) as $row) {
|
||||
if ($row["Engine"] == "InnoDB") {
|
||||
@@ -396,7 +396,7 @@ if (!defined("DRIVER")) {
|
||||
* @return bool
|
||||
*/
|
||||
function is_view($table_status) {
|
||||
return !isset($table_status["Engine"]);
|
||||
return $table_status["Engine"] === null;
|
||||
}
|
||||
|
||||
/** Check if table supports foreign keys
|
||||
@@ -445,6 +445,7 @@ if (!defined("DRIVER")) {
|
||||
$return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? "INDEX" : "UNIQUE")));
|
||||
$return[$row["Key_name"]]["columns"][] = $row["Column_name"];
|
||||
$return[$row["Key_name"]]["lengths"][] = $row["Sub_part"];
|
||||
$return[$row["Key_name"]]["descs"][] = null;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -532,14 +533,6 @@ if (!defined("DRIVER")) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Return expression for binary comparison
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function exact_value($val) {
|
||||
return q($val) . " COLLATE utf8_bin";
|
||||
}
|
||||
|
||||
/** Create database
|
||||
* @param string
|
||||
* @param string
|
||||
@@ -983,7 +976,7 @@ if (!defined("DRIVER")) {
|
||||
$return = "UNHEX($return)";
|
||||
}
|
||||
if ($field["type"] == "bit") {
|
||||
return "CONV($return, 2, 10) + 0";
|
||||
$return = "CONV($return, 2, 10) + 0";
|
||||
}
|
||||
if (ereg("geometry|point|linestring|polygon", $field["type"])) {
|
||||
$return = "GeomFromText($return)";
|
||||
|
@@ -181,7 +181,8 @@ if (isset($_GET["oracle"])) {
|
||||
|
||||
function tables_list() {
|
||||
return get_key_vals("SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q(DB) . "
|
||||
UNION SELECT view_name, 'view' FROM user_views"
|
||||
UNION SELECT view_name, 'view' FROM user_views
|
||||
ORDER BY 1"
|
||||
); //! views don't have schema
|
||||
}
|
||||
|
||||
@@ -193,7 +194,8 @@ UNION SELECT view_name, 'view' FROM user_views"
|
||||
$return = array();
|
||||
$search = q($name);
|
||||
foreach (get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q(DB) . ($name != "" ? " AND table_name = $search" : "") . "
|
||||
UNION SELECT view_name, 'view', 0, 0 FROM user_views" . ($name != "" ? " WHERE view_name = $search" : "")
|
||||
UNION SELECT view_name, 'view', 0, 0 FROM user_views" . ($name != "" ? " WHERE view_name = $search" : "") . "
|
||||
ORDER BY 1"
|
||||
) as $row) {
|
||||
if ($name != "") {
|
||||
return $row;
|
||||
@@ -243,9 +245,11 @@ FROM user_ind_columns uic
|
||||
LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
|
||||
WHERE uic.table_name = " . q($table) . "
|
||||
ORDER BY uc.constraint_type, uic.column_position", $connection2) as $row) {
|
||||
$return[$row["INDEX_NAME"]]["type"] = ($row["CONSTRAINT_TYPE"] == "P" ? "PRIMARY" : ($row["CONSTRAINT_TYPE"] == "U" ? "UNIQUE" : "INDEX"));
|
||||
$return[$row["INDEX_NAME"]]["columns"][] = $row["COLUMN_NAME"];
|
||||
$return[$row["INDEX_NAME"]]["lengths"][] = ($row["CHAR_LENGTH"] && $row["CHAR_LENGTH"] != $row["COLUMN_LENGTH"] ? $row["CHAR_LENGTH"] : null);
|
||||
$index_name = $row["INDEX_NAME"];
|
||||
$return[$index_name]["type"] = ($row["CONSTRAINT_TYPE"] == "P" ? "PRIMARY" : ($row["CONSTRAINT_TYPE"] == "U" ? "UNIQUE" : "INDEX"));
|
||||
$return[$index_name]["columns"][] = $row["COLUMN_NAME"];
|
||||
$return[$index_name]["lengths"][] = ($row["CHAR_LENGTH"] && $row["CHAR_LENGTH"] != $row["COLUMN_LENGTH"] ? $row["CHAR_LENGTH"] : null);
|
||||
$return[$index_name]["descs"][] = ($row["DESCEND"] ? '1' : null);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -268,10 +272,6 @@ ORDER BY uc.constraint_type, uic.column_position", $connection2) as $row) {
|
||||
return h($connection->error); //! highlight sqltext from offset
|
||||
}
|
||||
|
||||
function exact_value($val) {
|
||||
return q($val);
|
||||
}
|
||||
|
||||
function explain($connection, $query) {
|
||||
$connection->query("EXPLAIN PLAN FOR $query");
|
||||
return $connection->query("SELECT * FROM plan_table");
|
||||
|
@@ -206,11 +206,11 @@ if (isset($_GET["pgsql"])) {
|
||||
|
||||
function table_status($name = "") {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN 'table' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\", reltuples as \"Rows\"
|
||||
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN 'table' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids::int AS \"Oid\", reltuples as \"Rows\"
|
||||
FROM pg_class
|
||||
WHERE relkind IN ('r','v')
|
||||
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
|
||||
. ($name != "" ? " AND relname = " . q($name) : "")
|
||||
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
|
||||
" . ($name != "" ? "AND relname = " . q($name) : "ORDER BY relname")
|
||||
) as $row) { //! Index_length, Auto_increment
|
||||
$return[$row["Name"]] = $row;
|
||||
}
|
||||
@@ -227,6 +227,10 @@ AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema(
|
||||
|
||||
function fields($table) {
|
||||
$return = array();
|
||||
$aliases = array(
|
||||
'timestamp without time zone' => 'timestamp',
|
||||
'timestamp with time zone' => 'timestamptz',
|
||||
);
|
||||
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
|
||||
FROM pg_class c
|
||||
JOIN pg_namespace n ON c.relnamespace = n.oid
|
||||
@@ -239,8 +243,11 @@ AND a.attnum > 0
|
||||
ORDER BY a.attnum"
|
||||
) as $row) {
|
||||
//! collation, primary
|
||||
ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match);
|
||||
list(, $row["type"], , $row["length"]) = $match;
|
||||
$type = $row["full_type"];
|
||||
if (ereg('(.+)\\((.*)\\)$', $row["full_type"], $match)) {
|
||||
list(, $type, $row["length"]) = $match;
|
||||
}
|
||||
$row["type"] = ($aliases[$type] ? $aliases[$type] : $type);
|
||||
$row["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : "");
|
||||
$row["null"] = !$row["attnotnull"];
|
||||
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]);
|
||||
@@ -261,13 +268,18 @@ ORDER BY a.attnum"
|
||||
$return = array();
|
||||
$table_oid = $connection2->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q($table));
|
||||
$columns = get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $table_oid AND attnum > 0", $connection2);
|
||||
foreach (get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid", $connection2) as $row) {
|
||||
$return[$row["relname"]]["type"] = ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX"));
|
||||
$return[$row["relname"]]["columns"] = array();
|
||||
foreach (get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption FROM pg_index i, pg_class ci WHERE i.indrelid = $table_oid AND ci.oid = i.indexrelid", $connection2) as $row) {
|
||||
$relname = $row["relname"];
|
||||
$return[$relname]["type"] = ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX"));
|
||||
$return[$relname]["columns"] = array();
|
||||
foreach (explode(" ", $row["indkey"]) as $indkey) {
|
||||
$return[$row["relname"]]["columns"][] = $columns[$indkey];
|
||||
$return[$relname]["columns"][] = $columns[$indkey];
|
||||
}
|
||||
$return[$row["relname"]]["lengths"] = array();
|
||||
$return[$relname]["descs"] = array();
|
||||
foreach (explode(" ", $row["indoption"]) as $indoption) {
|
||||
$return[$relname]["descs"][] = ($indoption & 1 ? '1' : null); // 1 - INDOPTION_DESC
|
||||
}
|
||||
$return[$relname]["lengths"] = array();
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -319,10 +331,6 @@ ORDER BY conkey, conname") as $row) {
|
||||
return nl_br($return);
|
||||
}
|
||||
|
||||
function exact_value($val) {
|
||||
return q($val);
|
||||
}
|
||||
|
||||
function create_database($db, $collation) {
|
||||
return queries("CREATE DATABASE " . idf_escape($db) . ($collation ? " ENCODING " . idf_escape($collation) : ""));
|
||||
}
|
||||
@@ -399,21 +407,32 @@ ORDER BY conkey, conname") as $row) {
|
||||
function alter_indexes($table, $alter) {
|
||||
$create = array();
|
||||
$drop = array();
|
||||
$queries = array();
|
||||
foreach ($alter as $val) {
|
||||
if ($val[0] != "INDEX") {
|
||||
//! descending UNIQUE indexes results in syntax error
|
||||
$create[] = ($val[2] == "DROP"
|
||||
? "\nDROP CONSTRAINT " . idf_escape($val[1])
|
||||
: "\nADD $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . $val[2]
|
||||
: "\nADD" . ($val[1] != "" ? " CONSTRAINT " . idf_escape($val[1]) : "") . " $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . $val[2]
|
||||
);
|
||||
} elseif ($val[2] == "DROP") {
|
||||
$drop[] = idf_escape($val[1]);
|
||||
} elseif (!queries("CREATE INDEX " . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) . " $val[2]")) {
|
||||
} else {
|
||||
$queries[] = "CREATE INDEX " . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) . " $val[2]";
|
||||
}
|
||||
}
|
||||
if ($create) {
|
||||
array_unshift($queries, "ALTER TABLE " . table($table) . implode(",", $create));
|
||||
}
|
||||
if ($drop) {
|
||||
array_unshift($queries, "DROP INDEX " . implode(", ", $drop));
|
||||
}
|
||||
foreach ($queries as $query) {
|
||||
if (!queries($query)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return ((!$create || queries("ALTER TABLE " . table($table) . implode(",", $create)))
|
||||
&& (!$drop || queries("DROP INDEX " . implode(", ", $drop)))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
function truncate_tables($tables) {
|
||||
|
@@ -253,8 +253,8 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
function table_status($name = "") {
|
||||
global $connection;
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view')" . ($name != "" ? " AND name = " . q($name) : "")) as $row) {
|
||||
$row["Oid"] = "t";
|
||||
foreach (get_rows("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view') " . ($name != "" ? "AND name = " . q($name) : "ORDER BY name")) as $row) {
|
||||
$row["Oid"] = 1;
|
||||
$row["Auto_increment"] = "";
|
||||
$row["Rows"] = $connection->result("SELECT COUNT(*) FROM " . idf_escape($row["Name"]));
|
||||
$return[$row["Name"]] = $row;
|
||||
@@ -304,12 +304,21 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
if ($primary) {
|
||||
$return[""] = array("type" => "PRIMARY", "columns" => $primary, "lengths" => array());
|
||||
}
|
||||
$sqls = get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q($table));
|
||||
foreach (get_rows("PRAGMA index_list(" . table($table) . ")") as $row) {
|
||||
if (!ereg("^sqlite_", $row["name"])) {
|
||||
$return[$row["name"]]["type"] = ($row["unique"] ? "UNIQUE" : "INDEX");
|
||||
$return[$row["name"]]["lengths"] = array();
|
||||
foreach (get_rows("PRAGMA index_info(" . idf_escape($row["name"]) . ")") as $row1) {
|
||||
$return[$row["name"]]["columns"][] = $row1["name"];
|
||||
$name = $row["name"];
|
||||
if (!ereg("^sqlite_", $name)) {
|
||||
$return[$name]["type"] = ($row["unique"] ? "UNIQUE" : "INDEX");
|
||||
$return[$name]["lengths"] = array();
|
||||
foreach (get_rows("PRAGMA index_info(" . idf_escape($name) . ")") as $row1) {
|
||||
$return[$name]["columns"][] = $row1["name"];
|
||||
}
|
||||
$return[$name]["descs"] = array();
|
||||
if (eregi('^CREATE( UNIQUE)? INDEX ' . quotemeta(idf_escape($name) . ' ON ' . idf_escape($table)) . ' \((.*)\)$', $sqls[$name], $regs)) {
|
||||
preg_match_all('/("[^"]*+")+( DESC)?/', $regs[2], $matches);
|
||||
foreach ($matches[2] as $val) {
|
||||
$return[$name]["descs"][] = ($val ? '1' : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,10 +357,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
return h($connection->error);
|
||||
}
|
||||
|
||||
function exact_value($val) {
|
||||
return q($val);
|
||||
}
|
||||
|
||||
function check_sqlite_name($name) {
|
||||
// avoid creating PHP files on unsecured servers
|
||||
global $connection;
|
||||
@@ -514,7 +519,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
}
|
||||
|
||||
function alter_indexes($table, $alter) {
|
||||
foreach ($alter as $val) {
|
||||
foreach (array_reverse($alter) as $val) {
|
||||
if (!queries($val[2] == "DROP"
|
||||
? "DROP INDEX " . idf_escape($val[1])
|
||||
: index_sql($table, $val[0], $val[1], $val[2])
|
||||
|
@@ -55,7 +55,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
||||
}
|
||||
}
|
||||
|
||||
$table_name = $adminer->tableName(table_status($TABLE, true));
|
||||
$table_name = $adminer->tableName(table_status1($TABLE, true));
|
||||
page_header(
|
||||
($update ? lang('Edit') : lang('Insert')),
|
||||
$error,
|
||||
|
@@ -20,10 +20,11 @@ class Adminer {
|
||||
}
|
||||
|
||||
/** Get key used for permanent login
|
||||
* @return string cryptic string which gets combined with password
|
||||
* @param bool
|
||||
* @return string cryptic string which gets combined with password or false in case of an error
|
||||
*/
|
||||
function permanentLogin() {
|
||||
return password_file();
|
||||
function permanentLogin($create = false) {
|
||||
return password_file($create);
|
||||
}
|
||||
|
||||
/** Identifier of selected database
|
||||
@@ -229,15 +230,14 @@ username.form['auth[driver]'].onchange();
|
||||
print_fieldset("select", lang('Select'), $select);
|
||||
$i = 0;
|
||||
$fun_group = array(lang('Functions') => $functions, lang('Aggregation') => $grouping);
|
||||
$move = "<img src='static/move.gif' width='18' height='18' alt='" . lang('Move') . "' class='jsonly move' onmousedown=''>";
|
||||
foreach ($select as $key => $val) {
|
||||
$val = $_GET["columns"][$key];
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"]);
|
||||
echo "(<select name='columns[$i][col]' onchange='selectFieldChange(this.form);'><option>" . optionlist($columns, $val["col"], true) . "</select>) $move</div>\n";
|
||||
echo "(<select name='columns[$i][col]' onchange='selectFieldChange(this.form);'><option>" . optionlist($columns, $val["col"], true) . "</select>)</div>\n";
|
||||
$i++;
|
||||
}
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, "", "this.nextSibling.nextSibling.onchange();");
|
||||
echo "(<select name='columns[$i][col]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>) $move</div>\n";
|
||||
echo "(<select name='columns[$i][col]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>)</div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ username.form['auth[driver]'].onchange();
|
||||
}
|
||||
}
|
||||
echo "<div><select name='order[$i]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>";
|
||||
echo "<label><input type='checkbox' name='desc[$i]' value='1'>" . lang('descending') . "</label></div>\n"; // not checkbox() to allow selectAddRow()
|
||||
echo checkbox("desc[$i]", 1, false, lang('descending')) . "</div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ username.form['auth[driver]'].onchange();
|
||||
<p class="logout">
|
||||
<?php
|
||||
if (DB == "" || !$missing) {
|
||||
echo "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"])) . ">" . lang('SQL command') . "</a>\n";
|
||||
echo "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"])) . " title='" . lang('Import') . "'>" . lang('SQL command') . "</a>\n";
|
||||
if (support("dump")) {
|
||||
echo "<a href='" . h(ME) . "dump=" . urlencode(isset($_GET["table"]) ? $_GET["table"] : $_GET["select"]) . "' id='dump'" . bold(isset($_GET["dump"])) . ">" . lang('Dump') . "</a>\n";
|
||||
}
|
||||
@@ -812,17 +812,16 @@ username.form['auth[driver]'].onchange();
|
||||
<form action="">
|
||||
<p id="dbs">
|
||||
<?php
|
||||
hidden_fields_get();
|
||||
echo ($databases
|
||||
? '<select name="db" onmousedown="dbMouseDown(event, this);" onchange="dbChange(this);">' . optionlist(array("" => "(" . lang('database') . ")") + $databases, DB) . '</select>'
|
||||
: '<input name="db" value="' . h(DB) . '" autocapitalize="off">'
|
||||
);
|
||||
?>
|
||||
<input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
|
||||
<?php
|
||||
hidden_fields_get();
|
||||
$db_events = " onmousedown='dbMouseDown(event, this);' onchange='dbChange(this);'";
|
||||
echo ($databases
|
||||
? "<select name='db'$db_events>" . optionlist(array("" => "(" . lang('database') . ")") + $databases, DB) . "</select>"
|
||||
: '<input name="db" value="' . h(DB) . '" autocapitalize="off">'
|
||||
);
|
||||
echo "<input type='submit' value='" . lang('Use') . "'" . ($databases ? " class='hidden'" : "") . ">\n";
|
||||
if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
|
||||
if (support("scheme")) {
|
||||
echo "<br>" . html_select("ns", array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"], "this.form.submit();");
|
||||
echo "<br><select name='ns'$db_events>" . optionlist(array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"]) . "</select>";
|
||||
if ($_GET["ns"] != "") {
|
||||
set_schema($_GET["ns"]);
|
||||
}
|
||||
@@ -842,8 +841,8 @@ echo ($databases
|
||||
function tablesPrint($tables) {
|
||||
echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
|
||||
foreach ($tables as $table => $status) {
|
||||
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table) . ">" . lang('select') . "</a> ";
|
||||
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . " title='" . lang('Show structure') . "'>" . $this->tableName($status) . "</a><br>\n";
|
||||
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table) . ">" . lang('select') . "</a> ";
|
||||
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold(in_array($table, array($_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"]))) . " title='" . lang('Show structure') . "'>" . $this->tableName($status) . "</a><br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ if ($auth) {
|
||||
$_SESSION["db"][$auth["driver"]][$auth["server"]][$auth["username"]][$auth["db"]] = true;
|
||||
if ($auth["permanent"]) {
|
||||
$key = base64_encode($auth["driver"]) . "-" . base64_encode($auth["server"]) . "-" . base64_encode($auth["username"]) . "-" . base64_encode($auth["db"]);
|
||||
$private = $adminer->permanentLogin();
|
||||
$private = $adminer->permanentLogin(true);
|
||||
$permanent[$key] = "$key:" . base64_encode($private ? encrypt_string($auth["password"], $private) : "");
|
||||
cookie("adminer_permanent", implode(" ", $permanent));
|
||||
}
|
||||
@@ -49,7 +49,7 @@ if ($auth) {
|
||||
|
||||
} elseif ($permanent && !$_SESSION["pwds"]) {
|
||||
session_regenerate_id();
|
||||
$private = $adminer->permanentLogin(); // try to decode even if not set
|
||||
$private = $adminer->permanentLogin();
|
||||
foreach ($permanent as $key => $val) {
|
||||
list(, $cipher) = explode(":", $val);
|
||||
list($driver, $server, $username, $db) = array_map('base64_decode', explode("-", $key));
|
||||
@@ -82,6 +82,9 @@ function auth_error($exception = null) {
|
||||
$password = &get_session("pwds");
|
||||
if ($password !== null) {
|
||||
$error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
|
||||
if ($password === false) {
|
||||
$error .= '<br>' . lang('Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.', '<code>permanentLogin()</code>');
|
||||
}
|
||||
$password = null;
|
||||
}
|
||||
unset_permanent();
|
||||
@@ -141,4 +144,7 @@ if ($_POST) {
|
||||
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// posted form with no data means that post_max_size exceeded because Adminer always sends token at least
|
||||
$error = lang('Too big POST data. Reduce the data or increase the %s configuration directive.', "'post_max_size'");
|
||||
if (isset($_GET["sql"])) {
|
||||
$error .= ' ' . lang('You can upload a big SQL file via FTP and import it from server.');
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ function connect_error() {
|
||||
global $adminer, $connection, $token, $error, $drivers;
|
||||
$databases = array();
|
||||
if (DB != "") {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
||||
} else {
|
||||
if ($_POST["db"] && !$error) {
|
||||
@@ -75,6 +76,7 @@ if (support("scheme") && DB != "" && $_GET["ns"] !== "") {
|
||||
redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema());
|
||||
}
|
||||
if (!set_schema($_GET["ns"])) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
page_header(lang('Schema') . ": " . h($_GET["ns"]), lang('Invalid schema.'), true);
|
||||
page_footer("ns");
|
||||
exit;
|
||||
|
@@ -99,14 +99,12 @@ function nl_br($string) {
|
||||
* @return string
|
||||
*/
|
||||
function checkbox($name, $value, $checked, $label = "", $onclick = "", $class = "") {
|
||||
static $id = 0;
|
||||
$id++;
|
||||
$return = "<input type='checkbox' name='$name' value='" . h($value) . "'"
|
||||
. ($checked ? " checked" : "")
|
||||
. ($onclick ? ' onclick="' . h($onclick) . '"' : '')
|
||||
. " id='checkbox-$id'>"
|
||||
. ">"
|
||||
;
|
||||
return ($label != "" || $class ? "<label for='checkbox-$id'" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
|
||||
return ($label != "" || $class ? "<label" . ($class ? " class='$class'" : "") . ">$return" . h($label) . "</label>" : $return);
|
||||
}
|
||||
|
||||
/** Generate list of HTML options
|
||||
@@ -335,12 +333,19 @@ function where($where, $fields = array()) {
|
||||
$function_pattern = '(^[\w\(]+' . str_replace("_", ".*", preg_quote(idf_escape("_"))) . '\)+$)'; //! columns looking like functions
|
||||
foreach ((array) $where["where"] as $key => $val) {
|
||||
$key = bracket_escape($key, 1); // 1 - back
|
||||
$return[] = (preg_match($function_pattern, $key) ? $key : idf_escape($key)) //! SQL injection
|
||||
. (($jush == "sql" && ereg('\\.', $val)) || $jush == "mssql" ? " LIKE " . exact_value(addcslashes($val, "%_\\")) : " = " . unconvert_field($fields[$key], exact_value($val))) // LIKE because of floats, but slow with ints, in MS SQL because of text
|
||||
$column = (preg_match($function_pattern, $key) ? $key : idf_escape($key)); //! SQL injection
|
||||
$return[] = $column
|
||||
. (($jush == "sql" && ereg('^[0-9]*\\.[0-9]*$', $val)) || $jush == "mssql"
|
||||
? " LIKE " . q(addcslashes($val, "%_\\"))
|
||||
: " = " . unconvert_field($fields[$key], q($val))
|
||||
) // LIKE because of floats but slow with ints, in MS SQL because of text
|
||||
; //! enum and set
|
||||
if ($jush == "sql" && ereg("[^ -@]", $val)) { // not just [a-z] to catch non-ASCII characters
|
||||
$return[] = "$column = " . q($val) . " COLLATE utf8_bin";
|
||||
}
|
||||
}
|
||||
foreach ((array) $where["null"] as $key) {
|
||||
$return[] = idf_escape($key) . " IS NULL";
|
||||
$return[] = (preg_match($function_pattern, $key) ? $key : idf_escape($key)) . " IS NULL";
|
||||
}
|
||||
return implode(" AND ", $return);
|
||||
}
|
||||
@@ -702,6 +707,16 @@ function hidden_fields_get() {
|
||||
echo '<input type="hidden" name="username" value="' . h($_GET["username"]) . '">';
|
||||
}
|
||||
|
||||
/** Get status of a single table and fall back to name on error
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return array
|
||||
*/
|
||||
function table_status1($table, $fast = false) {
|
||||
$return = table_status($table, $fast);
|
||||
return ($return ? $return : array("Name" => $table));
|
||||
}
|
||||
|
||||
/** Find out foreign keys for each column
|
||||
* @param string
|
||||
* @return array array($col => array())
|
||||
@@ -789,7 +804,7 @@ function input($field, $value, $function) {
|
||||
} else {
|
||||
// int(3) is only a display hint
|
||||
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
|
||||
if ($connection->server_info >= 5.6 && ereg('time', $field["type"])) {
|
||||
if ($jush == 'sql' && $connection->server_info >= 5.6 && ereg('time', $field["type"])) {
|
||||
$maxlength += 7; // microtime
|
||||
}
|
||||
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
|
||||
@@ -907,9 +922,10 @@ function apply_sql_function($function, $column) {
|
||||
}
|
||||
|
||||
/** Read password from file adminer.key in temporary directory or create one
|
||||
* @param bool
|
||||
* @return string or false if the file can not be created
|
||||
*/
|
||||
function password_file() {
|
||||
function password_file($create) {
|
||||
$dir = ini_get("upload_tmp_dir"); // session_save_path() may contain other storage path
|
||||
if (!$dir) {
|
||||
if (function_exists('sys_get_temp_dir')) {
|
||||
@@ -925,7 +941,7 @@ function password_file() {
|
||||
}
|
||||
$filename = "$dir/adminer.key";
|
||||
$return = @file_get_contents($filename); // @ - can not exist
|
||||
if ($return) {
|
||||
if ($return || !$create) {
|
||||
return $return;
|
||||
}
|
||||
$fp = @fopen($filename, "w"); // @ - can have insufficient rights //! is not atomic
|
||||
|
@@ -3,33 +3,34 @@
|
||||
|
||||
$langs = array(
|
||||
'en' => 'English', // Jakub Vrána - http://www.vrana.cz
|
||||
'cs' => 'Čeština', // Jakub Vrána - http://www.vrana.cz
|
||||
'sk' => 'Slovenčina', // Ivan Suchy - http://www.ivansuchy.com, Juraj Krivda - http://www.jstudio.cz
|
||||
'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be
|
||||
'es' => 'Español', // Klemens Häckel - http://clickdimension.wordpress.com
|
||||
'de' => 'Deutsch', // Klemens Häckel - http://clickdimension.wordpress.com
|
||||
'fr' => 'Français', // Francis Gagné, Aurélien Royer
|
||||
'it' => 'Italiano', // Alessandro Fiorotto, Paolo Asperti
|
||||
'et' => 'Eesti', // Priit Kallas
|
||||
'hu' => 'Magyar', // Borsos Szilárd (Borsosfi) - http://www.borsosfi.hu, info@borsosfi.hu
|
||||
'pl' => 'Polski', // Radosław Kowalewski - http://srsbiz.pl/
|
||||
'ar' => 'العربية', // Y.M Amine - Algeria - nbr7@live.fr
|
||||
'bn' => 'বাংলা', // Dipak Kumar - dipak.ndc@gmail.com
|
||||
'ca' => 'Català', // Joan Llosas
|
||||
'pt' => 'Português', // Gian Live - gian@live.com, Davi Alexandre davi@davialexandre.com.br
|
||||
'sl' => 'Slovenski', // Matej Ferlan - www.itdinamik.com, matej.ferlan@itdinamik.com
|
||||
'lt' => 'Lietuvių', // Paulius Leščinskas - http://www.lescinskas.lt
|
||||
'tr' => 'Türkçe', // Bilgehan Korkmaz - turktron.com
|
||||
'ro' => 'Limba Română', // .nick .messing - dot.nick.dot.messing@gmail.com
|
||||
'cs' => 'Čeština', // Jakub Vrána - http://www.vrana.cz
|
||||
'de' => 'Deutsch', // Klemens Häckel - http://clickdimension.wordpress.com
|
||||
'es' => 'Español', // Klemens Häckel - http://clickdimension.wordpress.com
|
||||
'et' => 'Eesti', // Priit Kallas
|
||||
'fa' => 'فارسی', // mojtaba barghbani - Iran - mbarghbani@gmail.com
|
||||
'fr' => 'Français', // Francis Gagné, Aurélien Royer
|
||||
'hu' => 'Magyar', // Borsos Szilárd (Borsosfi) - http://www.borsosfi.hu, info@borsosfi.hu
|
||||
'id' => 'Bahasa Indonesia', // Ivan Lanin - http://ivan.lanin.org
|
||||
'it' => 'Italiano', // Alessandro Fiorotto, Paolo Asperti
|
||||
'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/
|
||||
'ko' => '한국어', // dalli - skcha67@gmail.com
|
||||
'lt' => 'Lietuvių', // Paulius Leščinskas - http://www.lescinskas.lt
|
||||
'nl' => 'Nederlands', // Maarten Balliauw - http://blog.maartenballiauw.be
|
||||
'pl' => 'Polski', // Radosław Kowalewski - http://srsbiz.pl/
|
||||
'pt' => 'Português', // Gian Live - gian@live.com, Davi Alexandre davi@davialexandre.com.br
|
||||
'ro' => 'Limba Română', // .nick .messing - dot.nick.dot.messing@gmail.com
|
||||
'ru' => 'Русский язык', // Maksim Izmaylov
|
||||
'uk' => 'Українська', // Valerii Kryzhov
|
||||
'sk' => 'Slovenčina', // Ivan Suchy - http://www.ivansuchy.com, Juraj Krivda - http://www.jstudio.cz
|
||||
'sl' => 'Slovenski', // Matej Ferlan - www.itdinamik.com, matej.ferlan@itdinamik.com
|
||||
'sr' => 'Српски', // Nikola Radovanović - cobisimo@gmail.com
|
||||
'ta' => 'தமிழ்', // G. Sampath Kumar, Chennai, India, sampathkumar11@gmail.com
|
||||
'tr' => 'Türkçe', // Bilgehan Korkmaz - turktron.com
|
||||
'uk' => 'Українська', // Valerii Kryzhov
|
||||
'zh' => '简体中文', // Mr. Lodar
|
||||
'zh-tw' => '繁體中文', // http://tzangms.com
|
||||
'ja' => '日本語', // Hitoshi Ozawa - http://sourceforge.jp/projects/oss-ja-jpn/releases/
|
||||
'ta' => 'தமிழ்', // G. Sampath Kumar, Chennai, India, sampathkumar11@gmail.com
|
||||
'bn' => 'বাংলা', // Dipak Kumar - dipak.ndc@gmail.com
|
||||
'ar' => 'العربية', // Y.M Amine - Algeria - nbr7@live.fr
|
||||
'fa' => 'فارسی', // mojtaba barghbani - Iran - mbarghbani@gmail.com
|
||||
);
|
||||
|
||||
/** Get current language
|
||||
|
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
$VERSION = "3.7.1-dev";
|
||||
$VERSION = "3.7.1";
|
||||
|
@@ -79,6 +79,9 @@ function decrypt_string($str, $key) {
|
||||
if ($str == "") {
|
||||
return "";
|
||||
}
|
||||
if (!$key) {
|
||||
return false;
|
||||
}
|
||||
$key = array_values(unpack("V*", pack("H*", md5($key))));
|
||||
$v = str2long($str, false);
|
||||
$n = count($v) - 1;
|
||||
|
@@ -19,14 +19,17 @@ if ($_POST && !$error && !$_POST["add"]) {
|
||||
if (in_array($index["type"], $index_types)) {
|
||||
$columns = array();
|
||||
$lengths = array();
|
||||
$descs = array();
|
||||
$set = array();
|
||||
ksort($index["columns"]);
|
||||
foreach ($index["columns"] as $key => $column) {
|
||||
if ($column != "") {
|
||||
$length = $index["lengths"][$key];
|
||||
$set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "");
|
||||
$desc = $index["descs"][$key];
|
||||
$set[] = idf_escape($column) . ($length ? "(" . (+$length) . ")" : "") . ($desc ? " DESC" : "");
|
||||
$columns[] = $column;
|
||||
$lengths[] = ($length ? $length : null);
|
||||
$descs[] = $desc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +38,12 @@ if ($_POST && !$error && !$_POST["add"]) {
|
||||
if ($existing) {
|
||||
ksort($existing["columns"]);
|
||||
ksort($existing["lengths"]);
|
||||
if ($index["type"] == $existing["type"] && array_values($existing["columns"]) === $columns && (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)) {
|
||||
ksort($existing["descs"]);
|
||||
if ($index["type"] == $existing["type"]
|
||||
&& array_values($existing["columns"]) === $columns
|
||||
&& (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths)
|
||||
&& array_values($existing["descs"]) === $descs
|
||||
) {
|
||||
// skip existing index
|
||||
unset($indexes[$name]);
|
||||
continue;
|
||||
@@ -66,7 +74,11 @@ if ($_POST["add"]) {
|
||||
}
|
||||
}
|
||||
$index = end($row["indexes"]);
|
||||
if ($index["type"] || array_filter($index["columns"], 'strlen') || array_filter($index["lengths"], 'strlen')) {
|
||||
if ($index["type"]
|
||||
|| array_filter($index["columns"], 'strlen')
|
||||
|| array_filter($index["lengths"], 'strlen')
|
||||
|| array_filter($index["descs"])
|
||||
) {
|
||||
$row["indexes"][] = array("columns" => array(1 => ""));
|
||||
}
|
||||
}
|
||||
@@ -92,7 +104,9 @@ foreach ($row["indexes"] as $index) {
|
||||
$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_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');");
|
||||
echo "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'> </span>"; //! hide for non-MySQL drivers, add ASC|DESC
|
||||
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++;
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ $translations = array(
|
||||
'Logged as: %s' => 'Přihlášen jako: %s',
|
||||
'Logout successful.' => 'Odhlášení proběhlo v pořádku.',
|
||||
'Invalid credentials.' => 'Neplatné přihlašovací údaje.',
|
||||
'Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.' => 'Platnost hlavního hesla vypršela. <a href="http://www.adminer.org/cs/extension/" target="_blank">Implementujte</a> metodu %s, aby platilo stále.',
|
||||
'Language' => 'Jazyk',
|
||||
'Invalid CSRF token. Send the form again.' => 'Neplatný token CSRF. Odešlete formulář znovu.',
|
||||
'No extension' => 'Žádné rozšíření',
|
||||
@@ -64,6 +65,7 @@ $translations = array(
|
||||
'Unable to upload a file.' => 'Nepodařilo se nahrát soubor.',
|
||||
'Maximum allowed file size is %sB.' => 'Maximální povolená velikost souboru je %sB.',
|
||||
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Příliš velká POST data. Zmenšete data nebo zvyšte hodnotu konfigurační direktivy %s.',
|
||||
'You can upload a big SQL file via FTP and import it from server.' => 'Velký SQL soubor můžete nahrát pomocí FTP a importovat ho ze serveru.',
|
||||
|
||||
'Export' => 'Export',
|
||||
'Dump' => 'Export',
|
||||
@@ -240,6 +242,7 @@ $translations = array(
|
||||
|
||||
'Import' => 'Import',
|
||||
'%d row(s) have been imported.' => array('Byl importován %d záznam.', 'Byly importovány %d záznamy.', 'Bylo importováno %d záznamů.'),
|
||||
'File must be in UTF-8 encoding.' => 'Soubor musí být v kódování UTF-8.',
|
||||
|
||||
// in-place editing in select
|
||||
'Ctrl+click on a value to modify it.' => 'Ctrl+klikněte na políčko, které chcete změnit.',
|
||||
|
270
adminer/lang/ko.inc.php
Normal file
270
adminer/lang/ko.inc.php
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
$translations = array(
|
||||
'Login' => '로그인',
|
||||
'Logout successful.' => '로그아웃',
|
||||
'Invalid credentials.' => '잘못된 로그인',
|
||||
'Server' => '서버',
|
||||
'Username' => '사용자이름',
|
||||
'Password' => '비밀번호',
|
||||
'Select database' => '데이터베이스를 선택하십시오.',
|
||||
'Invalid database.' => '잘못된 데이터베이스입니다.',
|
||||
'Create new database' => '새 데이터베이스 만들기',
|
||||
'Table has been dropped.' => '테이블을 삭제했습니다.',
|
||||
'Table has been altered.' => '테이블을 변경했습니다.',
|
||||
'Table has been created.' => '테이블을 만들었습니다.',
|
||||
'Alter table' => '테이블 변경',
|
||||
'Create table' => '테이블 만들기',
|
||||
'Table name' => '테이블 이름',
|
||||
'engine' => '엔진',
|
||||
'collation' => '정렬',
|
||||
'Column name' => '열 이름',
|
||||
'Type' => '형',
|
||||
'Length' => '길이',
|
||||
'Auto Increment' => '자동증가',
|
||||
'Options' => '설정',
|
||||
'Save' => '저장',
|
||||
'Drop' => '삭제',
|
||||
'Database has been dropped.' => '데이터베이스를 삭제했습니다.',
|
||||
'Database has been created.' => '데이터베이스를 만들었습니다.',
|
||||
'Database has been renamed.' => '데이터베이스의 이름을 바꾸었습니다.',
|
||||
'Database has been altered.' => '데이터베이스를 변경했습니다.',
|
||||
'Alter database' => '데이터베이스 변경',
|
||||
'Create database' => '데이터베이스 만들기',
|
||||
'SQL command' => 'SQL 명령',
|
||||
'Dump' => '덤프',
|
||||
'Logout' => '로그아웃',
|
||||
'database' => '데이터베이스',
|
||||
'Use' => '사용',
|
||||
'No tables.' => '테이블이 없습니다.',
|
||||
'select' => '선택',
|
||||
'Create new table' => '테이블 만들기',
|
||||
'Item has been deleted.' => '항목을 삭제했습니다.',
|
||||
'Item has been updated.' => '항목을 갱신했습니다.',
|
||||
'Edit' => '편집',
|
||||
'Insert' => '삽입',
|
||||
'Save and insert next' => '저장하고 다음에 추가',
|
||||
'Delete' => '삭제',
|
||||
'Database' => '데이터베이스',
|
||||
'Routines' => '루틴',
|
||||
'Indexes have been altered.' => '인덱스를 변경했습니다.',
|
||||
'Indexes' => '색인',
|
||||
'Alter indexes' => '인덱스 변경',
|
||||
'Add next' => '추가',
|
||||
'Language' => '언어',
|
||||
'Select' => '선택',
|
||||
'New item' => '항목 만들기',
|
||||
'Search' => '검색',
|
||||
'Sort' => '정렬',
|
||||
'descending' => '역순',
|
||||
'Limit' => '제약',
|
||||
'No rows.' => '행이 없습니다.',
|
||||
'Action' => '실행',
|
||||
'edit' => '편집',
|
||||
'Page' => '페이지',
|
||||
'Query executed OK, %d row(s) affected.' => '쿼리를 실행했습니다. %d 행을 변경했습니다.',
|
||||
'Error in query' => '쿼리의 오류',
|
||||
'Execute' => '실행',
|
||||
'Table' => '테이블',
|
||||
'Foreign keys' => '외부 키',
|
||||
'Triggers' => '트리거',
|
||||
'View' => '보기',
|
||||
'Unable to select the table' => '테이블을 선택할 수 없습니다.',
|
||||
'Invalid CSRF token. Send the form again.' => '잘못된 CSRF 토큰. 다시 보내주십시오.',
|
||||
'Comment' => '코멘트',
|
||||
'Default values' => '기본값',
|
||||
'%d byte(s)' => '%d 바이트',
|
||||
'No commands to execute.' => '실행할 수 있는 명령이 없습니다.',
|
||||
'Unable to upload a file.' => '파일을 업로드 할 수 없습니다.',
|
||||
'File upload' => '파일 올리기',
|
||||
'File uploads are disabled.' => '파일 업로드가 잘못되었습니다.',
|
||||
'Routine has been called, %d row(s) affected.' => '루틴을 호출했습니다. %d 행을 변경했습니다.',
|
||||
'Call' => '외침',
|
||||
'No extension' => '확장 기능이 없습니다.',
|
||||
'None of the supported PHP extensions (%s) are available.' => 'PHP 확장 (%s)가 설치되어 있지 않습니다.',
|
||||
'Session support must be enabled.' => '세션을 사용하십시오.',
|
||||
'Session expired, please login again.' => '세션 만료. 다시 로그인하십시오.',
|
||||
'Text length' => '문자열의 길이',
|
||||
'Foreign key has been dropped.' => '외부 키를 제거했습니다.',
|
||||
'Foreign key has been altered.' => '외부 키를 변경했습니다.',
|
||||
'Foreign key has been created.' => '외부 키를 만들었습니다.',
|
||||
'Foreign key' => '외부 키',
|
||||
'Target table' => '테이블',
|
||||
'Change' => '변경',
|
||||
'Source' => '소스',
|
||||
'Target' => '타겟',
|
||||
'Add column' => '열 추가',
|
||||
'Alter' => '변경',
|
||||
'Add foreign key' => '외부 키를 추가',
|
||||
'ON DELETE' => 'ON DELETE',
|
||||
'ON UPDATE' => 'ON UPDATE',
|
||||
'Index Type' => '인덱스 형',
|
||||
'Column (length)' => '열 (길이)',
|
||||
'View has been dropped.' => '보기를 삭제했습니다.',
|
||||
'View has been altered.' => '보기를 변경했습니다.',
|
||||
'View has been created.' => '보기를 만들었습니다.',
|
||||
'Alter view' => '보기 변경',
|
||||
'Create view' => '뷰 만들기',
|
||||
'Name' => '이름',
|
||||
'Process list' => '프로세스 목록',
|
||||
'%d process(es) have been killed.' => '%d 프로세스를 강제 종료되었습니다.',
|
||||
'Kill' => '강제 종료',
|
||||
'Parameter name' => '참조 여명',
|
||||
'Database schema' => '구조',
|
||||
'Create procedure' => '시저 만들기',
|
||||
'Create function' => '함수 만들기',
|
||||
'Routine has been dropped.' => '루틴 만들기',
|
||||
'Routine has been altered.' => '루틴 변경',
|
||||
'Routine has been created.' => '루틴 만들기',
|
||||
'Alter function' => '함수의 변경',
|
||||
'Alter procedure' => '시저 변경',
|
||||
'Return type' => '반환 형식',
|
||||
'Add trigger' => '트리거 추가',
|
||||
'Trigger has been dropped.' => '트리거를 제거했습니다.',
|
||||
'Trigger has been altered.' => '트리거를 변경했습니다.',
|
||||
'Trigger has been created.' => '트리거를 추가했습니다.',
|
||||
'Alter trigger' => '트리거 변경',
|
||||
'Create trigger' => '트리거 만들기',
|
||||
'Time' => '시간',
|
||||
'Event' => '이벤트',
|
||||
'%s version: %s through PHP extension %s' => '%s 버전 %s, PHP 확장 %s',
|
||||
'%d row(s)' => '%d 행',
|
||||
'Remove' => '제외',
|
||||
'Are you sure?' => '실행 하시겠습니까?',
|
||||
'Privileges' => '권한',
|
||||
'Create user' => '사용자 만들기',
|
||||
'User has been dropped.' => '사용자 삭제',
|
||||
'User has been altered.' => '사용자 변경',
|
||||
'User has been created.' => '사용자 만들기',
|
||||
'Hashed' => 'Hashed',
|
||||
'Column' => '열',
|
||||
'Routine' => '루틴',
|
||||
'Grant' => '권한 부여',
|
||||
'Revoke' => '권한 취소',
|
||||
'Logged as: %s' => '로그 : %s',
|
||||
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'POST 데이터가 너무 큽니다. 데이터 크기를 줄이거나 %s 설정을 늘리십시오.',
|
||||
'Move up' => '상',
|
||||
'Move down' => '아래',
|
||||
'Export' => '내보내기',
|
||||
'Tables' => '테이블',
|
||||
'Data' => '데이터',
|
||||
'Output' => '출력',
|
||||
'open' => '열',
|
||||
'save' => '저장',
|
||||
'Format' => '형식',
|
||||
'Functions' => '함수',
|
||||
'Aggregation' => '집합',
|
||||
'Event has been dropped.' => '삭제했습니다.',
|
||||
'Event has been altered.' => '변경했습니다.',
|
||||
'Event has been created.' => '만들었습니다.',
|
||||
'Alter event' => '변경',
|
||||
'Create event' => '만들기',
|
||||
'Start' => '시작',
|
||||
'End' => '종료',
|
||||
'Every' => '매번',
|
||||
'Status' => '상태',
|
||||
'On completion preserve' => '완성 후 저장',
|
||||
'Events' => '이벤트',
|
||||
'Schedule' => '일정',
|
||||
'At given time' => '지정 시간',
|
||||
'Tables have been truncated.' => '테이블을 truncate했습니다.',
|
||||
'Tables have been moved.' => '테이블을 옮겼습니다.',
|
||||
'Tables and views' => '테이블과 뷰',
|
||||
'Engine' => '엔진',
|
||||
'Collation' => '정렬',
|
||||
'Data Length' => '데이터 길이',
|
||||
'Index Length' => '인덱스 길이',
|
||||
'Data Free' => '여유',
|
||||
'Rows' => '행',
|
||||
',' => ',',
|
||||
'Analyze' => '분석',
|
||||
'Optimize' => '최적화',
|
||||
'Check' => '확인',
|
||||
'Repair' => '복구',
|
||||
'Truncate' => 'Truncate',
|
||||
'Move to other database' => '다른 데이터베이스로 이동',
|
||||
'Move' => '이동',
|
||||
'Save and continue edit' => '저장하고 계속',
|
||||
'original' => '원래',
|
||||
'%d item(s) have been affected.' => '%d를 갱신했습니다.',
|
||||
'whole result' => '모든 결과',
|
||||
'Tables have been dropped.' => '테이블을 삭제했습니다.',
|
||||
'Clone' => '복제',
|
||||
'Maximum number of allowed fields exceeded. Please increase %s.' => '정의 가능한 최대 필드 수를 초과했습니다. %s를 늘리십시오.',
|
||||
'Partition by' => '파티션',
|
||||
'Partitions' => '파티션',
|
||||
'Partition name' => '파티션 이름',
|
||||
'Values' => '값',
|
||||
'%d row(s) have been imported.' => '%d 행을 가져 왔습니다.',
|
||||
'Show structure' => '구조',
|
||||
'anywhere' => '모든',
|
||||
'Import' => '가져 오기',
|
||||
'Stop on error' => '오류의 경우 중지',
|
||||
'Select data' => '데이터',
|
||||
'%.3f s' => '%.3f 초',
|
||||
'$1-$3-$5' => '$1-$3-$5',
|
||||
'[yyyy]-mm-dd' => '[yyyy]-mm-dd',
|
||||
'History' => '역사',
|
||||
'Variables' => '변수',
|
||||
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => '원본 및 대상 열은 동일한 데이터 형식이어야합니다. 목표 컬럼에 인덱스와 데이터가 존재해야합니다.',
|
||||
'Relations' => '관계',
|
||||
'Run file' => '파일을 실행',
|
||||
'Clear' => '삭제',
|
||||
'Maximum allowed file size is %sB.' => '파일의 최대 크기 %sB',
|
||||
'Numbers' => '숫자',
|
||||
'Date and time' => '시간',
|
||||
'Strings' => '문자열',
|
||||
'Binary' => '이진',
|
||||
'Lists' => '목록',
|
||||
'Editor' => '에디터',
|
||||
'E-mail' => '메일',
|
||||
'From' => '보낸 사람',
|
||||
'Subject' => '제목',
|
||||
'Send' => '보내기',
|
||||
'%d e-mail(s) have been sent.' => '%d 메일을 보냈습니다.',
|
||||
'Webserver file %s' => 'Web 서버 파일 %s',
|
||||
'File does not exist.' => '파일이 존재하지 않습니다.',
|
||||
'%d in total' => '총 %d',
|
||||
'Permanent login' => '영구적으로 로그인',
|
||||
'Databases have been dropped.' => '데이터베이스를 삭제했습니다.',
|
||||
'Search data in tables' => '데이터 검색',
|
||||
'schema' => '스키마',
|
||||
'Schema' => '스키마',
|
||||
'Alter schema' => '스키마 변경',
|
||||
'Create schema' => '스키마 추가',
|
||||
'Schema has been dropped.' => '스키마를 삭제했습니다.',
|
||||
'Schema has been created.' => '스키마를 추가했습니다.',
|
||||
'Schema has been altered.' => '스키마를 변경했습니다.',
|
||||
'Sequences' => '시퀀스',
|
||||
'Create sequence' => '시퀀스 만들기',
|
||||
'Alter sequence' => '순서 변경',
|
||||
'Sequence has been dropped.' => '시퀀스를 제거했습니다.',
|
||||
'Sequence has been created.' => '시퀀스를 추가했습니다.',
|
||||
'Sequence has been altered.' => '순서를 변경했습니다.',
|
||||
'User types' => '사용자 정의 형',
|
||||
'Create type' => '사용자 정의 형식 만들기',
|
||||
'Alter type' => '사용자 정의 형식 변경',
|
||||
'Type has been dropped.' => '사용자 정의 형식을 삭제했습니다.',
|
||||
'Type has been created.' => '사용자 정의 형식을 추가했습니다.',
|
||||
'Use edit link to modify this value.' => '링크 편집',
|
||||
'last' => '마지막',
|
||||
'From server' => '서버에서 실행',
|
||||
'System' => '데이터베이스 형식',
|
||||
'empty' => '하늘',
|
||||
'Network' => '네트워크 형',
|
||||
'Geometry' => '기하 형',
|
||||
'File exists.' => '파일이 이미 있습니다.',
|
||||
'Attachments' => '첨부 파일',
|
||||
'Item%s has been inserted.' => '%s 항목을 삽입했습니다.',
|
||||
'now' => '현재 시간',
|
||||
'%d query(s) executed OK.' => '%d 쿼리를 실행했습니다.',
|
||||
'Show only errors' => '오류 만 표시',
|
||||
'Refresh' => '새로 고침',
|
||||
'Invalid schema.' => '잘못된 스키마',
|
||||
'Please use one of the extensions %s.' => '하나의 확장 기능을 사용하십시오 %s',
|
||||
'ltr' => 'ltr',
|
||||
'Tables have been copied.' => '테이블을 복사했습니다',
|
||||
'Copy' => '복사',
|
||||
'Permanent link' => '영구 링크',
|
||||
'Edit all' => '모든 편집',
|
||||
'HH:MM:SS' => '시:분:초',
|
||||
);
|
@@ -11,6 +11,7 @@ $translations = array(
|
||||
'Logged as: %s' => 'xx',
|
||||
'Logout successful.' => 'xx',
|
||||
'Invalid credentials.' => 'xx',
|
||||
'Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.' => 'xx',
|
||||
'Language' => 'xx',
|
||||
'Invalid CSRF token. Send the form again.' => 'xx',
|
||||
'No extension' => 'xx',
|
||||
@@ -64,6 +65,7 @@ $translations = array(
|
||||
'Unable to upload a file.' => 'xx',
|
||||
'Maximum allowed file size is %sB.' => 'xx',
|
||||
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'xx',
|
||||
'You can upload a big SQL file via FTP and import it from server.' => 'xx',
|
||||
|
||||
'Export' => 'xx',
|
||||
'Dump' => 'xx',
|
||||
@@ -240,6 +242,7 @@ $translations = array(
|
||||
|
||||
'Import' => 'xx',
|
||||
'%d row(s) have been imported.' => array('xx', 'xx'),
|
||||
'File must be in UTF-8 encoding.' => 'xx',
|
||||
|
||||
// in-place editing in select
|
||||
'Ctrl+click on a value to modify it.' => 'xx',
|
||||
|
@@ -12,6 +12,7 @@ function adminer_object() {
|
||||
// specify enabled plugins here
|
||||
new AdminerDatabaseHide(array('information_schema')),
|
||||
new AdminerDumpJson,
|
||||
new AdminerDumpBz2,
|
||||
new AdminerDumpZip,
|
||||
new AdminerDumpXml,
|
||||
new AdminerDumpAlter,
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
$TABLE = $_GET["select"];
|
||||
$table_status = table_status($TABLE);
|
||||
$table_status = table_status1($TABLE);
|
||||
$indexes = indexes($TABLE);
|
||||
$fields = fields($TABLE);
|
||||
$foreign_keys = column_foreign_keys($TABLE);
|
||||
$oid = "";
|
||||
if ($table_status["Oid"] == "t") {
|
||||
if ($table_status["Oid"]) {
|
||||
$oid = ($jush == "sqlite" ? "rowid" : "oid");
|
||||
$indexes[] = array("type" => "PRIMARY", "columns" => array($oid));
|
||||
}
|
||||
@@ -111,7 +111,7 @@ if ($_POST && !$error) {
|
||||
$command = "INSERT";
|
||||
$query = "INTO $query";
|
||||
}
|
||||
if ($_POST["all"] || ($unselected === array() && $_POST["check"]) || $is_group) {
|
||||
if ($_POST["all"] || ($unselected === array() && is_array($_POST["check"])) || $is_group) {
|
||||
$result = queries("$command $query$where_check");
|
||||
$affected = $connection->affected_rows;
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@ if ($_POST && !$error) {
|
||||
}
|
||||
$query = table($TABLE) . " SET " . implode(", ", $set);
|
||||
$where2 = " WHERE " . where_check($unique_idf, $fields) . ($where ? " AND " . implode(" AND ", $where) : "");
|
||||
$result = queries("UPDATE" . ($is_group ? " $query$where2" : limit1($query, $where2))); // can change row on a different page without unique key
|
||||
$result = queries("UPDATE" . ($is_group || $unselected === array() ? " $query$where2" : limit1($query, $where2))); // can change row on a different page without unique key
|
||||
if (!$result) {
|
||||
break;
|
||||
}
|
||||
@@ -158,8 +158,11 @@ if ($_POST && !$error) {
|
||||
queries_redirect(remove_from_uri(), lang('%d item(s) have been affected.', $affected), $result);
|
||||
}
|
||||
|
||||
} elseif (is_string($file = get_file("csv_file", true))) {
|
||||
//! character set
|
||||
} elseif (!is_string($file = get_file("csv_file", true))) {
|
||||
$error = upload_error($file);
|
||||
} elseif (!preg_match('~~u', $file)) {
|
||||
$error = lang('File must be in UTF-8 encoding.');
|
||||
} else {
|
||||
cookie("adminer_import", "output=" . urlencode($adminer_import["output"]) . "&format=" . urlencode($_POST["separator"]));
|
||||
$result = true;
|
||||
$cols = array_keys($fields);
|
||||
@@ -190,8 +193,6 @@ if ($_POST && !$error) {
|
||||
queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
|
||||
queries("ROLLBACK"); // after queries_redirect() to not overwrite error
|
||||
|
||||
} else {
|
||||
$error = upload_error($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,6 @@ input.default { box-shadow: 1px 1px 1px #777; }
|
||||
.icon { width: 18px; height: 18px; }
|
||||
.size { width: 6ex; }
|
||||
.help { cursor: help; }
|
||||
.move { cursor: move; }
|
||||
.pages { position: fixed; bottom: 0; left: 21em; padding: 5px; background: #ddf; border: 1px solid #999; }
|
||||
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; }
|
||||
#menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }
|
||||
|
@@ -76,7 +76,7 @@ function loginDriver(driver) {
|
||||
|
||||
|
||||
var dbCtrl;
|
||||
var dbPrevious;
|
||||
var dbPrevious = {};
|
||||
|
||||
/** Check if database should be opened to a new window
|
||||
* @param MouseEvent
|
||||
@@ -84,8 +84,8 @@ var dbPrevious;
|
||||
*/
|
||||
function dbMouseDown(event, el) {
|
||||
dbCtrl = isCtrl(event);
|
||||
if (dbPrevious == undefined) {
|
||||
dbPrevious = el.value;
|
||||
if (dbPrevious[el.name] == undefined) {
|
||||
dbPrevious[el.name] = el.value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ function dbChange(el) {
|
||||
}
|
||||
el.form.submit();
|
||||
el.form.target = '';
|
||||
if (dbCtrl && dbPrevious != undefined) {
|
||||
el.value = dbPrevious;
|
||||
dbPrevious = undefined;
|
||||
if (dbCtrl && dbPrevious[el.name] != undefined) {
|
||||
el.value = dbPrevious[el.name];
|
||||
dbPrevious[el.name] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ function editingAddRow(button, focus) {
|
||||
var tags = row.getElementsByTagName('select');
|
||||
var tags2 = row2.getElementsByTagName('select');
|
||||
for (var i=0; i < tags.length; i++) {
|
||||
tags2[i].name = tags[i].name.replace(/([0-9.]+)/, x);
|
||||
tags2[i].name = tags[i].name.replace(/[0-9.]+/, x);
|
||||
tags2[i].selectedIndex = tags[i].selectedIndex;
|
||||
}
|
||||
tags = row.getElementsByTagName('input');
|
||||
@@ -503,7 +503,7 @@ function indexesAddColumn(field, prefix) {
|
||||
};
|
||||
var select = field.form[field.name.replace(/\].*/, '][type]')];
|
||||
if (!select.selectedIndex) {
|
||||
select.selectedIndex = 3;
|
||||
select.selectedIndex = select.options.length - 1;
|
||||
select.onchange();
|
||||
}
|
||||
var column = cloneNode(field.parentNode);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 70 B |
@@ -4,7 +4,7 @@ $fields = fields($TABLE);
|
||||
if (!$fields) {
|
||||
$error = error();
|
||||
}
|
||||
$table_status = table_status($TABLE, true);
|
||||
$table_status = table_status1($TABLE, true);
|
||||
|
||||
page_header(($fields && is_view($table_status) ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
|
||||
|
||||
@@ -35,7 +35,10 @@ if ($fields) {
|
||||
ksort($index["columns"]); // enforce correct columns order
|
||||
$print = array();
|
||||
foreach ($index["columns"] as $key => $val) {
|
||||
$print[] = "<i>" . h($val) . "</i>" . ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "");
|
||||
$print[] = "<i>" . h($val) . "</i>"
|
||||
. ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "")
|
||||
. ($index["descs"][$key] ? " DESC" : "")
|
||||
;
|
||||
}
|
||||
echo "<tr title='" . h($name) . "'><th>$index[type]<td>" . implode(", ", $print) . "\n";
|
||||
}
|
||||
|
@@ -28,12 +28,15 @@ if ($_POST && !$error) {
|
||||
}
|
||||
}
|
||||
|
||||
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
|
||||
|
||||
if (!$_POST && $TABLE != "") {
|
||||
$row = view($TABLE);
|
||||
$row["name"] = $TABLE;
|
||||
if (!$error) {
|
||||
$error = $connection->error;
|
||||
}
|
||||
}
|
||||
|
||||
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
|
18
changes.txt
18
changes.txt
@@ -1,6 +1,20 @@
|
||||
Adminer 3.7.1-dev:
|
||||
Adminer (released 2013-06-29):
|
||||
Increase click target for checkboxes
|
||||
Use shadow for highlighting default button
|
||||
Don't use LIMIT 1 if inline updating unique row
|
||||
Don't check previous checkbox on added column in create table (bug #3614245)
|
||||
Order table list by name
|
||||
Verify UTF-8 encoding of CSV import
|
||||
Notify user about expired master password for permanent login
|
||||
Highlight table being altered in navigation
|
||||
Send 404 for invalid database and schema
|
||||
Fix title and links on invalid table pages
|
||||
Display error on invalid alter table and view pages
|
||||
MySQL: Speed up updating rows without numeric or UTF-8 primary key
|
||||
Non-MySQL: Descending indexes
|
||||
PostgreSQL: Fix detecting oid column in PDO
|
||||
PostgreSQL: Handle timestamp types (bug #3614086)
|
||||
Add Korean translation
|
||||
|
||||
Adminer 3.7.0 (released 2013-05-19):
|
||||
Allow more SQL files to be uploaded at the same time
|
||||
@@ -25,7 +39,7 @@ MySQL: Fix handling of POINT data type (bug #3582578)
|
||||
MySQL: Don't export binary and geometry columns twice in select
|
||||
MySQL: Fix EXPLAIN in MySQL < 5.1, bug since Adminer 3.6.4
|
||||
SQLite: Export views
|
||||
PostgreSQL: Fix swapped NULL and NOT NULL columns in weird setups
|
||||
PostgreSQL: Fix swapped NULL and NOT NULL columns in PDO
|
||||
|
||||
Adminer 3.6.4 (released 2013-04-26):
|
||||
Display pagination on a fixed position
|
||||
|
319
designs/pappu687/adminer.css
Normal file
319
designs/pappu687/adminer.css
Normal file
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
FLAT UI Flavored Adminer Theme by M. Mahbubur Rahman (mahbub@mahbubblog.com)
|
||||
Screenshot : http://d.pr/i/cznH
|
||||
Based on work by : Lukáš Brandejs
|
||||
https://raw.github.com/vrana/adminer/master/designs/ng9/adminer.css
|
||||
*/
|
||||
|
||||
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600);
|
||||
|
||||
* {
|
||||
font: 14px/1.7 "Source Sans Pro","Droid Sans",Arial,Helvetica, sans-serif;
|
||||
color:#333333;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
a,a:visited {
|
||||
color:#2980b9;
|
||||
text-decoration:none;
|
||||
padding:3px 1px;
|
||||
}
|
||||
|
||||
#content table thead span, #content table thead a {
|
||||
font-weight:bold;
|
||||
color:black;
|
||||
}
|
||||
|
||||
#content table thead a:hover {
|
||||
background:none;
|
||||
text-decoration:underline;
|
||||
color:black;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size:1.9em;
|
||||
font-weight:normal;
|
||||
background:white;
|
||||
color:#1e5eb6;
|
||||
border-bottom:1px solid rgb(85, 112, 139);
|
||||
padding:20px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#menu h1 {
|
||||
padding:0px 0px 5px 20px;
|
||||
background:none;
|
||||
}
|
||||
|
||||
h2,h3 {
|
||||
font-size:1.7em;
|
||||
font-weight:bold;
|
||||
background:white;
|
||||
color:#34495e;
|
||||
border-bottom:1px solid #f4f4f4;
|
||||
padding:10px 0px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding:5px;
|
||||
border:1px solid #DEDEDE;
|
||||
}
|
||||
|
||||
input,select,textarea {
|
||||
border:1px solid #e5e5e5;
|
||||
margin:1px;
|
||||
padding:3px;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
color:white;
|
||||
background:#27ae60;
|
||||
padding:4px 10px;
|
||||
cursor:pointer;
|
||||
border:0px solid;
|
||||
}
|
||||
|
||||
input[type=submit]:hover{
|
||||
background:#2c3e50;
|
||||
}
|
||||
|
||||
input[type=checkbox]{
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
input[type=image] {
|
||||
border:1px solid #d0cdc4;
|
||||
}
|
||||
|
||||
input[type=checkbox],input[type=radio]{
|
||||
border:1px solid #e5e5e5;
|
||||
padding:2px 5px;
|
||||
}
|
||||
|
||||
code{
|
||||
background:#f0ffe1;
|
||||
border:1px dashed #d5f1b9;
|
||||
padding:2px 4px;
|
||||
font-family:"Monaco","Courier New";
|
||||
}
|
||||
code a:hover{background:transparent}
|
||||
|
||||
table{
|
||||
margin:10px 0px;
|
||||
border:1px solid #d0cdc4;
|
||||
border-collapse:collapse;
|
||||
}
|
||||
|
||||
tbody tr:hover td,tbody tr:hover th{
|
||||
background:#edf4ff
|
||||
}
|
||||
|
||||
thead th, thead td {
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
font-weight:bold;
|
||||
white-space:nowrap;
|
||||
background:#ecf0f1;
|
||||
color:#808080;
|
||||
}
|
||||
|
||||
th,td{
|
||||
border:1px solid #d0cdc4;
|
||||
padding:3px 6px;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
th a {
|
||||
font-weight:bold;
|
||||
padding-bottom:0px;
|
||||
}
|
||||
|
||||
th {
|
||||
background:white;
|
||||
}
|
||||
|
||||
tr.odd td {
|
||||
background:#fcfaf5;
|
||||
}
|
||||
|
||||
#content tbody tr.checked td, tr.checked.odd td {
|
||||
background:#fbe2e2;
|
||||
color:red;
|
||||
}
|
||||
|
||||
.hidden{
|
||||
display:none
|
||||
}
|
||||
|
||||
.error,.message{
|
||||
padding:0px;
|
||||
background:transparent;
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
.error{
|
||||
color:#c00
|
||||
}
|
||||
|
||||
.message{
|
||||
color:#090
|
||||
}
|
||||
|
||||
#content{
|
||||
margin:0px 0px 0px 320px;
|
||||
padding:50px 20px 40px 0px;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
#lang {
|
||||
background:#ecf0f1;
|
||||
color:#808080;
|
||||
position:fixed;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:100%;
|
||||
padding:10px 20px;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
#breadcrumb {
|
||||
position:fixed;
|
||||
top:0px;
|
||||
left:300px;
|
||||
background:#34495e;
|
||||
z-index:2;
|
||||
width:100%;
|
||||
color:#ecf0f1;
|
||||
padding:10px;
|
||||
font-size:15px;
|
||||
font-weight:bold;
|
||||
}
|
||||
#breadcrumb a{
|
||||
color:#ecf0f1;
|
||||
font-size:15px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
#menu {
|
||||
background:#34495e;
|
||||
position:fixed;
|
||||
top:-10px;
|
||||
color:#FFF;
|
||||
padding:20px;
|
||||
padding-top:40px;
|
||||
bottom:0px;
|
||||
overflow:auto;
|
||||
left:0px;
|
||||
width:240px;
|
||||
border-right:5px solid #34495e;
|
||||
}
|
||||
|
||||
#menu p{
|
||||
border-bottom:1px solid rgb(85, 112, 139);
|
||||
}
|
||||
|
||||
#menu a{
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
#schema .table {
|
||||
padding:5px;
|
||||
background:#fcfaf5;
|
||||
border:1px solid #d0cdc4;
|
||||
}
|
||||
|
||||
#schema .table b {
|
||||
color:#006aeb;
|
||||
font-weight:bold;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#schema .table b:hover {
|
||||
color:white;
|
||||
}
|
||||
|
||||
input[name=logout] {
|
||||
color:#fce2e2;
|
||||
background:#d73e3e;
|
||||
}
|
||||
|
||||
input[name=drop] {
|
||||
background-color:#c0392b;
|
||||
}
|
||||
|
||||
input[name=logout]:hover {
|
||||
background:#ea0202;
|
||||
}
|
||||
|
||||
#logins a, #tables a {
|
||||
background:none;
|
||||
}
|
||||
|
||||
#logins a:hover, #tables a:hover {
|
||||
|
||||
}
|
||||
|
||||
#logout {
|
||||
color:#FFF;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#logout:hover {
|
||||
color:red;
|
||||
}
|
||||
|
||||
.js .column {
|
||||
background:#ecf0f1;
|
||||
}
|
||||
|
||||
#content table thead a.text:hover {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#version, .version {
|
||||
font-size:50%;
|
||||
}
|
||||
|
||||
#h1:hover {
|
||||
color:white;
|
||||
}
|
||||
|
||||
|
||||
input[type=submit] {
|
||||
font-size:13px;
|
||||
font-weight:normal;
|
||||
-moz-border-radius:2px;
|
||||
-webkit-border-radius:2px;
|
||||
border-radius:2px;
|
||||
border:0px solid #469df5;
|
||||
padding:3px 10px;
|
||||
text-decoration:none;
|
||||
background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #63b8ee), color-stop(100%, #468ccf) );
|
||||
background:-moz-linear-gradient( center top, #63b8ee 5%, #468ccf 100% );
|
||||
background:-ms-linear-gradient( top, #63b8ee 5%, #468ccf 100% );
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#63b8ee', endColorstr='#468ccf');
|
||||
background-color:#63b8ee;
|
||||
color:#ffffff;
|
||||
display:inline-block;
|
||||
text-shadow:1px 1px 0px #287ace;
|
||||
-webkit-box-shadow:inset 0px 0px 0px 0px #cae3fc;
|
||||
-moz-box-shadow:inset 0px 0px 0px 0px #cae3fc;
|
||||
box-shadow:inset 0px 0px 0px 0px #cae3fc;
|
||||
}
|
||||
input[type=submit]:hover {
|
||||
background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #4197ee), color-stop(100%, #79bbff) );
|
||||
background:-moz-linear-gradient( center top, #4197ee 5%, #79bbff 100% );
|
||||
background:-ms-linear-gradient( top, #4197ee 5%, #79bbff 100% );
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4197ee', endColorstr='#79bbff');
|
||||
background-color:#4197ee;
|
||||
}
|
||||
input[type=submit]:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
@@ -13,17 +13,19 @@ class Adminer {
|
||||
return array(SERVER, $_GET["username"], get_session("pwds"));
|
||||
}
|
||||
|
||||
function permanentLogin() {
|
||||
return password_file();
|
||||
function permanentLogin($create = false) {
|
||||
return password_file($create);
|
||||
}
|
||||
|
||||
function database() {
|
||||
global $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
|
||||
);
|
||||
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 databases($flush = true) {
|
||||
@@ -143,7 +145,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
// find all used ids
|
||||
$ids = array();
|
||||
foreach ($rows as $row) {
|
||||
$ids[$row[$key]] = exact_value($row[$key]);
|
||||
$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];
|
||||
@@ -355,6 +357,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
}
|
||||
foreach (($index_order != "" ? array($indexes[$index_order]) : $indexes) as $index) {
|
||||
if ($index_order != "" || $index["type"] == "INDEX") {
|
||||
$has_desc = array_filter($index["descs"]);
|
||||
$desc = false;
|
||||
foreach ($index["columns"] as $val) {
|
||||
if (ereg('date|timestamp', $fields[$val]["type"])) {
|
||||
@@ -363,8 +366,8 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
}
|
||||
}
|
||||
$return = array();
|
||||
foreach ($index["columns"] as $val) {
|
||||
$return[] = idf_escape($val) . ($desc ? " DESC" : "");
|
||||
foreach ($index["columns"] as $key => $val) {
|
||||
$return[] = idf_escape($val) . (($has_desc ? $index["descs"][$key] : $desc) ? " DESC" : "");
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@@ -580,7 +583,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
foreach ($tables as $row) {
|
||||
$name = $this->tableName($row);
|
||||
if (isset($row["Engine"]) && $name != "") { // ignore views and tables without name
|
||||
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'" . bold($_GET["select"] == $row["Name"]) . " title='" . lang('Select data') . "'>$name</a><br>\n";
|
||||
echo "<a href='" . h(ME) . 'select=' . urlencode($row["Name"]) . "'" . bold($_GET["select"] == $row["Name"] || $_GET["edit"] == $row["Name"]) . " title='" . lang('Select data') . "'>$name</a><br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,11 +3,12 @@ if ($_GET["script"] == "kill") {
|
||||
$connection->query("KILL " . (+$_POST["kill"]));
|
||||
|
||||
} elseif (list($table, $id, $name) = $adminer->_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) {
|
||||
$result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE " . (ereg('^[0-9]+$', $_GET["value"]) ? "$id = $_GET[value] OR " : "") . "$name LIKE " . q("$_GET[value]%") . " ORDER BY 2 LIMIT 11");
|
||||
for ($i=0; $i < 10 && ($row = $result->fetch_row()); $i++) {
|
||||
$limit = 11;
|
||||
$result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE " . (ereg('^[0-9]+$', $_GET["value"]) ? "$id = $_GET[value] OR " : "") . "$name LIKE " . q("$_GET[value]%") . " ORDER BY 2 LIMIT $limit");
|
||||
for ($i=1; ($row = $result->fetch_row()) && $i < $limit; $i++) {
|
||||
echo "<a href='" . h(ME . "edit=" . urlencode($table) . "&where" . urlencode("[" . bracket_escape(idf_unescape($id)) . "]") . "=" . urlencode($row[0])) . "'>" . h($row[1]) . "</a><br>\n";
|
||||
}
|
||||
if ($i == 10) {
|
||||
if ($row) {
|
||||
echo "...\n";
|
||||
}
|
||||
}
|
||||
|
41
plugins/dump-bz2.php
Normal file
41
plugins/dump-bz2.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/** Dump to Bzip2 format
|
||||
* @link http://www.adminer.org/plugins/#use
|
||||
* @uses bzopen(), tempnam("")
|
||||
* @author Jakub Vrana, http://www.vrana.cz/
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||
*/
|
||||
class AdminerDumpBz2 {
|
||||
/** @access protected */
|
||||
var $filename, $fp;
|
||||
|
||||
function dumpOutput() {
|
||||
if (!function_exists('bzopen')) {
|
||||
return array();
|
||||
}
|
||||
return array('bz2' => 'bzip2');
|
||||
}
|
||||
|
||||
function _bz2($string, $state) {
|
||||
bzwrite($this->fp, $string);
|
||||
if ($state & PHP_OUTPUT_HANDLER_END) {
|
||||
bzclose($this->fp);
|
||||
$return = file_get_contents($this->filename);
|
||||
unlink($this->filename);
|
||||
return $return;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function dumpHeaders($identifier, $multi_table = false) {
|
||||
if ($_POST["output"] == "bz2") {
|
||||
$this->filename = tempnam("", "bz2");
|
||||
$this->fp = bzopen($this->filename, 'w');
|
||||
header("Content-Type: application/x-bzip");
|
||||
ob_start(array($this, '_bz2'), 1e6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -35,8 +35,8 @@ class AdminerDumpZip {
|
||||
}
|
||||
|
||||
function dumpHeaders($identifier, $multi_table = false) {
|
||||
$this->filename = "$identifier." . ($multi_table && ereg("[ct]sv", $_POST["format"]) ? "tar" : $_POST["format"]);
|
||||
if ($_POST["output"] == "zip") {
|
||||
$this->filename = "$identifier." . ($multi_table && ereg("[ct]sv", $_POST["format"]) ? "tar" : $_POST["format"]);
|
||||
header("Content-Type: application/zip");
|
||||
ob_start(array($this, '_zip'));
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>checkbox-3</td>
|
||||
<td>name=comments</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@@ -68,7 +68,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>click</td>
|
||||
<td>checkbox-3</td>
|
||||
<td>name=comments</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user