1
0
mirror of https://github.com/vrana/adminer.git synced 2025-09-09 13:50:49 +02:00

Compare commits

...

25 Commits

Author SHA1 Message Date
Jakub Vrana
38f4735758 Release 4.0.3 2014-02-01 10:18:49 -08:00
Jakub Vrana
6acf188c2f Don't store invalid credentials to session (bug #376) 2014-01-30 10:28:05 -08:00
Jakub Vrana
125b519937 Fix All checkbox in Opera (bug #374) 2014-01-30 10:06:43 -08:00
Jakub Vrana
d5a2afeef7 SQLite: Fix creating table and altering primary key (bug #373) 2014-01-30 09:39:15 -08:00
Jakub Vrana
147957cef7 Activate JUSH before loading databases 2014-01-30 09:06:58 -08:00
Jakub Vrana
adae922f36 Defer loading of JUSH 2014-01-30 08:27:56 -08:00
Jakub Vrana
81037ca4fb Fix zh-tw translation (bug #375) 2014-01-25 11:18:56 -08:00
Jakub Vrana
7e9725782d Norweigan translation 2014-01-25 10:58:54 -08:00
Jakub Vrana
32d542b633 MongoDB, Elasticsearch: Allow removing field in multi-edit 2014-01-15 08:36:38 -08:00
Jakub Vrana
bb7331e6a0 MongoDB, Elasticsearch: Allow downloading binary data 2014-01-15 08:26:47 -08:00
Jakub Vrana
60c8ec61e3 Make select(..., , , ) optional 2014-01-15 08:23:26 -08:00
Jakub Vrana
e9b5616657 MySQLi: Print error for editing invalid row 2014-01-13 21:24:55 -08:00
Tomas Lang
24eb008794 Elasticsearch: rootQuery() method for ES driver 2014-01-12 21:58:06 -08:00
Jakub Vrana
9edfe6d1ff MongoDB: Alter indexes 2014-01-11 21:08:57 -08:00
Jakub Vrana
91bb94eda6 MongoDB: Prepare for alter index 2014-01-11 19:22:44 -08:00
Jakub Vrana
63a04ff753 MongoDB: alter indexes form 2014-01-11 19:15:21 -08:00
Jakub Vrana
c106cf2a34 Use JUSH only with supported drivers 2014-01-11 18:45:05 -08:00
Jakub Vrana
5136b62e84 MongoDB: truncate 2014-01-11 18:29:47 -08:00
Jakub Vrana
ed13006512 MongoDB: Don't store unset values 2014-01-11 17:37:01 -08:00
Jakub Vrana
9824540ed8 MongoDB: auto_increment 2014-01-11 17:27:04 -08:00
Jakub Vrana
48848de529 SimpleDB, MongoDB: insert more fields at once 2014-01-11 15:46:30 -08:00
Jakub Vrana
2a9a50553b MongoDB: insert 2014-01-11 15:44:03 -08:00
Jakub Vrana
4bab88a1a0 MongoDB: Fix insert form with empty table 2014-01-11 15:16:26 -08:00
Jakub Vrana
f301fc2dcd Allow \r after -- comment 2014-01-11 12:22:54 -08:00
Jakub Vrana
b99148daeb Show only errors by default in import 2014-01-11 12:17:25 -08:00
28 changed files with 534 additions and 111 deletions

View File

@@ -123,7 +123,7 @@ if ($adminer->homepage()) {
. "<input type='submit' name='check' value='" . lang('Check') . "'" . on_help("'CHECK TABLE'") . "> " . "<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='repair' value='" . lang('Repair') . "'" . on_help("'REPAIR TABLE'") . "> "
: ""))) : "")))
. (support("table") ? "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . on_help($jush == "sqlite" ? "'DELETE'" : "'TRUNCATE" . ($jush == "pgsql" ? "'" : " 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"; . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . on_help("'DROP TABLE'") . ">\n";
$databases = (support("scheme") ? $adminer->schemas() : $adminer->databases()); $databases = (support("scheme") ? $adminer->schemas() : $adminer->databases());
if (count($databases) != 1 && $jush != "sqlite") { if (count($databases) != 1 && $jush != "sqlite") {

View File

@@ -3,5 +3,8 @@ $TABLE = $_GET["download"];
$fields = fields($TABLE); $fields = fields($TABLE);
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . friendly_url("$TABLE-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"])); header("Content-Disposition: attachment; filename=" . friendly_url("$TABLE-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"]));
echo $connection->result("SELECT" . limit(idf_escape($_GET["field"]) . " FROM " . table($TABLE), " WHERE " . where($_GET, $fields), 1)); $select = array(idf_escape($_GET["field"]));
$result = $driver->select($TABLE, $select, array(where($_GET, $fields)), $select);
$row = ($result ? $result->fetch_row() : array());
echo $row[0];
exit; // don't output footer exit; // don't output footer

View File

@@ -9,9 +9,15 @@ if (isset($_GET["elastic"])) {
class Min_DB { class Min_DB {
var $extension = "JSON", $server_info, $errno, $error, $_url; var $extension = "JSON", $server_info, $errno, $error, $_url;
function query($path, $content = array(), $method = 'GET') { /** Performs query
* @param string
* @param array
* @param string
* @return mixed
*/
function rootQuery($path, $content = array(), $method = 'GET') {
@ini_set('track_errors', 1); // @ - may be disabled @ini_set('track_errors', 1); // @ - may be disabled
$file = @file_get_contents($this->_url . ($this->_db != "" ? "$this->_db/" : "") . $path, false, stream_context_create(array('http' => array( $file = @file_get_contents($this->_url . '/' . ltrim($path, '/'), false, stream_context_create(array('http' => array(
'method' => $method, 'method' => $method,
'content' => json_encode($content), 'content' => json_encode($content),
'ignore_errors' => 1, // available since PHP 5.2.10 'ignore_errors' => 1, // available since PHP 5.2.10
@@ -42,6 +48,16 @@ if (isset($_GET["elastic"])) {
return $return; return $return;
} }
/** Performs query relative to actual selected DB
* @param string
* @param array
* @param string
* @return mixed
*/
function query($path, $content = array(), $method = 'GET') {
return $this->rootQuery(($this->_db != "" ? "$this->_db/" : "/") . ltrim($path, '/'), $content, $method);
}
function connect($server, $username, $password) { function connect($server, $username, $password) {
$this->_url = "http://$username:$password@$server/"; $this->_url = "http://$username:$password@$server/";
$return = $this->query(''); $return = $this->query('');
@@ -89,7 +105,7 @@ if (isset($_GET["elastic"])) {
class Min_Driver extends Min_SQL { class Min_Driver extends Min_SQL {
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) { function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
global $adminer; global $adminer;
$data = array(); $data = array();
$query = "$table/_search"; $query = "$table/_search";
@@ -174,7 +190,7 @@ if (isset($_GET["elastic"])) {
function get_databases() { function get_databases() {
global $connection; global $connection;
$return = $connection->query('_aliases'); $return = $connection->rootQuery('_aliases');
if ($return) { if ($return) {
$return = array_keys($return); $return = array_keys($return);
} }
@@ -285,7 +301,7 @@ if (isset($_GET["elastic"])) {
*/ */
function create_database($db) { function create_database($db) {
global $connection; global $connection;
return $connection->query(urlencode($db), array(), 'PUT'); return $connection->rootQuery(urlencode($db), array(), 'PUT');
} }
/** Drop databases /** Drop databases
@@ -294,7 +310,7 @@ if (isset($_GET["elastic"])) {
*/ */
function drop_databases($databases) { function drop_databases($databases) {
global $connection; global $connection;
return $connection->query(urlencode(implode(',', $databases)), array(), 'DELETE'); return $connection->rootQuery(urlencode(implode(',', $databases)), array(), 'DELETE');
} }
/** Drop tables /** Drop tables

View File

@@ -7,7 +7,7 @@ if (isset($_GET["mongo"])) {
if (class_exists('MongoDB')) { if (class_exists('MongoDB')) {
class Min_DB { class Min_DB {
var $extension = "Mongo", $error, $_link, $_db; var $extension = "Mongo", $error, $last_id, $_link, $_db;
function connect($server, $username, $password) { function connect($server, $username, $password) {
global $adminer; global $adminer;
@@ -114,7 +114,13 @@ if (isset($_GET["mongo"])) {
class Min_Driver extends Min_SQL { class Min_Driver extends Min_SQL {
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) { public $primary = "_id";
function quote($value) {
return ($value === null ? $value : parent::quote($value));
}
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
$select = ($select == array("*") $select = ($select == array("*")
? array() ? array()
: array_fill_keys($select, true) : array_fill_keys($select, true)
@@ -137,6 +143,7 @@ if (isset($_GET["mongo"])) {
$return = $this->_conn->_db->selectCollection($table)->insert($set); $return = $this->_conn->_db->selectCollection($table)->insert($set);
$this->_conn->errno = $return['code']; $this->_conn->errno = $return['code'];
$this->_conn->error = $return['err']; $this->_conn->error = $return['err'];
$this->_conn->last_id = $set['_id'];
return !$return['err']; return !$return['err'];
} catch (Exception $ex) { } catch (Exception $ex) {
$this->_conn->error = $ex->getMessage(); $this->_conn->error = $ex->getMessage();
@@ -238,6 +245,7 @@ if (isset($_GET["mongo"])) {
$return[$index["name"]] = array( $return[$index["name"]] = array(
"type" => ($index["name"] == "_id_" ? "PRIMARY" : ($index["unique"] ? "UNIQUE" : "INDEX")), "type" => ($index["name"] == "_id_" ? "PRIMARY" : ($index["unique"] ? "UNIQUE" : "INDEX")),
"columns" => array_keys($index["key"]), "columns" => array_keys($index["key"]),
"lengths" => array(),
"descs" => $descs, "descs" => $descs,
); );
} }
@@ -245,7 +253,7 @@ if (isset($_GET["mongo"])) {
} }
function fields($table) { function fields($table) {
return array(); return fields_from_edit();
} }
function convert_field($field) { function convert_field($field) {
@@ -302,6 +310,37 @@ if (isset($_GET["mongo"])) {
return true; return true;
} }
function alter_indexes($table, $alter) {
global $connection;
foreach ($alter as $val) {
list($type, $name, $set) = $val;
if ($set == "DROP") {
$return = $connection->_db->command(array("deleteIndexes" => $table, "index" => $name));
} else {
$columns = array();
foreach ($set as $column) {
$column = preg_replace('~ DESC$~', '', $column, 1, $count);
$columns[$column] = ($count ? -1 : 1);
}
$return = $connection->_db->selectCollection($table)->ensureIndex($columns, array(
"unique" => ($type == "UNIQUE"),
"name" => $name,
//! "sparse"
));
}
if ($return['errmsg']) {
$connection->error = $return['errmsg'];
return false;
}
}
return true;
}
function last_id() {
global $connection;
return $connection->last_id;
}
function table($idf) { function table($idf) {
return $idf; return $idf;
} }

View File

@@ -480,7 +480,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table)
} elseif (!queries(($val[0] != "PRIMARY" } elseif (!queries(($val[0] != "PRIMARY"
? "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) ? "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table)
: "ALTER TABLE " . table($table) . " ADD PRIMARY KEY" : "ALTER TABLE " . table($table) . " ADD PRIMARY KEY"
) . " $val[2]")) { ) . " (" . implode(", ", $val[2]) . ")")) {
return false; return false;
} }
} }

View File

@@ -672,14 +672,14 @@ if (!defined("DRIVER")) {
/** Run commands to alter indexes /** Run commands to alter indexes
* @param string escaped table name * @param string escaped table name
* @param array of array("index type", "name", "(columns definition)") or array("index type", "name", "DROP") * @param array of array("index type", "name", array("column definition", ...)) or array("index type", "name", "DROP")
* @return bool * @return bool
*/ */
function alter_indexes($table, $alter) { function alter_indexes($table, $alter) {
foreach ($alter as $key => $val) { foreach ($alter as $key => $val) {
$alter[$key] = ($val[2] == "DROP" $alter[$key] = ($val[2] == "DROP"
? "\nDROP INDEX " . idf_escape($val[1]) ? "\nDROP INDEX " . idf_escape($val[1])
: "\nADD $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . ($val[1] != "" ? idf_escape($val[1]) . " " : "") . $val[2] : "\nADD $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . ($val[1] != "" ? idf_escape($val[1]) . " " : "") . "(" . implode(", ", $val[2]) . ")"
); );
} }
return queries("ALTER TABLE " . table($table) . implode(",", $alter)); return queries("ALTER TABLE " . table($table) . implode(",", $alter));

View File

@@ -439,12 +439,12 @@ ORDER BY conkey, conname") as $row) {
//! descending UNIQUE indexes results in syntax error //! descending UNIQUE indexes results in syntax error
$create[] = ($val[2] == "DROP" $create[] = ($val[2] == "DROP"
? "\nDROP CONSTRAINT " . idf_escape($val[1]) ? "\nDROP CONSTRAINT " . idf_escape($val[1])
: "\nADD" . ($val[1] != "" ? " CONSTRAINT " . idf_escape($val[1]) : "") . " $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . $val[2] : "\nADD" . ($val[1] != "" ? " CONSTRAINT " . idf_escape($val[1]) : "") . " $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . "(" . implode(", ", $val[2]) . ")"
); );
} elseif ($val[2] == "DROP") { } elseif ($val[2] == "DROP") {
$drop[] = idf_escape($val[1]); $drop[] = idf_escape($val[1]);
} else { } else {
$queries[] = "CREATE INDEX " . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) . " $val[2]"; $queries[] = "CREATE INDEX " . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) . " (" . implode(", ", $val[2]) . ")";
} }
} }
if ($create) { if ($create) {

View File

@@ -118,6 +118,7 @@ if (isset($_GET["simpledb"])) {
class Min_Driver extends Min_SQL { class Min_Driver extends Min_SQL {
public $primary = "itemName()";
function _chunkRequest($ids, $action, $params, $expand = array()) { function _chunkRequest($ids, $action, $params, $expand = array()) {
global $connection; global $connection;
@@ -149,7 +150,7 @@ if (isset($_GET["simpledb"])) {
return $return; return $return;
} }
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) { function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
global $connection; global $connection;
$connection->next = $_GET["next"]; $connection->next = $_GET["next"];
$return = parent::select($table, $select, $where, $group, $order, $limit, $page, $print); $return = parent::select($table, $select, $where, $group, $order, $limit, $page, $print);
@@ -323,19 +324,7 @@ if (isset($_GET["simpledb"])) {
} }
function fields($table) { function fields($table) {
$return = array(); return fields_from_edit();
foreach ((array) $_POST["field_keys"] as $key => $val) {
if ($val != "") {
$val = bracket_escape($val);
$_POST["function"][$val] = $_POST["field_funs"][$key];
$_POST["fields"][$val] = $_POST["field_vals"][$key];
}
}
foreach ((array) $_POST["fields"] as $key => $val) {
$name = bracket_escape($key, 1); // 1 - back
$return[$name] = array("field" => $name, "privileges" => array("insert" => 1, "update" => 1), "null" => 1);
}
return $return;
} }
function foreign_keys($table) { function foreign_keys($table) {

View File

@@ -497,7 +497,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
function recreate_table($table, $name, $fields, $originals, $foreign, $indexes = array()) { function recreate_table($table, $name, $fields, $originals, $foreign, $indexes = array()) {
queries("BEGIN");
if ($table != "") { if ($table != "") {
if (!$fields) { if (!$fields) {
foreach (fields($table) as $key => $field) { foreach (fields($table) as $key => $field) {
@@ -506,11 +505,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
} }
$primary_key = false; $primary_key = false;
foreach ($fields as $key => $field) { foreach ($fields as $field) {
if ($field[6]) { if ($field[6]) {
$primary_key = true; $primary_key = true;
} }
$fields[$key] = " " . implode($field);
} }
$drop_indexes = array(); $drop_indexes = array();
foreach ($indexes as $key => $val) { foreach ($indexes as $key => $val) {
@@ -527,7 +525,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
} }
$columns[] = $originals[$column] . ($index["descs"][$key] ? " DESC" : ""); $columns[] = $originals[$column] . ($index["descs"][$key] ? " DESC" : "");
} }
$columns = "(" . implode(", ", $columns) . ")";
if (!$drop_indexes[$key_name]) { if (!$drop_indexes[$key_name]) {
if ($index["type"] != "PRIMARY" || !$primary_key) { if ($index["type"] != "PRIMARY" || !$primary_key) {
$indexes[] = array($index["type"], $key_name, $columns); $indexes[] = array($index["type"], $key_name, $columns);
@@ -537,7 +534,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
foreach ($indexes as $key => $val) { foreach ($indexes as $key => $val) {
if ($val[0] == "PRIMARY") { if ($val[0] == "PRIMARY") {
unset($indexes[$key]); unset($indexes[$key]);
$foreign[] = " PRIMARY KEY $val[2]"; $foreign[] = " PRIMARY KEY (" . implode(", ", $val[2]) . ")";
} }
} }
foreach (foreign_keys($table) as $key_name => $foreign_key) { foreach (foreign_keys($table) as $key_name => $foreign_key) {
@@ -551,6 +548,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
$foreign[] = " " . format_foreign_key($foreign_key); $foreign[] = " " . format_foreign_key($foreign_key);
} }
} }
queries("BEGIN");
}
foreach ($fields as $key => $field) {
$fields[$key] = " " . implode($field);
} }
$fields = array_merge($fields, array_filter($foreign)); $fields = array_merge($fields, array_filter($foreign));
if (!queries("CREATE TABLE " . table($table != "" ? "adminer_$name" : $name) . " (\n" . implode(",\n", $fields) . "\n)")) { if (!queries("CREATE TABLE " . table($table != "" ? "adminer_$name" : $name) . " (\n" . implode(",\n", $fields) . "\n)")) {
@@ -600,7 +601,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
foreach (array_reverse($alter) as $val) { foreach (array_reverse($alter) as $val) {
if (!queries($val[2] == "DROP" if (!queries($val[2] == "DROP"
? "DROP INDEX " . idf_escape($val[1]) ? "DROP INDEX " . idf_escape($val[1])
: index_sql($table, $val[0], $val[1], $val[2]) : index_sql($table, $val[0], $val[1], "(" . implode(", ", $val[2]) . ")")
)) { )) {
return false; return false;
} }

View File

@@ -89,8 +89,11 @@ if ($_POST["save"]) {
$select = array("*"); $select = array("*");
} }
if ($select) { if ($select) {
$result = $driver->select($TABLE, $select, array($where), $select, array(), (isset($_GET["select"]) ? 2 : 1), 0); $result = $driver->select($TABLE, $select, array($where), $select, array(), (isset($_GET["select"]) ? 2 : 1));
$row = $result->fetch_assoc(); $row = $result->fetch_assoc();
if (!$row) { // MySQLi returns null
$row = false;
}
if (isset($_GET["select"]) && (!$row || $result->fetch_assoc())) { // $result->num_rows != 1 isn't available in all drivers if (isset($_GET["select"]) && (!$row || $result->fetch_assoc())) { // $result->num_rows != 1 isn't available in all drivers
$row = null; $row = null;
} }
@@ -98,17 +101,19 @@ if ($_POST["save"]) {
} }
if (!support("table") && !$fields) { if (!support("table") && !$fields) {
$id = ($jush == "mongo" ? "_id" : "itemName()"); // simpledb
if (!$where) { // insert if (!$where) { // insert
$row = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0); $result = $driver->select($TABLE, array("*"), $where, array("*"));
$row = ($row ? $row->fetch_assoc() : array($id => "")); $row = ($result ? $result->fetch_assoc() : false);
if (!$row) {
$row = array($driver->primary => "");
}
} }
if ($row) { if ($row) {
foreach ($row as $key => $val) { foreach ($row as $key => $val) {
if (!$where) { if (!$where) {
$row[$key] = null; $row[$key] = null;
} }
$fields[$key] = array("field" => $key, "null" => ($key != $id), "auto_increment" => ($key == $id)); $fields[$key] = array("field" => $key, "null" => ($key != $driver->primary), "auto_increment" => ($key == $driver->primary));
} }
} }
} }
@@ -160,9 +165,9 @@ if (!$fields) {
if (!support("table")) { if (!support("table")) {
echo "<tr>" echo "<tr>"
. "<th><input name='field_keys[]' value='" . h($_POST["field_keys"][0]) . "'>" . "<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>" // needs empty value for keyupChange()
. "<td class='function'>" . html_select("field_funs[]", $adminer->editFunctions(array()), $_POST["field_funs"][0]) . "<td class='function'>" . html_select("field_funs[]", $adminer->editFunctions(array("null" => isset($_GET["select"]))))
. "<td><input name='field_vals[]' value='" . h($_POST["field_vals"][0]) . "'>" . "<td><input name='field_vals[]'>"
. "\n" . "\n"
; ;
} }

View File

@@ -15,7 +15,10 @@ if ($_GET["file"] == "favicon.ico") {
echo lzw_decompress(compile_file('../adminer/static/default.css;../externals/jush/jush.css', 'minify_css')); echo lzw_decompress(compile_file('../adminer/static/default.css;../externals/jush/jush.css', 'minify_css'));
} elseif ($_GET["file"] == "functions.js") { } elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8"); header("Content-Type: text/javascript; charset=utf-8");
echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js;../externals/jush/modules/jush.js;../externals/jush/modules/jush-textarea.js;../externals/jush/modules/jush-txt.js;../externals/jush/modules/jush-sql.js;../externals/jush/modules/jush-pgsql.js;../externals/jush/modules/jush-sqlite.js;../externals/jush/modules/jush-mssql.js;../externals/jush/modules/jush-oracle.js;../externals/jush/modules/jush-simpledb.js', 'minify_js')); echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js', 'minify_js'));
} elseif ($_GET["file"] == "jush.js") {
header("Content-Type: text/javascript; charset=utf-8");
echo lzw_decompress(compile_file('../externals/jush/modules/jush.js;../externals/jush/modules/jush-textarea.js;../externals/jush/modules/jush-txt.js;../externals/jush/modules/jush-sql.js;../externals/jush/modules/jush-pgsql.js;../externals/jush/modules/jush-sqlite.js;../externals/jush/modules/jush-mssql.js;../externals/jush/modules/jush-oracle.js;../externals/jush/modules/jush-simpledb.js', 'minify_js'));
} else { } else {
header("Content-Type: image/gif"); header("Content-Type: image/gif");
switch ($_GET["file"]) { switch ($_GET["file"]) {

View File

@@ -68,13 +68,8 @@ class Adminer {
* @return bool true to link adminer.css if exists * @return bool true to link adminer.css if exists
*/ */
function head() { function head() {
global $jush;
?> ?>
<link rel="stylesheet" type="text/css" href="../externals/jush/jush.css"> <link rel="stylesheet" type="text/css" href="../externals/jush/jush.css">
<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>
<?php <?php
return true; return true;
} }
@@ -766,7 +761,7 @@ username.form['auth[driver]'].onchange();
* @return null * @return null
*/ */
function navigation($missing) { function navigation($missing) {
global $VERSION, $jush, $drivers; global $VERSION, $jush, $drivers, $connection;
?> ?>
<h1> <h1>
<?php echo $this->name(); ?> <span class="version"><?php echo $VERSION; ?></span> <?php echo $this->name(); ?> <span class="version"><?php echo $VERSION; ?></span>
@@ -792,6 +787,33 @@ username.form['auth[driver]'].onchange();
} }
} }
} else { } else {
if ($_GET["ns"] !== "" && !$missing && DB != "") {
$connection->select_db(DB);
$tables = table_status('', true);
}
if (support("sql")) {
?>
<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>
<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>
<script type="text/javascript">
<?php
if ($tables) {
$links = array();
foreach ($tables as $table => $type) {
$links[] = preg_quote($table, '/');
}
echo "var jushLinks = { $jush: [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
echo "jushLinks.$val = jushLinks.$jush;\n";
}
}
?>
bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');
</script>
<?php
}
$this->databasesPrint($missing); $this->databasesPrint($missing);
if (DB == "" || !$missing) { if (DB == "" || !$missing) {
echo "<p class='links'>" . (support("sql") ? "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>\n<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>\n" : "") . ""; echo "<p class='links'>" . (support("sql") ? "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>\n<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>\n" : "") . "";
@@ -801,22 +823,10 @@ username.form['auth[driver]'].onchange();
} }
if ($_GET["ns"] !== "" && !$missing && DB != "") { if ($_GET["ns"] !== "" && !$missing && DB != "") {
echo '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>\n"; echo '<a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create table') . "</a>\n";
$tables = table_status('', true);
if (!$tables) { if (!$tables) {
echo "<p class='message'>" . lang('No tables.') . "\n"; echo "<p class='message'>" . lang('No tables.') . "\n";
} else { } else {
$this->tablesPrint($tables); $this->tablesPrint($tables);
$links = array();
foreach ($tables as $table => $type) {
$links[] = preg_quote($table, '/');
}
echo "<script type='text/javascript'>\n";
echo "var jushLang = '$jush';\n";
echo "var jushLinks = { $jush: [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
echo "jushLinks.$val = jushLinks.$jush;\n";
}
echo "</script>\n";
} }
} }
} }

View File

@@ -109,7 +109,7 @@ function auth_error($exception = null) {
} }
function set_password($vendor, $server, $username, $password) { function set_password($vendor, $server, $username, $password) {
$_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] $_SESSION["pwds"][$vendor][$server][$username] = ($_COOKIE["adminer_key"] && is_string($password)
? array(encrypt_string($password, $_COOKIE["adminer_key"])) ? array(encrypt_string($password, $_COOKIE["adminer_key"]))
: $password : $password
); );

View File

@@ -7,7 +7,7 @@
* @return null * @return null
*/ */
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
global $LANG, $VERSION, $adminer, $connection, $drivers, $jush; global $LANG, $VERSION, $adminer, $drivers, $jush;
page_headers(); page_headers();
$title_all = $title . ($title2 != "" ? ": $title2" : ""); $title_all = $title . ($title2 != "" ? ": $title2" : "");
$title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name()); $title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
@@ -29,7 +29,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion('$VERSION');"); ?>"> <body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);"<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " onload=\"verifyVersion('$VERSION');\""); ?>>
<script type="text/javascript"> <script type="text/javascript">
document.body.className = document.body.className.replace(/ nojs/, ' js'); document.body.className = document.body.className.replace(/ nojs/, ' js');
</script> </script>

View File

@@ -10,6 +10,14 @@
$this->_conn = $connection; $this->_conn = $connection;
} }
/** Quote a SQL string or null value
* @param string
* @return string
*/
function quote($value) {
return ($value === null ? "NULL" : $this->_conn->quote($value));
}
/** Select data from table /** Select data from table
* @param string * @param string
* @param array result of $adminer->selectColumnsProcess()[0] * @param array result of $adminer->selectColumnsProcess()[0]
@@ -21,7 +29,7 @@
* @param bool whether to print the query * @param bool whether to print the query
* @return Min_Result * @return Min_Result
*/ */
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) { function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
global $adminer, $jush; global $adminer, $jush;
$is_group = (count($group) < count($select)); $is_group = (count($group) < count($select));
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page); $query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);

View File

@@ -159,7 +159,7 @@ function html_select($name, $options, $value = "", $onchange = true) {
function select_input($attrs, $options, $value = "", $placeholder = "") { function select_input($attrs, $options, $value = "", $placeholder = "") {
return ($options return ($options
? "<select$attrs><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>" ? "<select$attrs><option value=''>$placeholder" . optionlist($options, $value, true) . "</select>"
: "<input$attrs value='" . h($value) . "' placeholder='$placeholder'>" : "<input$attrs size='10' value='" . h($value) . "' placeholder='$placeholder'>"
); );
} }
@@ -249,13 +249,13 @@ function sid() {
return $return; return $return;
} }
/** Shortcut for $connection->quote($string) /** Shortcut for $driver->quote($string)
* @param string * @param string
* @return string * @return string
*/ */
function q($string) { function q($string) {
global $connection; global $driver;
return $connection->quote($string); return $driver->quote($string);
} }
/** Get list of values from database /** Get list of values from database
@@ -880,7 +880,7 @@ function process_input($field) {
return ($field["on_update"] == "CURRENT_TIMESTAMP" ? idf_escape($field["field"]) : false); return ($field["on_update"] == "CURRENT_TIMESTAMP" ? idf_escape($field["field"]) : false);
} }
if ($function == "NULL") { if ($function == "NULL") {
return "NULL"; $value = null;
} }
if ($field["type"] == "set") { if ($field["type"] == "set") {
return array_sum((array) $value); return array_sum((array) $value);
@@ -903,6 +903,31 @@ function process_input($field) {
return $adminer->processInput($field, $value, $function); return $adminer->processInput($field, $value, $function);
} }
/** Compute fields() from $_POST edit data
* @return array
*/
function fields_from_edit() {
global $driver;
$return = array();
foreach ((array) $_POST["field_keys"] as $key => $val) {
if ($val != "") {
$val = bracket_escape($val);
$_POST["function"][$val] = $_POST["field_funs"][$key];
$_POST["fields"][$val] = $_POST["field_vals"][$key];
}
}
foreach ((array) $_POST["fields"] as $key => $val) {
$name = bracket_escape($key, 1); // 1 - back
$return[$name] = array(
"field" => $name,
"privileges" => array("insert" => 1, "update" => 1),
"null" => 1,
"auto_increment" => ($key == $driver->primary),
);
}
return $return;
}
/** Print results of search in all tables /** Print results of search in all tables
* @uses $_GET["where"][0] * @uses $_GET["where"][0]
* @uses $_POST["tables"] * @uses $_POST["tables"]

View File

@@ -33,6 +33,7 @@ $langs = array(
'uk' => 'Українська', // Valerii Kryzhov 'uk' => 'Українська', // Valerii Kryzhov
'zh' => '简体中文', // Mr. Lodar, vea - urn2.net - vea.urn2@gmail.com 'zh' => '简体中文', // Mr. Lodar, vea - urn2.net - vea.urn2@gmail.com
'zh-tw' => '繁體中文', // http://tzangms.com 'zh-tw' => '繁體中文', // http://tzangms.com
'no' => 'Norsk', // Iver Odin Kvello, mupublishing.com
); );
/** Get current language /** Get current language

View File

@@ -1,2 +1,2 @@
<?php <?php
$VERSION = "4.0.2"; $VERSION = "4.0.3";

View File

@@ -51,7 +51,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
continue; continue;
} }
} }
$alter[] = array($index["type"], $name, "(" . implode(", ", $set) . ")"); $alter[] = array($index["type"], $name, $set);
} }
} }
} }
@@ -102,7 +102,7 @@ if (!$row) {
if ($primary) { if ($primary) {
echo "<tr><td>PRIMARY<td>"; echo "<tr><td>PRIMARY<td>";
foreach ($primary["columns"] as $key => $column) { foreach ($primary["columns"] as $key => $column) {
echo "<select disabled>" . optionlist($fields, $column) . "</select>"; echo select_input(" disabled", $fields, $column);
echo "<label><input disabled type='checkbox'>" . lang('descending') . "</label> "; echo "<label><input disabled type='checkbox'>" . lang('descending') . "</label> ";
} }
echo "<td><td>\n"; echo "<td><td>\n";
@@ -116,7 +116,11 @@ foreach ($row["indexes"] as $index) {
ksort($index["columns"]); ksort($index["columns"]);
$i = 1; $i = 1;
foreach ($index["columns"] as $key => $column) { 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 "<span>" . select_input(
" name='indexes[$j][columns][$i]' onchange=\"" . ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');\"",
($fields ? array_combine($fields, $fields) : $fields),
$column
);
echo ($jush == "sql" || $jush == "mssql" ? "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'>" : ""); echo ($jush == "sql" || $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 ($jush != "sql" ? checkbox("indexes[$j][descs][$i]", 1, $index["descs"][$key], lang('descending')) : "");
echo " </span>"; echo " </span>";

284
adminer/lang/no.inc.php Normal file
View File

@@ -0,0 +1,284 @@
<?php
$translations = array(
'System' => 'System',
'Server' => 'Server',
'Username' => 'Brukernavn',
'Password' => 'Passord',
'Permanent login' => 'Permanent login',
'Login' => 'Logg inn',
'Logout' => 'Logg ut',
'Logged as: %s' => 'Logget inn som: %s',
'Logout successful.' => 'Utlogging vellykket.',
'Invalid credentials.' => 'Ugylding innloggingsinformasjon.',
'Master password expired. <a href="http://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.' => 'Master-passord er utløpt. <a href="http://www.adminer.org/en/extension/" target="_blank">Implementer</a> en metode for %s for å gjøre det permanent.',
'Language' => 'Språk',
'Invalid CSRF token. Send the form again.' => 'Ugylding CSRF-token - Send inn skjemaet igjen.',
'No extension' => 'Ingen utvidelse',
'None of the supported PHP extensions (%s) are available.' => 'Ingen av de støttede PHP-utvidelsene (%s) er tilgjengelige.',
'Session support must be enabled.' => 'Økt-støtte må være skrudd på.',
'Session expired, please login again.' => 'Økt utløpt - vennligst logg inn på nytt.',
'%s version: %s through PHP extension %s' => '%s versjon: %s via PHP-utvidelse %s',
'Refresh' => 'Gjenoppfrisk',
'ltr' => 'venstre-til-høyre',
'Privileges' => 'Privilegier',
'Create user' => 'Lag bruker',
'User has been dropped.' => 'Bruker slettet.',
'User has been altered.' => 'Bruker endret.',
'User has been created.' => 'Bruker opprettet.',
'Hashed' => 'Hashet',
'Column' => 'Kolonne',
'Routine' => 'Rutine',
'Grant' => 'Gi privilegier',
'Revoke' => 'Trekk tilbake',
'Process list' => 'Prosessliste',
'%d process(es) have been killed.' => array('%d prosess avsluttet.', '%d prosesser avsluttet.'),
'Kill' => 'Avslutt',
'Variables' => 'Variabler',
'Status' => 'Status',
'SQL command' => 'SQL-kommando',
'%d query(s) executed OK.' => array('%d kall utført OK.', '%d kall utført OK.'),
'Query executed OK, %d row(s) affected.' => array('Kall utført OK, %d rad påvirket.', 'Kall utført OK, %d rader påvirket.'),
'No commands to execute.' => 'Ingen kommandoer å utføre.',
'Error in query' => 'Feil i forespørsel',
'Execute' => 'Kjør',
'Stop on error' => 'Stopp ved feil',
'Show only errors' => 'Vis bare feil',
'%.3f s' => '%.3f s',
'History' => 'Historie',
'Clear' => 'Tøm skjema',
'Edit all' => 'Rediger alle',
'File upload' => 'Filopplasting',
'From server' => 'Fra server',
'Webserver file %s' => 'Webserver-fil %s',
'Run file' => 'Kjør fil',
'File does not exist.' => 'Filen eksisterer ikke.',
'File uploads are disabled.' => 'Filopplastinger ikke tillatt.',
'Unable to upload a file.' => 'Kunne ikke laste opp fil.',
'Maximum allowed file size is %sB.' => 'Maksimum tillatte filstørrelse er %sB.',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'For stor datamengde i skjemaet. Reduser datamengden, eller øk størrelsen på %s-konfigurasjonsdirektivet.',
'You can upload a big SQL file via FTP and import it from server.' => 'Du kan laste opp en stor SQL-fil via FTP og importere den fra serveren.',
'Export' => 'Eksport',
'Dump' => 'Dump',
'Output' => 'Resultat',
'open' => 'åpne',
'save' => 'lagre',
'Format' => 'Format',
'Data' => 'Data',
'Database' => 'Database',
'database' => 'database',
'Use' => 'Bruk',
'Select database' => 'Velg database',
'Invalid database.' => 'Ugyldig database.',
'Create new database' => 'Lag ny database',
'Database has been dropped.' => 'Databasen har blitt slettet.',
'Databases have been dropped.' => 'Databasene har blitt slettet.',
'Database has been created.' => 'Databasen er opprettet.',
'Database has been renamed.' => 'Databasen har fått nytt navn.',
'Database has been altered.' => 'Databasen er endret.',
'Alter database' => 'Endre database',
'Create database' => 'Opprett database',
'Database schema' => 'Databaseskjema',
'Permanent link' => 'Permanent lenke',
',' => ' ',
'Engine' => 'Motor',
'Collation' => 'Tekstsortering',
'Data Length' => 'Datalengde',
'Index Length' => 'Indekslengde',
'Data Free' => 'Frie data',
'Rows' => 'Rader',
'%d in total' => '%d totalt',
'Analyze' => 'Analyser',
'Optimize' => 'Optimaliser',
'Vacuum' => 'Støvsug',
'Check' => 'Sjekk',
'Repair' => 'Reparer',
'Truncate' => 'Avkort',
'Tables have been truncated.' => 'Tabellene har blitt avkortet.',
'Move to other database' => 'Flytt til annen database',
'Move' => 'Flytt',
'Tables have been moved.' => 'Tabellene har blitt flyttet.',
'Copy' => 'Kopier',
'Tables have been copied.' => 'Tabellene har blitt kopiert.',
'Routines' => 'Rutiner',
'Routine has been called, %d row(s) affected.' => array('Rutinen er utført, %d rad påvirket.', 'Rutinen er utført, %d rader påvirket.'),
'Call' => 'Kall',
'Parameter name' => 'Parameternavn',
'Create procedure' => 'Opprett prosedyre',
'Create function' => 'Opprett funksjon',
'Routine has been dropped.' => 'Rutinen er slettet.',
'Routine has been altered.' => 'Rutinen er endret.',
'Routine has been created.' => 'Rutinen er opprettet.',
'Alter function' => 'Endre funksjon',
'Alter procedure' => 'Endre prosedyre',
'Return type' => 'Returtype',
'Events' => 'Eventer',
'Event has been dropped.' => 'Eventen er slettet.',
'Event has been altered.' => 'Eventen er endret.',
'Event has been created.' => 'Eventen er opprettet.',
'Alter event' => 'Endre event',
'Create event' => 'Opprett event',
'At given time' => 'På gitte tid',
'Every' => 'Hver',
'Schedule' => 'Tidsplan',
'Start' => 'Start',
'End' => 'Slutt',
'On completion preserve' => 'Ved fullførelse bevar',
'Tables' => 'Tabeller',
'Tables and views' => 'Tabeller og views',
'Table' => 'Tabell',
'No tables.' => 'Ingen tabeller.',
'Alter table' => 'Endre tabell',
'Create table' => 'Opprett tabell',
'Table has been dropped.' => 'Tabellen er slettet.',
'Tables have been dropped.' => 'Tabellene er slettet.',
'Tables have been optimized.' => 'Tabellene er blitt optimalisert.',
'Table has been altered.' => 'Tabellen er endret.',
'Table has been created.' => 'Tabellen er opprettet.',
'Table name' => 'Tabellnavn',
'Show structure' => 'Vis struktur',
'engine' => 'mottor',
'collation' => 'sortering',
'Column name' => 'Kolonnenavn',
'Type' => 'Type',
'Length' => 'Lengde',
'Auto Increment' => 'Autoinkrement',
'Options' => 'Valg',
'Comment' => 'Kommentarer',
'Default values' => 'Standardverdier',
'Drop' => 'Dropp',
'Are you sure?' => 'Er du sikker?',
'Move up' => 'Flytt opp',
'Move down' => 'Flytt ned',
'Remove' => 'Fjern',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Maksimum antall feltnavn overskredet - venligst øk %s.',
'Partition by' => 'Partisjoner ved',
'Partitions' => 'Partisjoner',
'Partition name' => 'Partisjonsnavn',
'Values' => 'Verdier',
'View' => 'View',
'View has been dropped.' => 'Viewet er slettet.',
'View has been altered.' => 'Viewet er endret.',
'View has been created.' => 'Viewet er opprettet.',
'Alter view' => 'Endre view',
'Create view' => 'Lag nytt view',
'Indexes' => 'Indekser',
'Indexes have been altered.' => 'Indeksene er endret.',
'Alter indexes' => 'Endre indekser',
'Add next' => 'Legg til neste',
'Index Type' => 'Indekstype',
'Column (length)' => 'Kolonne (lengde)',
'Foreign keys' => 'Fremmednøkler',
'Foreign key' => 'Fremmednøkkel',
'Foreign key has been dropped.' => 'Fremmednøkkelen er slettet.',
'Foreign key has been altered.' => 'Fremmednøkkelen er endret.',
'Foreign key has been created.' => 'Fremmednøkkelen er opprettet.',
'Target table' => 'Måltabell',
'Change' => 'Endre',
'Source' => 'Kilde',
'Target' => 'Mål',
'Add column' => 'Legg til kolonne',
'Alter' => 'Endre',
'Add foreign key' => 'Legg til fremmednøkkel',
'ON DELETE' => 'ON DELETE',
'ON UPDATE' => 'ON UPDATE',
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'Kilde- og mål-kolonner må ha samme datatype, det må være en indeks på mål-kolonnen, og dataene som refereres til må eksistere.',
'Triggers' => 'Triggere',
'Add trigger' => 'Legg til trigger',
'Trigger has been dropped.' => 'Triggeren er slettet.',
'Trigger has been altered.' => 'Triggeren er endret.',
'Trigger has been created.' => 'Triggeren er opprettet.',
'Alter trigger' => 'Endre trigger',
'Create trigger' => 'Opprett trigger',
'Time' => 'Tid',
'Event' => 'Hendelse',
'Name' => 'Navn',
'select' => 'Vis',
'Select' => 'Velg',
'Select data' => 'Velg data',
'Functions' => 'Funksjoner',
'Aggregation' => 'Sammenfatning',
'Search' => 'Søk',
'anywhere' => 'hvorsomhelst',
'Search data in tables' => 'Søk data i tabeller',
'Sort' => 'Sorter',
'descending' => 'minkende',
'Limit' => 'Skranke',
'Text length' => 'Tekstlengde',
'Action' => 'Handling',
'Full table scan' => 'Full tabell-scan',
'Unable to select the table' => 'Kan ikke velge tabellen',
'No rows.' => 'Ingen rader.',
'%d row(s)' => array('%d rad', '%d rader'),
'Page' => 'Side',
'last' => 'siste',
'Load more data' => 'Last mer data',
'Loading' => 'Laster',
'whole result' => 'hele resultatet',
'%d byte(s)' => array('%d byte', '%d bytes'),
'Import' => 'Importer',
'%d row(s) have been imported.' => array('%d rad er importert.', '%d rader er importert.'),
'File must be in UTF-8 encoding.' => 'Filen må være i UTF8-tegnkoding.',
'Modify' => 'Endre',
'Ctrl+click on a value to modify it.' => 'Ctrl+klikk på en verdi for å endre den.',
'Use edit link to modify this value.' => 'Bruk rediger-lengde for å endre dennne verdien.',
'Item%s has been inserted.' => 'Rad%s er satt inn.',
'Item has been deleted.' => 'Raden er slettet.',
'Item has been updated.' => 'Raden er oppdatert.',
'%d item(s) have been affected.' => array('%d rad påvirket.', '%d rader påvirket.'),
'New item' => 'Ny rad',
'original' => 'original',
'empty' => 'tom',
'edit' => 'rediger',
'Edit' => 'Rediger',
'Insert' => 'Sett inn',
'Save' => 'Lagre',
'Save and continue edit' => 'Lagre og fortsett å redigere',
'Save and insert next' => 'Lagre og sett inn neste',
'Selected' => 'Valgt',
'Clone' => 'Klon',
'Delete' => 'Slett',
'You have no privileges to update this table.' => 'Du mangler rettighetene som trengs for å endre denne tabellen.',
'E-mail' => 'E-post',
'From' => 'Fra',
'Subject' => 'Tittel',
'Attachments' => 'Vedlegg',
'Send' => 'Send',
'%d e-mail(s) have been sent.' => array('%d epost sendt.', '%d eposter sendt.'),
'Numbers' => 'Nummer',
'Date and time' => 'Dato og tid',
'Strings' => 'Strenger',
'Binary' => 'Binære',
'Lists' => 'Lister',
'Network' => 'Nettverk',
'Geometry' => 'Geometri',
'Relations' => 'Relasjoner',
'Editor' => 'Redigering',
'$1-$3-$5' => '$6/$4 $1',
'[yyyy]-mm-dd' => 'd/m [åååå]',
'HH:MM:SS' => 'HH:MM:SS',
'now' => 'nå',
'yes' => 'ja',
'no' => 'nei',
'File exists.' => 'Filen finnes.',
'Please use one of the extensions %s.' => 'Vennligst bruk en av filendelsene %s.',
'Alter schema' => 'Endre skjema',
'Create schema' => 'Opprett skjema',
'Schema has been dropped.' => 'Skjemaet er slettet.',
'Schema has been created.' => 'Skjemaet er opprettet.',
'Schema has been altered.' => 'Skjemaet er endret.',
'schema' => 'skjema',
'Schema' => 'Skjema',
'Invalid schema.' => 'Ugylding skjema.',
'Sequences' => 'Sekvenser',
'Create sequence' => 'Opprett sekvens',
'Sequence has been dropped.' => 'Sekvensen er slettet.',
'Sequence has been created.' => 'Sekvensen er opprettet.',
'Sequence has been altered.' => 'Sekvensen er endret.',
'Alter sequence' => 'Endre sekvens',
'User types' => 'Brukertyper',
'Create type' => 'Opprett type',
'Type has been dropped.' => 'Type er slettet.',
'Type has been created.' => 'Type er opprettet.',
'Alter type' => 'Endre type',
'Saving' => 'Lagrer',
);

View File

@@ -12,7 +12,7 @@ $translations = array(
'Table has been altered.' => '資料表已修改。', 'Table has been altered.' => '資料表已修改。',
'Table has been created.' => '資料表已修改。', 'Table has been created.' => '資料表已修改。',
'Alter table' => '修改資料表', 'Alter table' => '修改資料表',
'Create table' => '建立資料表', 'Create table' => '建立資料表',
'Table name' => '資料表名稱', 'Table name' => '資料表名稱',
'engine' => '引擎', 'engine' => '引擎',
'collation' => '校對', 'collation' => '校對',
@@ -30,7 +30,7 @@ $translations = array(
'Alter database' => '修改資料庫', 'Alter database' => '修改資料庫',
'Create database' => '建立資料庫', 'Create database' => '建立資料庫',
'SQL command' => 'SQL命令', 'SQL command' => 'SQL命令',
'Dump' => '匯入/匯出', 'Dump' => '匯出',
'Logout' => '登出', 'Logout' => '登出',
'database' => '資料庫', 'database' => '資料庫',
'Use' => '使用', 'Use' => '使用',

View File

@@ -41,7 +41,7 @@ if ($_GET["val"] && is_ajax()) {
$as = convert_field($fields[key($row)]); $as = convert_field($fields[key($row)]);
$select = array($as ? $as : idf_escape(key($row))); $select = array($as ? $as : idf_escape(key($row)));
$where[] = where_check($unique_idf, $fields); $where[] = where_check($unique_idf, $fields);
$return = $driver->select($TABLE, $select, $where, $select, array(), 1, 0); $return = $driver->select($TABLE, $select, $where, $select);
if ($return) { if ($return) {
echo reset($return->fetch_row()); echo reset($return->fetch_row());
} }

View File

@@ -45,7 +45,7 @@ if (!$error && $_POST) {
} }
} }
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)"; $space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\r?\n)";
$delimiter = ";"; $delimiter = ";";
$offset = 0; $offset = 0;
$empty = true; $empty = true;
@@ -217,7 +217,7 @@ if (!isset($_GET["import"])) {
} }
echo checkbox("error_stops", 1, ($_POST ? $_POST["error_stops"] : isset($_GET["import"])), lang('Stop on error')) . "\n"; echo checkbox("error_stops", 1, ($_POST ? $_POST["error_stops"] : isset($_GET["import"])), lang('Stop on error')) . "\n";
echo checkbox("only_errors", 1, $_POST["only_errors"], lang('Show only errors')) . "\n"; echo checkbox("only_errors", 1, ($_POST ? $_POST["only_errors"] : isset($_GET["import"])), lang('Show only errors')) . "\n";
echo "<input type='hidden' name='token' value='$token'>\n"; echo "<input type='hidden' name='token' value='$token'>\n";
if (!isset($_GET["import"]) && $history) { if (!isset($_GET["import"]) && $history) {

View File

@@ -6,16 +6,18 @@
function bodyLoad(version) { function bodyLoad(version) {
if (window.jush) { if (window.jush) {
jush.create_links = ' target="_blank" rel="noreferrer"'; jush.create_links = ' target="_blank" rel="noreferrer"';
for (var key in jush.urls) { if (version) {
var obj = jush.urls; for (var key in jush.urls) {
if (typeof obj[key] != 'string') { var obj = jush.urls;
obj = obj[key]; if (typeof obj[key] != 'string') {
key = 0; obj = obj[key];
key = 0;
}
obj[key] = obj[key]
.replace(/\/doc\/mysql/, '/doc/refman/' + version) // MySQL
.replace(/\/docs\/current/, '/docs/' + version) // PostgreSQL
;
} }
obj[key] = obj[key]
.replace(/\/doc\/mysql/, '/doc/refman/' + version) // MySQL
.replace(/\/docs\/current/, '/docs/' + version) // PostgreSQL
;
} }
if (window.jushLinks) { if (window.jushLinks) {
jush.custom_links = jushLinks; jush.custom_links = jushLinks;
@@ -433,12 +435,16 @@ function indexesAddRow(field) {
* @param string name prefix * @param string name prefix
*/ */
function indexesChangeColumn(field, prefix) { function indexesChangeColumn(field, prefix) {
var columns = parentTag(field, 'td').getElementsByTagName('select');
var names = []; var names = [];
for (var i=0; i < columns.length; i++) { for (var tag in { 'select': 1, 'input': 1 }) {
var value = selectValue(columns[i]); var columns = parentTag(field, 'td').getElementsByTagName(tag);
if (value) { for (var i=0; i < columns.length; i++) {
names.push(value); if (/\[columns\]/.test(columns[i].name)) {
var value = selectValue(columns[i]);
if (value) {
names.push(value);
}
}
} }
} }
field.form[field.name.replace(/\].*/, '][name]')].value = prefix + names.join('_'); field.form[field.name.replace(/\].*/, '][name]')].value = prefix + names.join('_');
@@ -460,12 +466,20 @@ function indexesAddColumn(field, prefix) {
select.onchange(); select.onchange();
} }
var column = cloneNode(field.parentNode); var column = cloneNode(field.parentNode);
select = column.getElementsByTagName('select')[0]; var selects = column.getElementsByTagName('select');
select.name = select.name.replace(/\]\[\d+/, '$&1'); for (var i = 0; i < selects.length; i++) {
select.selectedIndex = 0; select = selects[i];
var input = column.getElementsByTagName('input')[0]; select.name = select.name.replace(/\]\[\d+/, '$&1');
input.name = input.name.replace(/\]\[\d+/, '$&1'); select.selectedIndex = 0;
input.value = ''; }
var inputs = column.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
input.name = input.name.replace(/\]\[\d+/, '$&1');
if (input.type != 'checkbox') {
input.value = '';
}
}
parentTag(field, 'td').appendChild(column); parentTag(field, 'td').appendChild(column);
field.onchange(); field.onchange();
} }

View File

@@ -95,7 +95,7 @@ function parentTag(el, tag) {
function trCheck(el) { function trCheck(el) {
var tr = parentTag(el, 'tr'); var tr = parentTag(el, 'tr');
alterClass(tr, 'checked', el.checked); alterClass(tr, 'checked', el.checked);
if (el.form && el.form['all']) { if (el.form && el.form['all'] && el.form['all'].onclick) { // Opera thinks that 'all' is who knows what
el.form['all'].onclick(); el.form['all'].onclick();
} }
} }
@@ -478,6 +478,20 @@ function keyupChange() {
} }
} }
/** Add new field in schema-less edit
* @param HTMLInputElement
*/
function fieldChange(field) {
var row = cloneNode(parentTag(field, 'tr'));
var inputs = row.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
inputs[i].value = '';
}
// keep value in <select> (function)
parentTag(field, 'table').appendChild(row);
field.onchange = function () { };
}
/** Create AJAX request /** Create AJAX request

View File

@@ -1,3 +1,10 @@
Adminer 4.0.3 (released 2014-02-01)
MongoDB: insert, truncate, indexes
SimpleDB, MongoDB: insert more fields at once
SQLite: Fix creating table and altering primary key, bug since Adminer 4.0.0
Don't store invalid credentials to session, bug since Adminer 4.0.0
Norweigan translation
Adminer 4.0.2 (released 2014-01-11): Adminer 4.0.2 (released 2014-01-11):
Fix handling of long text in SQL textarea Fix handling of long text in SQL textarea
Support paste to SQL textarea in Opera Support paste to SQL textarea in Opera

View File

@@ -287,11 +287,14 @@ function minify_js($file) {
function compile_file($match) { function compile_file($match) {
global $project; global $project;
$file = ""; $file = "";
foreach (explode(";", $match[1]) as $filename) { list(, $filenames, $callback) = $match;
$file .= file_get_contents(dirname(__FILE__) . "/$project/$filename"); if ($filenames != "") {
foreach (explode(";", $filenames) as $filename) {
$file .= file_get_contents(dirname(__FILE__) . "/$project/$filename");
}
} }
if ($match[2]) { if ($callback) {
$file = call_user_func($match[2], $file); $file = call_user_func($callback, $file);
} }
return '"' . add_quo_slashes($file) . '"'; return '"' . add_quo_slashes($file) . '"';
} }
@@ -378,7 +381,7 @@ if ($driver) {
} }
if ($project == "editor") { if ($project == "editor") {
$file = preg_replace('~;../externals/jush/jush.css~', '', $file); $file = preg_replace('~;../externals/jush/jush.css~', '', $file);
$file = preg_replace('~;../externals/jush/modules/jush[^.]*.js~', '', $file); $file = preg_replace('~;?../externals/jush/modules/jush[^.]*.js~', '', $file);
} }
$file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file); $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
$file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file); $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
@@ -390,7 +393,6 @@ if ($_SESSION["lang"]) {
$file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file); $file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
} }
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file); $file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>' . "\n", "", $file); $file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>' . "\n", "", $file); $file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>' . "\n", "", $file); $file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>' . "\n", "", $file);
@@ -399,6 +401,7 @@ $file = preg_replace_callback("~compile_file\\('([^']+)'(?:, '([^']*)')?\\)~", '
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION . ($driver ? '&amp;driver=' . $driver : ''); $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION . ($driver ? '&amp;driver=' . $driver : '');
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file); $file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file); $file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
$file = preg_replace('~\\.\\./externals/jush/modules/(jush\\.js)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file); $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
$file = php_shrink($file); $file = php_shrink($file);

View File

@@ -1,8 +1,5 @@
// Editor specific functions // Editor specific functions
function bodyLoad(version) {
}
function selectFieldChange(form) { function selectFieldChange(form) {
} }