1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 01:30:12 +02:00

Compare commits

...

121 Commits
v3.6.3 ... move

Author SHA1 Message Date
Jakub Vrana
d812af573e Allow moving select columns 2013-05-20 18:49:00 -07:00
Jakub Vrana
7be9d5c7ca Simplify box-shadow 2013-05-20 10:58:06 -07:00
Jakub Vrana
2dfe2640db Don't highlight rows in uncheckable tables 2013-05-20 10:14:04 -07:00
Jakub Vrana
68aba96c72 Increase click target for checkboxes (thanks to Roman) 2013-05-20 10:13:54 -07:00
Jakub Vrana
bf94b88503 Use shadow for highlighting default button (thanks to srigi) 2013-05-20 09:13:06 -07:00
Jakub Vrana
b51d4ab105 Release 3.7.0 2013-05-19 20:37:27 -07:00
Jakub Vrana
fabfb8a0bc Get number of rows on export page asynchronously 2013-05-17 17:40:08 -07:00
Jakub Vrana
5a4d1b3704 Add server placeholder to login form 2013-05-17 14:08:15 -07:00
Jakub Vrana
982974fe27 Use ALTER VIEW and don't use temporary object if changing name 2013-05-13 11:12:28 -07:00
Jakub Vrana
3ed0ce926c Fix table links for existing but invalid views 2013-05-13 10:12:13 -07:00
Jakub Vrana
65fae98558 Don't rely on 't' and 'f' PostgreSQL boolean return values
https://sourceforge.net/projects/adminer/forums/forum/1095138/topic/8119905
2013-05-13 08:40:06 -07:00
Jakub Vrana
af30f59737 Don't use LIMIT 1 if updating unique row (bug #3613109) 2013-05-11 13:05:40 -07:00
Jakub Vrana
2f996ba014 Restrict editing rows without unique identifier to search results 2013-05-11 12:47:04 -07:00
Jakub Vrana
b7e0f1d81c Fix EXPLAIN in MySQL < 5.1, bug since Adminer 3.6.4 (thanks to Coudy) 2013-05-11 08:02:28 -07:00
Jakub Vrana
20915b1764 Save bytes 2013-05-08 12:13:04 -07:00
Jakub Vrana
516416e72b Fix tables list in Editor 2013-05-08 11:58:21 -07:00
Jakub Vrana
c38655418b Simplify process_fields() 2013-05-08 11:43:53 -07:00
Jakub Vrana
046da00eb6 Strip trailing spaces 2013-05-08 11:29:19 -07:00
Jakub Vrana
22f0a5ded8 Display navigation bellow main content on mobile browsers 2013-05-08 11:27:20 -07:00
Jakub Vrana
6a41240c42 Move common function 2013-05-08 10:46:16 -07:00
Jakub Vrana
a09916737e Simplify initializing post variables 2013-05-08 08:54:26 -07:00
Jakub Vrana
e99463b295 Don't drop original view and routine before creating the new one 2013-05-08 07:55:08 -07:00
Jakub Vrana
b7021c9c7f Highlight default submit button 2013-05-06 09:27:35 -07:00
Jakub Vrana
94a0cc8de8 Fix resetting search (bug #3612507) 2013-05-03 18:53:13 -07:00
Jakub Vrana
9c78b3bb34 Add empty lines to source code 2013-05-01 18:28:04 -07:00
Jakub Vrana
0e6003e833 Send export headers sooner 2013-05-01 09:44:07 -07:00
Jakub Vrana
601cdd43c1 Constraint memory used in TAR export 2013-05-01 09:33:23 -07:00
Jakub Vrana
17a8495c2e Display logout button in Nette design. 2013-04-30 12:02:02 -07:00
Jakub Vrana
40c61f6cfc Reduce memory used by TAR export 2013-04-29 15:45:15 -07:00
Jakub Vrana
63c400f95d Allow exporting views dependent on each other (bug #3459151) 2013-04-29 15:42:39 -07:00
Jakub Vrana
34adf46293 Export SQLite views 2013-04-29 15:37:50 -07:00
Jakub Vrana
1ecdde0500 Remove bzip2 compression support
It didn't work for exports bigger than 1 MB.
An alternative would be to remove the limit from output buffer which would need memory for the whole export.
Another alternative would be to create a temporary file in output handler and bzwrite() to this file - that would work but it's complicated, especially if we want to output the file progressively - bzopen($tmp, 'w'), fopen($tmp, 'r').
2013-04-29 15:37:33 -07:00
Jakub Vrana
7f05141b89 Save memory in get_file() 2013-04-28 08:17:50 -07:00
Jakub Vrana
d513de4d71 Allow using lang() in plugins 2013-04-28 08:17:40 -07:00
Jakub Vrana
18d51c6b6e Allow using lang() in plugin with single language Adminer version 2013-04-27 23:36:43 -07:00
Jakub Vrana
5eda7e547f Add anchors to database and table sections to allow linking 2013-04-27 23:17:07 -07:00
Jakub Vrana
f7e671448c Select only required routine columns (possible fix for bug #3515776) 2013-04-27 13:04:54 -07:00
Jakub Vrana
d97ae22fb4 Properly unescape apostrophe in column name 2013-04-26 23:25:35 -07:00
Jakub Vrana
49c1484722 Display bit default value same as existing values 2013-04-26 23:21:09 -07:00
Jakub Vrana
7541ceb1ca Improve export of binary data types (bug #3526494) 2013-04-26 22:57:44 -07:00
Jakub Vrana
2afd915f00 Save bytes 2013-04-26 22:22:38 -07:00
Jakub Vrana
5a0be7e7fe Convert fields with selected columns 2013-04-26 22:20:04 -07:00
Jakub Vrana
de2c3968d4 Display bit type as binary number, also fix bit outside MySQLnd 2013-04-26 22:20:03 -07:00
Jakub Vrana
e24d1fcb02 Optimize table_status() 2013-04-26 22:19:54 -07:00
Jakub Vrana
3cae3e2f7f Fix LIKE backslash escaping 2013-04-26 19:34:15 -07:00
Jakub Vrana
fd5e6ef343 Use standard view detection in schema 2013-04-26 19:34:15 -07:00
Jakub Vrana
8ae8507972 Save bytes 2013-04-26 19:34:03 -07:00
Jakub Vrana
b0b4cb1576 Allow more SQL files to be uploaded at the same time (thanks to Frantisek Svoboda) 2013-04-26 13:26:08 -07:00
Jakub Vrana
ada8917e43 Rename = edit operator to SQL 2013-04-26 12:20:47 -07:00
Jakub Vrana
e287642e26 Rename empty select operator to SQL 2013-04-26 12:20:17 -07:00
Jakub Vrana
4858f332c8 Disable SQL export when applying functions in select 2013-04-26 11:57:21 -07:00
Jakub Vrana
91dbaca3c4 Don't export binary and geometry columns twice in select 2013-04-26 11:52:26 -07:00
Jakub Vrana
741cd5b4b6 Fix handling of POINT data type (bug #3582578) 2013-04-26 11:42:18 -07:00
Étienne Deparis
0f47ae8e0f Update Nette design 2013-04-26 10:54:16 -07:00
Jakub Vrana
01a2722c94 Print run time next to executed queries 2013-04-25 23:41:46 -07:00
Jakub Vrana
3bc5c17d03 Develop 2013-04-25 19:00:37 -07:00
Jakub Vrana
a199998f54 Fix documentation comment 2013-04-25 18:19:27 -07:00
Jakub Vrana
c4040f03d9 Release 3.6.4 2013-04-25 17:53:50 -07:00
Jakub Vrana
db7d05b3ec Allow storing empty user password 2013-04-25 09:46:37 -07:00
Jakub Vrana
3d07d8bbd8 Display approx. number of last page in select 2013-04-24 21:22:30 -07:00
Jakub Vrana
bcd1e059f5 Delete Last page link from Editor 2013-04-24 21:16:54 -07:00
Jakub Vrana
0eadfc2b3f Do not store plain text password to history in creating user 2013-04-24 19:04:17 -07:00
Jakub Vrana
c270a06fb1 Fix unsetting permanent login after logout 2013-04-24 18:27:18 -07:00
Jakub Vrana
2b58ebe327 Compensate menuOver() for ellipsis 2013-04-23 17:12:48 -07:00
Jakub Vrana
a72347f3c7 Rename Edit link to Clone in processlist 2013-04-22 13:48:39 -07:00
Étienne Deparis
6f58f5af44 Update Nette admine.css
Fix glitches around #breadcrumb while scrolling.
2013-04-17 21:39:29 -07:00
EauLand
6bdfec0a1a Update fr.inc.php
Replace "sauvegarder" by "enregistrer"
Reduce strings to see all sentence
2013-04-17 21:26:34 -07:00
Jakub Vrana
93f581175f Update test format 2013-04-17 18:02:52 -07:00
Jakub Vrana
971c51783f Fix test 2013-04-17 18:01:40 -07:00
Jakub Vrana
ba5e7a1b53 Link processlist documentation 2013-04-17 17:57:14 -07:00
Jakub Vrana
46a7e7eea0 Selectable ON UPDATE CURRENT_TIMESTAMP field in create table 2013-04-17 09:41:58 -07:00
Jakub Vrana
7af362554a Respect global errors in dump 2013-04-17 08:48:59 -07:00
Jakub Vrana
a8947b62b8 Avoid using same id="" in more messages 2013-04-16 17:53:53 -07:00
Jakub Vrana
37adf537c9 Respect checked tables in export filename (bug #3245464) 2013-04-16 10:37:10 -07:00
Jakub Vrana
e8e95e5fd7 Display SQL history from oldest 2013-04-16 09:50:32 -07:00
Jakub Vrana
285afc202a Increase default select limit to 50 2013-04-15 14:45:49 -07:00
Jakub Vrana
8cce005b70 Increase limit for using MD5 in select 2013-04-12 09:08:44 -07:00
Jakub Vrana
433357f824 Use numeric time zone in export (thanks to Martin Dzubak) 2013-04-11 10:12:53 -07:00
Jakub Vrana
d97300dd5a MSSQL: Don't seek to top (bug #3610309) 2013-04-11 09:37:55 -07:00
Jakub Vrana
99221f3265 Display help cursor over documentation links 2013-04-11 09:37:55 -07:00
Jakub Vrana
fee31e73c1 Display help cursor over documentation links 2013-04-04 18:45:54 -07:00
Jakub Vrana
2c626c7fc7 Explain partitions in SQL query (bug #3600150) 2013-04-04 18:40:49 -07:00
Jakub Vrana
3093f58157 Clear column name after resetting search (bug #3601200) 2013-04-04 18:32:05 -07:00
Jakub Vrana
1a1b800b40 Edit select SQL query on Ctrl+click 2013-04-04 18:15:18 -07:00
Jakub Vrana
e4d5835dab Open database to a new window after selecting it with Ctrl 2013-04-04 10:35:15 -07:00
Jakub Vrana
aba9d23ba2 Move comment 2013-04-04 09:44:48 -07:00
Jakub Vrana
190812456f Move ALTER export to plugin 2013-04-04 09:42:02 -07:00
Jakub Vrana
58a8df7c86 Export SQLite indexes (bug #3609741) 2013-04-03 10:46:51 -07:00
Jakub Vrana
cb57afd0e5 Handle empty integer values in SQLite export 2013-04-03 10:41:14 -07:00
Jakub Vrana
b14a2a5330 Revert "Order by auto_increment column by default"
This reverts commit 79b61855e5.
2013-04-03 10:41:05 -07:00
Jakub Vrana
0cd85c1ce9 Plugin for displaying JSON data 2013-04-02 18:49:32 -07:00
Jakub Vrana
c69d9fcfdf Delete confusing link to the last page 2013-04-02 18:40:07 -07:00
Jakub Vrana
5739e03e97 Display pagination on a fixed position 2013-04-02 18:35:23 -07:00
Jakub Vrana
79b61855e5 Order by auto_increment column by default 2013-04-02 18:15:35 -07:00
Jakub Vrana
7769cab32c Handle max_input_vars and generalize Suhosin compatibility 2013-04-02 18:14:27 -07:00
Jakub Vrana
f3920f381d Use ellipsis in overflowed texts 2013-04-01 18:03:58 -07:00
Jakub Vrana
f697486884 Revert indeterminate checkbox state 2013-04-01 17:57:08 -07:00
Jakub Vrana
5d68a29b3e Open full edit SQL with Ctrl 2013-04-01 11:22:20 -07:00
Jakub Vrana
e531d6ef41 Don't convert columns which are not selected 2013-03-27 21:11:46 -07:00
Jakub Vrana
a38ea926f2 Use class_exists() instead of extension_loaded() for checking SQLite
https://sourceforge.net/projects/adminer/forums/forum/1095138/topic/6780041
2013-03-27 21:11:14 -07:00
Pavel Sedlák
5b36472a45 Remove unused external/CodeMirror2 dir 2013-03-27 10:16:09 -07:00
Jakub Vrana
e139f94561 Refresh database list after dropping database 2013-03-27 09:24:51 -07:00
Jakub Vrana
50528be5cb Jump to first page after deleting all records 2013-03-26 19:08:58 -07:00
Jakub Vrana
2323f433c4 Stay on the same page after deleting rows (bug #3605845) 2013-03-26 18:46:56 -07:00
Jakub Vrana
f43ef7b083 Allow loading more data with inline edit (bug #3605531) 2013-03-26 18:31:03 -07:00
Jakub Vrana
e1545065f0 Display select SQL edit form inline 2013-03-26 10:11:35 -07:00
Jakub Vrana
9a4b30a646 Add master-slave plugin 2013-02-22 04:23:06 -08:00
Jakub Vrana
2b2d6987ef Compatibility with MySQL 5.6 2013-02-20 03:40:20 -08:00
Jakub Vrana
356cadf2b2 Avoid variable collision 2013-02-19 16:46:29 -08:00
Jakub Vrana
8caa889635 Add iOS touch icon 2013-02-19 16:31:51 -08:00
Jakub Vrana
dd9167a101 JSON export plugin (http://forum.zdrojak.cz/?topic=808) 2013-02-07 19:04:36 -08:00
Jakub Vrana
34633a4e60 Separate link for altering event 2013-01-30 23:47:53 -08:00
Jakub Vrana
3d2b869f2e Add typehint to event fields 2013-01-30 23:47:53 -08:00
Jakub Vrana
737c2bdc0e Recover original view, trigger, routine if creating fails (bug #3601088) 2013-01-30 23:47:53 -08:00
Jakub Vrana
1e310977b6 Display information for processing no tables 2013-01-30 23:47:53 -08:00
Jakub Vrana
79fd0238b5 Indeterminate state of select all checkboxes 2013-01-30 23:47:53 -08:00
Jakub Vrana
f86cb5f837 Use autocapitalize="off" 2013-01-30 23:47:53 -08:00
Jakub Vrana
de0d3aca84 Allow editing rows without unique key and long text 2013-01-30 23:47:53 -08:00
Jakub Vrana
51b7104342 Allow editing function results 2013-01-30 23:47:52 -08:00
Jakub Vrana
15e83e9396 Fix displaying length of blob columns 2013-01-30 23:47:52 -08:00
Jakub Vrana
0448bd118c Add Nette design 2013-01-26 21:26:17 -08:00
111 changed files with 2044 additions and 752 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/adminer/adminer.css
/adminer*.php
/editor*.php

View File

@@ -28,8 +28,10 @@ if (!$error && $_POST) {
}
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
}
$query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")";
echo "<p><code class='jush-$jush'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
if (!$connection->multi_query($query)) {
echo "<p class='error'>" . error() . "\n";
} else {
@@ -37,6 +39,7 @@ if (!$error && $_POST) {
if (is_object($connection2)) {
$connection2->select_db(DB);
}
do {
$result = $connection->store_result();
if (is_object($result)) {
@@ -45,6 +48,7 @@ if (!$error && $_POST) {
echo "<p class='message'>" . lang('Routine has been called, %d row(s) affected.', $connection->affected_rows) . "\n";
}
} while ($connection->next_result());
if ($out) {
select($connection->query("SELECT " . implode(", ", $out)));
}

View File

@@ -14,11 +14,14 @@ if ($TABLE != "") {
$orig_fields = fields($TABLE);
$orig_status = table_status($TABLE);
}
if ($_POST && !$_POST["fields"]) {
$_POST["fields"] = array();
$row = $_POST;
$row["fields"] = (array) $row["fields"];
if ($row["auto_increment_col"]) {
$row["fields"][$row["auto_increment_col"]]["auto_increment"] = true;
}
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
if ($_POST && !process_fields($row["fields"]) && !$error) {
if ($_POST["drop"]) {
query_redirect("DROP TABLE " . table($TABLE), substr(ME, 0, -1), lang('Table has been dropped.'));
} else {
@@ -26,22 +29,18 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
$all_fields = array();
$use_all_fields = false;
$foreign = array();
ksort($_POST["fields"]);
ksort($row["fields"]);
$orig_field = reset($orig_fields);
$after = " FIRST";
foreach ($_POST["fields"] as $key => $field) {
foreach ($row["fields"] as $key => $field) {
$foreign_key = $foreign_keys[$field["type"]];
$type_field = ($foreign_key !== null ? $referencable_primary[$foreign_key] : $field); //! can collide with user defined type
if ($field["field"] != "") {
if (!$field["has_default"]) {
$field["default"] = null;
}
$default = eregi_replace(" *on update CURRENT_TIMESTAMP", "", $field["default"]);
if ($default != $field["default"]) { // preg_replace $count is available since PHP 5.1.0
$field["on_update"] = "CURRENT_TIMESTAMP";
$field["default"] = $default;
}
if ($key == $_POST["auto_increment_col"]) {
if ($key == $row["auto_increment_col"]) {
$field["auto_increment"] = true;
}
$process_field = process_field($field, $type_field);
@@ -67,37 +66,40 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
}
}
}
$partitioning = "";
if (in_array($_POST["partition_by"], $partition_by)) {
if (in_array($row["partition_by"], $partition_by)) {
$partitions = array();
if ($_POST["partition_by"] == 'RANGE' || $_POST["partition_by"] == 'LIST') {
foreach (array_filter($_POST["partition_names"]) as $key => $val) {
$value = $_POST["partition_values"][$key];
$partitions[] = "\nPARTITION " . idf_escape($val) . " VALUES " . ($_POST["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
if ($row["partition_by"] == 'RANGE' || $row["partition_by"] == 'LIST') {
foreach (array_filter($row["partition_names"]) as $key => $val) {
$value = $row["partition_values"][$key];
$partitions[] = "\n PARTITION " . idf_escape($val) . " VALUES " . ($row["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
}
}
$partitioning .= "\nPARTITION BY $_POST[partition_by]($_POST[partition])" . ($partitions // $_POST["partition"] can be expression, not only column
$partitioning .= "\nPARTITION BY $row[partition_by]($row[partition])" . ($partitions // $row["partition"] can be expression, not only column
? " (" . implode(",", $partitions) . "\n)"
: ($_POST["partitions"] ? " PARTITIONS " . (+$_POST["partitions"]) : "")
: ($row["partitions"] ? " PARTITIONS " . (+$row["partitions"]) : "")
);
} elseif (support("partitioning") && ereg("partitioned", $orig_status["Create_options"])) {
$partitioning .= "\nREMOVE PARTITIONING";
}
$message = lang('Table has been altered.');
if ($TABLE == "") {
cookie("adminer_engine", $_POST["Engine"]);
cookie("adminer_engine", $row["Engine"]);
$message = lang('Table has been created.');
}
$name = trim($_POST["name"]);
$name = trim($row["name"]);
queries_redirect(ME . "table=" . urlencode($name), $message, alter_table(
$TABLE,
$name,
($jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields),
$foreign,
$_POST["Comment"],
($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? $_POST["Engine"] : ""),
($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? $_POST["Collation"] : ""),
($_POST["Auto_increment"] != "" ? +$_POST["Auto_increment"] : ""),
$row["Comment"],
($row["Engine"] && $row["Engine"] != $orig_status["Engine"] ? $row["Engine"] : ""),
($row["Collation"] && $row["Collation"] != $orig_status["Collation"] ? $row["Collation"] : ""),
($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),
$partitioning
));
}
@@ -105,51 +107,38 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
page_header(($TABLE != "" ? lang('Alter table') : lang('Create table')), $error, array("table" => $TABLE), $TABLE);
$row = array(
"Engine" => $_COOKIE["adminer_engine"],
"fields" => array(array("field" => "", "type" => (isset($types["int"]) ? "int" : (isset($types["integer"]) ? "integer" : "")))),
"partition_names" => array(""),
);
if ($_POST) {
$row = $_POST;
if ($row["auto_increment_col"]) {
$row["fields"][$row["auto_increment_col"]]["auto_increment"] = true;
}
process_fields($row["fields"]);
} elseif ($TABLE != "") {
$row = $orig_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
$row["Auto_increment"] = "";
}
foreach ($orig_fields as $field) {
$field["has_default"] = isset($field["default"]);
if ($field["on_update"]) {
$field["default"] .= " ON UPDATE $field[on_update]"; // CURRENT_TIMESTAMP
if (!$_POST) {
$row = array(
"Engine" => $_COOKIE["adminer_engine"],
"fields" => array(array("field" => "", "type" => (isset($types["int"]) ? "int" : (isset($types["integer"]) ? "integer" : "")))),
"partition_names" => array(""),
);
if ($TABLE != "") {
$row = $orig_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
$row["Auto_increment"] = "";
}
$row["fields"][] = $field;
}
if (support("partitioning")) {
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($TABLE);
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
$row["partition_names"] = array();
$row["partition_values"] = array();
foreach (get_rows("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION") as $row1) {
$row["partition_names"][] = $row1["PARTITION_NAME"];
$row["partition_values"][] = $row1["PARTITION_DESCRIPTION"];
foreach ($orig_fields as $field) {
$field["has_default"] = isset($field["default"]);
$row["fields"][] = $field;
}
if (support("partitioning")) {
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($TABLE);
$result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
$partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $from AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
$partitions[""] = "";
$row["partition_names"] = array_keys($partitions);
$row["partition_values"] = array_values($partitions);
}
$row["partition_names"][] = "";
}
}
$collations = collations();
$suhosin = floor(extension_loaded("suhosin") ? (min(ini_get("suhosin.request.max_vars"), ini_get("suhosin.post.max_vars")) - 13) / 10 : 0); // 10 - number of fields per row, 13 - number of other fields
if ($suhosin && count($row["fields"]) > $suhosin) {
echo "<p class='error'>" . h(lang('Maximum number of allowed fields exceeded. Please increase %s and %s.', 'suhosin.post.max_vars', 'suhosin.request.max_vars')) . "\n";
}
$engines = engines();
// case of engine may differ
foreach ($engines as $engine) {
@@ -162,8 +151,8 @@ foreach ($engines as $engine) {
<form action="" method="post" id="form">
<p>
<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>">
<?php if ($TABLE == "" && !$_POST) { ?><script type='text/javascript'>document.getElementById('form')['name'].focus();</script><?php } ?>
<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
<?php if ($TABLE == "" && !$_POST) { ?><script type='text/javascript'>focus(document.getElementById('form')['name']);</script><?php } ?>
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) : ""); ?>
<?php echo ($collations && !ereg("sqlite|mssql", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
<input type="submit" value="<?php echo lang('Save'); ?>">
@@ -178,18 +167,21 @@ if (!$_POST && !$comments) {
}
}
}
edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys, $comments);
edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments);
?>
</table>
<p>
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
<label class="jsonly"><input type="checkbox" id="defaults" name="defaults" value="1" checked onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
<?php echo lang('Auto Increment'); ?>: <input type="number" name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
<?php echo checkbox("defaults", 1, true, lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
<?php if (!$_POST["defaults"]) { ?><script type="text/javascript">editingHideDefaults()</script><?php } ?>
<?php echo (support("comment") ? checkbox("comments", 1, $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();", true) . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="' . ($connection->server_info >= 5.5 ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<?php echo (support("comment")
? "<label><input type='checkbox' name='comments' value='1' class='jsonly' onclick=\"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();\"" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
. ' <input name="Comment" id="Comment" value="' . h($row["Comment"]) . '" maxlength="' . ($connection->server_info >= 5.5 ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
: '')
; ?>
<p>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($_GET["create"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php
if (support("partitioning")) {
$partition_table = ereg('RANGE|LIST', $row["partition_by"]);
@@ -204,7 +196,7 @@ if (support("partitioning")) {
<?php
foreach ($row["partition_names"] as $key => $val) {
echo '<tr>';
echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange(this);"' : '') . '>';
echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange(this);"' : '') . ' autocapitalize="off">';
echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
}
?>
@@ -213,4 +205,5 @@ foreach ($row["partition_names"] as $key => $val) {
<?php
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -1,7 +1,9 @@
<?php
$row = $_POST;
if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x
restart_session();
$name = trim($_POST["name"]);
$name = trim($row["name"]);
if ($_POST["drop"]) {
$_GET["db"] = ""; // to save in global history
queries_redirect(remove_from_uri("db|database"), lang('Database has been dropped.'), drop_databases(array(DB)));
@@ -9,14 +11,14 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
// create or rename database
if (DB != "") {
$_GET["db"] = $name;
queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($name), lang('Database has been renamed.'), rename_database($name, $_POST["collation"]));
queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($name), lang('Database has been renamed.'), rename_database($name, $row["collation"]));
} else {
$databases = explode("\n", str_replace("\r", "", $name));
$success = true;
$last = "";
foreach ($databases as $db) {
if (count($databases) == 1 || $db != "") { // ignore empty lines but always try to create single database
if (!create_database($db, $_POST["collation"])) {
if (!create_database($db, $row["collation"])) {
$success = false;
}
$last = $db;
@@ -26,10 +28,10 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
}
} else {
// alter database
if (!$_POST["collation"]) {
if (!$row["collation"]) {
redirect(substr(ME, 0, -1));
}
query_redirect("ALTER DATABASE " . idf_escape($name) . (eregi('^[a-z0-9_]+$', $_POST["collation"]) ? " COLLATE $_POST[collation]" : ""), substr(ME, 0, -1), lang('Database has been altered.'));
query_redirect("ALTER DATABASE " . idf_escape($name) . (eregi('^[a-z0-9_]+$', $row["collation"]) ? " COLLATE $row[collation]" : ""), substr(ME, 0, -1), lang('Database has been altered.'));
}
}
@@ -37,12 +39,10 @@ page_header(DB != "" ? lang('Alter database') : lang('Create database'), $error,
$collations = collations();
$name = DB;
$collate = null;
if ($_POST) {
$name = $_POST["name"];
$collate = $_POST["collation"];
$name = $row["name"];
} elseif (DB != "") {
$collate = db_collation(DB, $collations);
$row["collation"] = db_collation(DB, $collations);
} elseif ($jush == "sql") {
// propose database name with limited privileges
foreach (get_vals("SHOW GRANTS") as $grant) {
@@ -59,10 +59,10 @@ if ($_POST) {
<?php
echo ($_POST["add_x"] || strpos($name, "\n")
? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
: '<input id="name" name="name" value="' . h($name) . '" maxlength="64">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate) : "");
: '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) : "");
?>
<script type='text/javascript'>document.getElementById('name').focus();</script>
<script type='text/javascript'>focus(document.getElementById('name'));</script>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if (DB != "") {

View File

@@ -7,6 +7,7 @@ if ($tables_views && !$error && !$_POST["search"]) {
if ($jush == "sql" && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) {
queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
}
if ($_POST["truncate"]) {
if ($_POST["tables"]) {
$result = truncate_tables($_POST["tables"]);
@@ -32,11 +33,14 @@ if ($tables_views && !$error && !$_POST["search"]) {
: apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"])
);
$message = lang('Tables have been optimized.');
} elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) {
} elseif (!$_POST["tables"]) {
$message = lang('No tables.');
} elseif ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])))) {
while ($row = $result->fetch_assoc()) {
$message .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>";
}
}
queries_redirect(substr(ME, 0, -1), $message, $result);
}
@@ -44,7 +48,7 @@ page_header(($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema'
if ($adminer->homepage()) {
if ($_GET["ns"] !== "") {
echo "<h3>" . lang('Tables and views') . "</h3>\n";
echo "<h3 id='tables-views'>" . lang('Tables and views') . "</h3>\n";
$tables_list = tables_list();
if (!$tables_list) {
echo "<p class='message'>" . lang('No tables.') . "\n";
@@ -55,6 +59,7 @@ if ($adminer->homepage()) {
search_tables();
}
echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">';
echo '<th>' . lang('Table');
echo '<td>' . lang('Engine');
@@ -66,6 +71,7 @@ if ($adminer->homepage()) {
echo '<td>' . lang('Rows');
echo (support("comment") ? '<td>' . lang('Comment') : '');
echo "</thead>\n";
foreach ($tables_list as $name => $type) {
$view = ($type !== null && !eregi("table", $type));
echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
@@ -88,12 +94,14 @@ if ($adminer->homepage()) {
}
echo (support("comment") ? "<td id='Comment-" . h($name) . "'>&nbsp;" : "");
}
echo "<tr><td>&nbsp;<th>" . lang('%d in total', count($tables_list));
echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : "");
echo "<td>" . nbsp(db_collation(DB, collations()));
foreach (array("Data_length", "Index_length", "Data_free") as $key) {
echo "<td align='right' id='sum-$key'>&nbsp;";
}
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
if (!information_schema(DB)) {
@@ -105,7 +113,7 @@ if ($adminer->homepage()) {
if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
echo "<p>" . lang('Move to other database') . ": ";
echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '">');
echo ($databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">');
echo " <input type='submit' name='move' value='" . lang('Move') . "'>";
echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "");
echo "\n";
@@ -121,7 +129,7 @@ if ($adminer->homepage()) {
}
if (support("routine")) {
echo "<h3>" . lang('Routines') . "</h3>\n";
echo "<h3 id='routines'>" . lang('Routines') . "</h3>\n";
$routines = routines();
if ($routines) {
echo "<table cellspacing='0'>\n";
@@ -140,7 +148,7 @@ if ($adminer->homepage()) {
}
if (support("sequence")) {
echo "<h3>" . lang('Sequences') . "</h3>\n";
echo "<h3 id='sequences'>" . lang('Sequences') . "</h3>\n";
$sequences = get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema()");
if ($sequences) {
echo "<table cellspacing='0'>\n";
@@ -155,13 +163,13 @@ if ($adminer->homepage()) {
}
if (support("type")) {
echo "<h3>" . lang('User types') . "</h3>\n";
$types = types();
if ($types) {
echo "<h3 id='user-types'>" . lang('User types') . "</h3>\n";
$user_types = types();
if ($user_types) {
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "</thead>\n";
odd('');
foreach ($types as $val) {
foreach ($user_types as $val) {
echo "<tr" . odd() . "><th><a href='" . h(ME) . "type=" . urlencode($val) . "'>" . h($val) . "</a>\n";
}
echo "</table>\n";
@@ -170,16 +178,17 @@ if ($adminer->homepage()) {
}
if (support("event")) {
echo "<h3>" . lang('Events') . "</h3>\n";
echo "<h3 id='events'>" . lang('Events') . "</h3>\n";
$rows = get_rows("SHOW EVENTS");
if ($rows) {
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "</thead>\n";
echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "<td></thead>\n";
foreach ($rows as $row) {
echo "<tr>";
echo '<th><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . h($row["Name"]) . "</a>";
echo "<th>" . h($row["Name"]);
echo "<td>" . ($row["Execute at"] ? lang('At given time') . "<td>" . $row["Execute at"] : lang('Every') . " " . $row["Interval value"] . " " . $row["Interval field"] . "<td>$row[Starts]");
echo "<td>$row[Ends]";
echo '<td><a href="' . h(ME) . 'event=' . urlencode($row["Name"]) . '">' . lang('Alter') . '</a>';
}
echo "</table>\n";
$event_scheduler = $connection->result("SELECT @@event_scheduler");

View File

@@ -366,16 +366,21 @@ if (!defined("DRIVER")) {
/** Get table status
* @param string
* @param bool return only "Name", "Engine" and "Comment" fields
* @return array array($name => array("Name" => , "Engine" => , "Comment" => , "Oid" => , "Rows" => , "Collation" => , "Auto_increment" => , "Data_length" => , "Index_length" => , "Data_free" => )) or only inner array with $name
*/
function table_status($name = "") {
function table_status($name = "", $fast = false) {
global $connection;
$return = array();
foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_")) : "")) as $row) {
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) : "")
: "SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")
) as $row) {
if ($row["Engine"] == "InnoDB") {
// ignore internal comment, unnecessary since MySQL 5.1.21
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
}
if (!isset($row["Rows"])) {
if (!isset($row["Engine"])) {
$row["Comment"] = "";
}
if ($name != "") {
@@ -391,7 +396,7 @@ if (!defined("DRIVER")) {
* @return bool
*/
function is_view($table_status) {
return !isset($table_status["Rows"]);
return !isset($table_status["Engine"]);
}
/** Check if table supports foreign keys
@@ -550,6 +555,7 @@ if (!defined("DRIVER")) {
* @return bool
*/
function drop_databases($databases) {
restart_session();
set_session("dbs", null);
return apply_queries("DROP DATABASE", $databases, 'idf_escape');
}
@@ -732,7 +738,7 @@ if (!defined("DRIVER")) {
*/
function triggers($table) {
$return = array();
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_"))) as $row) {
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\"))) as $row) {
$return[$row["Trigger"]] = array($row["Timing"], $row["Event"]);
}
return $return;
@@ -791,7 +797,7 @@ if (!defined("DRIVER")) {
* @return array ("ROUTINE_TYPE" => , "ROUTINE_NAME" => , "DTD_IDENTIFIER" => )
*/
function routines() {
return get_rows("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB));
return get_rows("SELECT ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q(DB));
}
/** Get list of available routine languages
@@ -845,7 +851,7 @@ if (!defined("DRIVER")) {
* @return Min_Result
*/
function explain($connection, $query) {
return $connection->query("EXPLAIN $query");
return $connection->query("EXPLAIN " . ($connection->server_info >= 5.1 ? "PARTITIONS " : "") . $query);
}
/** Get approximate number of rows
@@ -923,7 +929,7 @@ if (!defined("DRIVER")) {
*/
function trigger_sql($table, $style) {
$return = "";
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_")), null, "-- ") as $row) {
foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\")), null, "-- ") as $row) {
$return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . table($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
}
@@ -959,6 +965,9 @@ if (!defined("DRIVER")) {
if (ereg("binary", $field["type"])) {
return "HEX(" . idf_escape($field["field"]) . ")";
}
if ($field["type"] == "bit") {
return "BIN(" . idf_escape($field["field"]) . " + 0)"; // + 0 is required outside MySQLnd
}
if (ereg("geometry|point|linestring|polygon", $field["type"])) {
return "AsWKT(" . idf_escape($field["field"]) . ")";
}
@@ -973,6 +982,9 @@ if (!defined("DRIVER")) {
if (ereg("binary", $field["type"])) {
$return = "UNHEX($return)";
}
if ($field["type"] == "bit") {
return "CONV($return, 2, 10) + 0";
}
if (ereg("geometry|point|linestring|polygon", $field["type"])) {
$return = "GeomFromText($return)";
}
@@ -1003,7 +1015,7 @@ if (!defined("DRIVER")) {
$structured_types[$key] = array_keys($val);
}
$unsigned = array("unsigned", "zerofill", "unsigned zerofill"); ///< @var array number variants
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", ""); ///< @var array operators used in select
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "REGEXP", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL"); ///< @var array operators used in select
$functions = array("char_length", "date", "from_unixtime", "lower", "round", "sec_to_time", "time_to_sec", "upper"); ///< @var array functions used in select
$grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum"); ///< @var array grouping functions used in select
$edit_functions = array( ///< @var array of array("$type|$type2" => "$function/$function2") functions used in editing, [0] - edit and insert, [1] - edit only

View File

@@ -386,7 +386,7 @@ ORDER BY PROCESS
$structured_types[$key] = array_keys($val);
}
$unsigned = array();
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "");
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT REGEXP", "NOT IN", "IS NOT NULL", "SQL");
$functions = array("length", "lower", "round", "upper");
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
$edit_functions = array(

View File

@@ -227,7 +227,7 @@ AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema(
function fields($table) {
$return = array();
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull, col_description(c.oid, a.attnum) AS comment
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
JOIN pg_attribute a ON c.oid = a.attrelid
@@ -242,7 +242,7 @@ ORDER BY a.attnum"
ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match);
list(, $row["type"], , $row["length"]) = $match;
$row["full_type"] = $row["type"] . ($row["length"] ? "($row[length])" : "");
$row["null"] = ($row["attnotnull"] == "f");
$row["null"] = !$row["attnotnull"];
$row["auto_increment"] = eregi("^nextval\\(", $row["default"]);
$row["privileges"] = array("insert" => 1, "select" => 1, "update" => 1);
if (preg_match('~^(.*)::.+$~', $row["default"], $match)) {
@@ -261,8 +261,8 @@ 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, indisprimary, 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"] == "t" ? "PRIMARY" : ($row["indisunique"] == "t" ? "UNIQUE" : "INDEX"));
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 (explode(" ", $row["indkey"]) as $indkey) {
$return[$row["relname"]]["columns"][] = $columns[$indkey];
@@ -607,7 +607,7 @@ AND typelem = 0"
$structured_types[$key] = array_keys($val);
}
$unsigned = array();
$operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "" to avoid SQL injection
$operators = array("=", "<", ">", "<=", ">=", "!=", "~", "!~", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL"); // no "SQL" to avoid SQL injection
$functions = array("char_length", "lower", "round", "to_hex", "to_timestamp", "upper");
$grouping = array("avg", "count", "count distinct", "max", "min", "sum");
$edit_functions = array(

View File

@@ -5,7 +5,7 @@ $drivers["sqlite2"] = "SQLite 2";
if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
$possible_drivers = array((isset($_GET["sqlite"]) ? "SQLite3" : "SQLite"), "PDO_SQLite");
define("DRIVER", (isset($_GET["sqlite"]) ? "sqlite" : "sqlite2"));
if (extension_loaded(isset($_GET["sqlite"]) ? "sqlite3" : "sqlite")) {
if (class_exists(isset($_GET["sqlite"]) ? "SQLite3" : "SQLiteDatabase")) {
if (isset($_GET["sqlite"])) {
class Min_SQLite {
@@ -505,11 +505,19 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return true;
}
function index_sql($table, $type, $name, $columns) {
return "CREATE $type " . ($type != "INDEX" ? "INDEX " : "")
. idf_escape($name != "" ? $name : uniqid($table . "_"))
. " ON " . table($table)
. " $columns"
;
}
function alter_indexes($table, $alter) {
foreach ($alter as $val) {
if (!queries($val[2] == "DROP"
? "DROP INDEX " . idf_escape($val[1])
: "CREATE $val[0] " . ($val[0] != "INDEX" ? "INDEX " : "") . idf_escape($val[1] != "" ? $val[1] : uniqid($table . "_")) . " ON " . table($table) . " $val[2]"
: index_sql($table, $val[0], $val[1], $val[2])
)) {
return false;
}
@@ -612,7 +620,14 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function create_sql($table, $auto_increment) {
global $connection;
return $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q($table));
$return = $connection->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q($table));
foreach (indexes($table) as $name => $index) {
if ($name == '') {
continue;
}
$return .= ";\n\n" . index_sql($table, $index['type'], $name, "(" . implode(", ", array_map('idf_escape', $index['columns'])) . ")");
}
return $return;
}
function truncate_sql($table) {
@@ -659,7 +674,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
$types = array("integer" => 0, "real" => 0, "numeric" => 0, "text" => 0, "blob" => 0);
$structured_types = array_keys($types);
$unsigned = array();
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", ""); // REGEXP can be user defined function
$operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL", "SQL"); // REGEXP can be user defined function
$functions = array("hex", "length", "lower", "round", "unixepoch", "upper");
$grouping = array("avg", "count", "count distinct", "group_concat", "max", "min", "sum");
$edit_functions = array(

View File

@@ -1,20 +1,24 @@
<?php
$TABLE = $_GET["dump"];
if ($_POST) {
if ($_POST && !$error) {
$cookie = "";
foreach (array("output", "format", "db_style", "routines", "events", "table_style", "auto_increment", "triggers", "data_style") as $key) {
$cookie .= "&$key=" . urlencode($_POST[$key]);
}
cookie("adminer_export", substr($cookie, 1));
$ext = dump_headers(($TABLE != "" ? $TABLE : DB), (DB == "" || count((array) $_POST["tables"] + (array) $_POST["data"]) > 1));
$is_sql = ($_POST["format"] == "sql");
$tables = array_flip((array) $_POST["tables"]) + array_flip((array) $_POST["data"]);
$ext = dump_headers(
(count($tables) == 1 ? key($tables) : DB),
(DB == "" || count($tables) > 1));
$is_sql = ereg('sql', $_POST["format"]);
if ($is_sql) {
echo "-- Adminer $VERSION " . $drivers[DRIVER] . " dump
" . ($jush != "sql" ? "" : "SET NAMES utf8;
" . ($_POST["data_style"] ? "SET foreign_key_checks = 0;
SET time_zone = " . q($connection->result("SELECT @@time_zone")) . ";
SET time_zone = " . q(substr(preg_replace('~^[^-]~', '+\0', $connection->result("SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP)")), 0, 6)) . ";
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
" : "") . "
");
@@ -28,22 +32,22 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
$databases = explode("\n", rtrim(str_replace("\r", "", $databases), "\n"));
}
}
foreach ((array) $databases as $db) {
$adminer->dumpDatabase($db);
if ($connection->select_db($db)) {
if ($is_sql && ereg('CREATE', $style) && ($create = $connection->result("SHOW CREATE DATABASE " . idf_escape($db), 1))) {
if ($style == "DROP+CREATE") {
echo "DROP DATABASE IF EXISTS " . idf_escape($db) . ";\n";
}
echo ($style == "CREATE+ALTER" ? preg_replace('~^CREATE DATABASE ~', '\\0IF NOT EXISTS ', $create) : $create) . ";\n";
echo "$create;\n";
}
if ($is_sql) {
if ($style) {
echo use_sql($db) . ";\n\n";
}
if (in_array("CREATE+ALTER", array($style, $_POST["table_style"]))) {
echo "SET @adminer_alter = '';\n\n";
}
$out = "";
if ($_POST["routines"]) {
foreach (array("FUNCTION", "PROCEDURE") as $routine) {
foreach (get_rows("SHOW $routine STATUS WHERE Db = " . q($db), null, "-- ") as $row) {
@@ -52,12 +56,14 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
}
}
}
if ($_POST["events"]) {
foreach (get_rows("SHOW EVENTS", null, "-- ") as $row) {
$out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
. remove_definer($connection->result("SHOW CREATE EVENT " . idf_escape($row["Name"]), 3)) . ";;\n\n";
}
}
if ($out) {
echo "DELIMITER ;;\n\n$out" . "DELIMITER ;\n\n";
}
@@ -65,87 +71,53 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
if ($_POST["table_style"] || $_POST["data_style"]) {
$views = array();
foreach (table_status() as $table_status) {
$table = (DB == "" || in_array($table_status["Name"], (array) $_POST["tables"]));
$data = (DB == "" || in_array($table_status["Name"], (array) $_POST["data"]));
foreach (table_status('', true) as $name => $table_status) {
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
if ($table || $data) {
if (!is_view($table_status)) {
if ($ext == "tar") {
ob_start();
}
$adminer->dumpTable($table_status["Name"], ($table ? $_POST["table_style"] : ""));
if ($data) {
$adminer->dumpData($table_status["Name"], $_POST["data_style"], "SELECT * FROM " . table($table_status["Name"]));
}
if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($table_status["Name"], $_POST["table_style"]))) {
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
}
if ($ext == "tar") {
echo tar_file((DB != "" ? "" : "$db/") . "$table_status[Name].csv", ob_get_clean());
} elseif ($is_sql) {
echo "\n";
}
if ($ext == "tar") {
$tmp_file = new TmpFile;
ob_start(array($tmp_file, 'write'), 1e5);
}
$adminer->dumpTable($name, ($table ? $_POST["table_style"] : ""), (is_view($table_status) ? 2 : 0));
if (is_view($table_status)) {
$views[] = $name;
} elseif ($data) {
$fields = fields($name);
$adminer->dumpData($name, $_POST["data_style"], "SELECT *" . convert_fields($fields, $fields) . " FROM " . table($name));
}
if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($name, $_POST["table_style"]))) {
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
}
if ($ext == "tar") {
ob_end_flush();
tar_file((DB != "" ? "" : "$db/") . "$name.csv", $tmp_file);
} elseif ($is_sql) {
$views[] = $table_status["Name"];
echo "\n";
}
}
}
foreach ($views as $view) {
$adminer->dumpTable($view, $_POST["table_style"], true);
$adminer->dumpTable($view, $_POST["table_style"], 1);
}
if ($ext == "tar") {
echo pack("x512");
}
}
if ($style == "CREATE+ALTER" && $is_sql) {
// drop old tables
$query = "SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";
echo "DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _table_name, _engine, _table_collation varchar(64);
DECLARE _table_comment varchar(64);
DECLARE done bool DEFAULT 0;
DECLARE tables CURSOR FOR $query;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN tables;
REPEAT
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN
CASE _table_name";
foreach (get_rows($query) as $row) {
$comment = q($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]);
echo "
WHEN " . q($row["TABLE_NAME"]) . " THEN
" . (isset($row["ENGINE"]) ? "IF _engine != '$row[ENGINE]' OR _table_collation != '$row[TABLE_COLLATION]' OR _table_comment != $comment THEN
ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment;
END IF" : "BEGIN END") . ";";
}
echo "
ELSE
SET alter_command = CONCAT(alter_command, 'DROP TABLE `', REPLACE(_table_name, '`', '``'), '`;\\n');
END CASE;
END IF;
UNTIL done END REPEAT;
CLOSE tables;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";
}
if (in_array("CREATE+ALTER", array($style, $_POST["table_style"])) && $is_sql) {
echo "SELECT @adminer_alter;\n";
}
}
}
if ($is_sql) {
echo "-- " . $connection->result("SELECT NOW()") . "\n";
}
exit;
}
page_header(lang('Export'), "", ($_GET["export"] != "" ? array("table" => $_GET["export"]) : array()), DB);
page_header(lang('Export'), $error, ($_GET["export"] != "" ? array("table" => $_GET["export"]) : array()), DB);
?>
<form action="" method="post">
@@ -154,9 +126,7 @@ page_header(lang('Export'), "", ($_GET["export"] != "" ? array("table" => $_GET[
$db_style = array('', 'USE', 'DROP+CREATE', 'CREATE');
$table_style = array('', 'DROP+CREATE', 'CREATE');
$data_style = array('', 'TRUNCATE+INSERT', 'INSERT');
if ($jush == "sql") {
$db_style[] = 'CREATE+ALTER';
$table_style[] = 'CREATE+ALTER';
if ($jush == "sql") { //! use insert_update() in all drivers
$data_style[] = 'INSERT+UPDATE';
}
parse_str($_COOKIE["adminer_export"], $row);
@@ -167,20 +137,26 @@ if (!isset($row["events"])) { // backwards compatibility
$row["routines"] = $row["events"] = ($_GET["dump"] == "");
$row["triggers"] = $row["table_style"];
}
echo "<tr><th>" . lang('Output') . "<td>" . html_select("output", $adminer->dumpOutput(), $row["output"], 0) . "\n"; // 0 - radio
echo "<tr><th>" . lang('Format') . "<td>" . html_select("format", $adminer->dumpFormat(), $row["format"], 0) . "\n"; // 0 - radio
echo ($jush == "sqlite" ? "" : "<tr><th>" . lang('Database') . "<td>" . html_select('db_style', $db_style, $row["db_style"])
. (support("routine") ? checkbox("routines", 1, $row["routines"], lang('Routines')) : "")
. (support("event") ? checkbox("events", 1, $row["events"], lang('Events')) : "")
);
echo "<tr><th>" . lang('Tables') . "<td>" . html_select('table_style', $table_style, $row["table_style"])
. checkbox("auto_increment", 1, $row["auto_increment"], lang('Auto Increment'))
. (support("trigger") ? checkbox("triggers", 1, $row["triggers"], lang('Triggers')) : "")
;
echo "<tr><th>" . lang('Data') . "<td>" . html_select('data_style', $data_style, $row["data_style"]);
?>
</table>
<p><input type="submit" value="<?php echo lang('Export'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<table cellspacing="0">
<?php
@@ -188,32 +164,37 @@ $prefixes = array();
if (DB != "") {
$checked = ($TABLE != "" ? "" : " checked");
echo "<thead><tr>";
echo "<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$checked onclick='formCheck(this, /^tables\\[/);'>" . lang('Tables') . "</label>";
echo "<th style='text-align: right;'><label>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='formCheck(this, /^data\\[/);'></label>";
echo "<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$checked onclick='formCheck(this, /^tables\\[/);'>" . lang('Tables') . "</label>";
echo "<th style='text-align: right;'><label class='block'>" . lang('Data') . "<input type='checkbox' id='check-data'$checked onclick='formCheck(this, /^data\\[/);'></label>";
echo "</thead>\n";
$views = "";
//! defer number of rows to JavaScript
foreach (table_status() as $table_status) {
$name = $table_status["Name"];
$tables_list = tables_list();
foreach ($tables_list as $name => $type) {
$prefix = ereg_replace("_.*", "", $name);
$checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "checkboxClick(event, this); formUncheck('check-tables');");
if (is_view($table_status)) {
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "checkboxClick(event, this); formUncheck('check-tables');", "block");
if ($type !== null && !eregi("table", $type)) {
$views .= "$print\n";
} else {
echo "$print<td align='right'><label>" . ($table_status["Engine"] == "InnoDB" && $table_status["Rows"] ? "~ " : "") . $table_status["Rows"] . checkbox("data[]", $name, $checked, "", "checkboxClick(event, this); formUncheck('check-data');") . "</label>\n";
echo "$print<td align='right'><label class='block'><span id='Rows-" . h($name) . "'></span>" . checkbox("data[]", $name, $checked, "", "checkboxClick(event, this); formUncheck('check-data');") . "</label>\n";
}
$prefixes[$prefix]++;
}
echo $views;
if ($tables_list) {
echo "<script type='text/javascript'>ajaxSetHtml('" . js_escape(ME) . "script=db');</script>\n";
}
} else {
echo "<thead><tr><th style='text-align: left;'><label><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
echo "<thead><tr><th style='text-align: left;'><label class='block'><input type='checkbox' id='check-databases'" . ($TABLE == "" ? " checked" : "") . " onclick='formCheck(this, /^databases\\[/);'>" . lang('Database') . "</label></thead>\n";
$databases = $adminer->databases();
if ($databases) {
foreach ($databases as $db) {
if (!information_schema($db)) {
$prefix = ereg_replace("_.*", "", $db);
echo "<tr><td>" . checkbox("databases[]", $db, $TABLE == "" || $TABLE == "$prefix%", $db, "formUncheck('check-databases');") . "</label>\n";
echo "<tr><td>" . checkbox("databases[]", $db, $TABLE == "" || $TABLE == "$prefix%", $db, "formUncheck('check-databases');", "block") . "\n";
$prefixes[$prefix]++;
}
}

View File

@@ -8,6 +8,7 @@ foreach ($fields as $name => $field) {
unset($fields[$name]);
}
}
if ($_POST && !$error && !isset($_GET["select"])) {
$location = $_POST["referer"];
if ($_POST["insert"]) { // continue edit or insert
@@ -15,8 +16,18 @@ if ($_POST && !$error && !isset($_GET["select"])) {
} elseif (!ereg('^.+&select=.+$', $location)) {
$location = ME . "select=" . urlencode($TABLE);
}
$indexes = indexes($TABLE);
$unique_array = unique_array($_GET["where"], $indexes);
$query_where = "\nWHERE $where";
if (isset($_POST["delete"])) {
query_redirect("DELETE" . limit1("FROM " . table($TABLE), " WHERE $where"), $location, lang('Item has been deleted.'));
$query = "FROM " . table($TABLE);
query_redirect(
"DELETE" . ($unique_array ? " $query$query_where" : limit1($query, $query_where)),
$location,
lang('Item has been deleted.')
);
} else {
$set = array();
foreach ($fields as $name => $field) {
@@ -25,11 +36,17 @@ if ($_POST && !$error && !isset($_GET["select"])) {
$set[idf_escape($name)] = ($update ? "\n" . idf_escape($name) . " = $val" : $val);
}
}
if ($update) {
if (!$set) {
redirect($location);
}
query_redirect("UPDATE" . limit1(table($TABLE) . " SET" . implode(",", $set), "\nWHERE $where"), $location, lang('Item has been updated.'));
$query = table($TABLE) . " SET" . implode(",", $set);
query_redirect(
"UPDATE" . ($unique_array ? " $query$query_where" : limit1($query, $query_where)),
$location,
lang('Item has been updated.')
);
} else {
$result = insert_into($TABLE, $set);
$last_id = ($result ? last_id() : 0);
@@ -38,7 +55,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
}
}
$table_name = $adminer->tableName(table_status($TABLE));
$table_name = $adminer->tableName(table_status($TABLE, true));
page_header(
($update ? lang('Edit') : lang('Insert')),
$error,
@@ -81,24 +98,32 @@ if (!$fields) {
echo "<p class='error'>" . lang('You have no privileges to update this table.') . "\n";
} else {
echo "<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";
foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)];
if ($default === null) {
$default = $field["default"];
if ($field["type"] == "bit" && ereg("^b'([01]*)'\$", $default, $regs)) {
$default = $regs[1];
}
}
$value = ($row !== null
? ($row[$name] != "" && $jush == "sql" && ereg("enum|set", $field["type"]) ? (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : $row[$name])
: (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : ($default !== null ? $default : $field["default"])))
: (!$update && $field["auto_increment"] ? "" : (isset($_GET["select"]) ? false : $default))
);
if (!$_POST["save"] && is_string($value)) {
$value = $adminer->editVal($value, $field);
}
$function = ($_POST["save"] ? (string) $_POST["function"][$name] : ($update && $field["on_update"] == "CURRENT_TIMESTAMP" ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL'))));
if ($field["type"] == "timestamp" && $value == "CURRENT_TIMESTAMP") {
if (ereg("time", $field["type"]) && $value == "CURRENT_TIMESTAMP") {
$value = "";
$function = "now";
}
input($field, $value, $function);
echo "\n";
}
echo "</table>\n";
}
?>
@@ -111,7 +136,7 @@ if ($fields) {
}
}
echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\">\n"
: ($_POST || !$fields ? "" : "<script type='text/javascript'>document.getElementById('form').getElementsByTagName('td')[1].firstChild.focus();</script>\n")
: ($_POST || !$fields ? "" : "<script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script>\n")
);
if (isset($_GET["select"])) {
hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));

View File

@@ -2,31 +2,32 @@
$EVENT = $_GET["event"];
$intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND");
$statuses = array("ENABLED" => "ENABLE", "DISABLED" => "DISABLE", "SLAVESIDE_DISABLED" => "DISABLE ON SLAVE");
$row = $_POST;
if ($_POST && !$error) {
if ($_POST["drop"]) {
query_redirect("DROP EVENT " . idf_escape($EVENT), substr(ME, 0, -1), lang('Event has been dropped.'));
} elseif (in_array($_POST["INTERVAL_FIELD"], $intervals) && isset($statuses[$_POST["STATUS"]])) {
$schedule = "\nON SCHEDULE " . ($_POST["INTERVAL_VALUE"]
? "EVERY " . q($_POST["INTERVAL_VALUE"]) . " $_POST[INTERVAL_FIELD]"
. ($_POST["STARTS"] ? " STARTS " . q($_POST["STARTS"]) : "")
. ($_POST["ENDS"] ? " ENDS " . q($_POST["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173
: "AT " . q($_POST["STARTS"])
) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
} elseif (in_array($row["INTERVAL_FIELD"], $intervals) && isset($statuses[$row["STATUS"]])) {
$schedule = "\nON SCHEDULE " . ($row["INTERVAL_VALUE"]
? "EVERY " . q($row["INTERVAL_VALUE"]) . " $row[INTERVAL_FIELD]"
. ($row["STARTS"] ? " STARTS " . q($row["STARTS"]) : "")
. ($row["ENDS"] ? " ENDS " . q($row["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173
: "AT " . q($row["STARTS"])
) . " ON COMPLETION" . ($row["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
;
queries_redirect(substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), queries(($EVENT != ""
? "ALTER EVENT " . idf_escape($EVENT) . $schedule
. ($EVENT != $_POST["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($_POST["EVENT_NAME"]) : "")
: "CREATE EVENT " . idf_escape($_POST["EVENT_NAME"]) . $schedule
) . "\n" . $statuses[$_POST["STATUS"]] . " COMMENT " . q($_POST["EVENT_COMMENT"])
. rtrim(" DO\n$_POST[EVENT_DEFINITION]", ";") . ";"
. ($EVENT != $row["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($row["EVENT_NAME"]) : "")
: "CREATE EVENT " . idf_escape($row["EVENT_NAME"]) . $schedule
) . "\n" . $statuses[$row["STATUS"]] . " COMMENT " . q($row["EVENT_COMMENT"])
. rtrim(" DO\n$row[EVENT_DEFINITION]", ";") . ";"
));
}
}
page_header(($EVENT != "" ? lang('Alter event') . ": " . h($EVENT) : lang('Create event')), $error);
$row = $_POST;
if (!$row && $EVENT != "") {
$rows = get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . q(DB) . " AND EVENT_NAME = " . q($EVENT));
$row = reset($rows);
@@ -35,9 +36,9 @@ if (!$row && $EVENT != "") {
<form action="" method="post">
<table cellspacing="0">
<tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64">
<tr><th><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
<tr><th><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
<tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64" autocapitalize="off">
<tr><th title="datetime"><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
<tr><th title="datetime"><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
<tr><th><?php echo lang('Every'); ?><td><input type="number" name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" class="size"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
<tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
<tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" maxlength="64">

View File

@@ -1,50 +1,50 @@
<?php
$TABLE = $_GET["foreign"];
$name = $_GET["name"];
$row = $_POST;
if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-js"]) {
if ($_POST["drop"]) {
query_redirect("ALTER TABLE " . table($TABLE) . "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($_GET["name"]), ME . "table=" . urlencode($TABLE), lang('Foreign key has been dropped.'));
query_redirect("ALTER TABLE " . table($TABLE) . "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($name), ME . "table=" . urlencode($TABLE), lang('Foreign key has been dropped.'));
} else {
$source = array_filter($_POST["source"], 'strlen');
$source = array_filter($row["source"], 'strlen');
ksort($source); // enforce input order
$target = array();
foreach ($source as $key => $val) {
$target[$key] = $_POST["target"][$key];
$target[$key] = $row["target"][$key];
}
query_redirect("ALTER TABLE " . table($TABLE)
. ($_GET["name"] != "" ? "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($_GET["name"]) . "," : "")
. "\nADD FOREIGN KEY (" . implode(", ", array_map('idf_escape', $source)) . ") REFERENCES " . table($_POST["table"]) . " (" . implode(", ", array_map('idf_escape', $target)) . ")" //! reuse $_GET["name"] - check in older MySQL versions
. (ereg("^($on_actions)\$", $_POST["on_delete"]) ? " ON DELETE $_POST[on_delete]" : "")
. (ereg("^($on_actions)\$", $_POST["on_update"]) ? " ON UPDATE $_POST[on_update]" : "")
, ME . "table=" . urlencode($TABLE), ($_GET["name"] != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));
. ($name != "" ? "\nDROP " . ($jush == "sql" ? "FOREIGN KEY " : "CONSTRAINT ") . idf_escape($name) . "," : "")
. "\nADD FOREIGN KEY (" . implode(", ", array_map('idf_escape', $source)) . ") REFERENCES " . table($row["table"]) . " (" . implode(", ", array_map('idf_escape', $target)) . ")" //! reuse $name - check in older MySQL versions
. (ereg("^($on_actions)\$", $row["on_delete"]) ? " ON DELETE $row[on_delete]" : "")
. (ereg("^($on_actions)\$", $row["on_update"]) ? " ON UPDATE $row[on_update]" : "")
, ME . "table=" . urlencode($TABLE), ($name != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));
$error = lang('Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.') . "<br>$error"; //! no partitioning
}
}
page_header(lang('Foreign key'), $error, array("table" => $TABLE), $TABLE);
$row = array("table" => $TABLE, "source" => array(""));
if ($_POST) {
$row = $_POST;
ksort($row["source"]);
if ($_POST["add"]) {
$row["source"][] = "";
} elseif ($_POST["change"] || $_POST["change-js"]) {
$row["target"] = array();
}
} elseif ($_GET["name"] != "") {
} elseif ($name != "") {
$foreign_keys = foreign_keys($TABLE);
$row = $foreign_keys[$_GET["name"]];
$row = $foreign_keys[$name];
$row["source"][] = "";
} else {
$row["table"] = $TABLE;
$row["source"] = array("");
}
$source = array_keys(fields($TABLE)); //! no text and blob
$target = ($TABLE === $row["table"] ? $source : array_keys(fields($row["table"])));
$referencable = array();
foreach (table_status() as $name => $table_status) {
if (fk_support($table_status)) {
$referencable[] = $name;
}
}
$referencable = array_keys(array_filter(table_status('', true), 'fk_support'));
?>
<form action="" method="post">
@@ -73,6 +73,6 @@ foreach ($row["source"] as $key => $val) {
<input type="submit" value="<?php echo lang('Save'); ?>">
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
<?php } ?>
<?php if ($_GET["name"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -71,14 +71,14 @@ class Adminer {
?>
<table cellspacing="0">
<tr><th><?php echo lang('System'); ?><td><?php echo html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);"); ?>
<tr><th><?php echo lang('Server'); ?><td><input name="auth[server]" value="<?php echo h(SERVER); ?>" title="hostname[:port]">
<tr><th><?php echo lang('Username'); ?><td><input id="username" name="auth[username]" value="<?php echo h($_GET["username"]); ?>">
<tr><th><?php echo lang('Server'); ?><td><input name="auth[server]" value="<?php echo h(SERVER); ?>" title="hostname[:port]" placeholder="localhost" autocapitalize="off">
<tr><th><?php echo lang('Username'); ?><td><input name="auth[username]" id="username" value="<?php echo h($_GET["username"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
<tr><th><?php echo lang('Database'); ?><td><input name="auth[db]" value="<?php echo h($_GET["db"]); ?>">
<tr><th><?php echo lang('Database'); ?><td><input name="auth[db]" value="<?php echo h($_GET["db"]); ?>" autocapitalize="off">
</table>
<script type="text/javascript">
var username = document.getElementById('username');
username.focus();
focus(username);
username.form['auth[driver]'].onchange();
</script>
<?php
@@ -164,8 +164,11 @@ username.form['auth[driver]'].onchange();
* @return string
*/
function selectQuery($query) {
global $jush;
return "<p><a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Last page') . "'>&gt;&gt;</a> <code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a></p>\n"; // </p> - required for IE9 inline edit
global $jush, $token;
return "<form action='" . h(ME) . "sql=' method='post'><p><span onclick=\"return !selectEditSql(event, this, '" . lang('Execute') . "');\">"
. "<code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code>"
. " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>"
. "</span><input type='hidden' name='token' value='$token'></p></form>\n"; // </p> - required for IE9 inline edit
}
/** Description of a row in a table
@@ -202,7 +205,7 @@ username.form['auth[driver]'].onchange();
function selectVal($val, $link, $field) {
$return = ($val === null ? "<i>NULL</i>" : (ereg("char|binary", $field["type"]) && !ereg("var", $field["type"]) ? "<code>$val</code>" : $val));
if (ereg('blob|bytea|raw|file', $field["type"]) && !is_utf8($val)) {
$return = lang('%d byte(s)', strlen($val));
$return = lang('%d byte(s)', strlen(html_entity_decode($val, ENT_QUOTES)));
}
return ($link ? "<a href='" . h($link) . "'>$return</a>" : $return);
}
@@ -226,14 +229,15 @@ 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>)</div>\n";
echo "(<select name='columns[$i][col]' onchange='selectFieldChange(this.form);'><option>" . optionlist($columns, $val["col"], true) . "</select>) $move</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>)</div>\n";
echo "(<select name='columns[$i][col]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>) $move</div>\n";
echo "</div></fieldset>\n";
}
@@ -261,7 +265,7 @@ username.form['auth[driver]'].onchange();
if (!$val || ("$val[col]$val[val]" != "" && in_array($val["op"], $this->operators))) {
echo "<div><select name='where[$i][col]' onchange='$change_next'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>";
echo html_select("where[$i][op]", $this->operators, $val["op"], $change_next);
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'></div>\n";
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";' onsearch='selectSearchSearch(this);'></div>\n";
}
}
echo "</div></fieldset>\n";
@@ -397,8 +401,8 @@ username.form['auth[driver]'].onchange();
if (ereg('IN$', $val["op"])) {
$in = process_length($val["val"]);
$cond .= " (" . ($in != "" ? $in : "NULL") . ")";
} elseif (!$val["op"]) {
$cond .= $val["val"]; // SQL injection
} elseif ($val["op"] == "SQL") {
$cond = " $val[val]"; // SQL injection
} elseif ($val["op"] == "LIKE %%") {
$cond = " LIKE " . $this->processInput($fields[$val["col"]], "%$val[val]%");
} elseif (!ereg('NULL$', $val["op"])) {
@@ -411,7 +415,7 @@ username.form['auth[driver]'].onchange();
$cols = array();
foreach ($fields as $name => $field) {
$is_text = ereg('char|text|enum|set', $field["type"]);
if ((is_numeric($val["val"]) || !ereg('int|float|double|decimal|bit', $field["type"]))
if ((is_numeric($val["val"]) || !ereg('(^|[^o])int|float|double|decimal|bit', $field["type"]))
&& (!ereg("[\x80-\xFF]", $val["val"]) || $is_text)
) {
$name = idf_escape($name);
@@ -444,7 +448,7 @@ username.form['auth[driver]'].onchange();
* @return string expression to use in LIMIT, will be escaped
*/
function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "30");
return (isset($_GET["limit"]) ? $_GET["limit"] : "50");
}
/** Process length box in select
@@ -482,10 +486,9 @@ username.form['auth[driver]'].onchange();
*/
function messageQuery($query) {
global $jush;
static $count = 0;
restart_session();
$id = "sql-" . ($count++);
$history = &get_session("queries");
$id = "sql-" . count($history[$_GET["db"]]);
if (strlen($query) > 1e6) {
$query = ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..."; // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
}
@@ -508,7 +511,7 @@ username.form['auth[driver]'].onchange();
}
}
if ($key && !ereg('set|blob|bytea|raw|file', $field["type"])) {
$return .= "/=";
$return .= "/SQL";
}
}
}
@@ -539,11 +542,11 @@ username.form['auth[driver]'].onchange();
* @return string expression to use in a query
*/
function processInput($field, $value, $function = "") {
if ($function == "=") {
if ($function == "SQL") {
return $value; // SQL injection
}
$name = $field["field"];
$return = ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $value) ? $value : q($value));
$return = q($value);
if (ereg('^(now|getdate|uuid)$', $function)) {
$return = "$function()";
} elseif (ereg('^current_(date|timestamp)$', $function)) {
@@ -568,10 +571,6 @@ username.form['auth[driver]'].onchange();
if (function_exists('gzencode')) {
$return['gz'] = 'gzip';
}
if (function_exists('bzcompress')) {
$return['bz2'] = 'bzip2';
}
// ZipArchive requires temporary file, ZIP can be created by gzcompress - see PEAR File_Archive
return $return;
}
@@ -582,99 +581,43 @@ username.form['auth[driver]'].onchange();
return array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV');
}
/** Export database structure
* @param string
* @return null prints data
*/
function dumpDatabase($db) {
}
/** Export table structure
* @param string
* @param string
* @param bool
* @param int 0 table, 1 view, 2 temporary view table
* @return null prints data
*/
function dumpTable($table, $style, $is_view = false) {
function dumpTable($table, $style, $is_view = 0) {
if ($_POST["format"] != "sql") {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
if ($style) {
dump_csv(array_keys(fields($table)));
}
} elseif ($style) {
$create = create_sql($table, $_POST["auto_increment"]);
if ($create) {
if ($style == "DROP+CREATE") {
echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
if ($is_view == 2) {
$fields = array();
foreach (fields($table) as $name => $field) {
$fields[] = idf_escape($name) . " $field[full_type]";
}
if ($is_view) {
$create = "CREATE TABLE " . table($table) . " (" . implode(", ", $fields) . ")";
} else {
$create = create_sql($table, $_POST["auto_increment"]);
}
if ($create) {
if ($style == "DROP+CREATE" || $is_view == 1) {
echo "DROP " . ($is_view == 2 ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
}
if ($is_view == 1) {
$create = remove_definer($create);
}
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
}
if ($style == "CREATE+ALTER" && !$is_view) {
// create procedure which iterates over original columns and adds new and removes old
$query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION";
echo "DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
DECLARE _column_type, _column_default text;
DECLARE _is_nullable char(3);
DECLARE _extra varchar(30);
DECLARE _column_comment varchar(255);
DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '";
$fields = array();
$after = "";
foreach (get_rows($query) as $row) {
$default = $row["COLUMN_DEFAULT"];
$row["default"] = ($default !== null ? q($default) : "NULL");
$row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work
$row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
. " $row[COLUMN_TYPE]"
. ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
. ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
. ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
. ($row["EXTRA"] ? " $row[EXTRA]" : "")
. ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "")
. ($after ? " AFTER " . idf_escape($after) : " FIRST")
);
echo ", ADD $row[alter]";
$fields[] = $row;
$after = $row["COLUMN_NAME"];
}
echo "';
DECLARE columns CURSOR FOR $query;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET @alter_table = '';
OPEN columns;
REPEAT
FETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;
IF NOT done THEN
SET set_after = 1;
CASE _column_name";
foreach ($fields as $row) {
echo "
WHEN " . q($row["COLUMN_NAME"]) . " THEN
SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF(
_column_default <=> $row[default] AND _is_nullable = '$row[IS_NULLABLE]' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . " AND _column_type = " . q($row["COLUMN_TYPE"]) . " AND _extra = '$row[EXTRA]' AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " AND after = $row[after]
, '', ', MODIFY $row[alter]'));"
; //! don't replace in comment
}
echo "
ELSE
SET @alter_table = CONCAT(@alter_table, ', DROP ', _column_name);
SET set_after = 0;
END CASE;
IF set_after THEN
SET after = _column_name;
END IF;
END IF;
UNTIL done END REPEAT;
CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN
SET alter_command = CONCAT(alter_command, 'ALTER TABLE " . table($table) . "', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');
END IF;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";
//! indexes
echo "$create;\n\n";
}
}
}
@@ -689,10 +632,10 @@ DROP PROCEDURE adminer_alter;
global $connection, $jush;
$max_packet = ($jush == "sqlite" ? 0 : 1048576); // default, minimum is 1024
if ($style) {
if ($_POST["format"] == "sql" && $style == "TRUNCATE+INSERT") {
echo truncate_sql($table) . ";\n";
}
if ($_POST["format"] == "sql") {
if ($style == "TRUNCATE+INSERT") {
echo truncate_sql($table) . ";\n";
}
$fields = fields($table);
}
$result = $connection->query($query, 1); // 1 - MYSQLI_USE_RESULT //! enum and set as numbers
@@ -701,7 +644,8 @@ DROP PROCEDURE adminer_alter;
$buffer = "";
$keys = array();
$suffix = "";
while ($row = $result->fetch_row()) {
$fetch_function = ($table != '' ? 'fetch_assoc' : 'fetch_row');
while ($row = $result->$fetch_function()) {
if (!$keys) {
$values = array();
foreach ($row as $val) {
@@ -723,7 +667,11 @@ DROP PROCEDURE adminer_alter;
$insert = "INSERT INTO " . table($table) . " (" . implode(", ", array_map('idf_escape', $keys)) . ") VALUES";
}
foreach ($row as $key => $val) {
$row[$key] = ($val !== null ? (ereg('int|float|double|decimal|bit', $fields[$keys[$key]]["type"]) ? $val : q($val)) : "NULL"); //! columns looking like functions
$field = $fields[$key];
$row[$key] = ($val !== null
? unconvert_field($field, ereg('(^|[^o])int|float|double|decimal', $field["type"]) && $val != '' ? $val : q($val))
: "NULL"
);
}
$s = ($max_packet ? "\n" : " ") . "(" . implode(",\t", $row) . ")";
if (!$buffer) {
@@ -760,16 +708,12 @@ DROP PROCEDURE adminer_alter;
*/
function dumpHeaders($identifier, $multi_table = false) {
$output = $_POST["output"];
$ext = ($_POST["format"] == "sql" ? "sql" : ($multi_table ? "tar" : "csv")); // multiple CSV packed to TAR
$ext = (ereg('sql', $_POST["format"]) ? "sql" : ($multi_table ? "tar" : "csv")); // multiple CSV packed to TAR
header("Content-Type: " .
($output == "bz2" ? "application/x-bzip" :
($output == "gz" ? "application/x-gzip" :
($ext == "tar" ? "application/x-tar" :
($ext == "sql" || $output != "file" ? "text/plain" : "text/csv") . "; charset=utf-8"
))));
if ($output == "bz2") {
ob_start('bzcompress', 1e6);
}
)));
if ($output == "gz") {
ob_start('gzencode', 1e6);
}
@@ -837,7 +781,7 @@ DROP PROCEDURE adminer_alter;
$this->databasesPrint($missing);
if ($_GET["ns"] !== "" && !$missing && DB != "") {
echo '<p><a href="' . h(ME) . 'create="' . bold($_GET["create"] === "") . ">" . lang('Create new table') . "</a>\n";
$tables = tables_list();
$tables = table_status('', true);
if (!$tables) {
echo "<p class='message'>" . lang('No tables.') . "\n";
} else {
@@ -867,8 +811,13 @@ DROP PROCEDURE adminer_alter;
?>
<form action="">
<p id="dbs">
<?php hidden_fields_get(); ?>
<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
<?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
if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
@@ -887,14 +836,14 @@ DROP PROCEDURE adminer_alter;
}
/** Prints table list in menu
* @param array
* @param array result of table_status('', true)
* @return null
*/
function tablesPrint($tables) {
echo "<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
foreach ($tables as $table => $type) {
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(array("Name" => $table)) . "</a><br>\n"; //! Adminer::tableName may work with full table status
echo '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold($_GET["table"] == $table) . " title='" . lang('Show structure') . "'>" . $this->tableName($status) . "</a><br>\n";
}
}

View File

@@ -33,6 +33,7 @@ if ($auth) {
) {
redirect(auth_url($auth["driver"], $auth["server"], $auth["username"], $auth["db"]));
}
} elseif ($_POST["logout"]) {
if ($token && $_POST["token"] != $token) {
page_header(lang('Logout'), lang('Invalid CSRF token. Send the form again.'));
@@ -45,6 +46,7 @@ if ($auth) {
unset_permanent();
redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.'));
}
} elseif ($permanent && !$_SESSION["pwds"]) {
session_regenerate_id();
$private = $adminer->permanentLogin(); // try to decode even if not set
@@ -59,8 +61,8 @@ if ($auth) {
function unset_permanent() {
global $permanent;
foreach ($permanent as $key => $val) {
list($driver, $server, $username) = array_map('base64_decode', explode("-", $key));
if ($driver == DRIVER && $server == SERVER && $db == $_GET["username"]) {
list($driver, $server, $username, $db) = array_map('base64_decode', explode("-", $key));
if ($driver == DRIVER && $server == SERVER && $username == $_GET["username"] && $db == DB) {
unset($permanent[$key]);
}
}
@@ -105,6 +107,7 @@ if (isset($_GET["username"])) {
}
$connection = connect();
}
if (is_string($connection) || !$adminer->login($_GET["username"], get_session("pwds"))) {
auth_error();
exit;
@@ -114,7 +117,28 @@ $token = $_SESSION["token"]; ///< @var string CSRF protection
if ($auth && $_POST["token"]) {
$_POST["token"] = $token; // reset token after explicit login
}
$error = ($_POST ///< @var string
? ($_POST["token"] == $token ? "" : lang('Invalid CSRF token. Send the form again.'))
: ($_SERVER["REQUEST_METHOD"] != "POST" ? "" : lang('Too big POST data. Reduce the data or increase the %s configuration directive.', '"post_max_size"')) // posted form with no data means that post_max_size exceeded because Adminer always sends token at least
);
$error = ''; ///< @var string
if ($_POST) {
if ($_POST["token"] != $token) {
$ini = "max_input_vars";
$max_vars = ini_get($ini);
if (extension_loaded("suhosin")) {
foreach (array("suhosin.request.max_vars", "suhosin.post.max_vars") as $key) {
$val = ini_get($key);
if ($val && (!$max_vars || $val < $max_vars)) {
$ini = $key;
$max_vars = $val;
}
}
}
$error = (!$_POST["token"] && $max_vars
? lang('Maximum number of allowed fields exceeded. Please increase %s.', "'$ini'")
: lang('Invalid CSRF token. Send the form again.')
);
}
} 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'");
}

View File

@@ -28,7 +28,7 @@ include "../adminer/include/functions.inc.php";
global $adminer, $connection, $drivers, $edit_functions, $enum_length, $error, $functions, $grouping, $HTTPS, $inout, $jush, $LANG, $langs, $on_actions, $permanent, $structured_types, $token, $translations, $types, $unsigned, $VERSION; // allows including Adminer inside a function
if (!$_SERVER["REQUEST_URI"]) { // IIS 5 compatibility
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"];
}
if (!strpos($_SERVER["REQUEST_URI"], '?') && $_SERVER["QUERY_STRING"] != "") { // IIS 7 compatibility
$_SERVER["REQUEST_URI"] .= "?$_SERVER[QUERY_STRING]";

View File

@@ -31,6 +31,7 @@ function connect_error() {
echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
echo "<thead><tr><td>&nbsp;<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
foreach ($databases as $db) {
$root = h(ME) . "db=" . urlencode($db);
echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
@@ -39,6 +40,7 @@ function connect_error() {
echo "<td align='right'><a href='$root&amp;schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>?</a>";
echo "\n";
}
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)") . ">\n";
@@ -49,6 +51,7 @@ function connect_error() {
echo "<p>$refresh";
}
}
page_footer("db");
if ($databases) {
echo "<script type='text/javascript'>ajaxSetHtml('" . js_escape(ME) . "script=connect');</script>\n";

View File

@@ -26,7 +26,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<?php if ($adminer->head()) { ?>
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico" id="favicon">
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
<link rel="apple-touch-icon" href="../adminer/static/favicon.ico">
<?php if (file_exists("adminer.css")) { ?>
<link rel="stylesheet" type="text/css" href="adminer.css">
<?php } ?>
@@ -97,5 +98,6 @@ function page_footer($missing = "") {
<div id="menu">
<?php $adminer->navigation($missing); ?>
</div>
<script type="text/javascript">setupSubmitHighlight(document);</script>
<?php
}

View File

@@ -3,7 +3,7 @@
* @param Min_Result
* @param Min_DB connection to examine indexes
* @param string base link for <th> fields
* @param array
* @param array
* @return null
*/
function select($result, $connection2 = null, $href = "", $orgtables = array()) {
@@ -49,7 +49,9 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
}
$types[$j] = $field->type;
$name = h($name);
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . ($href ? "<a href='$href" . strtolower($name) . "' target='_blank' rel='noreferrer'>$name</a>" : $name);
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">"
. ($href ? "<a href='$href" . strtolower($name) . "' target='_blank' rel='noreferrer' class='help'>$name</a>" : $name)
;
}
echo "</thead>\n";
}
@@ -92,7 +94,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
*/
function referencable_primary($self) {
$return = array(); // table_name => field
foreach (table_status() as $table_name => $table) {
foreach (table_status('', true) as $table_name => $table) {
if ($table_name != $self && fk_support($table)) {
foreach (fields($table_name) as $field) {
if ($field["primary"]) {
@@ -127,15 +129,6 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
echo "</textarea>";
}
/** Format time difference
* @param string output of microtime()
* @param string output of microtime()
* @return string HTML code
*/
function format_time($start, $end) {
return " <span class='time'>(" . lang('%.3f s', max(0, array_sum(explode(" ", $end)) - array_sum(explode(" ", $start)))) . ")</span>";
}
/** Print table columns for type edit
* @param string
* @param array
@@ -149,7 +142,8 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist((!$field["type"] || isset($types[$field["type"]]) ? array() : array($field["type"])) + $structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td class="options"><?php //! type="number" with enabled JavaScript
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('((^|[^o])int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
echo (isset($field['on_update']) ? "<select name='$key" . "[on_update]'" . ($field["type"] == "timestamp" ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
echo ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (ereg("`", $field["type"]) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
}
@@ -171,7 +165,7 @@ function process_type($field, $collate = "COLLATE") {
global $unsigned;
return " $field[type]"
. ($field["length"] != "" ? "(" . process_length($field["length"]) . ")" : "")
. (ereg('int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (ereg('(^|[^o])int|float|double|decimal', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "")
. (ereg('char|text|enum|set', $field["type"]) && $field["collation"] ? " $collate " . q($field["collation"]) : "")
;
}
@@ -186,8 +180,8 @@ function process_field($field, $type_field) {
idf_escape(trim($field["field"])),
process_type($type_field),
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
(isset($field["default"]) ? " DEFAULT " . (($field["type"] == "timestamp" && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""),
($field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
(isset($field["default"]) ? " DEFAULT " . ((ereg("time", $field["type"]) && eregi('^CURRENT_TIMESTAMP$', $field["default"])) || ($field["type"] == "bit" && ereg("^([0-9]+|b'[0-1]+')\$", $field["default"])) ? $field["default"] : q($field["default"])) : ""),
($field["type"] == "timestamp" && $field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
(support("comment") && $field["comment"] != "" ? " COMMENT " . q($field["comment"]) : ""),
($field["auto_increment"] ? auto_increment() : null),
);
@@ -214,12 +208,11 @@ function type_class($type) {
* @param array
* @param array
* @param string TABLE or PROCEDURE
* @param int number of fields allowed by Suhosin
* @param array returned by referencable_primary()
* @param bool display comments column
* @return null
*/
function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $foreign_keys = array(), $comments = false) {
function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = array(), $comments = false) {
global $connection, $inout;
?>
<thead><tr class="wrap">
@@ -245,18 +238,18 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
?>
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo ($field["field"] != "" || count($fields) > 1 ? "" : "editingAddRow(this, $allowed); "); ?>editingNameChange(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo ($field["field"] != "" || count($fields) > 1 ? "" : "editingAddRow(this); "); ?>editingNameChange(this);" maxlength="64" autocapitalize="off"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
<?php if ($type == "TABLE") { ?>
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"]); ?>
<td><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }">
<td><?php echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block"); ?>
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> onclick="var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.onchange(); }"></label><td><?php
echo checkbox("fields[$i][has_default]", 1, $field["has_default"]); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" onchange="this.previousSibling.checked = true;">
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . ($connection->server_info >= 5.5 ? 1024 : 255) . "'>" : ""); ?>
<?php } ?>
<?php
echo "<td>";
echo (support("move_col") ?
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, $allowed, 1);'>&nbsp;"
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, 1);'>&nbsp;"
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'>&nbsp;"
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'>&nbsp;"
: "");
@@ -267,7 +260,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
/** Move fields up and down or add field
* @param array
* @return null
* @return bool
*/
function process_fields(&$fields) {
ksort($fields);
@@ -285,8 +278,7 @@ function process_fields(&$fields) {
}
$offset++;
}
}
if ($_POST["down"]) {
} elseif ($_POST["down"]) {
$found = false;
foreach ($fields as $key => $field) {
if (isset($field["field"]) && $found) {
@@ -299,11 +291,13 @@ function process_fields(&$fields) {
}
$offset++;
}
}
$fields = array_values($fields);
if ($_POST["add"]) {
} elseif ($_POST["add"]) {
$fields = array_values($fields);
array_splice($fields, key($_POST["add"]), 0, array(array()));
} elseif (!$_POST["drop_col"]) {
return false;
}
return true;
}
/** Callback used in routine()
@@ -336,25 +330,78 @@ function grant($grant, $privileges, $columns, $on) {
}
/** Drop old object and create a new one
* @param string drop query
* @param string create query
* @param string drop old object query
* @param string create new object query
* @param string drop new object query
* @param string create test object query
* @param string drop test object query
* @param string
* @param string
* @param string
* @param string
* @param string
* @return bool dropped
* @param string
* @return null redirect in success
*/
function drop_create($drop, $create, $location, $message_drop, $message_alter, $message_create, $name) {
function drop_create($drop, $create, $drop_created, $test, $drop_test, $location, $message_drop, $message_alter, $message_create, $old_name, $new_name) {
if ($_POST["drop"]) {
return query_redirect($drop, $location, $message_drop, true, !$_POST["dropped"]);
query_redirect($drop, $location, $message_drop);
} elseif ($old_name == "") {
query_redirect($create, $location, $message_create);
} elseif ($old_name != $new_name) {
$created = queries($create);
queries_redirect($location, $message_alter, $created && queries($drop));
if ($created) {
queries($drop_created);
}
} else {
queries_redirect(
$location,
$message_alter,
queries($test) && queries($drop_test) && queries($drop) && queries($create)
);
}
$dropped = $name != "" && ($_POST["dropped"] || queries($drop));
$created = queries($create);
if (!queries_redirect($location, ($name != "" ? $message_alter : $message_create), $created) && $dropped) {
redirect(null, $message_drop);
}
/** Generate SQL query for creating trigger
* @param string
* @param array result of trigger()
* @return string
*/
function create_trigger($on, $row) {
global $jush;
$timing_event = " $row[Timing] $row[Event]";
return "CREATE TRIGGER "
. idf_escape($row["Trigger"])
. ($jush == "mssql" ? $on . $timing_event : $timing_event . $on)
. rtrim(" $row[Type]\n$row[Statement]", ";")
. ";"
;
}
/** Generate SQL query for creating routine
* @param string "PROCEDURE" or "FUNCTION"
* @param array result of routine()
* @return string
*/
function create_routine($routine, $row) {
global $inout;
$set = array();
$fields = (array) $row["fields"];
ksort($fields); // enforce fields order
foreach ($fields as $field) {
if ($field["field"] != "") {
$set[] = (ereg("^($inout)\$", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
}
}
return $dropped;
return "CREATE $routine "
. idf_escape(trim($row["name"]))
. " (" . implode(", ", $set) . ")"
. (isset($_GET["function"]) ? " RETURNS" . process_type($row["returns"], "CHARACTER SET") : "")
. ($row["language"] ? " LANGUAGE $row[language]" : "")
. rtrim("\n$row[definition]", ";")
. ";"
;
}
/** Remove current user definer from SQL command
@@ -365,19 +412,22 @@ function remove_definer($query) {
return preg_replace('~^([A-Z =]+) DEFINER=`' . preg_replace('~@(.*)~', '`@`(%|\\1)', logged_user()) . '`~', '\\1', $query); //! proper escaping of user
}
/** Get string to add a file in TAR
/** Add a file to TAR
* @param string
* @param string
* @return string
* @param TmpFile
* @return null prints the output
*/
function tar_file($filename, $contents) {
$return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct(strlen($contents)), decoct(time()));
function tar_file($filename, $tmp_file) {
$return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct($tmp_file->size), decoct(time()));
$checksum = 8*32; // space for checksum itself
for ($i=0; $i < strlen($return); $i++) {
$checksum += ord($return[$i]);
}
$return .= sprintf("%06o", $checksum) . "\0 ";
return $return . str_repeat("\0", 512 - strlen($return)) . $contents . str_repeat("\0", 511 - (strlen($contents) + 511) % 512);
echo $return;
echo str_repeat("\0", 512 - strlen($return));
$tmp_file->send();
echo str_repeat("\0", 511 - ($tmp_file->size + 511) % 512);
}
/** Get INI bytes value

View File

@@ -95,14 +95,18 @@ function nl_br($string) {
* @param bool
* @param string
* @param string
* @param bool
* @param string
* @return string
*/
function checkbox($name, $value, $checked, $label = "", $onclick = "", $jsonly = false) {
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) . '"' : '') . ($jsonly ? " class='jsonly'" : "") . " id='checkbox-$id'>";
return ($label != "" ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return);
$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);
}
/** Generate list of HTML options
@@ -303,7 +307,7 @@ function get_rows($query, $connection2 = null, $error = "<p class='error'>") {
/** Find unique identifier of a row
* @param array
* @param array result of indexes()
* @return array
* @return array or null if there is no unique identifier
*/
function unique_array($row, $indexes) {
foreach ($indexes as $index) {
@@ -318,13 +322,6 @@ function unique_array($row, $indexes) {
return $return;
}
}
$return = array();
foreach ($row as $key => $val) {
if (!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~', $key)) { //! columns looking like functions
$return[$key] = $val;
}
}
return $return;
}
/** Create SQL condition from parsed query string
@@ -335,8 +332,10 @@ function unique_array($row, $indexes) {
function where($where, $fields = array()) {
global $jush;
$return = array();
$function_pattern = '(^[\w\(]+' . str_replace("_", ".*", preg_quote(idf_escape("_"))) . '\)+$)'; //! columns looking like functions
foreach ((array) $where["where"] as $key => $val) {
$return[] = idf_escape(bracket_escape($key, 1)) // 1 - back
$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
; //! enum and set
}
@@ -368,6 +367,26 @@ function where_link($i, $column, $value, $operator = "=") {
return "&where%5B$i%5D%5Bcol%5D=" . urlencode($column) . "&where%5B$i%5D%5Bop%5D=" . urlencode(($value !== null ? $operator : "IS NULL")) . "&where%5B$i%5D%5Bval%5D=" . urlencode($value);
}
/** Get select clause for convertible fields
* @param array
* @param array
* @param array
* @return string
*/
function convert_fields($columns, $fields, $select = array()) {
$return = "";
foreach ($columns as $key => $val) {
if ($select && !in_array(idf_escape($key), $select)) {
continue;
}
$as = convert_field($fields[$key]);
if ($as) {
$return .= ", $as AS " . idf_escape($key);
}
}
return $return;
}
/** Set cookie valid for 1 month
* @param string
* @param string
@@ -480,12 +499,15 @@ function redirect($location, $message = null) {
*/
function query_redirect($query, $location, $message, $redirect = true, $execute = true, $failed = false) {
global $connection, $error, $adminer;
$time = "";
if ($execute) {
$start = microtime();
$failed = !$connection->query($query);
$time = "; -- " . format_time($start, microtime());
}
$sql = "";
if ($query) {
$sql = $adminer->messageQuery("$query;");
$sql = $adminer->messageQuery($query . $time);
}
if ($failed) {
$error = error() . $sql;
@@ -506,10 +528,13 @@ function queries($query = null) {
static $queries = array();
if ($query === null) {
// return executed queries without parameter
return implode(";\n", $queries);
return implode("\n", $queries);
}
$queries[] = (ereg(';$', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query);
return $connection->query($query);
$start = microtime();
$return = $connection->query($query);
$queries[] = (ereg(';$', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query)
. "; -- " . format_time($start, microtime());
return $return;
}
/** Apply command to all array items
@@ -537,6 +562,15 @@ function queries_redirect($location, $message, $redirect) {
return query_redirect(queries(), $location, $message, $redirect, false, !$redirect);
}
/** Format time difference
* @param string output of microtime()
* @param string output of microtime()
* @return string HTML code
*/
function format_time($start, $end) {
return lang('%.3f s', max(0, array_sum(explode(" ", $end)) - array_sum(explode(" ", $start))));
}
/** Remove parameter from query string
* @param string
* @return string
@@ -561,21 +595,34 @@ function pagination($page, $current) {
*/
function get_file($key, $decompress = false) {
$file = $_FILES[$key];
if (!$file || $file["error"]) {
return $file["error"];
if (!$file) {
return null;
}
$return = file_get_contents($decompress && ereg('\\.gz$', $file["name"]) ? "compress.zlib://$file[tmp_name]"
: ($decompress && ereg('\\.bz2$', $file["name"]) ? "compress.bzip2://$file[tmp_name]"
: $file["tmp_name"]
)); //! may not be reachable because of open_basedir
if ($decompress) {
$start = substr($return, 0, 3);
if (function_exists("iconv") && ereg("^\xFE\xFF|^\xFF\xFE", $start, $regs)) { // not ternary operator to save memory
$return = iconv("utf-16", "utf-8", $return);
} elseif ($start == "\xEF\xBB\xBF") { // UTF-8 BOM
$return = substr($return, 3);
foreach ($file as $key => $val) {
$file[$key] = (array) $val;
}
$return = '';
foreach ($file["error"] as $key => $error) {
if ($error) {
return $error;
}
$name = $file["name"][$key];
$tmp_name = $file["tmp_name"][$key];
$content = file_get_contents($decompress && ereg('\\.gz$', $name)
? "compress.zlib://$tmp_name"
: $tmp_name
); //! may not be reachable because of open_basedir
if ($decompress) {
$start = substr($content, 0, 3);
if (function_exists("iconv") && ereg("^\xFE\xFF|^\xFF\xFE", $start, $regs)) { // not ternary operator to save memory
$content = iconv("utf-16", "utf-8", $content);
} elseif ($start == "\xEF\xBB\xBF") { // UTF-8 BOM
$content = substr($content, 3);
}
}
$return .= $content . "\n\n";
}
//! support SQL files not ending with semicolon
return $return;
}
@@ -697,7 +744,7 @@ function enum_input($type, $attrs, $field, $value, $empty = null) {
* @return null
*/
function input($field, $value, $function) {
global $types, $adminer, $jush;
global $connection, $types, $adminer, $jush;
$name = h(bracket_escape($field["field"]));
echo "<td class='function'>";
$reset = ($jush == "mssql" && $field["auto_increment"]);
@@ -742,6 +789,9 @@ 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"])) {
$maxlength += 7; // microtime
}
// type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
echo "<input" . (ereg('int', $field["type"]) ? " type='number'" : "") . " value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
}
@@ -798,7 +848,7 @@ function search_tables() {
$_GET["where"][0]["op"] = "LIKE %%";
$_GET["where"][0]["val"] = $_POST["query"];
$found = false;
foreach (table_status() as $table => $table_status) {
foreach (table_status('', true) as $table => $table_status) {
$name = $adminer->tableName($table_status);
if (isset($table_status["Engine"]) && $name != "" && (!$_POST["tables"] || in_array($table, $_POST["tables"]))) {
$result = $connection->query("SELECT" . limit("1 FROM " . table($table), " WHERE " . implode(" AND ", $adminer->selectSearchProcess(fields($table), array())), 1));
@@ -829,6 +879,8 @@ function dump_headers($identifier, $multi_table = false) {
header("Content-Disposition: attachment; filename=" . $adminer->dumpFilename($identifier) . ".$return" . ($output != "file" && !ereg('[^0-9a-z]', $output) ? ".$output" : ""));
}
session_write_close();
ob_flush();
flush();
return $return;
}

View File

@@ -6,7 +6,7 @@ if (extension_loaded('pdo')) {
function __construct() {
global $adminer;
$pos = array_search("", $adminer->operators);
$pos = array_search("SQL", $adminer->operators);
if ($pos !== false) {
unset($adminer->operators[$pos]);
}

View File

@@ -0,0 +1,22 @@
<?php
class TmpFile {
var $handler;
var $size;
function TmpFile() {
$this->handler = tmpfile();
}
function write($contents) {
$this->size += strlen($contents);
fwrite($this->handler, $contents);
}
function send() {
fseek($this->handler, 0);
fpassthru($this->handler);
fclose($this->handler);
}
}

View File

@@ -1,2 +1,2 @@
<?php
$VERSION = "3.6.3";
$VERSION = "3.7.1-dev";

View File

@@ -8,6 +8,7 @@
*/
include "./include/bootstrap.inc.php";
include "./include/tmpfile.inc.php";
$enum_length = "'(?:''|[^'\\\\]|\\\\.)*+'";
$inout = "IN|OUT|INOUT";
@@ -21,6 +22,7 @@ if (isset($_GET["callf"])) {
if (isset($_GET["function"])) {
$_GET["procedure"] = $_GET["function"];
}
if (isset($_GET["download"])) {
include "./download.inc.php";
} elseif (isset($_GET["table"])) {

View File

@@ -1,8 +1,8 @@
<?php
$TABLE = $_GET["indexes"];
$index_types = array("PRIMARY", "UNIQUE", "INDEX");
$table_status = table_status($TABLE);
if (eregi("MyISAM|M?aria", $table_status["Engine"])) {
$table_status = table_status($TABLE, true);
if (eregi("MyISAM|M?aria" . ($connection->server_info >= 5.6 ? "|InnoDB" : ""), $table_status["Engine"])) {
$index_types[] = "FULLTEXT";
}
$indexes = indexes($TABLE);
@@ -10,9 +10,11 @@ if ($jush == "sqlite") { // doesn't support primary key
unset($index_types[0]);
unset($indexes[""]);
}
$row = $_POST;
if ($_POST && !$error && !$_POST["add"]) {
$alter = array();
foreach ($_POST["indexes"] as $index) {
foreach ($row["indexes"] as $index) {
$name = $index["name"];
if (in_array($index["type"], $index_types)) {
$columns = array();
@@ -27,6 +29,7 @@ if ($_POST && !$error && !$_POST["add"]) {
$lengths[] = ($length ? $length : null);
}
}
if ($columns) {
$existing = $indexes[$name];
if ($existing) {
@@ -42,6 +45,7 @@ if ($_POST && !$error && !$_POST["add"]) {
}
}
}
// drop removed indexes
foreach ($indexes as $name => $existing) {
$alter[] = array($existing["type"], $name, "DROP");
@@ -55,26 +59,24 @@ if ($_POST && !$error && !$_POST["add"]) {
page_header(lang('Indexes'), $error, array("table" => $TABLE), $TABLE);
$fields = array_keys(fields($TABLE));
$row = array("indexes" => $indexes);
if ($_POST) {
$row = $_POST;
if ($_POST["add"]) {
foreach ($row["indexes"] as $key => $index) {
if ($index["columns"][count($index["columns"])] != "") {
$row["indexes"][$key]["columns"][] = "";
}
}
$index = end($row["indexes"]);
if ($index["type"] || array_filter($index["columns"], 'strlen') || array_filter($index["lengths"], 'strlen')) {
$row["indexes"][] = array("columns" => array(1 => ""));
}
}
} else {
if ($_POST["add"]) {
foreach ($row["indexes"] as $key => $index) {
$row["indexes"][$key]["name"] = $key;
$row["indexes"][$key]["columns"][] = "";
if ($index["columns"][count($index["columns"])] != "") {
$row["indexes"][$key]["columns"][] = "";
}
}
$row["indexes"][] = array("columns" => array(1 => ""));
$index = end($row["indexes"]);
if ($index["type"] || array_filter($index["columns"], 'strlen') || array_filter($index["lengths"], 'strlen')) {
$row["indexes"][] = array("columns" => array(1 => ""));
}
}
if (!$row) {
foreach ($indexes as $key => $index) {
$indexes[$key]["name"] = $key;
$indexes[$key]["columns"][] = "";
}
$indexes[] = array("columns" => array(1 => ""));
$row["indexes"] = $indexes;
}
?>
@@ -86,13 +88,15 @@ $j = 1;
foreach ($row["indexes"] as $index) {
echo "<tr><td>" . html_select("indexes[$j][type]", array(-1 => "") + $index_types, $index["type"], ($j == count($row["indexes"]) ? "indexesAddRow(this);" : 1)) . "<td>";
ksort($index["columns"]);
$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
$i++;
}
echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "'>\n";
echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "' autocapitalize='off'>\n";
$j++;
}
?>

View File

@@ -188,7 +188,7 @@ $translations = array(
'%d item(s) have been affected.' => 'عدد العناصر المعدلة هو %d.',
'whole result' => 'نتيجة كاملة',
'Clone' => 'نسخ',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'لقد تجاوزت العدد الأقصى للحقول. يرجى الرفع من %s و %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'لقد تجاوزت العدد الأقصى للحقول. يرجى الرفع من %s.',
'Partition by' => 'مقسم بواسطة',
'Partitions' => 'التقسيمات',
'Partition name' => 'إسم التقسيم',
@@ -258,7 +258,6 @@ $translations = array(
'now' => 'الآن',
'%d query(s) executed OK.' => array('تم تنفيذ الإستعلام %d بنجاح.', 'تم تنفيذ الإستعلامات %d بنجاح.'),
'Show only errors' => 'إعرض الأخطاء فقط',
'Last page' => 'الصفحة السابقة',
'Refresh' => 'تحديث',
'Invalid schema.' => 'مخطط خاطئ.',
'Please use one of the extensions %s.' => 'من فضلك إستعمل إحدى الإمتدادات: %s.',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => '%d টি বিষয়বস্তু প্রভাবিত হয়েছে',
'whole result' => 'সম্পূর্ণ ফলাফল',
'Clone' => 'ক্লোন',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'অনুমোদিত ফিল্ড এর সর্বাধিক সংখ্যা অতিক্রম করে গেছে। অনুগ্রহপূর্বক %s এবং %s বৃদ্ধি করুন।',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'অনুমোদিত ফিল্ড এর সর্বাধিক সংখ্যা অতিক্রম করে গেছে। অনুগ্রহপূর্বক %s বৃদ্ধি করুন।',
'Partition by' => 'পার্টিশন যার মাধ্যমে',
'Partitions' => 'পার্টিশন',
'Partition name' => 'পার্টিশনের নাম',
@@ -257,7 +257,6 @@ $translations = array(
'Attachments' => 'সংযুক্তি',
'%d query(s) executed OK.' => array('SQL-কোয়্যারী সফলভাবে সম্পন্ন হয়েছে', '%d SQL-কোয়্যারীসমূহ সফলভাবে সম্পন্ন হয়েছে'),
'Show only errors' => 'শুধুমাত্র ত্রুটি দেখাও',
'Last page' => 'শেষ পাতা',
'Refresh' => 'রিফ্রেশ',
'Invalid schema.' => 'অবৈধ স্কিমা।',
'Please use one of the extensions %s.' => 'কোন একটা এক্সটেনশন %s ব্যবহার করো।',

View File

@@ -199,7 +199,7 @@ $translations = array(
'Show structure' => 'Mostra l\'estructura',
'Select data' => 'Selecciona dades',
'Stop on error' => 'Atura en trobar un error',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'S\'ha assolit el nombre màxim de camps. Incrementa %s i %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'S\'ha assolit el nombre màxim de camps. Incrementa %s.',
'anywhere' => 'a qualsevol lloc',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$5/$3/$1',
@@ -259,7 +259,6 @@ $translations = array(
'now' => 'ara',
'%d query(s) executed OK.' => array('%d consulta executada correctament.', '%d consultes executades correctament.'),
'Show only errors' => 'Mostra només els errors',
'Last page' => 'Darrera plana',
'Refresh' => 'Refresca',
'Invalid schema.' => 'Esquema invàlid.',
'Please use one of the extensions %s.' => 'Si us plau, utilitza una de les extensions %s.',

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Přesunout nahoru',
'Move down' => 'Přesunout dolů',
'Remove' => 'Odebrat',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Byl překročen maximální povolený počet polí. Zvyšte prosím %s a %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Byl překročen maximální povolený počet polí. Zvyšte prosím %s.',
'Partition by' => 'Rozdělit podle',
'Partitions' => 'Oddíly',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
'Page' => 'Stránka',
'last' => 'poslední',
'Last page' => 'Poslední stránka',
'Load more data' => 'Nahrát další data',
'Loading' => 'Nahrává se',
'whole result' => 'celý výsledek',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => '%d Artikel betroffen.',
'whole result' => 'Gesamtergebnis',
'Clone' => 'Klonen',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Die maximal erlaubte Anzahl der Felder ist überschritten. Bitte %s und %s erhöhen.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Die maximal erlaubte Anzahl der Felder ist überschritten. Bitte %s erhöhen.',
'Partition by' => 'Partitionieren um',
'Partitions' => 'Partitionen',
'Partition name' => 'Name der Partition',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Anhänge',
'%d query(s) executed OK.' => array('SQL-Query erfolgreich ausgeführt.', '%d SQL-Queries erfolgreich ausgeführt.'),
'Show only errors' => 'Nur Fehler anzeigen',
'Last page' => 'Letzte Seite',
'Refresh' => 'Aktualisieren',
'Invalid schema.' => 'Schema nicht gültig.',
'Please use one of the extensions %s.' => 'Bitte einen der Dateitypen %s benutzen.',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d ítem afectado.', '%d itemes afectados.'),
'whole result' => 'resultado completo',
'Clone' => 'Clonar',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Cantida máxima de campos permitidos excedidos. Por favor aumente %s y %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Cantida máxima de campos permitidos excedidos. Por favor aumente %s.',
'Partition by' => 'Particionar por',
'Partitions' => 'Particiones',
'Partition name' => 'Nombre de Partición',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Adjuntos',
'%d query(s) executed OK.' => array('%d sentencia sql ejecutada correctamente.', '%d sentencias sql ejecutadas correctamente.'),
'Show only errors' => 'Mostrar solamente errores',
'Last page' => 'Ultima página',
'Refresh' => 'Refrescar',
'Invalid schema.' => 'Esquema inválido.',
'Please use one of the extensions %s.' => 'Por favor use una de las extensiones %s.',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => 'Mõjutatud kirjeid: %d.',
'whole result' => 'Täielikud tulemused',
'Clone' => 'Kloon',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Maksimaalne väljade arv ületatud. Palun suurendage %s ja %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Maksimaalne väljade arv ületatud. Palun suurendage %s.',
'Partition by' => 'Partitsiooni',
'Partitions' => 'Partitsioonid',
'Partition name' => 'Partitsiooni nimi',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Manused',
'%d query(s) executed OK.' => array('%d päring edukalt käivitatud.', '%d päringut edukalt käivitatud.'),
'Show only errors' => 'Kuva vaid veateateid',
'Last page' => 'Viimane lehekülg',
'Refresh' => 'Uuenda',
'Invalid schema.' => 'Sobimatu skeema.',
'Please use one of the extensions %s.' => 'Palun kasuta üht laiendustest %s.',

View File

@@ -165,7 +165,7 @@ $translations = array(
'Move up' => 'انتقال به بالا',
'Move down' => 'انتقال به پایین',
'Remove' => 'حذف',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'حداکثر مجاز فیلدهای مجاز اشباع شد. لطفا %s و %s را کاهش دهید',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'حداکثر مجاز فیلدهای مجاز اشباع شد. لطفا %s را کاهش دهید',
'Partition by' => 'بخشبندی توسط',
'Partitions' => 'بخشبندیها',
@@ -231,7 +231,6 @@ $translations = array(
'%d row(s)' => array('%d سطر', '%d سطر'),
'Page' => 'صفحه',
'last' => 'آخری',
'Last page' => 'صفحه آخر',
'whole result' => 'همه نتایج',
'%d byte(s)' => array('%d بایت', '%d بایت'),

View File

@@ -22,7 +22,7 @@ $translations = array(
'Length' => 'Longueur',
'Auto Increment' => 'Auto increment',
'Options' => 'Options',
'Save' => 'Sauvegarder',
'Save' => 'Enregistrer',
'Drop' => 'Supprimer',
'Database has been created.' => 'La base de données a été créée.',
'Database has been renamed.' => 'La base de données a été renommée.',
@@ -41,7 +41,7 @@ $translations = array(
'Item has been updated.' => 'L\'élément a été modifié.',
'Edit' => 'Modifier',
'Insert' => 'Insérer',
'Save and insert next' => 'Sauvegarder et insérer le prochain',
'Save and insert next' => 'Enr. et insérer prochain',
'Delete' => 'Effacer',
'Database' => 'Base de données',
'Routines' => 'Routines',
@@ -148,7 +148,7 @@ $translations = array(
'Data' => 'Données',
'Output' => 'Sortie',
'open' => 'ouvrir',
'save' => 'sauvegarder',
'save' => 'enregistrer',
'Format' => 'Format',
'Functions' => 'Fonctions',
'Aggregation' => 'Agrégation',
@@ -165,7 +165,7 @@ $translations = array(
'Events' => 'Évènements',
'Schedule' => 'Horaire',
'At given time' => 'À un moment précis',
'Save and continue edit' => 'Sauvegarder et continuer l\'édition',
'Save and continue edit' => 'Enr. et continuer édition',
'original' => 'original',
'Tables have been truncated.' => 'Les tables ont été tronquées.',
'Tables have been moved.' => 'Les tables ont été déplacées.',
@@ -188,7 +188,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d élément a été modifié.', '%d éléments ont été modifiés.'),
'whole result' => 'résultat entier',
'Clone' => 'Cloner',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Le nombre maximum de champs est dépassé. Veuillez augmenter %s et %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Le nombre maximum de champs est dépassé. Veuillez augmenter %s.',
'Partition by' => 'Partitionner par',
'Partitions' => 'Partitions',
'Partition name' => 'Nom de la partition',
@@ -259,7 +259,6 @@ $translations = array(
'now' => 'maintenant',
'%d query(s) executed OK.' => array('%d requête exécutée avec succès.', '%d requêtes exécutées avec succès.'),
'Show only errors' => 'Montrer seulement les erreurs',
'Last page' => 'Dernière page',
'Refresh' => 'Rafraîchir',
'Invalid schema.' => 'Schéma invalide.',
'Please use one of the extensions %s.' => 'Veuillez utiliser l\'une des extensions %s.',

View File

@@ -199,7 +199,7 @@ $translations = array(
'Show structure' => 'Struktúra',
'Select data' => 'Tartalom',
'Stop on error' => 'Hiba esetén megáll',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'A maximális mezőszámot elérted. Növeld meg ezeket: %s, %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'A maximális mezőszámot elérted. Növeld meg ezeket: %s.',
'anywhere' => 'bárhol',
'%.3f s' => '%.3f másodperc',
'$1-$3-$5' => '$6.$4.$1',
@@ -258,7 +258,6 @@ $translations = array(
'now' => 'most',
'%d query(s) executed OK.' => '%d sikeres lekérdezés.',
'Show only errors' => 'Csak a hibák mutatása',
'Last page' => 'Utolsó oldal',
'Refresh' => 'Frissítés',
'Invalid schema.' => 'Érvénytelen séma.',
'Please use one of the extensions %s.' => 'Használja a(z) %s kiterjesztést.',

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Naik',
'Move down' => 'Turun',
'Remove' => 'Hapus',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Jumlah ruas maksimum yang diizinkan dilewati. Harap naikkan %s dan %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Jumlah ruas maksimum yang diizinkan dilewati. Harap naikkan %s.',
'Partition by' => 'Partisi menurut',
'Partitions' => 'Partisi',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => '%d baris',
'Page' => 'Halaman',
'last' => 'terakhir',
'Last page' => 'Halaman terakhir',
'whole result' => 'Seluruh hasil',
'%d byte(s)' => '%d bita',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => array('Il risultato consiste in %d elemento.', 'Il risultato consiste in %d elementi.'),
'whole result' => 'intero risultato',
'Clone' => 'Clona',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Troppi campi. Per favore aumentare %s e %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Troppi campi. Per favore aumentare %s.',
'Partition by' => 'Partiziona per',
'Partitions' => 'Partizioni',
'Partition name' => 'Nome partizione',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Allegati',
'%d query(s) executed OK.' => array('%d query eseguita con successo.', '%d query eseguite con successo.'),
'Show only errors' => 'Mostra solo gli errori',
'Last page' => 'Ultima pagina',
'Refresh' => 'Aggiorna',
'Invalid schema.' => 'Schema non valido.',
'Please use one of the extensions %s.' => 'Usa una delle estensioni %s.',

View File

@@ -189,7 +189,7 @@ $translations = array(
'whole result' => '全結果',
'Tables have been dropped.' => 'テーブルを削除しました',
'Clone' => 'クローン',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => '定義可能な最大フィールド数を越えました。%s と %s を増やしてください。',
'Maximum number of allowed fields exceeded. Please increase %s.' => '定義可能な最大フィールド数を越えました。%s を増やしてください。',
'Partition by' => 'パーティション',
'Partitions' => 'パーティション',
'Partition name' => 'パーティション名',
@@ -258,7 +258,6 @@ $translations = array(
'now' => '現在の日時',
'%d query(s) executed OK.' => '%d クエリーを実行しました',
'Show only errors' => 'エラーのみ表示',
'Last page' => '最後のページ',
'Refresh' => 'リフレッシュ',
'Invalid schema.' => '無効なスキーマ',
'Please use one of the extensions %s.' => 'いずれかの拡張機能を使ってください %s',

View File

@@ -165,7 +165,7 @@ $translations = array(
'Move up' => 'Perkelti į viršų',
'Move down' => 'Perkelti žemyn',
'Remove' => 'Pašalinti',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Viršytas maksimalus leidžiamų stulpelių kiekis. Padidinkite %s ir %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Viršytas maksimalus leidžiamų stulpelių kiekis. Padidinkite %s.',
'Partition by' => 'Skirstyti pagal',
'Partitions' => 'Skirsniai',
@@ -231,7 +231,6 @@ $translations = array(
'%d row(s)' => array('%d įrašas', '%d įrašai', '%d įrašų'),
'Page' => 'Puslapis',
'last' => 'paskutinis',
'Last page' => 'Paskutinis puslapis',
'whole result' => 'visas rezultatas',
'%d byte(s)' => array('%d baitas', '%d baigai', '%d baitų'),

View File

@@ -191,7 +191,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d item aangepast.', '%d items aangepast.'),
'whole result' => 'volledig resultaat',
'Clone' => 'Dupliceer',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Maximum aantal velden bereikt. Verhoog %s en %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Maximum aantal velden bereikt. Verhoog %s.',
'Partition by' => 'Partitioneren op',
'Partitions' => 'Partities',
'Partition name' => 'Partitie naam',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Bijlagen',
'%d query(s) executed OK.' => array('%d query succesvol uitgevoerd.', '%d querys succesvol uitgevoerd'),
'Show only errors' => 'Enkel fouten tonen',
'Last page' => 'Laatste pagina',
'Refresh' => 'Vernieuwen',
'Invalid schema.' => 'Ongeldig schema.',
'Please use one of the extensions %s.' => 'Gebruik 1 van volgende extensies: %s.',

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Przesuń w górę',
'Move down' => 'Przesuń w dół',
'Remove' => 'Usuń',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Przekroczono maksymalną liczbę pól. Zwiększ %s i %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Przekroczono maksymalną liczbę pól. Zwiększ %s.',
'Partition by' => 'Partycjonowanie',
'Partitions' => 'Partycje',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => array('%d rekord', '%d rekordy', '%d rekordów'),
'Page' => 'Strona',
'last' => 'ostatni',
'Last page' => 'Ostatnia strona',
'Load more data' => 'Wczytaj więcej danych',
'Loading' => 'Wczytywanie',
'whole result' => 'wybierz wszystkie',

View File

@@ -190,7 +190,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d item afetado.', '%d itens afetados.'),
'whole result' => 'resultado completo',
'Clone' => 'Clonar',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Quantidade máxima de campos permitidos excedidos. Por favor aumente %s e %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Quantidade máxima de campos permitidos excedidos. Por favor aumente %s.',
'Partition by' => 'Particionar por',
'Partitions' => 'Partições',
'Partition name' => 'Nome da Partição',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Anexos',
'%d query(s) executed OK.' => array('%d consulta sql executada corretamente.', '%d consultas sql executadas corretamente.'),
'Show only errors' => 'Mostrar somente erros',
'Last page' => 'Última página',
'Refresh' => 'Atualizar',
'Invalid schema.' => 'Esquema inválido.',
'Please use one of the extensions %s.' => 'Por favor use uma das extensões %s.',

View File

@@ -197,7 +197,7 @@ $translations = array(
'%d row(s) have been imported.' => array('%d rînd importat.', '%d rînduri importate.'),
'Import' => 'Importă',
'Stop on error' => 'Opreștete la eroare',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Numărul maxim de înscrieri disponibile a fost atins. Majorați %s și %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Numărul maxim de înscrieri disponibile a fost atins. Majorați %s.',
'anywhere' => 'oriunde',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$5.$3.$1',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Fișiere atașate',
'%d query(s) executed OK.' => array('%d query executat.', '%d query-uri executate cu succes.'),
'Show only errors' => 'Arată doar greșeli',
'Last page' => 'Ultima pagină',
'Refresh' => 'Împrospătează',
'Invalid schema.' => 'Schemă incorectă.',
'Please use one of the extensions %s.' => 'Folosiți una din următoarele extensii %s.',

View File

@@ -197,7 +197,7 @@ $translations = array(
'%d row(s) have been imported.' => array('Импортирована %d строка.', 'Импортировано %d строки.', 'Импортировано %d строк.'),
'Import' => 'Импорт',
'Stop on error' => 'Остановить при ошибке',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Достигнуто максимальное значение количества доступных полей. Увеличьте %s и %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Достигнуто максимальное значение количества доступных полей. Увеличьте %s.',
'anywhere' => 'в любом месте',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$5.$3.$1',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Прикрепленные файлы',
'%d query(s) executed OK.' => array('%d запрос выполнен успешно.', '%d запроса выполнено успешно.', '%d запросов выполнено успешно.'),
'Show only errors' => 'Только ошибки',
'Last page' => 'Последняя страница',
'Refresh' => 'Обновить',
'Invalid schema.' => 'Неправильная схема.',
'Please use one of the extensions %s.' => 'Используйте одно из этих расширений %s.',

View File

@@ -198,7 +198,7 @@ $translations = array(
'%d row(s) have been imported.' => array('Bol importovaný %d záznam.', 'Boli importované %d záznamy.', 'Bolo importovaných %d záznamov.'),
'Import' => 'Import',
'Stop on error' => 'Zastaviť pri chybe',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Bol prekročený maximálny počet povolených polí. Zvýšte prosím %s a %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Bol prekročený maximálny počet povolených polí. Zvýšte prosím %s.',
'anywhere' => 'kdekoľvek',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$6.$4.$1',
@@ -258,7 +258,6 @@ $translations = array(
'Attachments' => 'Prílohy',
'%d query(s) executed OK.' => array('Bol vykonaný %d dotaz.', 'Boli vykonané %d dotazy.', 'Bolo vykonaných %d dotazov.'),
'Show only errors' => 'Zobraziť iba chyby',
'Last page' => 'Posledná stránka',
'Refresh' => 'Obnoviť',
'Invalid schema.' => 'Neplatné schéma.',
'Please use one of the extensions %s.' => 'Prosím vyberte jednu z koncoviek %s.',

View File

@@ -161,7 +161,7 @@ $translations = array(
'Move up' => 'Premakni gor',
'Move down' => 'Premakni dol',
'Remove' => 'Odstrani',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Največje število dovoljenih polje je preseženo. Prosimo, povečajte %s in %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Največje število dovoljenih polje je preseženo. Prosimo, povečajte %s.',
'Partition by' => 'Porazdeli po',
'Partitions' => 'Porazdelitve',
@@ -227,7 +227,6 @@ $translations = array(
'%d row(s)' => array('%d vrstica', '%d vrstici', '%d vrstice', '%d vrstic'),
'Page' => 'Stran',
'last' => 'Zadnja',
'Last page' => 'Zadnja stran',
'whole result' => 'cel razultat',
'%d byte(s)' => array('%d bajt', '%d bajta', '%d bajti', '%d bajtov'),

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Помери на горе',
'Move down' => 'Помери на доле',
'Remove' => 'Уклони',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Премашен је максимални број дозвољених поља. Молим увећајте %s и %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Премашен је максимални број дозвољених поља. Молим увећајте %s.',
'Partition by' => 'Подели по',
'Partitions' => 'Поделе',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => array('%d ред', '%d реда', '%d редова'),
'Page' => 'Страна',
'last' => 'последња',
'Last page' => 'Последња страна',
'Loading' => 'Учитавам',
'Load more data' => 'Учитавам још података',
'whole result' => 'цео резултат',

View File

@@ -187,7 +187,7 @@ $translations = array(
'%d item(s) have been affected.' => array('%d உருப்ப‌டி மாற்ற‌ம‌டைந்தது.', '%d உருப்ப‌டிக‌ள் மாற்ற‌ம‌டைந்த‌ன‌.'),
'whole result' => 'முழுமையான‌ முடிவு',
'Clone' => 'ந‌க‌லி (Clone)',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'அனும‌திக்க‌ப்ப‌ட்ட‌ அதிக‌ப‌ட்ச‌ கோப்புக‌ளின் எண்ணிக்கை மீற‌ப்ப‌ட்ட‌து. த‌ய‌வு செய்து %s ம‌ற்றும் %s யை அதிக‌ரிக்க‌வும்.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'அனும‌திக்க‌ப்ப‌ட்ட‌ அதிக‌ப‌ட்ச‌ கோப்புக‌ளின் எண்ணிக்கை மீற‌ப்ப‌ட்ட‌து. த‌ய‌வு செய்து %s ம‌ற்றும் %s யை அதிக‌ரிக்க‌வும்.',
'Partition by' => 'பிரித்த‌து',
'Partitions' => 'பிரிவுக‌ள்',
'Partition name' => 'பிரிவின் பெய‌ர்',
@@ -258,7 +258,6 @@ $translations = array(
'now' => 'இப்பொழுது',
'%d query(s) executed OK.' => array('%d வின‌வ‌ல் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌து.', '%d வின‌வ‌ல்க‌ள் செய‌ல்ப‌டுத்த‌ப்ப‌ட்ட‌ன‌.'),
'Show only errors' => 'பிழைக‌ளை ம‌ட்டும் காண்பிக்க‌வும்',
'Last page' => 'க‌டைசி ப‌க்க‌ம்',
'Refresh' => 'புதுப்பி (Refresh)',
'Invalid schema.' => 'அமைப்புமுறை ச‌ரியான‌த‌ல்ல‌ (Invalid Schema).',
'Please use one of the extensions %s.' => 'த‌ய‌வு செய்து ஒரு விரிவினை %s (extension) உப‌யோகிக்க‌வும்.',

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Yukarı taşı',
'Move down' => 'Aşağı taşı',
'Remove' => 'Sil',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'İzin verilen en fazla alan sayısııldı. Lütfen %s ve %s değerlerini artırın.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'İzin verilen en fazla alan sayısııldı. Lütfen %s değerlerini artırın.',
'Partition by' => 'Bununla bölümle',
'Partitions' => 'Bölümler',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => array('%d kayıt', '%d adet kayıt'),
'Page' => 'Sayfa',
'last' => 'son',
'Last page' => 'Son sayfa',
'Load more data' => 'Daha fazla veri yükle',
'Loading' => 'Yükleniyor',
'whole result' => 'tüm sonuç',

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'Пересунути вгору',
'Move down' => 'Пересунути вниз',
'Remove' => 'Видалити',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Досягнута максимальна кількість доступних полів. Будь ласка, збільшіть %s і %s.',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'Досягнута максимальна кількість доступних полів. Будь ласка, збільшіть %s.',
'Partition by' => 'Розділити по',
'Partitions' => 'Розділи',
@@ -232,7 +232,6 @@ $translations = array(
'%d row(s)' => array('%d рядок', '%d рядки', '%d рядків'),
'Page' => 'Сторінка',
'last' => 'остання',
'Last page' => 'Остання сторінка',
'whole result' => 'весь результат',
'%d byte(s)' => array('%d байт', '%d байта', '%d байтів'),

View File

@@ -166,7 +166,7 @@ $translations = array(
'Move up' => 'xx',
'Move down' => 'xx',
'Remove' => 'xx',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'xx',
'Maximum number of allowed fields exceeded. Please increase %s.' => 'xx',
'Partition by' => 'xx',
'Partitions' => 'xx',
@@ -233,7 +233,6 @@ $translations = array(
'%d row(s)' => array('xx', 'xx'),
'Page' => 'xx',
'last' => 'xx',
'Last page' => 'xx',
'Load more data' => 'xx',
'Loading' => 'xx',
'whole result' => 'xx',

View File

@@ -188,7 +188,7 @@ $translations = array(
'whole result' => '所有結果',
'Tables have been dropped.' => '已丟棄表。',
'Clone' => '複製',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => '超過最多允許的字段數量。請增加%s和%s 。',
'Maximum number of allowed fields exceeded. Please increase %s.' => '超過最多允許的字段數量。請增加%s。',
'Partition by' => '分區類型',
'Partitions' => '分區',
'Partition name' => '分區名',
@@ -257,7 +257,6 @@ $translations = array(
'Attachments' => '附件',
'%d query(s) executed OK.' => '已順利執行 %d 個查詢。',
'Show only errors' => '僅顯示錯誤訊息',
'Last page' => '最後一頁',
'Refresh' => '重新載入',
'Invalid schema.' => '無效的資料表結構。',
'Please use one of the extensions %s.' => '請使用下列其中一個 extension %s。',

View File

@@ -190,7 +190,7 @@ $translations = array(
'whole result' => '所有结果',
'Tables have been dropped.' => '已丢弃表。',
'Clone' => '克隆',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => '超过最多允许的字段数量。请增加 %s 和 %s 。',
'Maximum number of allowed fields exceeded. Please increase %s.' => '超过最多允许的字段数量。请增加 %s。',
'Partition by' => '分区类型',
'Partitions' => '分区',
'Partition name' => '分区名',
@@ -257,7 +257,6 @@ $translations = array(
'Attachments' => '附件',
'%d query(s) executed OK.' => '%d 条查询已成功执行。',
'Show only errors' => '仅显示错误',
'Last page' => '末页',
'Refresh' => '刷新',
'Invalid schema.' => '非法模式。',
'Please use one of the extensions %s.' => '请使用这些扩展中的一个:%s。',

View File

@@ -11,13 +11,16 @@ function adminer_object() {
$plugins = array(
// specify enabled plugins here
new AdminerDatabaseHide(array('information_schema')),
new AdminerDumpJson,
new AdminerDumpZip,
new AdminerDumpXml,
new AdminerDumpAlter,
//~ new AdminerSqlLog("past-" . rtrim(`git describe --tags --abbrev=0`) . ".sql"),
//~ new AdminerEditCalendar("<script type='text/javascript' src='../externals/jquery-ui/jquery-1.4.4.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.core.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.widget.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.datepicker.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.mouse.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.slider.js'></script>\n<script type='text/javascript' src='../externals/jquery-timepicker/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' href='../externals/jquery-ui/themes/base/jquery.ui.all.css'>\n<style type='text/css'>\n.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }\n.ui-timepicker-div dl { text-align: left; }\n.ui-timepicker-div dl dt { height: 25px; }\n.ui-timepicker-div dl dd { margin: -25px 0 10px 65px; }\n.ui-timepicker-div td { font-size: 90%; }\n</style>\n", "../externals/jquery-ui/ui/i18n/jquery.ui.datepicker-%s.js"),
//~ new AdminerTinymce("../externals/tinymce/jscripts/tiny_mce/tiny_mce_dev.js"),
//~ new AdminerWymeditor(array("../externals/wymeditor/src/jquery/jquery.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.explorer.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.mozilla.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.opera.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.safari.js")),
new AdminerFileUpload(""),
new AdminerJsonColumn,
new AdminerSlugify,
new AdminerTranslation,
new AdminerForeignSystem,

View File

@@ -7,18 +7,22 @@ if (!$result) {
// list logged user, information_schema.USER_PRIVILEGES lists just the current user too
$result = $connection->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");
}
echo "<form action=''><p>\n";
hidden_fields_get();
echo "<input type='hidden' name='db' value='" . h(DB) . "'>\n";
echo ($grant ? "" : "<input type='hidden' name='grant' value=''>\n");
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Username') . "<th>" . lang('Server') . "<th>&nbsp;</thead>\n";
while ($row = $result->fetch_assoc()) {
echo '<tr' . odd() . '><td>' . h($row["User"]) . "<td>" . h($row["Host"]) . '<td><a href="' . h(ME . 'user=' . urlencode($row["User"]) . '&host=' . urlencode($row["Host"])) . '">' . lang('Edit') . "</a>\n";
}
if (!$grant || DB != "") {
echo "<tr" . odd() . "><td><input name='user'><td><input name='host' value='localhost'><td><input type='submit' value='" . lang('Edit') . "'>\n";
echo "<tr" . odd() . "><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='" . lang('Edit') . "'>\n";
}
echo "</table>\n";
echo "</form>\n";

View File

@@ -1,46 +1,40 @@
<?php
$PROCEDURE = $_GET["procedure"];
$routine = (isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE");
$routine_languages = routine_languages();
$row = $_POST;
$row["fields"] = (array) $row["fields"];
$dropped = false;
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
$set = array();
$fields = (array) $_POST["fields"];
ksort($fields); // enforce fields order
foreach ($fields as $field) {
if ($field["field"] != "") {
$set[] = (ereg("^($inout)\$", $field["inout"]) ? "$field[inout] " : "") . idf_escape($field["field"]) . process_type($field, "CHARACTER SET");
}
}
$dropped = drop_create(
if ($_POST && !process_fields($row["fields"]) && !$error) {
$temp_name = "$row[name]_adminer_" . uniqid();
drop_create(
"DROP $routine " . idf_escape($PROCEDURE),
"CREATE $routine " . idf_escape(trim($_POST["name"])) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . (in_array($_POST["language"], $routine_languages) ? " LANGUAGE $_POST[language]" : "") . rtrim("\n$_POST[definition]", ";") . ";",
create_routine($routine, $row),
"DROP $routine " . idf_escape($row["name"]),
create_routine($routine, array("name" => $temp_name) + $row),
"DROP $routine " . idf_escape($temp_name),
substr(ME, 0, -1),
lang('Routine has been dropped.'),
lang('Routine has been altered.'),
lang('Routine has been created.'),
$PROCEDURE
$PROCEDURE,
$row["name"]
);
}
page_header(($PROCEDURE != "" ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . h($PROCEDURE) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure'))), $error);
$collations = get_vals("SHOW CHARACTER SET");
sort($collations);
$row = array("fields" => array());
if ($_POST) {
$row = $_POST;
$row["fields"] = (array) $row["fields"];
process_fields($row["fields"]);
} elseif ($PROCEDURE != "") {
if (!$_POST && $PROCEDURE != "") {
$row = routine($PROCEDURE, $routine);
$row["name"] = $PROCEDURE;
}
$collations = get_vals("SHOW CHARACTER SET");
sort($collations);
$routine_languages = routine_languages();
?>
<form action="" method="post" id="form">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
<?php echo ($routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) : ""); ?>
<table cellspacing="0" class="nowrap">
<?php
@@ -55,6 +49,5 @@ if (isset($_GET["function"])) {
<p>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($PROCEDURE != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -18,16 +18,25 @@ page_header(lang('Process list'), $error);
// HTML valid because there is always at least one process
$i = -1;
foreach (process_list() as $i => $row) {
if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : "") . "<th>" . implode("<th>", array_keys($row)) . "</thead>\n";
echo "<thead><tr lang='en'>" . (support("kill") ? "<th>&nbsp;" : "");
foreach ($row as $key => $val) {
echo "<th>" . ($jush == "sql"
? "<a href='http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/show-processlist.html#processlist_" . strtolower($key) . "' target='_blank' rel='noreferrer' class='help'>$key</a>"
: $key
);
}
echo "</thead>\n";
}
echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row["Id"], 0) : "");
foreach ($row as $key => $val) {
echo "<td>" . (
($jush == "sql" && $key == "Info" && ereg("Query|Killed", $row["Command"]) && $val != "") ||
($jush == "pgsql" && $key == "current_query" && $val != "<IDLE>") ||
($jush == "oracle" && $key == "sql_text" && $val != "")
? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Edit') . '</a>'
? "<code class='jush-$jush'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>'
: nbsp($val)
);
}

View File

@@ -16,23 +16,23 @@ $base_left = -1;
$schema = array(); // table => array("fields" => array(name => field), "pos" => array(top, left), "references" => array(table => array(left => array(source, target))))
$referenced = array(); // target_table => array(table => array(left => target_column))
$lefts = array(); // float => bool
foreach (table_status() as $table_status) {
if (!isset($table_status["Engine"])) { // view
foreach (table_status('', true) as $table => $table_status) {
if (is_view($table_status)) {
continue;
}
$pos = 0;
$schema[$table_status["Name"]]["fields"] = array();
foreach (fields($table_status["Name"]) as $name => $field) {
$schema[$table]["fields"] = array();
foreach (fields($table) as $name => $field) {
$pos += 1.25;
$field["pos"] = $pos;
$schema[$table_status["Name"]]["fields"][$name] = $field;
$schema[$table]["fields"][$name] = $field;
}
$schema[$table_status["Name"]]["pos"] = ($table_pos[$table_status["Name"]] ? $table_pos[$table_status["Name"]] : array($top, 0));
foreach ($adminer->foreignKeys($table_status["Name"]) as $val) {
$schema[$table]["pos"] = ($table_pos[$table] ? $table_pos[$table] : array($top, 0));
foreach ($adminer->foreignKeys($table) as $val) {
if (!$val["db"]) {
$left = $base_left;
if ($table_pos[$table_status["Name"]][1] || $table_pos[$val["table"]][1]) {
$left = min(floatval($table_pos[$table_status["Name"]][1]), floatval($table_pos[$val["table"]][1])) - 1;
if ($table_pos[$table][1] || $table_pos[$val["table"]][1]) {
$left = min(floatval($table_pos[$table][1]), floatval($table_pos[$val["table"]][1])) - 1;
} else {
$base_left -= .1;
}
@@ -40,12 +40,12 @@ foreach (table_status() as $table_status) {
// find free $left
$left -= .0001;
}
$schema[$table_status["Name"]]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]);
$referenced[$val["table"]][$table_status["Name"]][(string) $left] = $val["target"];
$schema[$table]["references"][$val["table"]][(string) $left] = array($val["source"], $val["target"]);
$referenced[$val["table"]][$table][(string) $left] = $val["target"];
$lefts[(string) $left] = true;
}
}
$top = max($top, $schema[$table_status["Name"]]["pos"][0] + 2.5 + $pos);
$top = max($top, $schema[$table]["pos"][0] + 2.5 + $pos);
}
?>
@@ -62,10 +62,12 @@ document.onmouseup = function (ev) {
foreach ($schema as $name => $table) {
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schemaMousedown(this, event);'>";
echo '<a href="' . h(ME) . 'table=' . urlencode($name) . '"><b>' . h($name) . "</b></a>";
foreach ($table["fields"] as $field) {
$val = '<span' . type_class($field["type"]) . ' title="' . h($field["full_type"] . ($field["null"] ? " NULL" : '')) . '">' . h($field["field"]) . '</span>';
echo "<br>" . ($field["primary"] ? "<i>$val</i>" : $val);
}
foreach ((array) $table["references"] as $target_name => $refs) {
foreach ($refs as $left => $ref) {
$left1 = $left - $table_pos[$name][1];
@@ -75,6 +77,7 @@ foreach ($schema as $name => $table) {
}
}
}
foreach ((array) $referenced[$name] as $target_name => $refs) {
foreach ($refs as $left => $columns) {
$left1 = $left - $table_pos[$name][1];
@@ -84,8 +87,10 @@ foreach ($schema as $name => $table) {
}
}
}
echo "\n</div>\n";
}
foreach ($schema as $name => $table) {
foreach ((array) $table["references"] as $target_name => $refs) {
foreach ($refs as $left => $ref) {

View File

@@ -1,10 +1,12 @@
<?php
$row = $_POST;
if ($_POST && !$error) {
$link = preg_replace('~ns=[^&]*&~', '', ME) . "ns=";
if ($_POST["drop"]) {
query_redirect("DROP SCHEMA " . idf_escape($_GET["ns"]), $link, lang('Schema has been dropped.'));
} else {
$name = trim($_POST["name"]);
$name = trim($row["name"]);
$link .= urlencode($name);
if ($_GET["ns"] == "") {
query_redirect("CREATE SCHEMA " . idf_escape($name), $link, lang('Schema has been created.'));
@@ -18,15 +20,14 @@ if ($_POST && !$error) {
page_header($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema'), $error);
$row = $_POST;
if (!$row) {
$row = array("name" => $_GET["ns"]);
$row["name"] = $_GET["ns"];
}
?>
<form action="" method="post">
<p><input id="name" name="name" value="<?php echo h($row["name"]); ?>">
<script type='text/javascript'>document.getElementById('name').focus();</script>
<p><input name="name" id="name" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
<script type='text/javascript'>focus(document.getElementById('name'));</script>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if ($_GET["ns"] != "") {

View File

@@ -3,8 +3,8 @@ header("Content-Type: text/javascript; charset=utf-8");
if ($_GET["script"] == "db") {
$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
foreach (table_status() as $table_status) {
$id = js_escape($table_status["Name"]);
foreach (table_status() as $name => $table_status) {
$id = js_escape($name);
json_row("Comment-$id", nbsp($table_status["Comment"]));
if (!is_view($table_status)) {
foreach (array("Engine", "Collation") as $key) {

View File

@@ -17,7 +17,7 @@ $text_length = null;
foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field);
if (isset($field["privileges"]["select"]) && $name != "") {
$columns[$key] = html_entity_decode(strip_tags($name));
$columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
if (is_shortable($field)) {
$text_length = $adminer->selectLengthProcess();
}
@@ -30,29 +30,26 @@ $is_group = count($group) < count($select);
$where = $adminer->selectSearchProcess($fields, $indexes);
$order = $adminer->selectOrderProcess($fields, $indexes);
$limit = $adminer->selectLimitProcess();
$from = ($select ? implode(", ", $select) : "*" . ($oid ? ", $oid" : ""));
if ($jush == "sql") {
foreach ($columns as $key => $val) {
$as = convert_field($fields[$key]);
if ($as) {
$from .= ", $as AS " . idf_escape($key);
}
}
}
$from .= "\nFROM " . table($TABLE);
$from = ($select ? implode(", ", $select) : "*" . ($oid ? ", $oid" : ""))
. convert_fields($columns, $fields, $select)
. "\nFROM " . table($TABLE);
$group_by = ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
if ($_GET["val"] && is_ajax()) {
header("Content-Type: text/plain; charset=utf-8");
foreach ($_GET["val"] as $unique_idf => $row) {
$as = convert_field($fields[key($row)]);
echo $connection->result("SELECT" . limit(($as ? $as : idf_escape(key($row))) . " FROM " . table($TABLE), " WHERE " . where_check($unique_idf, $fields) . ($where ? " AND " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : ""), 1));
echo $connection->result("SELECT" . limit($as ? $as : idf_escape(key($row)) . " FROM " . table($TABLE), " WHERE " . where_check($unique_idf, $fields) . ($where ? " AND " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : ""), 1));
}
exit;
}
if ($_POST && !$error) {
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
$where_check = $where;
if (is_array($_POST["check"])) {
$where_check[] = "((" . implode(") OR (", array_map('where_check', $_POST["check"])) . "))";
}
$where_check = ($where_check ? "\nWHERE " . implode(" AND ", $where_check) : "");
$primary = $unselected = null;
foreach ($indexes as $index) {
if ($index["type"] == "PRIMARY") {
@@ -66,16 +63,13 @@ if ($_POST && !$error) {
unset($unselected[$key]);
}
}
if ($_POST["export"]) {
cookie("adminer_import", "output=" . urlencode($_POST["output"]) . "&format=" . urlencode($_POST["format"]));
dump_headers($TABLE);
$adminer->dumpTable($TABLE, "");
if (!is_array($_POST["check"]) || $unselected === array()) {
$where2 = $where;
if (is_array($_POST["check"])) {
$where2[] = "($where_check)";
}
$query = "SELECT $from" . ($where2 ? "\nWHERE " . implode(" AND ", $where2) : "") . $group_by;
$query = "SELECT $from$where_check$group_by";
} else {
$union = array();
foreach ($_POST["check"] as $val) {
@@ -87,6 +81,7 @@ if ($_POST && !$error) {
$adminer->dumpData($TABLE, "table", $query);
exit;
}
if (!$adminer->selectEmailProcess($where, $foreign_keys)) {
if ($_POST["save"] || $_POST["delete"]) { // edit
$result = true;
@@ -117,12 +112,12 @@ if ($_POST && !$error) {
$query = "INTO $query";
}
if ($_POST["all"] || ($unselected === array() && $_POST["check"]) || $is_group) {
$result = queries("$command $query" . ($_POST["all"] ? ($where ? "\nWHERE " . implode(" AND ", $where) : "") : "\nWHERE $where_check"));
$result = queries("$command $query$where_check");
$affected = $connection->affected_rows;
} else {
foreach ((array) $_POST["check"] as $val) {
// where is not unique so OR can't be used
$result = queries($command . limit1($query, "\nWHERE " . where_check($val, $fields)));
$result = queries($command . limit1($query, "\nWHERE " . ($where ? implode(" AND ", $where) . " AND " : "") . where_check($val, $fields)));
if (!$result) {
break;
}
@@ -137,8 +132,9 @@ if ($_POST && !$error) {
$message = lang('Item%s has been inserted.', " $last_id");
}
}
queries_redirect(remove_from_uri("page"), $message, $result);
queries_redirect(remove_from_uri($_POST["all"] && $_POST["delete"] ? "page" : ""), $message, $result);
//! display edit page in case of an error
} elseif (!$_POST["import"]) { // modify
if (!$_POST["val"]) {
$error = lang('Ctrl+click on a value to modify it.');
@@ -161,6 +157,7 @@ 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
cookie("adminer_import", "output=" . urlencode($adminer_import["output"]) . "&format=" . urlencode($_POST["separator"]));
@@ -192,6 +189,7 @@ 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);
}
@@ -257,7 +255,7 @@ if (!$columns) {
if (!$result) {
echo "<p class='error'>" . error() . "\n";
} else {
if ($jush == "mssql") {
if ($jush == "mssql" && $page) {
$result->seek($limit * $page);
}
$email_fields = array();
@@ -313,6 +311,7 @@ if (!$columns) {
next($select);
}
}
$lengths = array();
if ($_GET["modify"]) {
foreach ($rows as $row) {
@@ -321,26 +320,43 @@ if (!$columns) {
}
}
}
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
if (is_ajax()) {
if ($limit % 2 == 1 && $page % 2 == 1) {
odd();
}
ob_end_clean();
}
foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) {
$unique_array = unique_array($rows[$n], $indexes);
if (!$unique_array) {
$unique_array = array();
foreach ($rows[$n] as $key => $val) {
if (!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~', $key)) { //! columns looking like functions
$unique_array[$key] = $val;
}
}
}
$unique_idf = "";
foreach ($unique_array as $key => $val) {
if (strlen($val) > 64) {
$key = "MD5(" . (strpos($key, '(') ? $key : idf_escape($key)) . ")"; //! columns looking like functions
$val = md5($val);
}
$unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
}
echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . ($is_group || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>"));
foreach ($row as $key => $val) {
if (isset($names[$key])) {
$field = $fields[$key];
if ($val != "" && (!isset($email_fields[$key]) || $email_fields[$key] != "")) {
$email_fields[$key] = (is_mail($val) ? $names[$key] : ""); //! filled e-mails can be contained on other pages
}
$link = "";
$val = $adminer->editVal($val, $field);
if ($val !== null) {
@@ -369,6 +385,7 @@ if (!$columns) {
}
}
}
if ($key == "COUNT(*)") { //! columns looking like functions
$link = ME . "select=" . urlencode($TABLE);
$i = 0;
@@ -381,7 +398,9 @@ if (!$columns) {
$link .= where_link($i++, $k, $v);
}
}
}
if (!$link && ($link = $adminer->selectLink($row[$key], $field)) === null) {
if (is_mail($row[$key])) {
$link = "mailto:$row[$key]";
@@ -393,6 +412,7 @@ if (!$columns) {
);
}
}
$id = h("val[$unique_idf][" . bracket_escape($key) . "]");
$value = $_POST["val"][$unique_idf][bracket_escape($key)];
$h_value = h($value !== null ? $value : $row[$key]);
@@ -405,12 +425,14 @@ if (!$columns) {
);
}
}
if ($backward_keys) {
echo "<td>";
}
$adminer->backwardKeysPrint($backward_keys, $rows[$n]);
echo "</tr>\n"; // close to allow white-space: pre
}
if (is_ajax()) {
exit;
}
@@ -429,8 +451,9 @@ if (!$columns) {
$exact_count = false;
}
}
echo "<p class='pages'>";
if (+$limit && ($found_rows === false || $found_rows > $limit)) {
if (+$limit && ($found_rows === false || $found_rows > $limit || $page)) {
echo "<p class='pages'>";
// display first, previous 4, next 4 and last page
$max_page = ($found_rows === false
? $page + (count($rows) >= $limit ? 2 : 1)
@@ -441,11 +464,19 @@ if (!$columns) {
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
echo pagination($i, $page);
}
echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count && $found_rows !== false ? pagination($max_page, $page) : ' <a href="' . h(remove_from_uri("page") . "&page=last") . '">' . lang('last') . "</a>");
if ($max_page > 0) {
echo ($page + 5 < $max_page ? " ..." : "");
echo ($exact_count && $found_rows !== false
? pagination($max_page, $page)
: " <a href='" . h(remove_from_uri("page") . "&page=last") . "' title='~$max_page'>" . lang('last') . "</a>"
);
}
echo (($found_rows === false ? count($rows) + 1 : $found_rows - $page * $limit) > $limit ? ' <a href="' . h(remove_from_uri("page") . "&page=" . ($page + 1)) . '" onclick="return !selectLoadMore(this, ' . (+$limit) . ', \'' . lang('Loading') . '\');">' . lang('Load more data') . '</a>' : '');
}
echo ($found_rows !== false ? " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ")" : "");
echo (+$limit && ($found_rows === false ? count($rows) + 1 : $found_rows - $page * $limit) > $limit ? ' <a href="' . h(remove_from_uri("page") . "&page=" . ($page + 1)) . '" onclick="return !selectLoadMore(this, ' . (+$limit) . ', \'' . lang('Loading') . '\');">' . lang('Load more data') . '</a>' : '');
echo " " . checkbox("all", 1, 0, lang('whole result')) . "\n";
echo "<p>\n";
echo ($found_rows !== false ? "(" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " : "");
echo checkbox("all", 1, 0, lang('whole result')) . "\n";
if ($adminer->selectCommandPrint()) {
?>
@@ -457,7 +488,14 @@ if (!$columns) {
</div></fieldset>
<?php
}
$format = $adminer->dumpFormat();
foreach ((array) $_GET["columns"] as $column) {
if ($column["fun"]) {
unset($format['sql']);
break;
}
}
if ($format) {
print_fieldset("export", lang('Export'));
$output = $adminer->dumpOutput();
@@ -467,6 +505,7 @@ if (!$columns) {
echo "</div></fieldset>\n";
}
}
if ($adminer->selectImportPrint()) {
print_fieldset("import", lang('Import'), !$rows);
echo "<input type='file' name='csv_file'> ";

View File

@@ -1,9 +1,10 @@
<?php
$SEQUENCE = $_GET["sequence"];
$row = $_POST;
if ($_POST && !$error) {
$link = substr(ME, 0, -1);
$name = trim($_POST["name"]);
$name = trim($row["name"]);
if ($_POST["drop"]) {
query_redirect("DROP SEQUENCE " . idf_escape($SEQUENCE), $link, lang('Sequence has been dropped.'));
} elseif ($SEQUENCE == "") {
@@ -17,14 +18,13 @@ if ($_POST && !$error) {
page_header($SEQUENCE != "" ? lang('Alter sequence') . ": " . h($SEQUENCE) : lang('Create sequence'), $error);
$row = $_POST;
if (!$row) {
$row = array("name" => $SEQUENCE);
$row["name"] = $SEQUENCE;
}
?>
<form action="" method="post">
<p><input name="name" value="<?php echo h($row["name"]); ?>">
<p><input name="name" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if ($SEQUENCE != "") {

View File

@@ -20,18 +20,20 @@ if (!$error && $_POST) {
$fp = false;
$query = $_POST["query"];
if ($_POST["webfile"]) {
$fp = @fopen((file_exists("adminer.sql") ? "adminer.sql"
: (file_exists("adminer.sql.gz") ? "compress.zlib://adminer.sql.gz"
: "compress.bzip2://adminer.sql.bz2"
)), "rb");
$fp = @fopen((file_exists("adminer.sql")
? "adminer.sql"
: "compress.zlib://adminer.sql.gz"
), "rb");
$query = ($fp ? fread($fp, 1e6) : false);
} elseif ($_FILES && $_FILES["sql_file"]["error"] != UPLOAD_ERR_NO_FILE) {
} elseif ($_FILES && $_FILES["sql_file"]["error"][0] != 4) { // 4 - UPLOAD_ERR_NO_FILE
$query = get_file("sql_file", true);
}
if (is_string($query)) { // get_file() returns error as number, fread() as false
if (function_exists('memory_get_usage')) {
@ini_set("memory_limit", max(ini_bytes("memory_limit"), 2 * strlen($query) + memory_get_usage() + 8e6)); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables
}
if ($query != "" && strlen($query) < 1e6) { // don't add big queries
$q = $query . (ereg(";[ \t\r\n]*\$", $query) ? "" : ";"); //! doesn't work with DELIMITER |
if (!$history || reset(end($history)) != $q) { // no repeated queries
@@ -41,6 +43,7 @@ if (!$error && $_POST) {
stop_session();
}
}
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";
$delimiter = ";";
$offset = 0;
@@ -57,6 +60,7 @@ if (!$error && $_POST) {
parse_str($_COOKIE["adminer_export"], $adminer_export);
$dump_format = $adminer->dumpFormat();
unset($dump_format["sql"]);
while ($query != "") {
if (!$offset && preg_match("~^$space*DELIMITER\\s+(\\S+)~i", $query, $match)) {
$delimiter = $match[1];
@@ -71,6 +75,7 @@ if (!$error && $_POST) {
break;
}
$offset = $pos + strlen($found);
if ($found && rtrim($found) != $delimiter) { // find matching quote or comment end
while (preg_match('(' . ($found == '/*' ? '\\*/' : ($found == '[' ? ']' : (ereg('^-- |^#', $found) ? "\n" : preg_quote($found) . "|\\\\."))) . '|$)s', $query, $match, PREG_OFFSET_CAPTURE, $offset)) { //! respect sql_mode NO_BACKSLASH_ESCAPES
$s = $match[0][0];
@@ -83,6 +88,7 @@ if (!$error && $_POST) {
}
}
}
} else { // end of a query
$empty = false;
$q = substr($query, 0, $pos);
@@ -98,10 +104,14 @@ if (!$error && $_POST) {
if ($connection->multi_query($q) && is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) {
$connection2->query($q);
}
do {
$result = $connection->store_result();
$end = microtime();
$time = format_time($start, $end) . (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : ""); // 1000 - maximum length of encoded URL in IE is 2083 characters
$time = " <span class='time'>(" . format_time($start, $end) . ")</span>"
. (strlen($q) < 1000 ? " <a href='" . h(ME) . "sql=" . urlencode(trim($q)) . "'>" . lang('Edit') . "</a>" : "") // 1000 - maximum length of encoded URL in IE is 2083 characters
;
if ($connection->error) {
echo ($_POST["only_errors"] ? $print : "");
echo "<p class='error'>" . lang('Error in query') . ($connection->errno ? " ($connection->errno)" : "") . ": " . error() . "\n";
@@ -109,6 +119,7 @@ if (!$error && $_POST) {
if ($_POST["error_stops"]) {
break 2;
}
} elseif (is_object($result)) {
$orgtables = select($result, $connection2);
if (!$_POST["only_errors"]) {
@@ -132,6 +143,7 @@ if (!$error && $_POST) {
}
echo "</form>\n";
}
} else {
if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) {
restart_session();
@@ -142,23 +154,29 @@ if (!$error && $_POST) {
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
}
}
$start = $end;
} while ($connection->next_result());
$line += substr_count($q.$found, "\n");
$query = substr($query, $offset);
$offset = 0;
}
}
}
}
if ($empty) {
echo "<p class='message'>" . lang('No commands to execute.') . "\n";
} elseif ($_POST["only_errors"]) {
echo "<p class='message'>" . lang('%d query(s) executed OK.', $commands - count($errors)) . format_time($total_start, microtime()) . "\n";
echo "<p class='message'>" . lang('%d query(s) executed OK.', $commands - count($errors));
echo " <span class='time'>(" . format_time($total_start, microtime()) . ")</span>\n";
} elseif ($errors && $commands > 1) {
echo "<p class='error'>" . lang('Error in query') . ": " . implode("", $errors) . "\n";
}
//! MS SQL - SET SHOWPLAN_ALL OFF
} else {
echo "<p class='error'>" . upload_error($query) . "\n";
}
@@ -176,34 +194,31 @@ if ($_POST) {
$q = $history[$_GET["history"]][0];
}
textarea("query", $q, 20);
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n");
echo ($_POST ? "" : "<script type='text/javascript'>focus(document.getElementsByTagName('textarea')[0]);</script>\n");
echo "<p>" . (ini_bool("file_uploads")
? lang('File upload') . ': <input type="file" name="sql_file"' . ($_FILES && $_FILES["sql_file"]["error"] != 4 ? '' : ' onchange="this.form[\'only_errors\'].checked = true;"') . '> (&lt; ' . ini_get("upload_max_filesize") . 'B)' // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
? lang('File upload') . ': <input type="file" name="sql_file[]" multiple'
. ($_FILES && $_FILES["sql_file"]["error"][0] != 4 ? '' : ' onchange="this.form[\'only_errors\'].checked = true;"') // 4 - UPLOAD_ERR_NO_FILE
. '> (&lt; ' . ini_get("upload_max_filesize") . 'B)' // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
: lang('File uploads are disabled.')
);
?>
<p>
<input type="submit" value="<?php echo lang('Execute'); ?>" title="Ctrl+Enter">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php
echo checkbox("error_stops", 1, $_POST["error_stops"], lang('Stop on error')) . "\n";
echo checkbox("only_errors", 1, $_POST["only_errors"], lang('Show only errors')) . "\n";
print_fieldset("webfile", lang('From server'), $_POST["webfile"], "document.getElementById('form')['only_errors'].checked = true; ");
$compress = array();
foreach (array("gz" => "zlib", "bz2" => "bz2") as $key => $val) {
if (extension_loaded($val)) {
$compress[] = ".$key";
}
}
echo lang('Webserver file %s', "<code>adminer.sql" . ($compress ? "[" . implode("|", $compress) . "]" : "") . "</code>");
echo lang('Webserver file %s', "<code>adminer.sql" . (extension_loaded("zlib") ? "[.gz]" : "") . "</code>");
echo ' <input type="submit" name="webfile" value="' . lang('Run file') . '">';
echo "</div></fieldset>\n";
if ($history) {
print_fieldset("history", lang('History'), $_GET["history"] != "");
foreach ($history as $key => $val) {
for ($val = end($history); $val; $val = prev($history)) { // not array_reverse() to save memory
$key = key($history);
list($q, $time) = $val;
echo '<a href="' . h(ME . "sql=&history=$key") . '">' . lang('Edit') . "</a> <span class='time' title='" . @date('Y-m-d', $time) . "'>" . @date("H:i:s", $time) . "</span> <code class='jush-$jush'>" . shorten_utf8(ltrim(str_replace("\n", " ", str_replace("\r", "", preg_replace('~^(#|-- ).*~m', '', $q)))), 80, "</code>") . "<br>\n"; // @ - time zone may be not set
}
@@ -212,5 +227,5 @@ if ($history) {
echo "</div></fieldset>\n";
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -21,6 +21,8 @@ code { background: #eee; }
tbody tr:hover td, tbody tr:hover th { background: #eee; }
pre { margin: 1em 0 0; }
input[type=image] { vertical-align: middle; }
input.default { box-shadow: 1px 1px 1px #777; }
.block { display: block; }
.version { color: #777; font-size: 67%; }
.js .hidden, .nojs .jsonly { display: none; }
.js .column { position: absolute; background: #ddf; padding: .3em 1ex .3em 0; margin-top: -.3em; }
@@ -35,7 +37,7 @@ input[type=image] { vertical-align: middle; }
.enum { color: #007F7F; }
.binary { color: red; }
.odd td { background: #F5F5F5; }
.js .checked td, .js .checked th { background: #ddf; }
.js .checkable .checked td, .js .checkable .checked th { background: #ddf; }
.time { color: silver; font-size: 70%; }
.function { text-align: right; }
.number { text-align: right; }
@@ -46,10 +48,13 @@ input[type=image] { vertical-align: middle; }
.sqlarea { width: 98%; }
.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; }
#dbs { overflow: hidden; }
#logins, #tables { white-space: nowrap; overflow: auto; }
#logins, #tables { white-space: nowrap; overflow: auto; text-overflow: ellipsis; }
#logins a, #tables a { background: #fff; }
#logout { background: none; border: none; color: blue; font: inherit; padding: 0; text-decoration: underline; cursor: pointer; }
#logout:hover { color: red; }
@@ -68,6 +73,16 @@ input[type=image] { vertical-align: middle; }
.rtl #breadcrumb { left: auto; right: 21em; margin: 0 -18px 0 0; }
.rtl #lang, .rtl #menu { left: auto; right: 0; }
@media all and (max-device-width: 880px) {
.pages { left: auto; }
#menu { position: static; width: auto; }
#content { margin-left: 10px; }
#lang { position: static; border-top: 1px solid #999; }
#breadcrumb { left: auto; }
.rtl #content { margin-right: 10px; }
.rtl #breadcrumb { right: auto; }
}
@media print {
#lang, #menu { display: none; }
#content { margin-left: 1em; }

View File

@@ -75,6 +75,37 @@ function loginDriver(driver) {
var dbCtrl;
var dbPrevious;
/** Check if database should be opened to a new window
* @param MouseEvent
* @param HTMLSelectElement
*/
function dbMouseDown(event, el) {
dbCtrl = isCtrl(event);
if (dbPrevious == undefined) {
dbPrevious = el.value;
}
}
/** Load database after selecting it
* @param HTMLSelectElement
*/
function dbChange(el) {
if (dbCtrl) {
el.form.target = '_blank';
}
el.form.submit();
el.form.target = '';
if (dbCtrl && dbPrevious != undefined) {
el.value = dbPrevious;
dbPrevious = undefined;
}
}
/** Handle Tab and Esc in textarea
* @param HTMLTextAreaElement
* @param KeyboardEvent
@@ -168,6 +199,30 @@ function selectFieldChange(form) {
setHtml('noindex', (ok ? '' : '!'));
}
/** Create edit query form
* @param MouseEvent
* @param HTMLSpanElement
* @param string
*/
function selectEditSql(event, el, label) {
var a = parentTag(event.target || event.srcElement, 'a');
if (!isCtrl(event) || (a && a.href)) {
return;
}
var sql = el.firstChild;
var input = document.createElement('input');
input.name = 'query';
input.value = sql.textContent || sql.innerText;
input.style.width = sql.offsetWidth + 'px';
el.innerHTML = '';
el.appendChild(input);
var submit = document.createElement('input');
submit.type = 'submit';
submit.value = label;
el.appendChild(submit);
return true;
}
var added = '.', rowCount;
@@ -230,17 +285,13 @@ function editingNameChange(field) {
/** Add table row for next field
* @param HTMLInputElement
* @param boolean
* @param boolean
* @return boolean
*/
function editingAddRow(button, allowed, focus) {
if (allowed && rowCount >= allowed) {
return false;
}
function editingAddRow(button, focus) {
var match = /(\d+)(\.\d+)?/.exec(button.name);
var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
var row = parentTag(button, 'tr');
var row2 = row.cloneNode(true);
var row2 = cloneNode(row);
var tags = row.getElementsByTagName('select');
var tags2 = row2.getElementsByTagName('select');
for (var i=0; i < tags.length; i++) {
@@ -312,7 +363,10 @@ function editingTypeChange(type) {
el.className = (/(char|text|enum|set)$/.test(text) ? '' : 'hidden');
}
if (el.name == name + '[unsigned]') {
el.className = (/(int|float|double|decimal)$/.test(text) ? '' : 'hidden');
el.className = (/((^|[^o])int|float|double|decimal)$/.test(text) ? '' : 'hidden');
}
if (el.name == name + '[on_update]') {
el.className = (text == 'timestamp' ? '' : 'hidden');
}
if (el.name == name + '[on_delete]') {
el.className = (/`/.test(text) ? '' : 'hidden');
@@ -362,7 +416,7 @@ function columnShow(checked, column) {
*/
function editingHideDefaults() {
if (innerWidth < document.documentElement.scrollWidth) {
document.getElementById('defaults').checked = false;
document.getElementById('form')['defaults'].checked = false;
columnShow(false, 5);
}
}
@@ -380,7 +434,7 @@ function partitionByChange(el) {
* @param HTMLInputElement
*/
function partitionNameChange(el) {
var row = parentTag(el, 'tr').cloneNode(true);
var row = cloneNode(parentTag(el, 'tr'));
row.firstChild.firstChild.value = '';
parentTag(el, 'table').appendChild(row);
el.onchange = function () {};
@@ -393,7 +447,7 @@ function partitionNameChange(el) {
*/
function foreignAddRow(field) {
field.onchange = function () { };
var row = parentTag(field, 'tr').cloneNode(true);
var row = cloneNode(parentTag(field, 'tr'));
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/\]/, '1$&');
@@ -409,7 +463,7 @@ function foreignAddRow(field) {
*/
function indexesAddRow(field) {
field.onchange = function () { };
var row = parentTag(field, 'tr').cloneNode(true);
var row = cloneNode(parentTag(field, 'tr'));
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/indexes\[\d+/, '$&1');
@@ -452,7 +506,7 @@ function indexesAddColumn(field, prefix) {
select.selectedIndex = 3;
select.onchange();
}
var column = field.parentNode.cloneNode(true);
var column = cloneNode(field.parentNode);
select = column.getElementsByTagName('select')[0];
select.name = select.name.replace(/\]\[\d+/, '$&1');
select.selectedIndex = 0;

View File

@@ -40,12 +40,12 @@ function selectValue(select) {
/** Get parent node with specified tag name.
* @param HTMLElement
* @param string
* @param string regular expression
* @return HTMLElement
*/
function parentTag(el, tag) {
var re = new RegExp('^' + tag + '$', 'i');
while (!re.test(el.tagName)) {
while (el && !re.test(el.tagName)) {
el = el.parentNode;
}
return el;
@@ -218,7 +218,7 @@ function pageClick(href, page, event) {
*/
function menuOver(el, event) {
var a = event.target;
if (/^a$/i.test(a.tagName) && a.offsetLeft + a.offsetWidth > a.parentNode.offsetWidth) {
if (/^a$/i.test(a.tagName) && a.offsetLeft + a.offsetWidth > a.parentNode.offsetWidth - 15) { // 15 - ellipsis
el.style.overflow = 'visible';
}
}
@@ -240,7 +240,7 @@ function selectAddRow(field) {
selectFieldChange(field.form);
};
field.onchange();
var row = field.parentNode.cloneNode(true);
var row = cloneNode(field.parentNode);
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/[a-z]\[\d+/, '$&1');
@@ -255,6 +255,15 @@ function selectAddRow(field) {
field.parentNode.parentNode.appendChild(row);
}
/** Clear column name after resetting search
* @param HTMLInputElement
*/
function selectSearchSearch(el) {
if (!el.value) {
el.parentNode.firstChild.selectedIndex = 0;
}
}
/** Toggles column context menu
@@ -465,6 +474,7 @@ function selectClick(td, event, text, warning) {
}
td.innerHTML = '';
td.appendChild(input);
setupSubmitHighlight(td);
input.focus();
if (text == 2) { // long text
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (request) {
@@ -500,12 +510,10 @@ function selectLoadMore(a, limit, loading) {
if (href) {
a.removeAttribute('href');
return ajax(href, function (request) {
document.getElementById('table').innerHTML += request.responseText;
var rows = 0;
request.responseText.replace(/(^|\n)<tr/g, function () {
rows++;
});
if (rows < limit) {
var tbody = document.createElement('tbody');
tbody.innerHTML = request.responseText;
document.getElementById('table').appendChild(tbody);
if (tbody.children.length < limit) {
a.parentNode.removeChild(a);
} else {
a.href = href.replace(/\d+$/, function (page) {
@@ -529,3 +537,88 @@ function eventStop(event) {
event.cancelBubble = true;
}
}
/** Setup highlighting of default submit button on form field focus
* @param HTMLElement
*/
function setupSubmitHighlight(parent) {
for (var key in { input: 1, select: 1, textarea: 1 }) {
var inputs = parent.getElementsByTagName(key);
for (var i = 0; i < inputs.length; i++) {
if (!/submit|image|file/.test(inputs[i].type)) {
addEvent(inputs[i], 'focus', inputFocus);
addEvent(inputs[i], 'blur', inputBlur);
}
}
}
}
/** Highlight default submit button
* @this HTMLInputElement
*/
function inputFocus() {
var submit = findDefaultSubmit(this.form);
if (submit) {
submit.className += ' default';
}
}
/** Unhighlight default submit button
* @this HTMLInputElement
*/
function inputBlur() {
var submit = findDefaultSubmit(this.form);
if (submit) {
submit.className = submit.className.replace(/ default( |$)/, '$1');
}
}
/** Find submit button used by Enter
* @param HTMLFormElement
* @return HTMLInputElement
*/
function findDefaultSubmit(form) {
var inputs = form.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
if (input.type == 'submit') {
return input;
}
}
}
/** Add event listener
* @param HTMLElement
* @param string without 'on'
* @param function
*/
function addEvent(el, action, handler) {
if (el.addEventListener) {
el.addEventListener(action, handler, false);
} else {
el.attachEvent('on' + action, handler);
}
}
/** Defer focusing element
* @param HTMLElement
*/
function focus(el) {
setTimeout(function () { // this has to be an anonymous function because Firefox passes some arguments to setTimeout callback
el.focus();
}, 0);
}
/** Clone node and setup submit highlighting
* @param HTMLElement
* @return HTMLElement
*/
function cloneNode(el) {
var el2 = el.cloneNode(true);
setupSubmitHighlight(el2);
return el2;
}

BIN
adminer/static/move.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

View File

@@ -4,9 +4,10 @@ $fields = fields($TABLE);
if (!$fields) {
$error = error();
}
$table_status = ($fields ? table_status($TABLE) : array());
$table_status = table_status($TABLE, true);
page_header(($fields && is_view($table_status) ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
$adminer->selectLinks($table_status);
$comment = $table_status["Comment"];
if ($comment != "") {
@@ -26,7 +27,7 @@ if ($fields) {
echo "</table>\n";
if (!is_view($table_status)) {
echo "<h3>" . lang('Indexes') . "</h3>\n";
echo "<h3 id='indexes'>" . lang('Indexes') . "</h3>\n";
$indexes = indexes($TABLE);
if ($indexes) {
echo "<table cellspacing='0'>\n";
@@ -43,7 +44,7 @@ if ($fields) {
echo '<p><a href="' . h(ME) . 'indexes=' . urlencode($TABLE) . '">' . lang('Alter indexes') . "</a>\n";
if (fk_support($table_status)) {
echo "<h3>" . lang('Foreign keys') . "</h3>\n";
echo "<h3 id='foreign-keys'>" . lang('Foreign keys') . "</h3>\n";
$foreign_keys = foreign_keys($TABLE);
if ($foreign_keys) {
echo "<table cellspacing='0'>\n";
@@ -68,7 +69,7 @@ if ($fields) {
}
if (support("trigger")) {
echo "<h3>" . lang('Triggers') . "</h3>\n";
echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n";
$triggers = triggers($TABLE);
if ($triggers) {
echo "<table cellspacing='0'>\n";
@@ -79,5 +80,6 @@ if ($fields) {
}
echo '<p><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
}
}
}

View File

@@ -1,29 +1,36 @@
<?php
$TABLE = $_GET["trigger"];
$name = $_GET["name"];
$trigger_options = trigger_options();
$trigger_event = array("INSERT", "UPDATE", "DELETE");
$row = (array) trigger($name) + array("Trigger" => $TABLE . "_bi");
$dropped = false;
if ($_POST && !$error && in_array($_POST["Timing"], $trigger_options["Timing"]) && in_array($_POST["Event"], $trigger_event) && in_array($_POST["Type"], $trigger_options["Type"])) {
$timing_event = " $_POST[Timing] $_POST[Event]";
$on = " ON " . table($TABLE);
$dropped = drop_create(
"DROP TRIGGER " . idf_escape($_GET["name"]) . ($jush == "pgsql" ? $on : ""),
"CREATE TRIGGER " . idf_escape($_POST["Trigger"]) . ($jush == "mssql" ? $on . $timing_event : $timing_event . $on) . rtrim(" $_POST[Type]\n$_POST[Statement]", ";") . ";",
ME . "table=" . urlencode($TABLE),
lang('Trigger has been dropped.'),
lang('Trigger has been altered.'),
lang('Trigger has been created.'),
$_GET["name"]
);
if ($_POST) {
if (!$error && in_array($_POST["Timing"], $trigger_options["Timing"]) && in_array($_POST["Event"], $trigger_event) && in_array($_POST["Type"], $trigger_options["Type"])) {
// don't use drop_create() because there may not be more triggers for the same action
$on = " ON " . table($TABLE);
$drop = "DROP TRIGGER " . idf_escape($name) . ($jush == "pgsql" ? $on : "");
$location = ME . "table=" . urlencode($TABLE);
if ($_POST["drop"]) {
query_redirect($drop, $location, lang('Trigger has been dropped.'));
} else {
if ($name != "") {
queries($drop);
}
queries_redirect(
$location,
($name != "" ? lang('Trigger has been altered.') : lang('Trigger has been created.')),
queries(create_trigger($on, $_POST))
);
if ($name != "") {
queries(create_trigger($on, $row + array("Type" => reset($trigger_options["Type"]))));
}
}
}
$row = $_POST;
}
page_header(($_GET["name"] != "" ? lang('Alter trigger') . ": " . h($_GET["name"]) : lang('Create trigger')), $error, array("table" => $TABLE));
$row = $_POST;
if (!$row) {
$row = trigger($_GET["name"]) + array("Trigger" => $TABLE . "_bi");
}
page_header(($name != "" ? lang('Alter trigger') . ": " . h($name) : lang('Create trigger')), $error, array("table" => $TABLE));
?>
<form action="" method="post" id="form">
@@ -32,11 +39,10 @@ if (!$row) {
<tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?>
<tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?>
</table>
<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64" autocapitalize="off">
<p><?php textarea("Statement", $row["Statement"]); ?>
<p>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($_GET["name"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<?php if ($name != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -1,20 +1,20 @@
<?php
$TYPE = $_GET["type"];
$row = $_POST;
if ($_POST && !$error) {
$link = substr(ME, 0, -1);
if ($_POST["drop"]) {
query_redirect("DROP TYPE " . idf_escape($TYPE), $link, lang('Type has been dropped.'));
} else {
query_redirect("CREATE TYPE " . idf_escape(trim($_POST["name"])) . " $_POST[as]", $link, lang('Type has been created.'));
query_redirect("CREATE TYPE " . idf_escape(trim($row["name"])) . " $row[as]", $link, lang('Type has been created.'));
}
}
page_header($TYPE != "" ? lang('Alter type') . ": " . h($TYPE) : lang('Create type'), $error);
$row = $_POST;
if (!$row) {
$row = array("as" => "AS ");
$row["as"] = "AS ";
}
?>
@@ -24,7 +24,7 @@ if (!$row) {
if ($TYPE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} else {
echo "<input name='name' value='" . h($row['name']) . "'>\n";
echo "<input name='name' value='" . h($row['name']) . "' autocapitalize='off'>\n";
textarea("as", $row["as"]);
echo "<p><input type='submit' value='" . lang('Save') . "'>\n";
}

View File

@@ -26,6 +26,7 @@ if ($_POST) {
}
$grants = array();
$old_pass = "";
if (isset($_GET["host"]) && ($result = $connection->query("SHOW GRANTS FOR " . q($USER) . "@" . q($_GET["host"])))) { //! use information_schema for MySQL 5 - column names in column privileges are not escaped
while ($row = $result->fetch_row()) {
if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO
@@ -46,18 +47,27 @@ if (isset($_GET["host"]) && ($result = $connection->query("SHOW GRANTS FOR " . q
if ($_POST && !$error) {
$old_user = (isset($_GET["host"]) ? q($USER) . "@" . q($_GET["host"]) : "''");
$new_user = q($_POST["user"]) . "@" . q($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different
$pass = q($_POST["pass"]);
if ($_POST["drop"]) {
query_redirect("DROP USER $old_user", ME . "privileges=", lang('User has been dropped.'));
} else {
$created = false;
if ($old_user != $new_user) {
$created = queries(($connection->server_info < 5 ? "GRANT USAGE ON *.* TO" : "CREATE USER") . " $new_user IDENTIFIED BY" . ($_POST["hashed"] ? " PASSWORD" : "") . " $pass");
$error = !$created;
} elseif ($_POST["pass"] != $old_pass || !$_POST["hashed"]) {
queries("SET PASSWORD FOR $new_user = " . ($_POST["hashed"] ? $pass : "PASSWORD($pass)"));
$new_user = q($_POST["user"]) . "@" . q($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different
$pass = $_POST["pass"];
if ($pass != '' && !$_POST["hashed"]) {
// compute hash in a separate query so that plain text password is not saved to history
$pass = $connection->result("SELECT PASSWORD(" . q($pass) . ")");
$error = !$pass;
}
$created = false;
if (!$error) {
if ($old_user != $new_user) {
$created = queries(($connection->server_info < 5 ? "GRANT USAGE ON *.* TO" : "CREATE USER") . " $new_user IDENTIFIED BY PASSWORD " . q($pass));
$error = !$created;
} elseif ($pass != $old_pass) {
queries("SET PASSWORD FOR $new_user = " . q($pass));
}
}
if (!$error) {
$revoke = array();
foreach ($new_grants as $object => $grant) {
@@ -83,6 +93,7 @@ if ($_POST && !$error) {
}
}
}
if (!$error && isset($_GET["host"])) {
if ($old_user != $new_user) {
queries("DROP USER $old_user");
@@ -94,7 +105,9 @@ if ($_POST && !$error) {
}
}
}
queries_redirect(ME . "privileges=", (isset($_GET["host"]) ? lang('User has been altered.') : lang('User has been created.')), !$error);
if ($created) {
// delete new user in case of an error
$connection->query("DROP USER $new_user");
@@ -113,15 +126,15 @@ if ($_POST) {
if ($old_pass != "") {
$row["hashed"] = true;
}
$grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_"))) . ".*"] = array();
$grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_\\"))) . ".*"] = array();
}
?>
<form action="" method="post">
<table cellspacing="0">
<tr><th><?php echo lang('Server'); ?><td><input name="host" maxlength="60" value="<?php echo h($row["host"]); ?>">
<tr><th><?php echo lang('Username'); ?><td><input name="user" maxlength="16" value="<?php echo h($row["user"]); ?>">
<tr><th><?php echo lang('Password'); ?><td><input id="pass" name="pass" value="<?php echo h($row["pass"]); ?>">
<tr><th><?php echo lang('Server'); ?><td><input name="host" maxlength="60" value="<?php echo h($row["host"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Username'); ?><td><input name="user" maxlength="16" value="<?php echo h($row["user"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Password'); ?><td><input name="pass" id="pass" value="<?php echo h($row["pass"]); ?>">
<?php if (!$row["hashed"]) { ?><script type="text/javascript">typePassword(document.getElementById('pass'));</script><?php } ?>
<?php echo checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);"); ?>
</table>
@@ -129,13 +142,14 @@ if ($_POST) {
<?php
//! MAX_* limits, REQUIRE
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th colspan='2'><a href='http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/grant.html#priv_level' target='_blank' rel='noreferrer'>" . lang('Privileges') . "</a>";
echo "<thead><tr><th colspan='2'><a href='http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/grant.html#priv_level' target='_blank' rel='noreferrer' class='help'>" . lang('Privileges') . "</a>";
$i = 0;
foreach ($grants as $object => $grant) {
echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
$i++;
}
echo "</thead>\n";
foreach (array(
"" => "",
"Server Admin" => lang('Server'),
@@ -155,12 +169,13 @@ foreach (array(
} elseif (isset($_GET["grant"])) {
echo "<td><select name=$name><option><option value='1'" . ($value ? " selected" : "") . ">" . lang('Grant') . "<option value='0'" . ($value == "0" ? " selected" : "") . ">" . lang('Revoke') . "</select>";
} else {
echo "<td align='center'><input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges" ? " id='grants-$i-all'" : ($privilege == "Grant option" ? "" : " onclick=\"if (this.checked) formUncheck('grants-$i-all');\"")) . ">"; //! uncheck all except grant if all is checked
echo "<td align='center'><label class='block'><input type='checkbox' name=$name value='1'" . ($value ? " checked" : "") . ($privilege == "All privileges" ? " id='grants-$i-all'" : ($privilege == "Grant option" ? "" : " onclick=\"if (this.checked) formUncheck('grants-$i-all');\"")) . "></label>"; //! uncheck all except grant if all is checked
}
$i++;
}
}
}
echo "</table>\n";
?>
<p>

View File

@@ -1,33 +1,45 @@
<?php
$TABLE = $_GET["view"];
$dropped = false;
$row = $_POST;
if ($_POST && !$error) {
$name = trim($_POST["name"]);
$dropped = drop_create(
"DROP VIEW " . table($TABLE),
"CREATE VIEW " . table($name) . " AS\n$_POST[select]",
($_POST["drop"] ? substr(ME, 0, -1) : ME . "table=" . urlencode($name)),
lang('View has been dropped.'),
lang('View has been altered.'),
lang('View has been created.'),
$TABLE
);
$name = trim($row["name"]);
$as = " AS\n$row[select]";
$location = ME . "table=" . urlencode($name);
$message = lang('View has been altered.');
if (!$_POST["drop"] && $TABLE == $name && $jush != "sqlite") {
query_redirect(($jush == "mssql" ? "ALTER" : "CREATE OR REPLACE") . " VIEW " . table($name) . $as, $location, $message);
} else {
$temp_name = $name . "_adminer_" . uniqid();
drop_create(
"DROP VIEW " . table($TABLE),
"CREATE VIEW " . table($name) . $as,
"DROP VIEW " . table($name),
"CREATE VIEW " . table($temp_name) . $as,
"DROP VIEW " . table($temp_name),
($_POST["drop"] ? substr(ME, 0, -1) : $location),
lang('View has been dropped.'),
$message,
lang('View has been created.'),
$TABLE,
$name
);
}
}
page_header(($TABLE != "" ? lang('Alter view') : lang('Create view')), $error, array("table" => $TABLE), $TABLE);
$row = $_POST;
if (!$row && $TABLE != "") {
if (!$_POST && $TABLE != "") {
$row = view($TABLE);
$row["name"] = $TABLE;
}
?>
<form action="" method="post">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64" autocapitalize="off">
<p><?php textarea("select", $row["select"]); ?>
<p>
<?php if ($dropped) { // old view was dropped but new wasn't created ?><input type="hidden" name="dropped" value="1"><?php } ?>
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($_GET["view"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">

View File

@@ -1,4 +1,56 @@
Adminer 3.6.3 (released 2012-01-23):
Adminer 3.7.1-dev:
Increase click target for checkboxes
Use shadow for highlighting default button
Adminer 3.7.0 (released 2013-05-19):
Allow more SQL files to be uploaded at the same time
Print run time next to executed queries
Don't drop original view and routine before creating the new one
Highlight default submit button
Add server placeholder to login form
Disable SQL export when applying functions in select
Allow using lang() in plugins (customization)
Remove bzip2 compression support
Constraint memory used in TAR export
Allow exporting views dependent on each other (bug #3459151)
Fix resetting search (bug #3612507)
Don't use LIMIT 1 if updating unique row (bug #3613109)
Restrict editing rows without unique identifier to search results
Display navigation bellow main content on mobile browsers
Get number of rows on export page asynchronously
MySQL: Optimize create table page and Editor navigation
MySQL: Display bit type as binary number
MySQL: Improve export of binary data types
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
Adminer 3.6.4 (released 2013-04-26):
Display pagination on a fixed position
Increase default select limit to 50
Display SQL edit form on Ctrl+click on the select query
Display SQL history from newest
Recover original view, trigger, routine if creating fails
Do not store plain text password to history in creating user
Selectable ON UPDATE CURRENT_TIMESTAMP field in create table
Open database to a new window after selecting it with Ctrl
Clear column name after resetting search (bug #3601200)
Explain partitions in SQL query (bug #3600150)
Allow loading more data with inline edit (bug #3605531)
Stay on the same page after deleting rows (bug #3605845)
Respect checked tables in export filename (bug #3245464)
Respect PHP configuration max_input_vars
Fix unsetting permanent login after logout
Disable autocapitalize in identifiers on mobile browsers
MySQL: Compatibility with MySQL 5.6
MySQL: Move ALTER export to plugin
MySQL: Use numeric time zone in export
MySQL: Link processlist documentation
SQLite: Export indexes
Adminer 3.6.3 (released 2013-01-23):
Display error code in SQL query
Allow specifying external links
Treat Meta key same as Ctrl

View File

@@ -42,6 +42,19 @@ function put_file($match) {
}
$return = file_get_contents(dirname(__FILE__) . "/$project/$match[2]");
if (basename($match[2]) != "lang.inc.php" || !$_SESSION["lang"]) {
if (basename($match[2]) == "lang.inc.php") {
$return = str_replace('function lang($idf, $number = null) {', 'function lang($idf, $number = null) {
if (is_string($idf)) { // compiled version uses numbers, string comes from a plugin
// English translation is closest to the original identifiers //! pluralized translations are not found
$pos = array_search($idf, get_translations("en")); //! this should be cached
if ($pos !== false) {
$idf = $pos;
}
}', $return, $count);
if (!$count) {
echo "lang() not found\n";
}
}
$tokens = token_get_all($return); // to find out the last token
return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? "<?php" : "");
} elseif (preg_match('~\\s*(\\$pos = (.+\n).+;)~sU', $return, $match2)) {
@@ -50,16 +63,19 @@ function put_file($match) {
return '$_SESSION[lang]';
}
function lang(\$translation, \$number) {
\$pos = $match2[2]\t\t: " . (preg_match("~\\\$LANG == '$_SESSION[lang]'.* \\? (.+)\n~U", $match2[1], $match3) ? $match3[1] : "1") . '
);
$translation = str_replace("%d", "%s", $translation[$pos]);
function lang(\$translation, \$number = null) {
if (is_array(\$translation)) {
\$pos = $match2[2]\t\t\t: " . (preg_match("~\\\$LANG == '$_SESSION[lang]'.* \\? (.+)\n~U", $match2[1], $match3) ? $match3[1] : "1") . '
);
$translation = $translation[$pos];
}
$translation = str_replace("%d", "%s", $translation);
$number = number_format($number, 0, ".", lang(\',\'));
return sprintf($translation, $number);
}
';
} else {
echo "lang() not found\n";
echo "lang() \$pos not found\n";
}
}
@@ -123,13 +139,19 @@ if ($_SESSION["translations_version"] != ' . $translations_version . ') {
$translations = array();
$_SESSION["translations_version"] = ' . $translations_version . ';
}
if (!$translations) {
switch ($LANG) {' . $return . '
function get_translations($lang) {
switch ($lang) {' . $return . '
}
$translations = array();
foreach (explode("\n", lzw_decompress($compressed)) as $val) {
$translations[] = (strpos($val, "\t") ? explode("\t", $val) : $val);
}
return $translations;
}
if (!$translations) {
$translations = get_translations($LANG);
}
';
}

570
designs/nette/adminer.css Normal file
View File

@@ -0,0 +1,570 @@
/* Theme "Nette" for Adminer, (c) David Grudl */
/*
it is based on some parts of:
- Nette Framework design - http://api.nette.org
- CSS by Brade - http://www.bradezone.com
- Silk icon set 1.3 by Mark James - http://www.famfamfam.com/lab/icons/silk
- CSS icons by Hever - http://hev.cz
*/
body {
background: #FFF;
color: #333;
font: 13px/18px Helvetica, Arial, sans-serif;
}
/* generic */
a, a:visited {
padding: 3px 2px;
color: #006AEB;
text-decoration: none;
}
a:hover {
background-color: #006AEB !important;
border-bottom: 1px solid #006AEB;
color: #FFF;
}
p {
margin-bottom: 4px;
padding-bottom: 4px;
}
h1 {
background: none;
border: none;
color: #666;
font-size: 18px;
font-weight: bold;
height: 40px;
padding: 0 0 8px;
}
h2 {
background: transparent;
border: none;
color: #333;
font: 32px Georgia,serif;
margin: 0;
padding: 10px 0 8px;
}
h3 {
font-size: 18px;
font-weight: bold;
margin: 0;
padding: 4px 0;
}
fieldset {
border: 1px solid #CCC;
float: left;
margin-bottom: 8px;
margin-right: 4px;
min-height: 48px;
padding: 0 4px 4px;
}
fieldset div {
margin-top: 4px;
}
input, select, textarea {
border: 1px solid #CCC;
color: #555;
font: 13px Helvetica,Arial,sans-serif;
padding: 3px;
}
select {
padding: 2px;
}
textarea, .sqlarea {
font-family: Consolas,monospace;
height: 500px;
}
input[type=submit] {
background: #4890E7;
color: white;
cursor: pointer;
padding: 3px;
border: none;
}
input[type=submit]:hover {
background-color: #006AEB;
}
input[type=image], input[type=checkbox] {
border: none;
padding: 0;
vertical-align: middle;
}
label input[type=checkbox], td input[type=radio], td span select {
margin-right: 4px;
}
fieldset select {
margin-right: 4px;
}
option {
padding: 0 5px;
}
optgroup {
font-size: 11px;
}
code {
background: #EEE;
font-family: Consolas,monospace;
padding: 2px 4px;
}
code a:hover {
background-color: transparent !important;
}
table {
border: 1px solid #D0CDC4;
font-size: inherit;
margin: 4px 0 8px;
}
tbody tr:hover td, tbody tr:hover th {
background: #EDF4FF;
}
th, td {
background: inherit;
border: 1px dotted #CCC;
border-width:0 0 0 1px;
font-weight: normal;
margin: 0;
padding: 3px 5px;
text-align: left;
vertical-align: top;
}
.odd th, .odd td {
background: #FCFAF5;
}
.js .checked th, .js .checked td {
background: #CEE0FC;
}
thead th, thead td {
background: #F2EEE1;
border-color: #D0CDC4;
font-weight: bold;
white-space: nowrap;
}
thead tr:hover td, thead tr:hover th,
.js thead .checked th, .js thead .checked td {
background: #F2EEE1;
}
th:first-child, td:first-child {
border-color: transparent;
white-space: nowrap;
}
td[align=right] {
text-align: right;
}
table code {
font-size: 13px;
line-height: 18px;
}
.hidden {
display: none;
}
.error, .message {
background: transparent;
font-weight: bold;
padding: 0;
}
.error {
color: #C00;
}
.message {
color: #090;
}
/* specific */
#content {
height: 100%;
margin: 40px 0 0 300px;
padding: 20px;
background: white;
z-index: 1;
}
#content:after {
clear: both;
content: "";
display: table;
}
#content > h2:before {
display: block;
content: "";
color: #FF9;
font-size: 13px;
background: #333;
line-height: 40px;
margin: 0;
padding: 0 0 0 20px;
position: fixed;
top: 0;
left: 300px;
width: 100%;
height: 40px;
}
#content > #breadcrumb + h2:before {
display: none;
}
#content > p {
clear: left;
}
#lang {
background: #333;
color: #FFF;
height: 40px;
line-height: 40px;
padding: 0 0 0 40px;
position: fixed;
top: 0;
left: 0;
width: 260px;
}
#lang select {
border: none;
background: #5F5F5F;
color: white;
}
#menu {
background: #FCFAF5;
border-right: 5px solid #E4E2DA;
bottom: 0;
margin: 0;
overflow: auto;
padding: 10px 15px;
position: fixed;
top: 40px;
width: 240px;
}
#menu a {
color: #333;
border: none;
margin-right: 4px;
}
#tables a {
padding: 1px 2px;
}
#menu a:hover {
color: #FFF;
}
#menu p {
border: none;
margin: 0 0 4px;
padding: 0 0 4px;
white-space: nowrap;
}
#breadcrumb {
background: #333;
color: #FFF;
line-height: 40px;
margin: 0;
padding: 0 0 0 20px;
position: fixed;
top: 0;
left: 300px;
width: 100%;
height: 40px;
}
#breadcrumb a {
color: #FF9;
}
#breadcrumb a:hover {
background: transparent;
border-color: #FF9;
color: #FF9;
}
#schema .table {
background: #F3F3F3;
padding: 4px 8px;
}
#logins a, #tables a {
background: transparent;
}
/* IE hacks */
* + html th:first-child, * + html td:first-child {
border-color: inherit;
white-space: inherit;
}
* html #lang, * html #menu, * html #breadcrumb {
position: absolute;
}
* html #lang {
height: 30px;
padding-top: 10px;
}
* html form#form {
height: 100%;
}
#content > p.tabs + *:after {
display: table;
clear: both;
content: "";
}
/* icons */
.error {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIsSURBVDjLpVNLSJQBEP7+h6uu62vLVAJDW1KQTMrINQ1vPQzq1GOpa9EppGOHLh0kCEKL7JBEhVCHihAsESyJiE4FWShGRmauu7KYiv6Pma+DGoFrBQ7MzGFmPr5vmDFIYj1mr1WYfrHPovA9VVOqbC7e/1rS9ZlrAVDYHig5WB0oPtBI0TNrUiC5yhP9jeF4X8NPcWfopoY48XT39PjjXeF0vWkZqOjd7LJYrmGasHPCCJbHwhS9/F8M4s8baid764Xi0Ilfp5voorpJfn2wwx/r3l77TwZUvR+qajXVn8PnvocYfXYH6k2ioOaCpaIdf11ivDcayyiMVudsOYqFb60gARJYHG9DbqQFmSVNjaO3K2NpAeK90ZCqtgcrjkP9aUCXp0moetDFEeRXnYCKXhm+uTW0CkBFu4JlxzZkFlbASz4CQGQVBFeEwZm8geyiMuRVntzsL3oXV+YMkvjRsydC1U+lhwZsWXgHb+oWVAEzIwvzyVlk5igsi7DymmHlHsFQR50rjl+981Jy1Fw6Gu0ObTtnU+cgs28AKgDiy+Awpj5OACBAhZ/qh2HOo6i+NeA73jUAML4/qWux8mt6NjW1w599CS9xb0mSEqQBEDAtwqALUmBaG5FV3oYPnTHMjAwetlWksyByaukxQg2wQ9FlccaK/OXA3/uAEUDp3rNIDQ1ctSk6kHh1/jRFoaL4M4snEMeD73gQx4M4PsT1IZ5AfYH68tZY7zv/ApRMY9mnuVMvAAAAAElFTkSuQmCC") no-repeat scroll 0.8em center #FFEEEE;
padding-left: 38px;
}
.message, #menu p.message {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKfSURBVDjLpZPrS1NhHMf9O3bOdmwDCWREIYKEUHsVJBI7mg3FvCxL09290jZj2EyLMnJexkgpLbPUanNOberU5taUMnHZUULMvelCtWF0sW/n7MVMEiN64AsPD8/n83uucQDi/id/DBT4Dolypw/qsz0pTMbj/WHpiDgsdSUyUmeiPt2+V7SrIM+bSss8ySGdR4abQQv6lrui6VxsRonrGCS9VEjSQ9E7CtiqdOZ4UuTqnBHO1X7YXl6Daa4yGq7vWO1D40wVDtj4kWQbn94myPGkCDPdSesczE2sCZShwl8CzcwZ6NiUs6n2nYX99T1cnKqA2EKui6+TwphA5k4yqMayopU5mANV3lNQTBdCMVUA9VQh3GuDMHiVcLCS3J4jSLhCGmKCjBEx0xlshjXYhApfMZRP5CyYD+UkG08+xt+4wLVQZA1tzxthm2tEfD3JxARH7QkbD1ZuozaggdZbxK5kAIsf5qGaKMTY2lAU/rH5HW3PLsEwUYy+YCcERmIjJpDcpzb6l7th9KtQ69fi09ePUej9l7cx2DJbD7UrG3r3afQHOyCo+V3QQzE35pvQvnAZukk5zL5qRL59jsKbPzdheXoBZc4saFhBS6AO7V4zqCpiawuptwQG+UAa7Ct3UT0hh9p9EnXT5Vh6t4C22QaUDh6HwnECOmcO7K+6kW49DKqS2DrEZCtfuI+9GrNHg4fMHVSO5kE7nAPVkAxKBxcOzsajpS4Yh4ohUPPWKTUh3PaQEptIOr6BiJjcZXCwktaAGfrRIpwblqOV3YKdhfXOIvBLeREWpnd8ynsaSJoyESFphwTtfjN6X1jRO2+FxWtCWksqBApeiFIR9K6fiTpPiigDoadqCEag5YUFKl6Yrciw0VOlhOivv/Ff8wtn0KzlebrUYwAAAABJRU5ErkJggg==") no-repeat scroll 0.8em center #EEFFEE;
padding-left: 38px;
}
a[href$="sql="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHGSURBVHjaxFPNLkNREP5aB6WhaKLSVtKFiIUqK1sLT2DhTXgDL2FlxSOw8FOLRiyQWhDRiKSEhKQJou49P9fMnFsLsevCJCcz594z3/m+mTmJKIrQjSXRpXUNoGqbm39qcMbAkbyIvbVwYQhD3tIeWsOQ1+QVH86Xyz+JXJPIOb9iAI4ZpOMd/yN/vb/vAdiC93cP0El2dNA6z4RjYyW2MaPU0BB0u+0BOGGsVML49LSA3J+cYDCblb0l6jeHBwg/26isrOB0a8uzYBlBgKShgD8M53J4aTTQqFaRSCYl+WxnG83zcxTmKpKg+vtFu9W8NDQDMCXW+VivYyAzjKmlJahUSpiYUKPVbCKTz0sCGzOyOpBLzdcXlCMdDDIxO4vboyoyhQIKlYocLi0uIjczIyBcA98dYqx9NywxUEyDi/P29IyF1VU5dFeroS+dRnF+Xvajk5N0ayjx8tq6+FuSyiwUF4LRHi/reLg4o9ijs6xG9RjWGowUi/h4fcXexoa0L4oc0mNZuVgFzID09VKBnFXoUb7Pnb5zQrvVovpkZC4QzwfiN6QM1eBqdxcmnq6IAA395Mlz8eTxTZwg/pcl/v01fgswAESqYZbsIsnLAAAAAElFTkSuQmCC") no-repeat scroll left bottom;
padding-left: 22px;
}
a[href*="dump="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJrSURBVHjajFPPaxNREP72V8ymTbGQbRB/IT0otdV6CcWTgqCoUFQQEXoSEQ/+AypK755E1KsULIpGgw1F9KC22lgstFgQLdoWhSab2PRHTNrs7nvObGhSsRa/ZXjv7c6b+eabWUVKiX9AJQuRRci2k+260N91VwgJIQSEV1mVnjf5axTjvCfFFn7hCcBlBzJNVRA0gAZTQ1ODgXC4gDtjV9AW2QNFUTA0/Q66kPLSqVg4shYF8vEdKQ7mln+i+/VVRM0oFpbmETLq/SS6J4R/OfHtHmV24XouHFo94REDAyE9hMZgBMkvT2GZFqxQE6by0/g4P74SoKLB2ZZzWA8ffqRQLBcxNTuFjRTwxpmbfad7Oo/rHhdN6B20/6JvaKyBCnODhqNbL+PRxHXUGXWINV5kl9TDrkQct/pnZKHkyPsDGcl4MJiWq5Ecsf84LxTL8nbyK2+Pke3XHWJAQkLXgMdDNjRNRTxlQ6UmakRD0vN8NEd7EBsFO6Impu1fzGCCrOSXwCro5HEiZiExnEVnrKlaypNhG4fba02aTC8ik1/ibZrM9RlIkkGnjH0jWWJQWRn8TpLI8fcZ6MSA1WrZFERx2eHPTEPqjksBqASDLh7ZZ+HlWA6H9tYyvhjNomNnI8Km7p8/f5+HGdB46/lJeOoYPHV8mbGy8gA59HngU74asNkKYKVzlQCuW9GA6B5si+DVeA4HWmsM4qksTnZY1TMz0NRauysaUAmt2+oxM1tCM6k8mS74WXjIdm8O+JdWg36oKgXqgnzb3TvRXvZEneN6YPNIFw7MY70W5haXnlUHbp3f+b/wW4ABAAtWTLcKdqLcAAAAAElFTkSuQmCC") no-repeat scroll 2px center;
padding-left: 22px;
}
a[href$="dump="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHzSURBVHjajJPPS+NQEMcnaaxpdWsp6Q8vtWtdkIo9+B948SjIgruCUg8F/wGP/glePe5JcBehwl4qePGm0J6KQj30UBHEzaFLUromTfPizJMnrxhhB4bJvDfzme97SZQgCOB/be98J2AsAMYYMP81KjKg0WhMYljHtS30RSz4gjkGdot559F7OLt8vvi1bJRBURS4vr8CTTQ3m80SFv1MpVJlwzBA13XuNGUwGKyY1p+Vk9aPzWw8C7ZjQXximu+9ATA5KhQK5Uwmw+nCIpEIJBIJOLjah3Q8w7379x5urFsOUEUhTl/C6R+ef35mARzPhW6vC+q/iHvyvaYwXwIQje6j1+tBv98H13VhNBpxxyPA5tw2TI50MPQsrMbXbOo53fmtaJIC7iSZAMPhkOe+73MA5Ruz3yCfz9NlvykLBUSjUR41TQPP8zhE7JNSyj8E0CbJpkiXKRoIRFABeQcQd0DFwlVV5evUTFBZRSiATEwnp4lCAa0LI2AoQC4WimRl4qgyYOw12rYNyWSSX6L4mKiBnukDK5VKYJrmmBpZwW6r1TotFotTuVyOQwQgnU7zV9npdKDdbj+hgnXRN/Yz1ev1zwg6QP+KU2disRiXblkWOI7zhJOPce+wWq2aoQDZarXaJ2xYQGfod5VKxQ2rexFgAI4OiAKxKkWeAAAAAElFTkSuQmCC") no-repeat scroll 2px center ;
padding-left: 22px;
}
select[name="db"] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC") no-repeat scroll left center white;
padding-left: 16px;
}
select[name="db"] option {
padding-left: 18px;
}
#menu p a[href*="&select="] {
display: inline-block;
margin-right: 8px;
overflow: hidden;
padding-left: 0;
text-decoration: none;
width: 16px;
height: 16px;
}
#menu p a[href*="&select="]:before {
content: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHISURBVDjLpVPNK0RRFP+9D98syMwUspHkm9I0YkFZWBFKkZ0s7a3Ewh+ilChK7FgoZCJFKYlYKB8zk2+Z5t0P577He29kQU7dd+6575zf+d1zztWklPiPmOozt/U4SThjXIoyIQS4AJjSXO0lGGlvcXAm6Vzsz4xUhm0AIeX4QLig+C+ZpxbOG1wGhGYHr1zMUmZGWRgs0ha3PE1nX/8mWmdgWTzLB+DUYbhm9FfZ35IEyrhXA3VXJfPbsV8B9LQUIeUHYJ8ASobag1jcucNgW8g9W4reYSDi2YnnZDoDiwCokDANct6NwTB0LEdj0HRA/wxa2SN25JNBEdWluUhZ366gqmAaGvrCAXKOozccTGPgt8+vn8GYSGcgyTYp3dpBnBg42nbQPRBTo5bTvqYkmxL6AQhNTWQGBXY3B7BxlEBXozcW64dxRKoKUZBju+P06gl5WaaviMJBM3TNDlbypemIZgHYOnlwASsCmW7nHADGnBoQ3c76YmweJ9BR5zFYjsbRHwm4tmJg6PhWA7pCXXk+bu7fURHKweXtq/sWaksz7SC/CCGFrwtyZ3r+rCnFRZ7qr1qc6mLZj4f9OEyPL8lVpbX/PucPv5QPKHB1TdEAAAAASUVORK5CYII=");
padding-right: 5px;
display: inline-block;
margin-top: 2px;
}
#menu p a[href*="&table="], #menu p a[href*="&view="] {
display: inline-block;
text-decoration: none;
}
a[href*="&create="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJ6SURBVDjLpZNZSNRRGMV//2XGsjFrMg2z0so2K21xIFpepYUiAsGIICLffI8eWiBBeg3qQV+KwBYKLB8qpHUmrahcKLc0QsxldNSxdPz/79LD1ChBUXTh8sG93POdc75zDa01/7NsgGvPR09rzQmpVZZSCqlAKIWUCqk0QqoZWyKFRir1uvxIbsAGUFqXHQqkpP1L57M3Pm5MMJBKpQHUdF9BKIGQAlcJXOlOVykSdye3leO6MmkGQNyHw+uO/1X3bzGBK+S0B1IqAKqDg3986HeCZPffwvJtoNT7lOZLvUdtAPEDAKBkRzo3QwMUb89InN1uGGD3spdE214xe8MRUnM2MfppNW0Pqy7YAK5UKK2xLbhdP4hlmdxpGMQwwQT8ziNiI534c7cT6WrFazikzF2Eb8HS1IQEDdiWwcHAQmpehTkQSAcgNvSMiYFW5uUUMdV3HW+ywefGNqITJsbUUL75k4FWYJtQ+yaMZcXrk1ANk/33mbdiD7EvlRieETy+FJLkMFcjRRSW3emIAwiF1hqPBfu2LGSWbbA1uZ41SfWkrtxPrPcypsfFiWYzFGzGKTjFV28WEJeIUHETLdOgrmkI1VdHpCdEet5enP4qLK9mKrqMgedv6cyrAP+qxOTiUxAi7oEJi8frELoFoTLpa7nI/HQvscgSRt+0kV1SSW7qYtp7xrBMphm4Mi5h/VIfTcEq1u0oJaknSEdNiMYHET7UvcMpPEN31Ed7zxgASmk1I0g6dK66s8CRak5mVxjnfS05+TsZCw/T9baTx1nnGb47DrQksjE6HrsHYPz6nYt3+Sc3L8+wA2tz0J6pF5OD4WP7Kpq7f5fO79DfSxjdtCtDAAAAAElFTkSuQmCC") no-repeat scroll 2px center;
padding-left: 22px;
}
a[href$="&create="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIpSURBVDjLpZNPSFRRFMZ/749/Kt3IqFTSRoSMmrGIYTTbpEJtjBCCok1Em9JVG1dRC8FFEES5aGFEgRRZWq1iLKKxBiNqLDcltQgmHR9hY6LOu+feFm+YGVsZXbh8nHO53/nud8+xjDH8z3IB7r5avGgMZ8XoBq01okFpjYhGtEGJLtmCKINo/XbgVFPUBdDG9PVEq0P/UvnSvdlwQYFoHQIY/3obpRVKFL5W+OIXUVThrL91AN+XihKCwIeTu85sqPryqsJXUvRARAMwkshsiKB7fw25UgKVJwA40V7H/cl5jh+oL+RGk/P0xIqxl11dr8AXjTYG14HRNxkcx+ZhMoNlg52/ND6VAWMoc6F5+2Zy/l9PMIDrWByL1jI+tcDRaN06BaXxbDqLUnq9AqPBteHpuwUcJ0AIcgBXH93h+/wEyyuLrPk5cmv7gNY8gdIYYyhz4PDeWuIpj85IsS2ujQ2zJAk6DkZpqGnixcwYyU+PifUOX7Eh6DoAx7aIpzwA4imPeMrj+bTH+88PaNkZQWwhsrULsXxie9oAzgcESgUe2NAZCeE6AXZGQhwKh/Cyc5RZVXQ39wFwoeMmjXVhgMqiB8awe0cVP36u0Fi/iW9zvwuzkF3+xUz6Nal0gv6uWww+O02lUwGwmv8FM3l55EtLTvQWXwm+EkRpfNEoUZRXHCE5PUFbuJ0nH4cot1wSH14C3LA2Os6x3m2DwDmgGlgChpLX0/1/AIu8MA7WsWBMAAAAAElFTkSuQmCC") no-repeat scroll left center;
padding-left: 22px;
}
a[href*="&default="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJ7SURBVHjabFPfa1JhGH6OR88odSKDaTEzS9i0jejXBtVuBzGooOgqoquu+heii27aRUTUaKx1nbAYDCqqm4raoBZDZrqhaCw31janm3r0eOb8+t4PFXW98Jz3O985z/P++j6JMQZJkroAODhk/Mfs/nZrJpLN8eUGxx/OqdQ/kgC3M7qub5fL5T1ujHtGvrYmlEolFggEnvB/j3IYiCe4VYF+IheLRaZpGiNPyOfzLJfLsXQ6zVKZDZZKpfaJkEkkQNEoCs9EeBJSVVUIZDIZkQ3tFQoFNjk5KURE+VWBczyD75VKBaFQCLu7uwJ8T4DWQ0ND1CtUewZZlgc4b65JQKQjSfXe8KggUfIEbf0zMnOvIFv6oKa+gBVWbhsbu03kSCRSj1xDTcSHWTj7bsLmOYXt391Y+jgx0iRAUf1+f+uEBFmNP4TZegHp+CIUSYe13QlLxxGbsTE6WSwWE4RaZIJbmYL9+CWU1gJQDkpYDi5BK5R2VDU3YGw9NF6vt+k9u3gPNu9laKtjMChlmCxumNkKnk0v3B19F48aG9OlLJLJZL1m685LdPZe5eTnMJjK0LMepGaDcA6PYPRWb5R4hsYSSMTlcuGAxhuZGEfniWHofycgKwylrBubM/M4fG0MbY6eeob7pvDz/TgsUhJlfj3WQk9h71SgpV3Y+hGGfP4+TLZDTSUaGodAj+Vfr+G/eAdtyW+ITs8g+CGN6Kcguq48gtt3thaoUi2b0XkmIi+7UiQfS2xCD7+B5+QgzOZurIcS8N14DKXDIzIkMrcCTVeIVZvnql5nw/VB+9fTxxxyf48H+T114cVU+MHb+a3VlmEReYNzk/8EGADOaaVGDf2TtwAAAABJRU5ErkJggg==") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&select="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHISURBVDjLpVPNK0RRFP+9D98syMwUspHkm9I0YkFZWBFKkZ0s7a3Ewh+ilChK7FgoZCJFKYlYKB8zk2+Z5t0P577He29kQU7dd+6575zf+d1zztWklPiPmOozt/U4SThjXIoyIQS4AJjSXO0lGGlvcXAm6Vzsz4xUhm0AIeX4QLig+C+ZpxbOG1wGhGYHr1zMUmZGWRgs0ha3PE1nX/8mWmdgWTzLB+DUYbhm9FfZ35IEyrhXA3VXJfPbsV8B9LQUIeUHYJ8ASobag1jcucNgW8g9W4reYSDi2YnnZDoDiwCokDANct6NwTB0LEdj0HRA/wxa2SN25JNBEdWluUhZ366gqmAaGvrCAXKOozccTGPgt8+vn8GYSGcgyTYp3dpBnBg42nbQPRBTo5bTvqYkmxL6AQhNTWQGBXY3B7BxlEBXozcW64dxRKoKUZBju+P06gl5WaaviMJBM3TNDlbypemIZgHYOnlwASsCmW7nHADGnBoQ3c76YmweJ9BR5zFYjsbRHwm4tmJg6PhWA7pCXXk+bu7fURHKweXtq/sWaksz7SC/CCGFrwtyZ3r+rCnFRZ7qr1qc6mLZj4f9OEyPL8lVpbX/PucPv5QPKHB1TdEAAAAASUVORK5CYII=") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&page="] {
background-image: none;
padding: .2em .5em;
}
#content p a[href*="&edit="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJvSURBVDjLpZPrS5NhGIf9W7YvBYOkhlkoqCklWChv2WyKik7blnNris72bi6dus0DLZ0TDxW1odtopDs4D8MDZuLU0kXq61CijSIIasOvv94VTUfLiB74fXngup7nvrnvJABJ/5PfLnTTdcwOj4RsdYmo5glBWP6iOtzwvIKSWstI0Wgx80SBblpKtE9KQs/We7EaWoT/8wbWP61gMmCH0lMDvokT4j25TiQU/ITFkek9Ow6+7WH2gwsmahCPdwyw75uw9HEO2gUZSkfyI9zBPCJOoJ2SMmg46N61YO/rNoa39Xi41oFuXysMfh36/Fp0b7bAfWAH6RGi0HglWNCbzYgJaFjRv6zGuy+b9It96N3SQvNKiV9HvSaDfFEIxXItnPs23BzJQd6DDEVM0OKsoVwBG/1VMzpXVWhbkUM2K4oJBDYuGmbKIJ0qxsAbHfRLzbjcnUbFBIpx/qH3vQv9b3U03IQ/HfFkERTzfFj8w8jSpR7GBE123uFEYAzaDRIqX/2JAtJbDat/COkd7CNBva2cMvq0MGxp0PRSCPF8BXjWG3FgNHc9XPT71Ojy3sMFdfJRCeKxEsVtKwFHwALZfCUk3tIfNR8XiJwc1LmL4dg141JPKtj3WUdNFJqLGFVPC4OkR4BxajTWsChY64wmCnMxsWPCHcutKBxMVp5mxA1S+aMComToaqTRUQknLTH62kHOVEE+VQnjahscNCy0cMBWsSI0TCQcZc5ALkEYckL5A5noWSBhfm2AecMAjbcRWV0pUTh0HE64TNf0mczcnnQyu/MilaFJCae1nw2fbz1DnVOxyGTlKeZft/Ff8x1BRssfACjTwQAAAABJRU5ErkJggg==") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&table="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJcSURBVDjLpZPtT5JhFMafrW997I9rscA+FFu2QRurtlw5cQ4InLpwBogIPNFSiNJ4C+JVkj0QTBHQKFPQlJfwlanY1tXz3ARkn2jd27Wz++yc33XOvd0UAOp/RNGR/X5zeH9rOlTDVKAK3fsqJrxlqN27GHPuYHh+G4rXRQzZNjEws47Hli/oo/PxNsAU3qvWT3/gX3TPuHrWBhiC30nSktXDtKLB1NI4NKkxqBMqjDByPFkcxNBCPwbCfXgUeEBq705m0AZM+qsk2e3hau88W+4ANOy+XPLFQrkrcbW31KkOYJx9rBaAOzPR0gVHW6x593q9cDgcqB6e4sZoogMYdXzD0ck5ZhfLsHGKVfAqVoadKcMdzcLr82PuwwZCoRACgQCWVzdhoK2gaVpDAMNzWzhkAXamQpze/I4t13w+j2AwiFwuh7W1NXg8HmQyGSgUCshkssuU3F7AQf0c84kK3n68KFc4hXQ6DavVCqlUCqVSSdaIx+NQq9UGMsHg7Ab2jxtwp5rOvqUqia3CUqnEObWn0mp1KBaLcLlckMvloPpfrhOAl230/SGLxQK3241CoQC9Xg9nskKk1emQzWZZkBZCoRBU3/NP2GMBgXTTObjSjI1GA8lkEgzDwO/3E4iObXY6nYhEIhCJRHoWcIW6b1pF7egMlYNT7NROUKzU8XX3GJ+3D2E0GgmAm4Zbh2s0mUyIRqMcAGKx+BIlMeSiYu1K/fbEMm4+TaFnJIHrSgZX5TFIZNPo7e1Fj9QOs9kMlUqFaw9pCASCnzwe7x15xG6/rUQiAZ/Px9/5XyhZOMVGKlOdAAAAAElFTkSuQmCC") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&database="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKRSURBVDjLhVNLTBNRFD3TTju1FCcBaxuaQEr94ydiZIHGpcFISBOi0YREZWHCVoyRxKUxxq0LXcACQyLsjO6KjSEiDfHDz0S0CLSxlFKd2g7MTDudGd+bMAQCxJucuXfuu+fcO/PeYwzDALVoNMqRuI3guq7rR4g/SEBC/Svxc8T3EUTD4bCGTcZQAUI+RvxLr9d70u/3o6KiAm63G3Qtn89DFEUkk0lks9lRkrvW3t6e2lCgRZFI5F0ikaDtjN1MVVVjYmLCGBoa6qccC7Z1kQafz4f/WSAQAGlyaXOOpQ+SNNUymQxcLhc4joPD4TBzkiRBEASkUimEQiGzdlcBlmWRy+WgKIr5Xi6XUSgUUCwWzTVN+IAzeOOde71orP0eAaOkbrDWf6Cw2+3mBLSYgny3KULXPOUY2BUB/hMd4IOn8XfhMGYjvU+2TECLLRLDMNA0zYw5JYa6Ghke/hyEn9/gZEqo3OuHp7qW3yJgESjoNPSdlb8gWCOCr29BMT0Ip5tBYnIWqlL6o8irzVsEaHcKSqQCen4cweok+FAblNRz2JxlODx1cEkzGWmVbTl7Z/jHhgCF1Z3GYjIKf+U8+ANhQn4Gm6OMUiGI9MhHg5Gl1sbu8UnKNc8B7Ui3ipxEcwvlpVFw6hz2N1xGabkXdqeBYqEOmfefEZWac4e6xz9Z22hbn+BmLBZbi8fjEBdG4NF/QdUDSM88hQ4FawKJR6cxLDZl86qzZdtdoDYwMBAkQg/2LL/ovNLVh++Dd7G0OAau9hTkrKgnnE39GW3f/Z6enpUdBSx7ePu4eq+zi4VNw+TbV0gsxFd5b9X5i4+mpnY63tsErl6okhvrfWzT0SAMR3FMXsnean08Pb/b/fgHqpjCspi90kkAAAAASUVORK5CYII=") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&schema="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFOSURBVDjLtVK7SgNRED0b9iuM2lr4QK1DQIyk0FZsJAj+gH+ilRZb2NjaRHTLmA9QFKz9huzm7t37Hu+u7IJgQjR6YLjDzOXMmcMERIR5EE5qXA4z4sqACYWEC5wfLQXf/WtMIuDSoL0A7DZDjBj/uYI0l8jzEEJYJMkvCEZM4PqZIxlzpGk+kSCY18TGtGYcx9Tv96dOqBUMBgNyzsFaC621312Ac+59yJFlGRhj5VvVoigKvniglEK32w1mkd3r9ejPPAjOhqdknYX18p1/rzo3pYqTh0OSRkJI5UMgPn4s61sX66SkhtEGcISGsQad5gH2FvehfV5BaIF2cwet5RZyKeu68pe5ubKG7dUNP5AQGltMN57Mosgr5EIiVQmYGvtc1PVicqHY+dXpk8Dg7v22XKFo1ARe9v1bDOlXKKKCs4Sn1xdU1v3vIc2CD3bN4xJjfJWvAAAAAElFTkSuQmCC") no-repeat scroll 2px center;
padding-left: 22px;
}
#content p a[href*="&sql="] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJ5SURBVHjapFNLaxNRFP4mnZmQZtKYpJ2I8ZE0NSbSWKpgBYNUhIJQUDddCaILwb34C0RcCi60vpa14sZFoSjxUWxTFEubFkxf9kFS+7Jp0yQmM5mH905SF9pSwQt3vnPnnvPNd86cA13Xsds+23XKsdMdQx//s0z/6hi54he3e8/0d3ZuK0FTFGhUJkVVhSbLUAiq5IxSCQrBEkGWOu8Lh38HGrlpWnlXCKhNSbZQo3cEE9FomYAuKZstE2wFa8RR1cpKqK2o4JhxmLVJVAlh5Df6IFj5MgENcHq9EAMBg2RucBDVLpdxVon0iXdvIf8sQHRIsNReht3XjI3ZI8iuPAOrkDyorBq3G6vT08ikUuAsFiN46HkXXL56eI41QV1/BMF+GulvCfCMDFvNXtSIHrC0KDTPhXgc7lAQdQ2thk2XIpewnkzCJvTA4T8PabEbfDWD+ZFxyEUdX94sw6QVCkZlxWAQU+8/YGZgALV+v0HgbWmBNzQMR0M7it8fg+HWwQk2cLkkcvJh5NNFsCVJMgq1ubiE5o4OI5CS8FYrya8b9saLKC48gIlTIG/6sBaLw3PpHrTEMrSXr4kPIaAKFkbjSA0PEVuFlB+DO8Ah2HoB8tITVPE6iplDWOn7jLn0CSQevoDV6TI+zEpUASkkZzaTYrLIrH3C/qMCFEbE4th9OEQexfQBrPYP44d+DuY91eBp+1dGgFVIDb729kKpdJfQtIy2yFNMdN/E5McYzAebUEhOYjZuQXaj5+9W/nOYbl9vLN26doOFScVI9BXmZ6dy9jpnpO1O5dfsRtBxxlk4Xu9mT4Z80DkpVlhZvdp+d3RmpyH7JcAAnHiAVYWMsdkAAAAASUVORK5CYII=") no-repeat scroll 2px center;
padding-left: 24px;
}
table tbody input[type="checkbox"] {
display: block;
float: left;
}
table a[href*="&edit="][href*="&where"] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFUSURBVDjLrZM/SAJxGIZdWwuDlnCplkAEm1zkaIiGFFpyMIwGK5KGoK2lphDKkMDg3LLUSIJsSKhIi+684CokOtTiMizCGuzEU5K3vOEgKvtBDe/2Pc8H3x8NAM1fQlx4H9M3pcOWp6TXWmM8A7j0629v1nraiAVC0IrrwATKIgs5xyG5QiE+Z4iQdoeU2oAsnqCSO1NSTu+D9VhqRLD8nIB8F0Q2MgmJDyipCzjvYJkIfpN2UBLG8MpP4dxvQ3ZzGuyyBQ2H+AnOOCBd9aL6soh81A5hyYSGWyCFvxUcerqI4S+CvYVOFPMHxLAq8I3qdHVY5LbBhJzEsCrwutpRFBlUHy6wO2tEYtWAzLELPN2P03kjfj3luqDycV2F8AgefWbEnVqEHa2IznSD6BdsVDNStB0lfh0FPoQjdx8RrAqGzC0YprSgxzsUMOY2bf37N/6Ud1Vc9yYcH50CAAAAAElFTkSuQmCC") no-repeat scroll right center;
padding-right: 18px;
}
table input + a[href*="&edit="][href*="&where"] {
clear: right;
display: block;
float: left;
line-height: 15px;
margin-right: 8px;
overflow: hidden;
padding: 0;
text-decoration: none;
width: 16px;
}
table input + a[href*="&edit="][href*="&where"]:before {
content: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFUSURBVDjLrZM/SAJxGIZdWwuDlnCplkAEm1zkaIiGFFpyMIwGK5KGoK2lphDKkMDg3LLUSIJsSKhIi+684CokOtTiMizCGuzEU5K3vOEgKvtBDe/2Pc8H3x8NAM1fQlx4H9M3pcOWp6TXWmM8A7j0629v1nraiAVC0IrrwATKIgs5xyG5QiE+Z4iQdoeU2oAsnqCSO1NSTu+D9VhqRLD8nIB8F0Q2MgmJDyipCzjvYJkIfpN2UBLG8MpP4dxvQ3ZzGuyyBQ2H+AnOOCBd9aL6soh81A5hyYSGWyCFvxUcerqI4S+CvYVOFPMHxLAq8I3qdHVY5LbBhJzEsCrwutpRFBlUHy6wO2tEYtWAzLELPN2P03kjfj3luqDycV2F8AgefWbEnVqEHa2IznSD6BdsVDNStB0lfh0FPoQjdx8RrAqGzC0YprSgxzsUMOY2bf37N/6Ud1Vc9yYcH50CAAAAAElFTkSuQmCC");
padding-right: 5px;
}
table input + a[href*="&edit="][href*="&where"]:hover {
background: #FFC;
color: white;
margin-left: 19px;
margin-top: -1px;
overflow: visible;
padding: 1px 2px;
position: absolute;
width: auto;
}
table a[href*="&clone="] {
clear: right;
display: block;
float: left;
line-height: 15px;
margin-right: 8px;
overflow: hidden;
padding-top: 0;
text-decoration: none;
width: 16px;
}
table a[href*="&clone="]:before {
content: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADHSURBVCjPdZFNbsIwFAa/5B5FuQPCOQ9HQuqCq3SHUAtrrgFCSKQk8Y80XTjYJqiajRfj55GftNBKJtGoRiXSytlAZORzM1ckExjouHEm0LPdqHkTRnruXAgEPGpVq1JVCJ6RB3dOfHFEa7W5RzLx3kjPDse8ZxKisue9JwkByzevPQGZQnD8kHuunEvB43EcyD0dt/kEzzGdLD2/k9Ckb261zs9ZhiggVRO12jzN4Z5C+tQq90T+ETK20/J1tU2xeCOjpT7+APfbTaDnTb/mAAAAAElFTkSuQmCC");
padding-right: 5px;
}
table a[href*="&clone="]:hover {
background: #FFC;
border: 1px solid #CCC;
color: white;
font-size: .9em;
margin-left: 42px;
margin-top: -2px;
overflow: visible;
padding: 1px 2px;
position: absolute;
width: auto;
}
input[name="delete"], input[name="drop"] {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHSSURBVHjapFM5bsJQEB2zSIDFJrHYpEtyAyoKJAp6CrqIkBPkNDlBAKXjBEgUpKOBCyQNijFiEZvZl8z7wsjESYpkpNFfPO/Nmz9j6Xg80n/M9fWi3W7fMOnd4XAo8qogAbvO5xKvL6lU6s0aL1kVMDjP5ye/36+Gw2FyOp3EQFqtVtTr9WixWHT5/JhOp6s2ghP4ORaLyaFQiGazGa3Xa0HgdrvJ6/WSpmk0Go0MjnvIZDLVM0Gr1brm/WskEkkA3O/3abvdQjq5XC6xgoiVka7rNB6PNT6ns9nsu+OkpODxeBLBYJAGgwHt9/uzQ8Vms6Hdbie+KYqC+ASTFrARBMx2HwgEaDKZiHqn0yktl0uxtzrMMAyKx+MCc+4Cs13hwQCC1GQy+W3Lms2mUIUygbEqEBLNun8z8zswVgUfLO0WD4Z6kekn8/l8okNM8GFVUMYDoVWQ6HA4bEAzoyzL1O12kbRsJajwhYZhiUajJEnShWSAQaqqKnU6HahEGysXg9RoNPJ8+cwZZLSKp47m8/k5Kxzg4XBocNxDLper2ka5Xq+LUeatilahJLN1mEJ+ZDHKJthGAKvVauJnYi9ysHIqQee1xOsLg3/+mf5inwIMAJMhb74NwG5wAAAAAElFTkSuQmCC") no-repeat scroll left center;
border: none;
cursor: pointer;
font-size: .9em;
padding: 1px 5px 1px 18px;
color: #999;
}
input[name="delete"]:hover, input[name="drop"]:hover {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJdSURBVDjLpZP7S1NhGMf9W7YfogSJboSEUVCY8zJ31trcps6zTI9bLGJpjp1hmkGNxVz4Q6ildtXKXzJNbJRaRmrXoeWx8tJOTWptnrNryre5YCYuI3rh+8vL+/m8PA/PkwIg5X+y5mJWrxfOUBXm91QZM6UluUmthntHqplxUml2lciF6wrmdHriI0Wx3xw2hAediLwZRWRkCPzdDswaSvGqkGCfq8VEUsEyPF1O8Qu3O7A09RbRvjuIttsRbT6HHzebsDjcB4/JgFFlNv9MnkmsEszodIIY7Oaut2OJcSF68Qx8dgv8tmqEL1gQaaARtp5A+N4NzB0lMXxon/uxbI8gIYjB9HytGYuusfiPIQcN71kjgnW6VeFOkgh3XcHLvAwMSDPohOADdYQJdF1FtLMZPmslvhZJk2ahkgRvq4HHUoWHRDqTEDDl2mDkfheiDgt8pw340/EocuClCuFvboQzb0cwIZgki4KhzlaE6w0InipbVzBfqoK/qRH94i0rgokSFeO11iBkp8EdV8cfJo0yD75aE2ZNRvSJ0lZKcBXLaUYmQrCzDT6tDN5SyRqYlWeDLZAg0H4JQ+Jt6M3atNLE10VSwQsN4Z6r0CBwqzXesHmV+BeoyAUri8EyMfi2FowXS5dhd7doo2DVII0V5BAjigP89GEVAtda8b2ehodU4rNaAW+dGfzlFkyo89GTlcrHYCLpKD+V7yeeHNzLjkp24Uu1Ed6G8/F8qjqGRzlbl2H2dzjpMg1KdwsHxOlmJ7GTeZC/nesXbeZ6c9OYnuxUc3fmBuFft/Ff8xMd0s65SXIb/gAAAABJRU5ErkJggg==") no-repeat scroll left center;
color: red;
}
#logout {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJHSURBVDjLlZPNi81hFMc/z7137p1mTCFvNZfGSzLIWNjZKRvFRoqNhRCSYm8xS3+AxRRZ2JAFJWJHSQqTQkbEzYwIM+6Yid/znJfH4prLXShOnb6r8/nWOd8Tcs78bz0/f+KMu50y05nK/wy+uHDylbutqS5extvGcxaWqtoGDA8PZ3dnrs2srQc2Zko41UXLmLdyDW5OfvsUkUgbYGbU63UAQggdmvMzFmzZCgTi7CQmkZwdEaX0JwDgTnGbTCaE0G4zw80omhPI92lcEtkNkdgJCCHwJX7mZvNaB0A14SaYJlwTrpHsTkoFlV1nt2c3x5YYo1/vM9A/gKpxdfwyu/v3teCayKq4JEwT5EB2R6WgYmrs2bYbcUNNUVfEhIfFYy69uci+1fuRX84mkawFSxd/4nVWUopUVIykwlQxRTJBTIDA4Pp1jBZPuNW4wUAPmCqWIn29X1k4f5Ku8g9mpKCkakRLVEs1auVuauVuyqHMo8ejNCe+sWPVTkQKXCMmkeZUmUZjETF1tc6ooly+fgUVw9So1/tRN6YnZji46QghBFKKuAouERNhMlbAHZFE6e7pB+He8MMw+GGI4xtOMf1+lsl3TQ4NHf19BSlaO1DB9BfMHdX0O0iqSgiBbJkjm491hClJbA1LxCURgpPzXwAHhg63necAIi3XngXLcRU0fof8ETMljIyM5LGxMcbHxzvy/6fuXdWgt6+PWncv1e4euqo1ZmabvHs5+jn8yzufO7hiiZmuNpNBM13rbvVSpbrXJE7/BMkHtU9jFIC/AAAAAElFTkSuQmCC") no-repeat scroll left center;
border: none;
cursor: pointer;
margin-left: 6px;
overflow: hidden;
text-indent: 18px;
width: 16px;
}
/* paginator */
.pages {
margin: 1em 0;
font-size: 90%;
}
.pages a[href*="&page="] {
margin: .2em;
padding: .2em .5em;
border: 1px solid #9AAFE5;
text-decoration: none;
}

View File

@@ -9,6 +9,7 @@ if ($adminer->homepage()) {
}
echo "<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);'>\n";
echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^tables\[/);"><th>' . lang('Table') . '<td>' . lang('Rows') . "</thead>\n";
foreach (table_status() as $table => $row) {
$name = $adminer->tableName($row);
if (isset($row["Engine"]) && $name != "") {
@@ -18,6 +19,7 @@ if ($adminer->homepage()) {
echo "<td align='right'><a href='" . h(ME . "edit=") . urlencode($table) . "'>" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "</a>";
}
}
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "</form>\n";

View File

@@ -45,11 +45,11 @@ class Adminer {
function loginForm() {
?>
<table cellspacing="0">
<tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="auth[driver]" value="server"><input id="username" name="auth[username]" value="<?php echo h($_GET["username"]); ?>">
<tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="auth[driver]" value="server"><input name="auth[username]" id="username" value="<?php echo h($_GET["username"]); ?>" autocapitalize="off">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
</table>
<script type="text/javascript">
document.getElementById('username').focus();
focus(document.getElementById('username'));
</script>
<?php
echo "<p><input type='submit' value='" . lang('Login') . "'>\n";
@@ -75,7 +75,6 @@ document.getElementById('username').focus();
if ($set !== null) {
echo '<p class="tabs"><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
}
echo "<a href='" . h(remove_from_uri("page")) . "&amp;page=last' title='" . lang('Last page') . "'>&gt;&gt;</a>\n";
}
function foreignKeys($table) {
@@ -93,7 +92,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return[$row["TABLE_NAME"]]["keys"][$row["CONSTRAINT_NAME"]][$row["COLUMN_NAME"]] = $row["REFERENCED_COLUMN_NAME"];
}
foreach ($return as $key => $val) {
$name = $this->tableName(table_status($key));
$name = $this->tableName(table_status($key, true));
if ($name != "") {
$search = preg_quote($tableName);
$separator = "(:|\\s*-)?\\s+";
@@ -235,13 +234,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if (($val["col"] == "" || $columns[$val["col"]]) && "$val[col]$val[val]" != "") {
echo "<div><select name='where[$i][col]'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>";
echo html_select("where[$i][op]", array(-1 => "") + $this->operators, $val["op"]);
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onsearch='selectSearchSearch(this);'></div>\n";
$i++;
}
}
echo "<div><select name='where[$i][col]' onchange='this.nextSibling.nextSibling.onchange();'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, null, true) . "</select>";
echo html_select("where[$i][op]", array(-1 => "") + $this->operators);
echo "<input type='search' name='where[$i][val]' onchange='selectAddRow(this);'></div>\n";
echo "<input type='search' name='where[$i][val]' onchange='selectAddRow(this);' onsearch='selectSearch(this);'></div>\n";
echo "</div></fieldset>\n";
}
@@ -272,7 +271,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
function selectLimitPrint($limit) {
echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
echo html_select("limit", array("", "30", "100"), $limit);
echo html_select("limit", array("", "50", "100"), $limit);
echo "</div></fieldset>\n";
}
@@ -374,7 +373,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
}
function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "30");
return (isset($_GET["limit"]) ? $_GET["limit"] : "50");
}
function selectLengthProcess() {
@@ -498,6 +497,9 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return array('csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV');
}
function dumpDatabase($db) {
}
function dumpTable() {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
}
@@ -560,7 +562,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
<?php
$this->databasesPrint($missing);
if ($missing != "db" && $missing != "ns") {
$table_status = table_status();
$table_status = table_status('', true);
if (!$table_status) {
echo "<p class='message'>" . lang('No tables.') . "\n";
} else {

View File

@@ -13,6 +13,7 @@ $drivers[DRIVER] = lang('Login');
if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) {
$_GET["edit"] = $_GET["select"];
}
if (isset($_GET["download"])) {
include "../adminer/download.inc.php";
} elseif (isset($_GET["edit"])) {

Submodule externals/CodeMirror2 deleted from 8feb48b37c

2
externals/jush vendored

151
plugins/dump-alter.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
/** Exports one database (e.g. development) so that it can be synced with other database (e.g. production)
* @link http://www.adminer.org/plugins/#use
* @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 AdminerDumpAlter {
function dumpFormat() {
if (DRIVER == 'server') {
return array('sql_alter' => 'Alter');
}
}
function _database() {
// drop old tables
$query = "SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";
echo "DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _table_name, _engine, _table_collation varchar(64);
DECLARE _table_comment varchar(64);
DECLARE done bool DEFAULT 0;
DECLARE tables CURSOR FOR $query;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN tables;
REPEAT
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN
CASE _table_name";
foreach (get_rows($query) as $row) {
$comment = q($row["ENGINE"] == "InnoDB" ? preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["TABLE_COMMENT"]) : $row["TABLE_COMMENT"]);
echo "
WHEN " . q($row["TABLE_NAME"]) . " THEN
" . (isset($row["ENGINE"]) ? "IF _engine != '$row[ENGINE]' OR _table_collation != '$row[TABLE_COLLATION]' OR _table_comment != $comment THEN
ALTER TABLE " . idf_escape($row["TABLE_NAME"]) . " ENGINE=$row[ENGINE] COLLATE=$row[TABLE_COLLATION] COMMENT=$comment;
END IF" : "BEGIN END") . ";";
}
echo "
ELSE
SET alter_command = CONCAT(alter_command, 'DROP TABLE `', REPLACE(_table_name, '`', '``'), '`;\\n');
END CASE;
END IF;
UNTIL done END REPEAT;
CLOSE tables;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
SELECT @adminer_alter;
";
}
function dumpDatabase($db) {
static $first = true;
if ($_POST["format"] == "sql_alter") {
if ($first) {
$first = false;
echo "SET @adminer_alter = '';\n\n";
register_shutdown_function(array($this, '_database'));
} else {
$this->_database();
}
return true;
}
}
function dumpTable($table, $style, $is_view = false) {
if ($_POST["format"] == "sql_alter") {
$create = create_sql($table, $_POST["auto_increment"]);
if ($is_view) {
echo substr_replace($create, " OR REPLACE", 6, 0) . ";\n\n";
} else {
echo substr_replace($create, " IF NOT EXISTS", 12, 0) . ";\n\n";
// create procedure which iterates over original columns and adds new and removes old
$query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION";
echo "DELIMITER ;;
CREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN
DECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';
DECLARE _column_type, _column_default text;
DECLARE _is_nullable char(3);
DECLARE _extra varchar(30);
DECLARE _column_comment varchar(255);
DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '";
$fields = array();
$after = "";
foreach (get_rows($query) as $row) {
$default = $row["COLUMN_DEFAULT"];
$row["default"] = ($default !== null ? q($default) : "NULL");
$row["after"] = q($after); //! rgt AFTER lft, lft AFTER id doesn't work
$row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"])
. " $row[COLUMN_TYPE]"
. ($row["COLLATION_NAME"] ? " COLLATE $row[COLLATION_NAME]" : "")
. ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "")
. ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL")
. ($row["EXTRA"] ? " $row[EXTRA]" : "")
. ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "")
. ($after ? " AFTER " . idf_escape($after) : " FIRST")
);
echo ", ADD $row[alter]";
$fields[] = $row;
$after = $row["COLUMN_NAME"];
}
echo "';
DECLARE columns CURSOR FOR $query;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET @alter_table = '';
OPEN columns;
REPEAT
FETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;
IF NOT done THEN
SET set_after = 1;
CASE _column_name";
foreach ($fields as $row) {
echo "
WHEN " . q($row["COLUMN_NAME"]) . " THEN
SET add_columns = REPLACE(add_columns, ', ADD $row[alter]', IF(
_column_default <=> $row[default] AND _is_nullable = '$row[IS_NULLABLE]' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'$row[COLLATION_NAME]'" : "NULL") . " AND _column_type = " . q($row["COLUMN_TYPE"]) . " AND _extra = '$row[EXTRA]' AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " AND after = $row[after]
, '', ', MODIFY $row[alter]'));"
; //! don't replace in comment
}
echo "
ELSE
SET @alter_table = CONCAT(@alter_table, ', DROP ', _column_name);
SET set_after = 0;
END CASE;
IF set_after THEN
SET after = _column_name;
END IF;
END IF;
UNTIL done END REPEAT;
CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN
SET alter_command = CONCAT(alter_command, 'ALTER TABLE " . table($table) . "', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');
END IF;
END;;
DELIMITER ;
CALL adminer_alter(@adminer_alter);
DROP PROCEDURE adminer_alter;
";
//! indexes
}
return true;
}
}
}

62
plugins/dump-json.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
/** Dump to JSON format
* @link http://www.adminer.org/plugins/#use
* @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 AdminerDumpJson {
/** @access protected */
var $database = false;
function dumpFormat() {
return array('json' => 'JSON');
}
function dumpTable($table, $style, $is_view = false) {
if ($_POST["format"] == "json") {
return true;
}
}
function _database() {
echo "}\n";
}
function dumpData($table, $style, $query) {
if ($_POST["format"] == "json") {
if ($this->database) {
echo ",\n";
} else {
$this->database = true;
echo "{\n";
register_shutdown_function(array($this, '_database'));
}
$connection = connection();
$result = $connection->query($query, 1);
if ($result) {
echo '"' . addcslashes($table, "\r\n\"\\") . "\": [\n";
$first = true;
while ($row = $result->fetch_assoc()) {
echo ($first ? "" : ", ");
$first = false;
foreach ($row as $key => $val) {
json_row($key, $val);
}
json_row("");
}
echo "]";
}
return true;
}
}
function dumpHeaders($identifier, $multi_table = false) {
if ($_POST["format"] == "json") {
header("Content-Type: application/json; charset=utf-8");
return "json";
}
}
}

View File

@@ -19,6 +19,7 @@ class AdminerDumpZip {
}
function _zip($string, $state) {
// ZIP can be created without temporary file by gzcompress - see PEAR File_Archive
$this->data .= $string;
if ($state & PHP_OUTPUT_HANDLER_END) {
$zip = new ZipArchive;

21
plugins/json-column.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
/** Display JSON values as table in edit
* @link http://www.adminer.org/plugins/#use
* @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 AdminerJsonColumn {
function editInput($table, $field, $attrs, $value) {
if (substr($value, 0, 1) == '{' && ($json = json_decode($value, true))) {
echo "<table cellspacing='0'>";
foreach ($json as $key => $val) {
echo "<tr><th>" . h($key) . "<td><code class='jush-js'>" . h(json_encode($val)) . "</code>";
}
echo "</table>";
}
}
}

43
plugins/master-slave.php Normal file
View File

@@ -0,0 +1,43 @@
<?php
/** Execute writes on master and reads on slave
* @link http://www.adminer.org/plugins/#use
* @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 AdminerMasterSlave {
private $masters = array();
/**
* @param array ($slave => $master)
*/
function AdminerMasterSlave($masters) {
$this->masters = $masters;
}
function credentials() {
if ($_POST && isset($this->masters[SERVER])) {
return array($this->masters[SERVER], $_GET["username"], get_session("pwds"));
}
}
function login($login, $password) {
if (!$_POST && ($master = &$_SESSION["master"])) {
$connection = connection();
$connection->query("DO MASTER_POS_WAIT('" . q($master['File']) . "', $master[Position])");
$master = null;
}
}
function messageQuery($query) {
//! doesn't work with sql.inc.php
$connection = connection();
$result = $connection->query('SHOW MASTER STATUS');
if ($result) {
restart_session();
$_SESSION["master"] = $result->fetch_assoc();
}
}
}

View File

@@ -301,6 +301,11 @@ class AdminerPlugin extends Adminer {
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpDatabase() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function dumpTable() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);

View File

@@ -56,7 +56,6 @@
<td>Query executed OK</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -41,7 +41,6 @@
<td>Database has been created.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -41,7 +41,6 @@
<td>Item 2 has been inserted.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -26,7 +26,6 @@
<td>Michael Jackson</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -31,7 +31,6 @@
<td>Item has been updated.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -36,7 +36,6 @@
<td>1 item has been affected.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -36,7 +36,6 @@
<td>No rows.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -126,7 +126,6 @@
<td>User has been dropped.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -21,7 +21,6 @@
<td>SHOW FULL PROCESSLIST</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -61,7 +61,6 @@
<td>VIEW `albums_interprets`</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -53,7 +53,7 @@
</tr>
<tr>
<td>clickAndWait</td>
<td>link=no_albums</td>
<td>link=Alter</td>
<td></td>
</tr>
<tr>
@@ -71,7 +71,6 @@
<td>Event has been dropped.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -121,7 +121,6 @@
<td>Routine has been dropped.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -86,7 +86,6 @@
<td>Table has been created.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@@ -91,7 +91,6 @@
<td>Table has been altered.</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More