1
0
mirror of https://github.com/vrana/adminer.git synced 2025-09-01 18:32:39 +02:00

Compare commits

..

101 Commits

Author SHA1 Message Date
Jakub Vrana
8b0acfe8ca Release 2011-03-28 12:44:17 +02:00
Jakub Vrana
324b19d281 Simplify JUSH replacement 2011-03-28 12:41:02 +02:00
Jakub Vrana
87888f1048 Comment 2011-03-28 12:40:14 +02:00
Jakub Vrana
9f58dc6328 Allow more extends with plugin autoloader 2011-03-28 01:51:18 +02:00
Jakub Vrana
63f197213e Show only errors with file upload by default 2011-03-28 00:56:48 +02:00
Jakub Vrana
869193fa18 Plugin autoloader 2011-03-28 00:47:42 +02:00
Jakub Vrana
989d75886f Schema permanent link before mouse move 2011-03-26 02:26:17 +01:00
Jakub Vrana
52a67a9d7c Drop view from alter 2011-03-25 23:59:27 +01:00
Jakub Vrana
8bda0b64ba Allow replacing JS functions in head method 2011-03-25 16:03:36 +01:00
Jakub Vrana
3929e19c7f Do not depend on externals 2011-03-25 15:59:19 +01:00
Jakub Vrana
b5cbbce3cd Save memory 2011-03-25 13:36:12 +01:00
Jakub Vrana
6d0b86bffa Show only SELECT result in 'Only errors' mode 2011-03-25 13:15:49 +01:00
Jakub Vrana
3535d0a325 Parse comment before delimiter 2011-03-25 12:50:21 +01:00
Jakub Vrana
ce9270ba66 Typo 2011-03-24 16:57:43 +01:00
Jakub Vrana
aea84dda9a Fix plugin extending
http://forum.zdrojak.root.cz/index.php?topic=366.0
2011-03-24 16:23:26 +01:00
Jakub Vrana
2dbc73833b PostgreSQL bool in Editor 2011-03-24 11:37:05 +01:00
Jakub Vrana
ebc0c52f5f Comment 2011-03-24 11:33:31 +01:00
Jakub Vrana
92259121a5 Display loader above menu 2011-03-24 11:07:17 +01:00
Jakub Vrana
58347d495e Load page without POST after denied AJAX reload 2011-03-24 08:39:35 +01:00
Jakub Vrana
fa832055c8 Fix AJAX history after reload 2011-03-24 08:24:57 +01:00
Jakub Vrana
5ee14079b8 Avoid double escaping 2011-03-24 02:19:21 +01:00
Jakub Vrana
07e4476e78 Register events after loading JS functions 2011-03-24 01:30:32 +01:00
Jakub Vrana
06e3746510 No HTML tags in <title> 2011-03-23 21:07:21 +01:00
Jakub Vrana
7d2735512f Develop 2011-03-23 18:33:33 +01:00
Jakub Vrana
85fc4b18e2 Release 3.2.1 2011-03-23 18:17:13 +01:00
Jakub Vrana
931f7ef6c6 Fix inline edit in IE9 2011-03-23 14:59:06 +01:00
Jakub Vrana
fa3268269a Use shortcut 2011-03-23 13:35:52 +01:00
Jakub Vrana
e89f42d466 Set MySQL time zone by PHP setting only in Editor 2011-03-23 13:35:35 +01:00
Jakub Vrana
d8cba0eb5d Allow own code in <head> (thanks to Nikolaj Vasilcuk) 2011-03-23 11:57:35 +01:00
Jakub Vrana
2e6ad2037f Display ; in history (thanks to Jan Cerny) 2011-03-22 15:37:40 +01:00
Jakub Vrana
0bc930c52a Avoid big ternary (save memory) 2011-03-22 15:12:38 +01:00
Jakub Vrana
2671a4774f No edit expression with set and binary 2011-03-22 15:11:42 +01:00
Jakub Vrana
04e5250044 Better translation 2011-03-22 14:10:25 +01:00
Jakub Vrana
9565f74745 JS only label 2011-03-21 15:45:16 +01:00
Jakub Vrana
e4cb779bd9 Fix test 2011-03-21 15:44:46 +01:00
Jakub Vrana
43b9502ce1 Respect number of lines in inline-edit 2011-03-21 14:35:58 +01:00
Jakub Vrana
7d152fbabf Utilize bodyKeydown function 2011-03-21 13:53:48 +01:00
Jakub Vrana
b68ddcad2b Send all forms by Ctrl+Enter on <select> 2011-03-21 12:15:38 +01:00
Jakub Vrana
1804f71b96 New plugin: Display constant list of servers in login form 2011-03-21 10:16:01 +01:00
Jakub Vrana
11863ab2ef Comment 2011-03-21 10:14:22 +01:00
Jakub Vrana
2f76084bbd Avoid big ternary operator (saves memory) 2011-03-21 10:06:27 +01:00
Jakub Vrana
08650eecf1 Send form by AJAX on Ctrl+Enter 2011-03-21 01:12:41 +01:00
Jakub Vrana
3fadf35599 Send search form by Ctrl+Enter on <select> 2011-03-21 00:59:40 +01:00
Jakub Vrana
0bf40f9c70 Respect order after search (Editor) 2011-03-19 14:47:44 +01:00
Jakub Vrana
5586c51d18 Send select search form by Enter on <select> 2011-03-18 17:24:29 +01:00
Jakub Vrana
266d83215d Hide JS only elements with disabled JavaScript 2011-03-18 15:03:41 +01:00
Jakub Vrana
10bb2b1526 Time format hint (Editor) 2011-03-18 14:29:36 +01:00
Jakub Vrana
ef3eb908fd Comment 2011-03-18 09:14:07 +01:00
Jakub Vrana
622845b096 Disable maxlength with edit functions 2011-03-18 09:08:27 +01:00
Jakub Vrana
cdeecc3e19 Avoid double AJAX refresh in Chrome 2011-03-17 23:48:38 +01:00
Jakub Vrana
0f4ca18427 Use class for SQL textarea 2011-03-17 16:23:37 +01:00
Jakub Vrana
06ba118199 Avoid JS error with empty table 2011-03-17 10:10:27 +01:00
Jakub Vrana
010b3e9307 Avoid warning with wrong table name 2011-03-17 10:07:58 +01:00
Jakub Vrana
ee229ef618 Compact JUSH links 2011-03-16 13:14:40 +01:00
Jakub Vrana
a8b62ceff0 Update JUSH 2011-03-16 13:13:01 +01:00
Jakub Vrana
4cb08c4ab3 Delete ajaxMain function 2011-03-16 13:08:46 +01:00
Jakub Vrana
a00b52a689 Confirm AJAX POST reload 2011-03-16 13:07:44 +01:00
Jakub Vrana
f60058aa74 Hide empty breadcrumb 2011-03-15 18:35:24 +01:00
Jakub Vrana
8e5d9d0756 Don't save AJAX redirect to history 2011-03-15 18:13:54 +01:00
Jakub Vrana
327b56bcdf Ability to save expression in edit 2011-03-15 17:34:25 +01:00
Jakub Vrana
c708fa1c69 Display AJAX loader favicon only on blur 2011-03-15 12:58:04 +01:00
Jakub Vrana
c41c101aa3 Offer foreign key for id_my_table (thanks to Kevujin) 2011-03-14 14:17:28 +01:00
Jakub Vrana
021e1e319c Allow % in view definer (thanks to Tomas Votruba) 2011-03-14 11:24:52 +01:00
Jakub Vrana
70066b3f37 Avoid double replacing AJAX favicon 2011-03-12 00:37:08 +01:00
Jakub Vrana
d1f6fa9a3a Title and redirect only in correct AJAX state 2011-03-12 00:33:06 +01:00
Jakub Vrana
f6e29f78f6 Ajax reload with POST data 2011-03-12 00:20:27 +01:00
Jakub Vrana
d3609817a1 Don't add the same page to history in AJAX 2011-03-12 00:16:56 +01:00
Jakub Vrana
3a84672355 Update AJAX history for Firefox 4 RC 2011-03-11 23:25:41 +01:00
Jakub Vrana
db40abccc8 Change favicon during AJAX 2011-03-11 23:21:54 +01:00
Jakub Vrana
e52ac37c3e No warning with setting time zone 2011-03-11 22:15:27 +01:00
Jakub Vrana
a8df780fe0 Clear AJAX loader in correct state only 2011-03-11 22:09:54 +01:00
Jakub Vrana
15ab4d28a7 Find exact count on big page only with InnoDB 2011-03-11 21:59:58 +01:00
Jakub Vrana
d48c3593e3 Style AJAX loader 2011-03-11 21:38:54 +01:00
Jakub Vrana
3c5cd76d26 Handler for stopped AJAX requests 2011-03-11 17:00:02 +01:00
Jakub Vrana
2edd575767 Push AJAX state after transfer 2011-03-11 16:50:36 +01:00
Jakub Vrana
6fee8048e0 Display AJAX loader together with page 2011-03-11 16:50:03 +01:00
Jakub Vrana
1a0369adc0 Display default engine only in MySQL (thanks to Honza Krakora) 2011-03-11 11:49:38 +01:00
Jakub Vrana
0a8cd02636 Set MySQL time zone by PHP setting 2011-03-11 11:10:49 +01:00
Jakub Vrana
b0fe26ba3e Tab: scroll to original position in Firefox 2011-03-10 18:06:48 +01:00
Jakub Vrana
5e189f68e2 Avoid ;;;
Revert "Remove useless rtrim"
This reverts commit 3f4ef94f83.
2011-03-10 12:08:25 +01:00
Jakub Vrana
f332258d56 Show databases even with skip_show_database in MySQL 5 (thanks to Radoslaw Kowalewski) 2011-03-10 12:00:08 +01:00
Jakub Vrana
8bf026336f Export table header 2011-03-10 09:51:46 +01:00
Jakub Vrana
dea2dcc878 Update translation 2011-03-10 09:51:46 +01:00
Jakub Vrana
12f7503a56 Polish translation 2011-03-10 09:51:46 +01:00
Jakub Vrana
3f4ef94f83 Remove useless rtrim 2011-03-10 01:17:29 +01:00
Jakub Vrana
5d7a974671 Typo 2011-03-10 00:37:16 +01:00
Jakub Vrana
d06de5512e Use DELIMITER in history 2011-03-10 00:36:22 +01:00
Jakub Vrana
1420b6a259 Esc to focus next field in Tab textarea (thanks to David Grudl) 2011-03-08 13:46:37 +01:00
Jakub Vrana
740ae10a3d Don't send incomplete forms 2011-03-08 13:43:05 +01:00
Jakub Vrana
071e6a2408 Work in IE8
Revert "Handle keypress instead of keydown (bug #3112458)"
This reverts commit 71438d57c3.
2011-03-08 13:14:36 +01:00
Jakub Vrana
61cec7efcc Ignore compiled files only in root 2011-03-07 14:38:25 +01:00
Jakub Vrana
9ff10f8301 Parse UTF-16 and UTF-8 BOM in all text uploads 2011-03-07 14:27:03 +01:00
Jakub Vrana
db030df487 Remove ? from form.action in AJAX (thanks to krucipisek) 2011-03-01 17:02:20 +01:00
Jakub Vrana
de4820cc83 New plugin: Edit textarea 2011-03-01 16:47:01 +01:00
Jakub Vrana
2ad1b6a062 Schema permanent link (thanks to Martin Hujer) 2011-02-28 17:00:42 +01:00
Jakub Vrana
ee653a689e Better select.value detection 2011-02-28 15:57:37 +01:00
Jakub Vrana
5b8361af65 Don't export triggers without table (bug #3193489) 2011-02-28 14:19:41 +01:00
Jakub Vrana
e25e78037f DESC labels (bug #3192356) 2011-02-25 16:22:25 +01:00
Jakub Vrana
8141463609 Update JUSH 2011-02-25 10:56:52 +01:00
Jakub Vrana
32f2000034 Respect default collation (bug #3191489) 2011-02-25 10:49:19 +01:00
Jakub Vrana
f842e33bee Develop 2011-02-24 17:36:19 +01:00
49 changed files with 837 additions and 523 deletions

4
.gitignore vendored
View File

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

View File

@@ -72,6 +72,6 @@ if ($in) {
}
?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Call'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -14,6 +14,9 @@ if ($TABLE != "") {
$orig_fields = fields($TABLE);
$orig_status = table_status($TABLE);
}
if ($_POST && !$_POST["fields"]) {
$_POST["fields"] = array();
}
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] && !$_POST["down"]) {
if ($_POST["drop"]) {
@@ -158,12 +161,12 @@ foreach ($engines as $engine) {
</table>
<p>
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
<label class="jsonly"><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?></label>
<?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
<?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"]);

View File

@@ -57,12 +57,11 @@ if ($_POST) {
<p>
<?php
echo ($_POST["add_x"] || strpos($name, "\n")
? '<textarea id="name" name="name" rows="10" cols="40" onkeypress="return textareaKeypress(this, event);">' . h($name) . '</textarea><br>'
? '<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) : "");
?>
<script type='text/javascript'>document.getElementById('name').focus();</script>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if (DB != "") {
@@ -71,4 +70,5 @@ if (DB != "") {
echo "<input type='image' name='add' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -66,14 +66,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($connection->result("SELECT @@storage_engine"));
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";
if (!information_schema(DB)) {
echo "<p><input type='hidden' name='token' value='$token'>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
echo "<p>" . ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm("formChecked(this, /tables/)") . "> <input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /tables|views/)", 1) . ">\n"; // 1 - eventStop
$databases = (support("scheme") ? schemas() : get_databases());
if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
@@ -83,6 +83,7 @@ if ($adminer->homepage()) {
echo (support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "' onclick='eventStop(event);'>" : "");
echo "\n";
}
echo "<input type='hidden' name='token' value='$token'>\n";
}
echo "</form>\n";
}

View File

@@ -250,7 +250,7 @@ if (!defined("DRIVER")) {
$connection = new Min_DB;
$credentials = $adminer->credentials();
if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
$connection->query("SET SQL_QUOTE_SHOW_CREATE=1");
$connection->query("SET sql_quote_show_create = 1");
return $connection;
}
return $connection->error;
@@ -261,6 +261,7 @@ if (!defined("DRIVER")) {
* @return array
*/
function get_databases($flush = true) {
global $connection;
// SHOW DATABASES can take a very long time so it is cached
$return = &get_session("dbs");
if (!isset($return)) {
@@ -269,7 +270,7 @@ if (!defined("DRIVER")) {
ob_flush();
flush();
}
$return = get_vals("SHOW DATABASES");
$return = get_vals($connection->server_info >= 5 ? "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA" : "SHOW DATABASES"); // SHOW DATABASES can be disabled by skip_show_database
}
return $return;
}
@@ -307,7 +308,7 @@ if (!defined("DRIVER")) {
$return = $match[1];
} elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) {
// default collation
$return = $collations[$match[1]][0];
$return = $collations[$match[1]][-1];
}
return $return;
}
@@ -479,11 +480,15 @@ if (!defined("DRIVER")) {
function collations() {
$return = array();
foreach (get_rows("SHOW COLLATION") as $row) {
$return[$row["Charset"]][] = $row["Collation"];
if ($row["Default"]) {
$return[$row["Charset"]][-1] = $row["Collation"];
} else {
$return[$row["Charset"]][] = $row["Collation"];
}
}
ksort($return);
foreach ($return as $key => $val) {
sort($return[$key]);
asort($return[$key]);
}
return $return;
}

View File

@@ -77,11 +77,8 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
if ($data) {
$adminer->dumpData($row["Name"], $_POST["data_style"], "SELECT * FROM " . table($row["Name"]));
}
if ($is_sql && $_POST["triggers"]) {
$triggers = trigger_sql($row["Name"], $_POST["table_style"]);
if ($triggers) {
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
}
if ($is_sql && $_POST["triggers"] && $table && ($triggers = trigger_sql($row["Name"], $_POST["table_style"]))) {
echo "\nDELIMITER ;;\n$triggers\nDELIMITER ;\n";
}
if ($ext == "tar") {
echo tar_file((DB != "" ? "" : "$db/") . "$row[Name].csv", ob_get_clean());
@@ -221,7 +218,7 @@ if (DB != "") {
}
}
} else {
echo "<tr><td><textarea name='databases' rows='10' cols='20' onkeypress='return textareaKeypress(this, event);'></textarea>";
echo "<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";
}
}
?>

View File

@@ -43,7 +43,7 @@ page_header(
($update ? lang('Edit') : lang('Insert')),
$error,
array("select" => array($TABLE, $table_name)),
$table_name
$table_name //! two calls of h()
);
$row = null;
@@ -90,13 +90,7 @@ if ($fields) {
}
?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="referer" value="<?php echo h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]); ?>">
<input type="hidden" name="save" value="1">
<?php
if (isset($_GET["select"])) {
hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));
}
if ($fields) {
echo "<input type='submit' value='" . lang('Save') . "'>\n";
if (!isset($_GET["select"])) {
@@ -104,7 +98,13 @@ if ($fields) {
}
}
echo ($update ? "<input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\">\n"
: ($_POST ? "" : "<script type='text/javascript'>document.getElementById('form').getElementsByTagName('td')[1].firstChild.focus();</script>\n")
: ($_POST || !$fields ? "" : "<script type='text/javascript'>document.getElementById('form').getElementsByTagName('td')[1].firstChild.focus();</script>\n")
);
if (isset($_GET["select"])) {
hidden_fields(array("check" => (array) $_POST["check"], "clone" => $_POST["clone"], "all" => $_POST["all"]));
}
?>
<input type="hidden" name="referer" value="<?php echo h(isset($_POST["referer"]) ? $_POST["referer"] : $_SERVER["HTTP_REFERER"]); ?>">
<input type="hidden" name="save" value="1">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -14,13 +14,13 @@ if ($_POST && !$error) {
: "AT " . q($_POST["STARTS"])
) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
;
query_redirect(($EVENT != ""
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"])
. " DO\n$_POST[EVENT_DEFINITION]"
, substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')));
. rtrim(" DO\n$_POST[EVENT_DEFINITION]", ";") . ";"
));
}
}
@@ -47,7 +47,7 @@ if ($_POST) {
</table>
<p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($EVENT != "") { ?><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

@@ -12,7 +12,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["change"] && !$_POST["change-
}
query_redirect("ALTER TABLE " . table($TABLE)
. ($_GET["name"] != "" ? "\nDROP FOREIGN KEY " . idf_escape($_GET["name"]) . "," : "")
. "\nADD FOREIGN KEY (" . implode(", ", array_map('idf_escape', $source)) . ") REFERENCES " . table($_POST["table"]) . " (" . implode(", ", array_map('idf_escape', $target)) . ")"
. "\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
. (in_array($_POST["on_delete"], $on_actions) ? " ON DELETE $_POST[on_delete]" : "")
. (in_array($_POST["on_update"], $on_actions) ? " ON UPDATE $_POST[on_update]" : "")
, ME . "table=" . urlencode($TABLE), ($_GET["name"] != "" ? lang('Foreign key has been altered.') : lang('Foreign key has been created.')));

View File

@@ -40,6 +40,13 @@ class Adminer {
header("X-XSS-Protection: 0"); // prevents introducing XSS in IE8 by removing safe parts of the page
}
/** Print HTML code inside <head>
* @return bool true to link adminer.css if exists
*/
function head() {
return true;
}
/** Print login form
* @return null
*/
@@ -73,7 +80,7 @@ username.form['driver'].onchange();
/** Table caption used in navigation and headings
* @param array result of SHOW TABLE STATUS
* @return string
* @return string HTML code, "" to ignore table
*/
function tableName($tableStatus) {
return h($tableStatus["Name"]);
@@ -82,7 +89,7 @@ username.form['driver'].onchange();
/** Field caption used in select and edit
* @param array single field returned from fields()
* @param int order of column in select
* @return string
* @return string HTML code, "" to ignore field
*/
function fieldName($field, $order = 0) {
return '<span title="' . h($field["full_type"]) . '">' . h($field["field"]) . '</span>';
@@ -141,7 +148,7 @@ username.form['driver'].onchange();
*/
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>\n";
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
}
/** Description of a row in a table
@@ -253,7 +260,7 @@ username.form['driver'].onchange();
}
}
echo "<div><select name='order[$i]' onchange='selectAddRow(this);'><option>" . optionlist($columns, null, true) . "</select>";
echo checkbox("desc[$i]", 1, 0, lang('descending')) . "</div>\n";
echo "<label><input type='checkbox' name='desc[$i]' value='1'>" . lang('descending') . "</label></div>\n"; // not checkbox() to allow selectAddRow()
echo "</div></fieldset>\n";
}
@@ -408,10 +415,10 @@ username.form['driver'].onchange();
restart_session();
$id = "sql-" . ($count++);
$history = &get_session("queries");
$history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database
? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
: $query
); //! respect $_GET["ns"]
if (strlen($query) > 1e6) { // not DB - reset in drop database
$query = ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..."; // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
}
$history[$_GET["db"]][] = $query; //! respect $_GET["ns"]
return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre><p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>';
}
@@ -429,6 +436,9 @@ username.form['driver'].onchange();
$return .= "/$val";
}
}
if ($key && !ereg('set|blob|bytea|raw|file', $field["type"])) {
$return .= "/=";
}
}
}
return explode("/", $return);
@@ -458,6 +468,9 @@ username.form['driver'].onchange();
* @return string expression to use in a query
*/
function processInput($field, $value, $function = "") {
if ($function == "=") {
return $value; // SQL injection
}
$name = $field["field"];
$return = ($field["type"] == "bit" && ereg('^[0-9]+$', $value) ? $value : q($value));
if (ereg('^(now|getdate|uuid)$', $function)) {
@@ -521,7 +534,7 @@ username.form['driver'].onchange();
}
if ($is_view) {
// remove DEFINER with current user
$create = preg_replace('~^([A-Z =]+) DEFINER=`' . str_replace("@", "`@`", logged_user()) . '`~', '\\1', $create); //! proper escaping of user
$create = preg_replace('~^([A-Z =]+) DEFINER=`' . preg_replace('~@(.*)~', '`@`(%|\\1)', logged_user()) . '`~', '\\1', $create); //! proper escaping of user
}
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
}
@@ -739,8 +752,8 @@ DROP PROCEDURE adminer_alter;
}
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" onclick="eventStop(event);">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</p>
</form>
<form action="">

View File

@@ -32,7 +32,7 @@ function connect_error() {
$collations = collations();
echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' onclick='tableClick(event);'>\n";
echo "<thead><tr><td><input type='hidden' name='token' value='$token'>&nbsp;<th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\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"]));
@@ -43,6 +43,7 @@ function connect_error() {
}
echo "</table>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n"; // 1 - eventStop
echo "<input type='hidden' name='token' value='$token'>\n";
echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n";
echo "</form>\n";
}

View File

@@ -1,9 +1,9 @@
<?php
/** Print HTML header
* @param string used in title, breadcrumb and heading
* @param string used in title, breadcrumb and heading, should be HTML escaped
* @param string
* @param mixed array("key" => "link=desc", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
* @param string used after colon in title and heading
* @param string used after colon in title and heading, will be HTML escaped
* @return null
*/
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
@@ -11,7 +11,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
header("Content-Type: text/html; charset=utf-8");
$adminer->headers();
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
$title_page = $title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name();
$title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
if (is_ajax()) {
header("X-AJAX-Title: " . rawurlencode($title_page));
} else {
@@ -22,15 +22,21 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<title><?php echo $title_page; ?></title>
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico" id="favicon">
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
<?php if (file_exists("adminer.css")) { ?>
<script type="text/javascript">
var areYouSure = '<?php echo lang('Resend POST data?'); ?>';
</script>
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<?php if ($adminer->head() && file_exists("adminer.css")) { ?>
<link rel="stylesheet" type="text/css" href="adminer.css">
<?php } ?>
<body class="<?php echo lang('ltr'); ?>" onclick="return bodyClick(event, '<?php echo js_escape(DB); ?>', '<?php echo js_escape($_GET["ns"]); ?>');" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion('$protocol');"); ?>">
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<body class="<?php echo lang('ltr'); ?> nojs" onclick="return bodyClick(event, '<?php echo js_escape(DB); ?>', '<?php echo js_escape($_GET["ns"]); ?>');" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
<script type="text/javascript">
document.body.className = document.body.className.replace(/(^|\s)nojs(\s|$)/, '$1js$2');
</script>
<div id="content">
<?php
@@ -61,6 +67,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
echo "$title\n";
}
}
echo "<span id='loader'></span>\n";
echo "<h2>$title_all</h2>\n";
restart_session();
$uri = preg_replace('~^[^?]*~', '', $_SERVER["REQUEST_URI"]);

View File

@@ -106,10 +106,10 @@ function referencable_primary($self) {
* @return null
*/
function textarea($name, $value, $rows = 10, $cols = 80) {
echo "<textarea name='$name' rows='$rows' cols='$cols' style='width: 98%;' spellcheck='false' wrap='off' onkeypress='return textareaKeypress(this, event, true);'>"; // spellcheck, wrap - not valid before HTML5
echo "<textarea name='$name' rows='$rows' cols='$cols' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'>"; // spellcheck, wrap - not valid before HTML5
if (is_array($value)) {
foreach ($value as $val) { // not implode() to save memory
echo h($val) . ";\n\n\n"; // rtrim(, ';') would possibly damage DELIMITER
echo h($val) . "\n\n\n";
}
} else {
echo h($value);

View File

@@ -91,7 +91,7 @@ function nl_br($string) {
function checkbox($name, $value, $checked, $label = "", $onclick = "") {
static $id = 0;
$id++;
$return = "<input type='checkbox'" . ($name ? " name='$name' value='" . h($value) . "'" : "") . ($checked ? " checked" : "") . ($onclick ? " onclick=\"$onclick\"" : "") . " id='checkbox-$id'>";
$return = "<input type='checkbox'" . ($name ? " name='$name' value='" . h($value) . "'" : " class='jsonly'") . ($checked ? " checked" : "") . ($onclick ? " onclick=\"$onclick\"" : "") . " id='checkbox-$id'>";
return ($label != "" ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return);
}
@@ -104,10 +104,12 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
function optionlist($options, $selected = null, $use_keys = false) {
$return = "";
foreach ($options as $k => $v) {
$opts = array($k => $v);
if (is_array($v)) {
$return .= '<optgroup label="' . h($k) . '">';
$opts = $v;
}
foreach ((is_array($v) ? $v : array($k => $v)) as $key => $val) {
foreach ($opts as $key => $val) {
$return .= '<option' . ($use_keys || is_string($key) ? ' value="' . h($key) . '"' : '') . (($use_keys || is_string($key) ? (string) $key : $val) === $selected ? ' selected' : '') . '>' . h($val);
}
if (is_array($v)) {
@@ -411,7 +413,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
}
$sql = "";
if ($query) {
$sql = $adminer->messageQuery($query);
$sql = $adminer->messageQuery("$query;");
}
if ($failed) {
$error = error() . $sql;
@@ -424,7 +426,7 @@ function query_redirect($query, $location, $message, $redirect = true, $execute
}
/** Execute and remember query
* @param string null to return remembered queries
* @param string null to return remembered queries, end with ';' to use DELIMITER
* @return Min_Result
*/
function queries($query = null) {
@@ -434,7 +436,7 @@ function queries($query = null) {
// return executed queries without parameter
return implode(";\n", $queries);
}
$queries[] = $query;
$queries[] = (ereg(';$', $query) ? "DELIMITER ;;\n$query;\nDELIMITER " : $query);
return $connection->query($query);
}
@@ -489,10 +491,19 @@ function get_file($key, $decompress = false) {
if (!$file || $file["error"]) {
return $file["error"];
}
return file_get_contents($decompress && ereg('\\.gz$', $file["name"]) ? "compress.zlib://$file[tmp_name]"
$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);
}
}
return $return;
}
/** Determine upload error
@@ -665,7 +676,7 @@ function input($field, $value, $function) {
}
$onchange = ($first ? " onchange=\"var f = this.form['function[" . js_escape($name) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
$attrs .= $onchange;
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "") : nbsp(reset($functions))) . '<td>';
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
if ($input != "") {
echo $input;
@@ -679,7 +690,7 @@ function input($field, $value, $function) {
} elseif (ereg('blob|bytea|raw|file', $field["type"]) && ini_bool("file_uploads")) {
echo "<input type='file' name='fields-$name'$onchange>";
} elseif (ereg('text|lob', $field["type"])) {
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs onkeypress='return textareaKeypress(this, event);'>" . h($value) . '</textarea>'; // 1.2em - line-height
echo "<textarea " . ($jush != "sqlite" || ereg("\n", $value) ? "cols='50' rows='12'" : "cols='30' rows='1' style='height: 1.2em;'") . "$attrs>" . h($value) . '</textarea>'; // 1.2em - line-height
} 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));
@@ -747,7 +758,7 @@ function search_tables() {
echo "<ul>\n";
$found = true;
}
echo "<li><a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>" . h($name) . "</a>\n";
echo "<li><a href='" . h(ME . "select=" . urlencode($table) . "&where[0][op]=" . urlencode($_GET["where"][0]["op"]) . "&where[0][val]=" . urlencode($_GET["where"][0]["val"])) . "'>$name</a>\n";
}
}
}

View File

@@ -12,7 +12,7 @@ $langs = array(
'it' => 'Italiano', // Alessandro Fiorotto, Paolo Asperti
'et' => 'Eesti', // Priit Kallas
'hu' => 'Magyar', // Borsos Szilárd (Borsosfi) - http://www.borsosfi.hu, info@borsosfi.hu
// hidden because of poor quality according to author: 'pl' => 'Polski', // Helmut von Ślask cieszyński
'pl' => 'Polski', // Radosław Kowalewski - http://srsbiz.pl/
'ca' => 'Català', // Joan Llosas
'pt' => 'Português', // Gian Live - gian@live.com
'sl' => 'Slovenski', // Matej Ferlan - www.itdinamik.com, matej.ferlan@itdinamik.com
@@ -44,7 +44,7 @@ function lang($idf, $number = null) {
if (is_array($translation) && $translation) {
$pos = ($number == 1 || (!$number && $LANG == 'fr') ? 0 // French treat zero as singular
: ($LANG == 'sl' && (!$number || $number > 2) ? 1 : 0) // Slovenian use different forms for 1, 2, 3-4, other
+ ((!$number || $number >= 5) && ereg('cs|sk|ru|sl', $LANG) ? 2 : 1) // Slavic languages use different forms for 1, 2-4, other
+ ((!$number || $number >= 5) && ereg('cs|sk|ru|sl|pl', $LANG) ? 2 : 1) // Slavic languages use different forms for 1, 2-4, other
);
$translation = $translation[$pos];
}

View File

@@ -1,2 +1,2 @@
<?php
$VERSION = "3.2.0";
$VERSION = "3.2.2";

View File

@@ -94,7 +94,7 @@ foreach ($row["indexes"] as $index) {
?>
</table>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add next'); ?>"></noscript>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -20,7 +20,7 @@ $translations = array(
'%s version: %s through PHP extension %s' => 'Verze %s: %s přes PHP extenzi %s',
'Refresh' => 'Obnovit',
// text direction
// text direction - 'ltr' or 'rtl'
'ltr' => 'ltr',
'Privileges' => 'Oprávnění',
@@ -53,6 +53,7 @@ $translations = array(
'%.3f s' => '%.3f s',
'History' => 'Historie',
'Clear' => 'Vyčistit',
'Edit all' => 'Upravit vše',
'File upload' => 'Nahrání souboru',
'From server' => 'Ze serveru',
@@ -87,6 +88,9 @@ $translations = array(
'Create database' => 'Vytvořit databázi',
'Database schema' => 'Schéma databáze',
// link to current database schema layout
'Permanent link' => 'Trvalý odkaz',
// thousands separator - must contain single byte
',' => ' ',
'Engine' => 'Úložiště',
@@ -273,11 +277,16 @@ $translations = array(
'Geometry' => 'Geometrie',
'Relations' => 'Vztahy',
// reload confirmation in AJAX
'Resend POST data?' => 'Znovu odeslat POST data?',
'Editor' => 'Editor',
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
'$1-$3-$5' => '$6.$4.$1',
// hint for date format - use language equivalents for day, month and year shortcuts
'[yyyy]-mm-dd' => 'd.m.[rrrr]',
// hint for time format - use language equivalents for hour, minute and second shortcuts
'HH:MM:SS' => 'HH:MM:SS',
'now' => 'teď',
// general SQLite error in create, drop or rename database

View File

@@ -1,116 +1,120 @@
<?php
$translations = array(
'Login' => 'Zalogować się',
'Logout successful.' => 'Wylogowanie pomyślne.',
'Invalid credentials.' => 'Nieprawidłowe dane.',
// label for database system selection (MySQL, SQLite, ...)
'System' => 'Rodzaj bazy',
'Server' => 'Serwer',
'Username' => 'Użytkownik',
'Password' => 'Hasło',
'Permanent login' => 'Zapamiętaj sesję',
'Login' => 'Zaloguj się',
'Logout' => 'Wyloguj',
'Logged as: %s' => 'Zalogowany jako: %s',
'Logout successful.' => 'Wylogowano pomyślnie.',
'Invalid credentials.' => 'Nieprawidłowe dane logowania.',
'Language' => 'Język',
'Invalid CSRF token. Send the form again.' => 'Nieprawidłowy token CSRF. Spróbuj wysłać formularz ponownie.',
'No extension' => 'Brak rozszerzenia',
'None of the supported PHP extensions (%s) are available.' => 'Żadne z rozszerzeń PHP umożliwiających połączenie się z bazą danych (%s) nie jest dostępne.',
'Session support must be enabled.' => 'Wymagana jest obsługa sesji w PHP.',
'Session expired, please login again.' => 'Sesja wygasła, zaloguj się ponownie.',
'%s version: %s through PHP extension %s' => 'Wersja %s: %s za pomocą %s',
'Refresh' => 'Odśwież',
// text direction
'ltr' => 'ltr',
'Privileges' => 'Uprawnienia użytkowników',
'Create user' => 'Dodaj użytkownika',
'User has been dropped.' => 'Użytkownik został usunięty.',
'User has been altered.' => 'Użytkownik został zmieniony.',
'User has been created.' => 'Użytkownik został dodany.',
'Hashed' => 'Zahashowane',
'Column' => 'Kolumna',
'Routine' => 'Procedura',
'Grant' => 'Uprawnienia',
'Revoke' => 'Usuń uprawnienia',
'Process list' => 'Lista procesów',
'%d process(es) have been killed.' => array('Przerwano %d wątek.', 'Przerwano %d wątki.', 'Przerwano %d wątków.'),
'Kill' => 'Przerwij wykonywanie',
'Variables' => 'Zmienne',
'Status' => 'Status',
'SQL command' => 'Zapytanie SQL',
'%d query(s) executed OK.' => array('Pomyślnie wykonano %d zapytanie.', 'Pomyślnie wykonano %d zapytania.', 'Pomyślnie wykonano %d zapytań.'),
'Query executed OK, %d row(s) affected.' => array('Zapytanie wykonane pomyślnie, zmieniono %d rekord.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordy.', 'Zapytanie wykonane pomyślnie, zmieniono %d rekordów.'),
'No commands to execute.' => 'Nic do wykonania.',
'Error in query' => 'Błąd w zapytaniu',
'Execute' => 'Wykonaj',
'Stop on error' => 'Zatrzymaj w przypadku błędu',
'Show only errors' => 'Pokaż tylko błędy',
// sprintf() format for time of the command
'%.3f s' => '%.3f s',
'History' => 'Historia',
'Clear' => 'Wyczyść',
'File upload' => 'Wgranie pliku',
'From server' => 'Z serwera',
'Webserver file %s' => 'Plik %s na serwerze',
'Run file' => 'Uruchom z pliku',
'File does not exist.' => 'Plik nie istnieje.',
'File uploads are disabled.' => 'Wgrywanie plików jest wyłączone.',
'Unable to upload a file.' => 'Wgranie pliku było niemożliwe.',
'Maximum allowed file size is %sB.' => 'Maksymalna wielkość pliku to %sB.',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Przesłano zbyt dużo danych. Zmniejsz objętość danych lub zwiększ zmienną konfiguracyjną %s.',
'Export' => 'Eksport',
'Dump' => 'Eksport',
'Output' => 'Rezultat',
'open' => 'otwórz',
'save' => 'zapisz',
'Format' => 'Format',
'Data' => 'Dane',
'Database' => 'Baza danych',
'database' => 'baza danych',
'Use' => 'Wybierz',
'Select database' => 'Wybierz bazę danych',
'Invalid database.' => 'Nie znaleziono bazę danych.',
'Invalid database.' => 'Nie znaleziono bazy danych.',
'Create new database' => 'Utwórz nową bazę danych',
'Table has been dropped.' => 'Tabela została usunięta.',
'Table has been altered.' => 'Tabela została zmieniona.',
'Table has been created.' => 'Tabela została utworzona.',
'Alter table' => 'Zmień tabelę',
'Create table' => 'Utwórz nową tabelę',
'Table name' => 'Nazwa tabeli',
'engine' => 'składowanie',
'collation' => 'porównywanie',
'Column name' => 'Nazwa kolumny',
'Type' => 'Typ',
'Length' => 'Długość',
'Auto Increment' => 'Auto Increment',
'Options' => 'Operacje',
'Save' => 'Zachowaj',
'Drop' => 'Usuń',
'Database has been dropped.' => 'Baza danych została usunięta.',
'Databases have been dropped.' => 'Bazy danych zostały usunięte.',
'Database has been created.' => 'Baza danych została utworzona.',
'Database has been renamed.' => 'Baza danych została przemianowana.',
'Database has been renamed.' => 'Nazwa bazy danych została zmieniona.',
'Database has been altered.' => 'Baza danych została zmieniona.',
'Alter database' => 'Zmień bazę danych',
'Create database' => 'Utwórz bazę danych',
'SQL command' => 'SQL zapytanie',
'Dump' => 'Eksport',
'Logout' => 'Wyjście',
'database' => 'baza danych',
'Use' => 'Vybrat',
'No tables.' => 'Nie znaleziono tabeli.',
'select' => 'pokaż',
'Create new table' => 'Utwórz nową tabelę',
'Item has been deleted.' => 'Rekord został usunięty.',
'Item has been updated.' => 'Rekord został aktualizowany.',
'Item%s has been inserted.' => 'Rekord%s został włożony.',
'Edit' => 'Edytuj',
'Insert' => 'Dodaj',
'Save and insert next' => 'Wykonaj i dodaj następny',
'Delete' => 'Usuń',
'Database' => 'Baza danych',
'Routines' => 'Procedury i funkcje',
'Indexes have been altered.' => 'Indeksy uległy zmianie.',
'Indexes' => 'Indeksy',
'Alter indexes' => 'Edytuj indeksy',
'Add next' => 'Dodaj następny',
'Language' => 'Język',
'Select' => 'Przeglądaj',
'New item' => 'Nowy rekord',
'Search' => 'Szukaj',
'Sort' => 'Sortuj',
'descending' => 'malejąco',
'Limit' => 'Limit',
'No rows.' => 'Pusty wynik.',
'Action' => 'Czynność',
'edit' => 'zmień',
'Page' => 'Strona',
'Query executed OK, %d row(s) affected.' => array('Wykonanie pomyślne, zmieniono %d rekord.', 'Wykonanie pomyślne, zmieniono %d rekordy.', 'Wykonanie pomyślne, zmieniono %d rekordów.'),
'Error in query' => 'Bląd w zapytaniu',
'Execute' => 'Wykonaj',
'Table' => 'Tabela',
'Foreign keys' => 'Klucze obce',
'Triggers' => 'Wyzwalacze',
'View' => 'Perspektywa',
'Unable to select the table' => 'Nie mozna było przeglądać tabel',
'Invalid CSRF token. Send the form again.' => 'Niepoprawny CSRF token. Odeślij ponownie.',
'Comment' => 'Komentarz',
'Default values' => 'Wartości domyślne',
'%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtów'),
'No commands to execute.' => 'Nic do wykonania.',
'Unable to upload a file.' => 'Nie było możliwe nagrać plik.',
'File upload' => 'Nagranie pliku',
'File uploads are disabled.' => 'Nagranie pliku nie jest dozwolone.',
'Routine has been called, %d row(s) affected.' => array('Procedura była uruchomiona, został zmieniony %d rekord.', 'Procedura była uruchomiona, zostały zmienione %d rekordy.', 'Procedura była uruchomiona, %d rekordów zostało zmienionych.'),
'Call' => 'Uruchomić',
'No extension' => 'Bez rozszerzenia',
'None of the supported PHP extensions (%s) are available.' => 'Nie jest dostępne żadne z PHP rozszerzeń (%s).',
'Session support must be enabled.' => 'Session zmienne muszą być dozwolone.',
'Session expired, please login again.' => 'Minął czas session, zaloguj się ponownie.',
'Text length' => 'Długość tekstu',
'Foreign key has been dropped.' => 'Klucz obcy został usunięty.',
'Foreign key has been altered.' => 'Klucz obcy został zmieniony.',
'Foreign key has been created.' => 'Klucz obcy został utworzony.',
'Foreign key' => 'Obcy klucz',
'Target table' => 'Tabela celowa',
'Change' => 'Zmienić',
'Source' => 'Źródło',
'Target' => 'Cel',
'Add column' => 'Dodaj kolumnę',
'Alter' => 'Zmień',
'Add foreign key' => 'Dodaj klucz obcy',
'ON DELETE' => 'W przypadku usunięcia',
'ON UPDATE' => 'W przypadku zmiany',
'Index Type' => 'Typ indeksu',
'Column (length)' => 'Kolumna (długość)',
'View has been dropped.' => 'Perspektywa została usunięta.',
'View has been altered.' => 'Perspektywa została zmieniona.',
'View has been created.' => 'Perspektywa została utworzona.',
'Alter view' => 'Zmień perspektywę',
'Create view' => 'Utwórz perspektywę',
'Name' => 'Nazwa',
'Process list' => 'Lista procesów',
'%d process(es) have been killed.' => array('Wątek %d został unicestwiony.', 'Unicestwiono %d wątki.', 'Unicestwiono %d wątków.'),
'Kill' => 'Unicestwij',
'Parameter name' => 'Nazwa parametru',
'Database schema' => 'Schemat bazy danych',
// link to current database schema layout
'Permanent link' => 'Trwały link',
// thousands separator - must contain single byte
',' => ' ',
'Engine' => 'Składowanie',
'Collation' => 'Porównywanie znaków',
'Data Length' => 'Rozmiar danych',
'Index Length' => 'Rozmiar indeksów',
'Data Free' => 'Wolne miejsce',
'Rows' => 'Liczba rekordów',
'%d in total' => '%d w sumie',
'Analyze' => 'Analizuj',
'Optimize' => 'Optymalizuj',
'Check' => 'Sprawdź',
'Repair' => 'Napraw',
'Truncate' => 'Opróżnij',
'Tables have been truncated.' => 'Tabele zostały opróżnione.',
'Move to other database' => 'Przenieś do innej bazy danych',
'Move' => 'Przenieś',
'Tables have been moved.' => 'Tabele zostały przeniesione.',
'Copy' => 'Kopiuj',
'Tables have been copied.' => 'Tabele zostały skopiowane.',
'Routines' => 'Procedury i funkcje',
'Routine has been called, %d row(s) affected.' => array('Procedura została uruchomiona, zmieniono %d rekord.', 'Procedura została uruchomiona, zmieniono %d rekordy.', 'Procedura została uruchomiona, zmieniono %d rekordów.'),
'Call' => 'Uruchom',
'Parameter name' => 'Nazwa parametru',
'Create procedure' => 'Utwórz procedurę',
'Create function' => 'Utwórz funkcję',
'Routine has been dropped.' => 'Procedura została usunięta.',
@@ -118,7 +122,86 @@ $translations = array(
'Routine has been created.' => 'Procedura została utworzona.',
'Alter function' => 'Zmień funkcję',
'Alter procedure' => 'Zmień procedurę',
'Return type' => 'Typ zwracania',
'Return type' => 'Zwracany typ',
'Events' => 'Wydarzenia',
'Event has been dropped.' => 'Wydarzenie zostało usunięte.',
'Event has been altered.' => 'Wydarzenie zostało zmienione.',
'Event has been created.' => 'Wydarzenie zostało utworzone.',
'Alter event' => 'Zmień wydarzenie',
'Create event' => 'Utwórz wydarzenie',
'At given time' => 'O danym czasie',
'Every' => 'Wykonuj co',
'Schedule' => 'Harmonogram',
'Start' => 'Początek',
'End' => 'Koniec',
'On completion preserve' => 'Nie kasuj wydarzenia po przeterminowaniu',
'Tables' => 'Tabele',
'Tables and views' => 'Tabele i perspektywy',
'Table' => 'Tabela',
'No tables.' => 'Brak tabel.',
'Alter table' => 'Zmień tabelę',
'Create table' => 'Utwórz tabelę',
'Create new table' => 'Utwórz nową tabelę',
'Table has been dropped.' => 'Tabela została usunięta.',
'Tables have been dropped.' => 'Tabele zostały usunięte.',
'Table has been altered.' => 'Tabela została zmieniona.',
'Table has been created.' => 'Tabela została utworzona.',
'Table name' => 'Nazwa tabeli',
'Show structure' => 'Struktura tabeli',
'engine' => 'składowanie',
'collation' => 'porównywanie znaków',
'Column name' => 'Nazwa kolumny',
'Type' => 'Typ',
'Length' => 'Długość',
'Auto Increment' => 'Auto Increment',
'Options' => 'Opcje',
'Comment' => 'Komentarz',
'Default values' => 'Wartości domyślne',
'Drop' => 'Usuń',
'Are you sure?' => 'Czy jesteś pewien?',
'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.',
'Partition by' => 'Partycjonowanie',
'Partitions' => 'Partycje',
'Partition name' => 'Nazwa partycji',
'Values' => 'Wartości',
'View' => 'Perspektywa',
'View has been dropped.' => 'Perspektywa została usunięta.',
'View has been altered.' => 'Perspektywa została zmieniona.',
'View has been created.' => 'Perspektywa została utworzona.',
'Alter view' => 'Zmień perspektywę',
'Create view' => 'Utwórz perspektywę',
'Indexes' => 'Indeksy',
'Indexes have been altered.' => 'Indeksy zostały zmienione.',
'Alter indexes' => 'Zmień indeksy',
'Add next' => 'Dodaj następny',
'Index Type' => 'Typ indeksu',
'Column (length)' => 'Kolumna (długość)',
'Foreign keys' => 'Klucze obce',
'Foreign key' => 'Klucz obcy',
'Foreign key has been dropped.' => 'Klucz obcy został usunięty.',
'Foreign key has been altered.' => 'Klucz obcy został zmieniony.',
'Foreign key has been created.' => 'Klucz obcy został utworzony.',
'Target table' => 'Tabela docelowa',
'Change' => 'Zmień',
'Source' => 'Źródło',
'Target' => 'Cel',
'Add column' => 'Dodaj kolumnę',
'Alter' => 'Zmień',
'Add foreign key' => 'Dodaj klucz obcy',
'ON DELETE' => 'W przypadku usunięcia',
'ON UPDATE' => 'W przypadku zmiany',
'Source and target columns must have the same data type, there must be an index on the target columns and referenced data must exist.' => 'Źródłowa i docelowa kolumna muszą być tego samego typu, powinien istnieć indeks na docelowej kolumnie oraz muszą istnieć dane referencyjne.',
'Triggers' => 'Wyzwalacze',
'Add trigger' => 'Dodaj wyzwalacz',
'Trigger has been dropped.' => 'Wyzwalacz został usunięty.',
'Trigger has been altered.' => 'Wyzwalacz został zmieniony.',
@@ -127,134 +210,105 @@ $translations = array(
'Create trigger' => 'Utwórz wyzwalacz',
'Time' => 'Czas',
'Event' => 'Wydarzenie',
'%s version: %s through PHP extension %s' => 'Wersja %s: %s przez PHP rozszerzenie %s',
'%d row(s)' => array('%d linia', '%d linie ', '%d linii'),
'Remove' => 'Usunąć',
'Are you sure?' => 'Naprawdę?',
'Privileges' => 'Uprawnienia użytkowników',
'Create user' => 'Utwórz użytkownika',
'User has been dropped.' => 'Użytkownik został usunięty.',
'User has been altered.' => 'Użytkownik został zmieniony.',
'User has been created.' => 'Użytkownik został utworzony.',
'Hashed' => 'Hashed',
'Column' => 'Kolumna',
'Routine' => 'Procedura',
'Grant' => 'Udzielić',
'Revoke' => 'Odwołać',
'Too big POST data. Reduce the data or increase the %s configuration directive.' => 'Zbyt duże POST data. Zmiejszyj data albo podwyższ wartość w konfiguracji %s.',
'Logged as: %s' => 'Zalogowany jako: %s',
'Move up' => 'Przesuń w górę',
'Move down' => 'Przesuń w dół',
'Name' => 'Nazwa',
'select' => 'przeglądaj',
'Select' => 'pokaż',
'Select data' => 'Pokaż dane',
'Functions' => 'Funkcje',
'Aggregation' => 'Agregacje',
'Export' => 'Eksport',
'Output' => 'Wyjście',
'open' => 'otworzyć',
'save' => 'uchować',
'Format' => 'Format',
'Tables' => 'Tabele',
'Data' => 'Data',
'Event has been dropped.' => 'Wydarzenie zostało usunięte.',
'Event has been altered.' => 'Wydarzenie zostało zmienione.',
'Event has been created.' => 'Wydarzenie zostało utworzone.',
'Alter event' => 'Zmień wydarzenie',
'Create event' => 'Utwórz wydarzenie',
'At given time' => 'O danym czasie',
'Every' => 'Każdych',
'Events' => 'Wydarzenie',
'Schedule' => 'Harmonogram',
'Start' => 'Początek',
'End' => 'Koniec',
'Status' => 'Status',
'On completion preserve' => 'Po zakończeniu zachować',
'Tables and views' => 'Tabele a perspektywy',
'Data Length' => 'Długość danych',
'Index Length' => 'Długość indeksów',
'Data Free' => 'Wolne miejsce',
'Collation' => 'Porównywanie',
'Analyze' => 'Analizuj',
'Optimize' => 'Optymalizacja',
'Check' => 'Sprawdź',
'Repair' => 'Napraw',
'Truncate' => 'Wypróźnij',
'Tables have been truncated.' => 'Tabele zostały wypróźnione.',
'Rows' => 'Linie',
',' => ' ',
'Tables have been moved.' => 'Tabele zostały przesunięte',
'Move to other database' => 'Przesunąć do innej bazy danych',
'Move' => 'Przesunąć',
'Engine' => 'Engine',
'Save and continue edit' => 'Zapisz i kontynuuj edycję',
'original' => 'oryginalny',
'%d item(s) have been affected.' => array('Został dotknięty %d rekord.', 'Zostały dotknięte %d rekordy.', 'Zostało dotkniętych %d rekordów.'),
'whole result' => 'cały wynik',
'Tables have been dropped.' => 'Tabele zostały usunięte.',
'Clone' => 'Klonować',
'Partition by' => 'Rozdzielić przez',
'Partitions' => 'Rozdziały',
'Partition name' => 'Nazwa rozdziału',
'Values' => 'Wartości',
'%d row(s) have been imported.' => array('%d rekord został importowany.', '%d rekordy zostały importowane.', 'Zostało importowanych %d rekordów.'),
'Search' => 'Szukaj',
'anywhere' => 'gdziekolwiek',
'Search data in tables' => 'Wyszukaj we wszystkich tabelach',
'Sort' => 'Sortuj',
'descending' => 'malejąco',
'Limit' => 'Limit',
'Text length' => 'Długość tekstu',
'Action' => 'Czynność',
'Unable to select the table' => 'Nie udało się pobrać danych z tabeli',
'No rows.' => 'Brak rekordów.',
'%d row(s)' => array('%d rekord', '%d rekordy', '%d rekordów'),
'Page' => 'Strona',
'last' => 'ostatni',
'Last page' => 'Ostatnia strona',
'whole result' => 'wybierz wszystkie',
'%d byte(s)' => array('%d bajt', '%d bajty', '%d bajtów'),
'Import' => 'Import',
'Show structure' => 'Pokaż całą strukturę',
'Select data' => 'Pokaż dane',
'Stop on error' => 'Stop w przypadku błędu',
'Maximum number of allowed fields exceeded. Please increase %s and %s.' => 'Przekroczono maksymalną liczbę pól. Zwiększ %s i %s.',
'anywhere' => 'kdziekolwiek',
'%.3f s' => '%.3f s',
'$1-$3-$5' => '$6.$4.$1',
'[yyyy]-mm-dd' => 'd.m.[rrrr]',
'History' => 'Historia',
'Variables' => 'Zmienne',
'%d row(s) have been imported.' => array('%d rekord został zaimportowany.', '%d rekordy zostały zaimportowane.', '%d rekordów zostało zaimportowanych.'),
// in-place editing in select
'Double click on a value to modify it.' => 'Kliknij podwójnie wartość, aby ją edytować.',
'Use edit link to modify this value.' => 'Użyj linku edycji aby zmienić tę wartość.',
// %s can contain auto-increment value
'Item%s has been inserted.' => 'Rekord%s został dodany.',
'Item has been deleted.' => 'Rekord został usunięty.',
'Item has been updated.' => 'Rekord został zaktualizowany.',
'%d item(s) have been affected.' => array('Zmieniono %d rekord.', 'Zmieniono %d rekordy.', 'Zmieniono %d rekordów.'),
'New item' => 'Nowy rekord',
'original' => 'bez zmian',
// label for value '' in enum data type
'empty' => 'puste',
'edit' => 'edytuj',
'Edit' => 'Edytuj',
'Insert' => 'Dodaj',
'Save' => 'Zapisz zmiany',
'Save and continue edit' => 'Zapisz i kontynuuj edycję',
'Save and insert next' => 'Zapisz i dodaj następny',
'Clone' => 'Duplikuj',
'Delete' => 'Usuń',
'E-mail' => 'E-mail',
'From' => 'Nadawca',
'Subject' => 'Temat',
'Send' => 'Wyślij',
'%d e-mail(s) have been sent.' => array('Został wysłany %d e-mail.', 'Zostały wysłane %d e-maile.', 'Zostało wysłanych %d e-mailów.'),
'Run file' => 'Uruchomić plik',
'Numbers' => 'Numery',
'Date and time' => 'Datum i czas',
'Strings' => 'Typu string',
'Binary' => 'Binarny',
'Lists' => 'Listy',
'Relations' => 'Relacje',
'Maximum allowed file size is %sB.' => 'Maksymalna wielkość pliku to %sB.',
'Clear' => 'Wyczyścić',
'Editor' => 'Edytor',
'Webserver file %s' => 'Plik %s na serweru',
'File does not exist.' => 'Plik nieistnieje.',
'Permanent login' => 'Logowanie stałe',
'%d in total' => '%d w sumie',
'Attachments' => 'Załączniki',
'System' => 'System',
'last' => 'ostatni',
'Send' => 'Wyślij',
'%d e-mail(s) have been sent.' => array('Wysłano %d e-mail.', 'Wysłano %d e-maile.', 'Wysłano %d e-maili.'),
// data type descriptions
'Numbers' => 'Numeryczne',
'Date and time' => 'Data i czas',
'Strings' => 'Tekstowe',
'Binary' => 'Binarne',
'Lists' => 'Listy',
'Network' => 'Sieć',
'Geometry' => 'Geometria',
'Databases have been dropped.' => 'Baze danych zostały usunięte.',
'File exists.' => 'Plik istnieje.',
'Double click on a value to modify it.' => 'Kliknij podwójnie by zmienić wartość.',
'Increase text length to modify this value.' => 'Aby zmienić wartość to potrzeba powiększyć długość tekstu.',
'Use edit link to modify this value.' => 'Użyj linku zmienić by poprawić wartość.',
'Alter schema' => 'Zmienić schemat',
'Relations' => 'Relacje',
'Editor' => 'Edytor',
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
'$1-$3-$5' => '$6.$4.$1',
// hint for date format - use language equivalents for day, month and year shortcuts
'[yyyy]-mm-dd' => 'd.m.[rrrr]',
'now' => 'teraz',
// general SQLite error in create, drop or rename database
'File exists.' => 'Plik już istnieje.',
'Please use one of the extensions %s.' => 'Proszę użyć jednego z rozszerzeń: %s.',
// PostgreSQL and MS SQL schema support
'Alter schema' => 'Zmień schemat',
'Create schema' => 'Utwórz schemat',
'Schema has been dropped.' => 'Schemat został usunięty.',
'Schema has been created.' => 'Schemat został utworzony.',
'Schema has been altered.' => 'Schemat został zmieniony.',
'schema' => 'schemat',
'Schema' => 'Schemat',
'Invalid schema.' => 'Nieprawidłowy schemat.',
// PostgreSQL sequences support
'Sequences' => 'Sekwencje',
'Create sequence' => 'Utwórz sekwencję',
'Sequence has been dropped.' => 'Sekwencja została usunięta.',
'Sequence has been created.' => 'Sekwencja została utworzona.',
'Sequence has been altered.' => 'Sekwencja została zmieniona.',
'Alter sequence' => 'Zmień sekwencję',
'User types' => 'Typy definiowane użytkownikiem',
'Create type' => 'Utwórz definiowany typ',
// PostgreSQL user types support
'User types' => 'Typy użytkownika',
'Create type' => 'Utwórz typ',
'Type has been dropped.' => 'Typ został usunięty.',
'Type has been created.' => 'Typ został utworzony.',
'Alter type' => 'Zmień typ',
'Search data in tables' => 'Wyszukaj data w tabelach',
'From server' => 'Ze serweru',
'empty' => 'puste',
'now' => 'teraz',
);

View File

@@ -8,24 +8,26 @@ function adminer_object() {
include_once $filename;
}
$plugins = array(
// specify enabled plugins here
new AdminerDumpZip,
new AdminerDumpXml,
//~ 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 AdminerFileUpload(""),
new AdminerSlugify,
new AdminerTranslation,
new AdminerForeignSystem,
new AdminerEnumOption,
);
/* It is possible to combine customization and plugins:
class AdminerCustomization extends AdminerPlugin {
}
return new AdminerCustomization($plugins);
*/
return new AdminerPlugin(array(
// specify enabled plugins here
new AdminerDumpZip,
new AdminerDumpXml,
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 AdminerFileUpload(""),
new AdminerSlugify,
new AdminerTranslation,
new AdminerForeignSystem,
new AdminerEnumOption,
));
return new AdminerPlugin($plugins);
}
// include original Adminer or Adminer Editor (usually named adminer.php)

View File

@@ -14,7 +14,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"]
}
$dropped = drop_create(
"DROP $routine " . idf_escape($PROCEDURE),
"CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . "\n$_POST[definition]",
"CREATE $routine " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . rtrim("\n$_POST[definition]", ";") . ";",
substr(ME, 0, -1),
lang('Routine has been dropped.'),
lang('Routine has been altered.'),
@@ -51,8 +51,8 @@ if (isset($_GET["function"])) {
</table>
<p><?php textarea("definition", $row["definition"]); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<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

@@ -30,6 +30,6 @@ foreach (get_rows("SHOW FULL PROCESSLIST") as $i => $row) {
</table>
<p><?php echo ($i + 1) . "/" . lang('%d in total', $connection->result("SELECT @@max_connections")); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Kill'); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -5,7 +5,8 @@ $table_pos = array();
$table_pos_js = array();
// saved in one cookie because there is a limit of 20 cookies per domain
$name = "adminer_schema";
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', ($_GET["schema"] ? $_GET["schema"] : $_COOKIE[($_COOKIE["$name-" . DB] ? "$name-" . DB : $name)]), $matches, PREG_SET_ORDER); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
$SCHEMA = ($_GET["schema"] ? $_GET["schema"] : $_COOKIE[($_COOKIE["$name-" . DB] ? "$name-" . DB : $name)]); // $_COOKIE["adminer_schema"] was used before 3.2.0 //! ':' in table name
preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~', $SCHEMA, $matches, PREG_SET_ORDER);
foreach ($matches as $i => $match) {
$table_pos[$match[1]] = array($match[2], $match[3]);
$table_pos_js[] = "\n\t'" . js_escape($match[1]) . "': [ $match[2], $match[3] ]";
@@ -103,4 +104,4 @@ foreach ($schema as $name => $table) {
}
?>
</div>
<p><a href="<?php echo h($_SERVER["REQUEST_URI"]); ?>" id="schema-link">#</a>
<p><a href="<?php echo h(ME . "schema=" . urlencode($SCHEMA)); ?>" id="schema-link"><?php echo lang('Permanent link'); ?></a>

View File

@@ -25,11 +25,11 @@ if ($_POST) {
<form action="" method="post">
<p><input name="name" value="<?php echo h($row["name"]); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if ($_GET["ns"] != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -141,7 +141,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))) {
$file = preg_replace("~^\xEF\xBB\xBF~", '', $file); //! character set
//! character set
$result = true;
$cols = array_keys($fields);
preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches);
@@ -349,7 +349,7 @@ if (!$columns) {
$editable = is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key];
$text = ereg('text|lob', $field["type"]);
echo (($_GET["modify"] && $editable) || isset($value)
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "' onkeypress='return textareaKeypress(this, event);'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
: "<td id='$id' ondblclick=\"" . ($editable ? "selectDblClick(this, event" . ($long ? ", 2" : ($text ? ", 1" : "")) . ")" : "alert('" . h(lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
);
}
@@ -369,9 +369,9 @@ if (!$columns) {
$exact_count = true;
if ($_GET["page"] != "last" && +$limit && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
$found_rows = $table_status["Rows"];
if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) {
if (!isset($found_rows) || $where || ($table_status["Engine"] == "InnoDB" && $found_rows < max(1e4, 2 * ($page + 1) * $limit))) {
// slow with big tables
ob_flush();
ob_flush(); //! doesn't work with AJAX
flush();
$found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
} else {
@@ -394,7 +394,7 @@ if (!$columns) {
if (!information_schema(DB)) {
?>
<fieldset><legend><?php echo lang('Edit'); ?></legend><div>
<input type="submit" id="save" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>">
<input type="submit" value="<?php echo lang('Save'); ?>" title="<?php echo lang('Double click on a value to modify it.'); ?>" class="jsonly">
<input type="submit" name="edit" value="<?php echo lang('Edit'); ?>">
<input type="submit" name="clone" value="<?php echo lang('Clone'); ?>">
<input type="submit" name="delete" value="<?php echo lang('Delete'); ?>" onclick="return confirm('<?php echo lang('Are you sure?'); ?> (' + (this.form['all'].checked ? <?php echo $found_rows; ?> : formChecked(this, /check/)) + ')');">
@@ -409,9 +409,10 @@ if (!$columns) {
echo "</div></fieldset>\n";
}
print_fieldset("import", lang('Import'), !$rows);
echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> ";
echo "<input type='file' name='csv_file'> ";
echo html_select("separator", array("csv" => "CSV,", "csv;" => "CSV;", "tsv" => "TSV"), $adminer_export["format"], 1); // 1 - select
echo " <input type='submit' name='import' value='" . lang('Import') . "'>\n";
echo " <input type='submit' name='import' value='" . lang('Import') . "'>";
echo "<input type='hidden' name='token' value='$token'>\n";
echo "</div></fieldset>\n";
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);

View File

@@ -24,11 +24,11 @@ if ($_POST) {
<form action="" method="post">
<p><input name="name" value="<?php echo h($row["name"]); ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
if ($SEQUENCE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -32,10 +32,13 @@ if (!$error && $_POST) {
if (function_exists('memory_get_usage')) {
@ini_set("memory_limit", 2 * strlen($query) + memory_get_usage() + 8e6); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables
}
if ($query != "" && strlen($query) < 1e6 && (!$history || end($history) != $query)) { // don't add repeated and big queries
$history[] = $query;
if ($query != "" && strlen($query) < 1e6) { // don't add big queries
$q = $query . (ereg(';$', $query) ? "" : ";"); //! doesn't work with DELIMITER |
if (!$history || end($history) != $q) { // no repeated queries
$history[] = $q;
}
}
$space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";
if (!ini_bool("session.use_cookies")) {
session_write_close();
}
@@ -54,7 +57,7 @@ if (!$error && $_POST) {
$dump_format = $adminer->dumpFormat();
unset($dump_format["sql"]);
while ($query != "") {
if (!$offset && $jush == "sql" && preg_match('~^\\s*DELIMITER\\s+(.+)~i', $query, $match)) {
if (!$offset && $jush == "sql" && preg_match("~^$space*DELIMITER\\s+(.+)~i", $query, $match)) {
$delimiter = $match[1];
$query = substr($query, strlen($match[0]));
} else {
@@ -90,7 +93,7 @@ if (!$error && $_POST) {
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5
//! don't allow changing of character_set_results, convert encoding of displayed query
if ($connection->multi_query($q)) {
if (is_object($connection2) && preg_match("~^$space*(USE)\\b~isU", $q)) {
if (is_object($connection2) && preg_match("~^$space*USE\\b~isU", $q)) {
$connection2->query($q);
}
do {
@@ -107,31 +110,28 @@ if (!$error && $_POST) {
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
}
} else {
if ($_POST["only_errors"]) {
echo $print;
$print = "";
}
select($result, $connection2);
echo "<form action='' method='post'>\n";
echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time;
$id = "export-$commands";
$export = ", <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('Export') . "</a><span id='$id' class='hidden'>: "
. html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " "
. html_select("format", $dump_format, $adminer_export["format"])
. " <input type='hidden' name='query' value='" . h($q) . "' />"
. " <input type='hidden' name='token' value='$token' />"
. " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'></span>"
;
if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) {
$id = "explain-$commands";
echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>$export\n";
echo "<div id='$id' class='hidden'>\n";
select($explain, $connection2, ($jush == "sql" ? "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/explain-output.html#" : ""));
echo "</div>\n";
} else {
echo "$export\n";
if (!$_POST["only_errors"]) {
echo "<form action='' method='post'>\n";
echo "<p>" . ($result->num_rows ? lang('%d row(s)', $result->num_rows) : "") . $time;
$id = "export-$commands";
$export = ", <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('Export') . "</a><span id='$id' class='hidden'>: "
. html_select("output", $adminer->dumpOutput(), $adminer_export["output"]) . " "
. html_select("format", $dump_format, $adminer_export["format"])
. "<input type='hidden' name='query' value='" . h($q) . "'>"
. " <input type='submit' name='export' value='" . lang('Export') . "' onclick='eventStop(event);'><input type='hidden' name='token' value='$token'></span>"
;
if ($connection2 && preg_match("~^($space|\\()*SELECT\\b~isU", $q) && ($explain = explain($connection2, $q))) {
$id = "explain-$commands";
echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>$export\n";
echo "<div id='$id' class='hidden'>\n";
select($explain, $connection2, ($jush == "sql" ? "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/explain-output.html#" : ""));
echo "</div>\n";
} else {
echo "$export\n";
}
echo "</form>\n";
}
echo "</form>\n";
}
$start = $end;
} while ($connection->next_result());
@@ -175,12 +175,15 @@ if ($_POST) {
}
textarea("query", $q, 20);
echo ($_POST ? "" : "<script type='text/javascript'>document.getElementsByTagName('textarea')[0].focus();</script>\n");
echo "<p>" . (ini_bool("file_uploads") ? lang('File upload') . ': <input type="file" name="sql_file"> (&lt; ' . ini_get("upload_max_filesize") . 'B)' : lang('File uploads are disabled.')); // ignore post_max_size because it is for all form fields together and bytes computing would be necessary
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 uploads are disabled.')
);
?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<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";
@@ -203,7 +206,7 @@ if ($history) {
echo '<a href="' . h(ME . "sql=&history=$key") . '">' . lang('Edit') . "</a> <code class='jush-$jush'>" . shorten_utf8(ltrim(str_replace("\n", " ", str_replace("\r", "", preg_replace('~^(#|-- ).*~m', '', $val)))), 80, "</code>") . "<br>\n";
}
echo "<input type='submit' name='clear' value='" . lang('Clear') . "'>\n";
echo "<a href='" . h(ME . "sql=&history=all") . "'>" . lang('Edit') . "</a>\n";
echo "<a href='" . h(ME . "sql=&history=all") . "'>" . lang('Edit all') . "</a>\n";
echo "</div></fieldset>\n";
}
?>

View File

@@ -20,7 +20,7 @@ code { background: #eee; }
tr:hover td, tr:hover th { background: #ddf; }
pre { margin: 1em 0 0; }
.version { color: #777; font-size: 67%; }
.js .hidden { display: none; }
.js .hidden, .nojs .jsonly { display: none; }
.nowrap td, .nowrap th, td.nowrap { white-space: pre; }
.wrap td { white-space: normal; }
.error { color: red; background: #fee; }
@@ -39,11 +39,13 @@ pre { margin: 1em 0 0; }
.type { width: 15ex; width: auto\9; }
.options select { width: 20ex; width: auto\9; }
.active { font-weight: bold; }
.sqlarea { width: 98%; }
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; }
#menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }
#content { margin: 2em 0 0 21em; padding: 10px 20px 20px 0; }
#lang { position: absolute; top: 0; left: 0; line-height: 1.8em; padding: .3em 1em; }
#breadcrumb { white-space: nowrap; position: absolute; top: 0; left: 21em; background: #eee; height: 2em; line-height: 1.8em; padding: 0 1em; margin: 0 0 0 -18px; }
#loader { position: fixed; top: 0; left: 18em; z-index: 1; }
#h1 { color: #777; text-decoration: none; font-style: italic; }
#version { font-size: 67%; color: red; }
#schema { margin-left: 60px; position: relative; }

View File

@@ -1,35 +1,38 @@
// Adminer specific functions
var jushRoot = '../externals/jush/'; // global variable to allow simple customization
/** Load syntax highlighting
* @param string first three characters of database system version
*/
function bodyLoad(version) {
var jushRoot = '../externals/jush/';
var script = document.createElement('script');
script.src = jushRoot + 'jush.js';
script.onload = function () {
if (window.jush) { // IE runs in case of an error too
jush.create_links = ' target="_blank" rel="noreferrer"';
jush.urls.sql[0] = 'http://dev.mysql.com/doc/refman/' + version + '/en/$key';
jush.urls.sql_sqlset = jush.urls.sql[0];
jush.urls.sqlset[0] = jush.urls.sql[0];
jush.urls.sqlstatus[0] = jush.urls.sql[0];
jush.urls.pgsql[0] = 'http://www.postgresql.org/docs/' + version + '/static/$key';
jush.urls.pgsql_pgsqlset = jush.urls.pgsql[0];
jush.urls.pgsqlset[0] = 'http://www.postgresql.org/docs/' + version + '/static/runtime-config-$key.html#GUC-$1';
jush.style(jushRoot + 'jush.css');
if (window.jushLinks) {
jush.custom_links = jushLinks;
if (history.state !== undefined) { // copied from editor/static/editing.js
onpopstate(history);
}
if (jushRoot) {
var script = document.createElement('script');
script.src = jushRoot + 'jush.js';
script.onload = function () {
if (window.jush) { // IE runs in case of an error too
jush.create_links = ' target="_blank" rel="noreferrer"';
jush.urls.sql_sqlset = jush.urls.sql[0] = jush.urls.sqlset[0] = jush.urls.sqlstatus[0] = 'http://dev.mysql.com/doc/refman/' + version + '/en/$key';
var pgsql = 'http://www.postgresql.org/docs/' + version + '/static/';
jush.urls.pgsql_pgsqlset = jush.urls.pgsql[0] = pgsql + '$key';
jush.urls.pgsqlset[0] = pgsql + 'runtime-config-$key.html#GUC-$1';
jush.style(jushRoot + 'jush.css');
if (window.jushLinks) {
jush.custom_links = jushLinks;
}
jush.highlight_tag('code', 0);
}
jush.highlight_tag('code', 0);
}
};
script.onreadystatechange = function () {
if (/^(loaded|complete)$/.test(script.readyState)) {
script.onload();
}
};
document.body.appendChild(script);
};
script.onreadystatechange = function () {
if (/^(loaded|complete)$/.test(script.readyState)) {
script.onload();
}
};
document.body.appendChild(script);
}
}
/** Get value of dynamically created form field
@@ -68,12 +71,14 @@ function loginDriver(driver) {
var added = '.', rowCount;
/** Escape string to use in regular expression
/** Check if val is equal to a-delimiter-b where delimiter is '_', '' or big letter
* @param string
* @return string
* @param string
* @param string
* @return boolean
*/
function reEscape(s) {
return s.replace(/[\[\]\\^$*+?.(){|}]/, '\\$&');
function delimiterEqual(val, a, b) {
return (val == a + '_' + b || val == a + b || val == a + b.charAt(0).toUpperCase() + b.substr(1));
}
/** Escape string to use as identifier
@@ -91,33 +96,28 @@ function editingNameChange(field) {
var name = field.name.substr(0, field.name.length - 7);
var type = formField(field.form, name + '[type]');
var opts = type.options;
var table = reEscape(field.value);
var column = '';
var match;
if ((match = /(.+)_(.+)/.exec(table)) || (match = /(.*[a-z])([A-Z].*)/.exec(table))) { // limited to single word columns
table = match[1];
column = match[2];
}
var plural = '(?:e?s)?';
var tabCol = table + plural + '_?' + column;
var re = new RegExp('(^' + idfEscape(table + plural) + '`' + idfEscape(column) + '$' // table_column
+ '|^' + idfEscape(tabCol) + '`' // table
+ '|^' + idfEscape(column + plural) + '`' + idfEscape(table) + '$' // column_table
+ ')|`' + idfEscape(tabCol) + '$' // column
, 'i');
var candidate; // don't select anything with ambiguous match (like column `id`)
var val = field.value;
for (var i = opts.length; i--; ) {
if (!/`/.test(opts[i].value)) { // common type
if (i == opts.length - 2 && candidate && !match[1] && name == 'fields[1]') { // single target table, link to column, first field - probably `id`
return false;
var match = /(.+)`(.+)/.exec(opts[i].value);
if (!match) { // common type
if (candidate && i == opts.length - 2 && val == opts[candidate].value.replace(/.+`/, '') && name == 'fields[1]') { // single target table, link to column, first field - probably `id`
return;
}
break;
}
if (match = re.exec(opts[i].value)) {
if (candidate) {
return false;
var table = match[1];
var column = match[2];
var tables = [ table, table.replace(/s$/, ''), table.replace(/es$/, '') ];
for (var j=0; j < tables.length; j++) {
table = tables[j];
if (val == column || val == table || delimiterEqual(val, table, column) || delimiterEqual(val, column, table)) {
if (candidate) {
return;
}
candidate = i;
break;
}
candidate = i;
}
}
if (candidate) {

View File

@@ -1,5 +1,3 @@
// to hide elements displayed by JavaScript
document.body.className += ' js';
/** Toggle visibility
* @param string
@@ -36,7 +34,8 @@ function verifyVersion() {
* @return string
*/
function selectValue(select) {
return (select.value !== undefined ? select.value : select.options[select.selectedIndex].text);
var selected = select.options[select.selectedIndex];
return ((selected.attributes.value || {}).specified ? selected.value : selected.text);
}
/** Check all elements matching given name
@@ -126,7 +125,7 @@ function nodePosition(el) {
function pageClick(href, page, event) {
if (!isNaN(page) && page) {
href += (page != 1 ? '&page=' + (page - 1) : '');
if (!ajaxMain(href, '', event)) {
if (!ajaxSend(href)) {
location.href = href;
}
}
@@ -156,35 +155,54 @@ function selectAddRow(field) {
/** Handle Ctrl+Enter and optionally Tab in textarea
/** Handle Tab and Esc in textarea
* @param HTMLTextAreaElement
* @param KeyboardEvent
* @param boolean handle also Tab
* @param HTMLInputElement submit button
* @return boolean
*/
function textareaKeypress(target, event, tab, button) {
if (tab && event.keyCode == 9 && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
// inspired by http://pallieter.org/Projects/insertTab/
if (target.setSelectionRange) {
var start = target.selectionStart;
target.value = target.value.substr(0, start) + '\t' + target.value.substr(target.selectionEnd);
target.setSelectionRange(start + 1, start + 1);
return false; //! still loses focus in Opera, can be solved by handling onblur
} else if (target.createTextRange) {
document.selection.createRange().text = '\t';
function textareaKeydown(target, event) {
if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
if (event.keyCode == 9) { // 9 - Tab
// inspired by http://pallieter.org/Projects/insertTab/
if (target.setSelectionRange) {
var start = target.selectionStart;
var scrolled = target.scrollTop;
target.value = target.value.substr(0, start) + '\t' + target.value.substr(target.selectionEnd);
target.setSelectionRange(start + 1, start + 1);
target.scrollTop = scrolled;
return false; //! still loses focus in Opera, can be solved by handling onblur
} else if (target.createTextRange) {
document.selection.createRange().text = '\t';
return false;
}
}
if (event.keyCode == 27) { // 27 - Esc
var els = target.form.elements;
for (var i=1; i < els.length; i++) {
if (els[i-1] == target) {
els[i].focus();
break;
}
}
return false;
}
}
if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey) { // shiftKey allowed
return true;
}
/** Send form by Enter on <select>
* @param KeyboardEvent
* @return boolean
*/
function bodyKeydown(event) {
var target = event.target || event.srcElement;
if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey && /select|textarea/i.test(target.tagName)) { // 13|10 - Enter, shiftKey allowed
target.blur();
if (button) {
button.click();
} else if (!target.form.onsubmit || target.form.onsubmit() !== false) {
if ((!target.form.onsubmit || target.form.onsubmit() !== false) && !ajaxForm(target.form)) {
target.form.submit();
}
return false;
}
return true;
}
@@ -194,7 +212,7 @@ function textareaKeypress(target, event, tab, button) {
* @return boolean
*/
function editingKeydown(event) {
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // shiftKey allowed
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // 40 - Down, 38 - Up, shiftKey allowed
var target = event.target || event.srcElement;
var sibling = (event.keyCode == 40 ? 'nextSibling' : 'previousSibling');
var el = target.parentNode.parentNode[sibling];
@@ -206,11 +224,26 @@ function editingKeydown(event) {
return true;
}
/** Disable maxlength for functions
* @param HTMLSelectElement
*/
function functionChange(select) {
var input = select.form[select.name.replace(/^function/, 'fields')];
if (selectValue(select)) {
if (input.origMaxLength === undefined) {
input.origMaxLength = input.maxLength;
}
input.removeAttribute('maxlength');
} else if (input.origMaxLength >= 0) {
input.maxLength = input.origMaxLength;
}
}
/** Create AJAX request
* @param string
* @param function (text)
* @param function (XMLHttpRequest)
* @param [string]
* @return XMLHttpRequest or false in case of an error
*/
@@ -224,18 +257,7 @@ function ajax(url, callback, data) {
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
var redirect = xmlhttp.getResponseHeader('X-AJAX-Redirect');
if (redirect) {
if (history.replaceState) {
history.replaceState(null, '', redirect);
}
return ajaxSend(redirect);
}
var title = xmlhttp.getResponseHeader('X-AJAX-Title');
if (title) {
document.title = decodeURIComponent(title);
}
callback(xmlhttp.responseText);
callback(xmlhttp);
}
};
xmlhttp.send(data);
@@ -248,85 +270,105 @@ function ajax(url, callback, data) {
* @return XMLHttpRequest or false in case of an error
*/
function ajaxSetHtml(url) {
return ajax(url, function (text) {
var data = eval('(' + text + ')');
for (var key in data) {
setHtml(key, data[key]);
return ajax(url, function (xmlhttp) {
if (xmlhttp.status) {
var data = eval('(' + xmlhttp.responseText + ')');
for (var key in data) {
setHtml(key, data[key]);
}
}
});
}
var ajaxState = 0, ajaxTimeout;
/** Replace favicon
* @param string
*/
function replaceFavicon(href) {
var favicon = document.getElementById('favicon');
favicon.href = href;
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
}
var ajaxState = 0;
/** Safely load content to #content
* @param string
* @param [string]
* @param [boolean]
* @return XMLHttpRequest or false in case of an error
*/
function ajaxSend(url, data) {
function ajaxSend(url, data, popState) {
if (!history.pushState) {
return false;
}
var currentState = ++ajaxState;
clearTimeout(ajaxTimeout);
ajaxTimeout = setTimeout(function () {
scrollTo(0, 0);
setHtml('content', '<img src="../adminer/static/loader.gif" alt="">');
}, 500); // defer displaying loader
return ajax(url, function (text) {
onblur = function () {
replaceFavicon('../adminer/static/loader.gif');
};
setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
return ajax(url, function (xmlhttp) {
if (currentState == ajaxState) {
clearTimeout(ajaxTimeout);
scrollTo(0, 0);
setHtml('content', text);
var content = document.getElementById('content');
var scripts = content.getElementsByTagName('script');
var length = scripts.length; // required to avoid infinite loop
for (var i=0; i < length; i++) {
var script = document.createElement('script');
script.text = scripts[i].text;
content.appendChild(script);
var title = xmlhttp.getResponseHeader('X-AJAX-Title');
if (title) {
document.title = decodeURIComponent(title);
}
var as = document.getElementById('menu').getElementsByTagName('a');
var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1');
for (var i=0; i < as.length; i++) {
if (href == as[i].href) {
as[i].className = 'active';
} else if (as[i].className == 'active') {
as[i].className = '';
var redirect = xmlhttp.getResponseHeader('X-AJAX-Redirect');
if (redirect) {
return ajaxSend(redirect, '', popState);
}
onblur = function () { };
replaceFavicon('../adminer/static/favicon.ico');
if (!xmlhttp.status) {
setHtml('loader', '');
} else {
if (!popState) {
if (data || url != location.href) {
history.pushState(data, '', url);
}
scrollTo(0, 0);
}
setHtml('content', xmlhttp.responseText);
var content = document.getElementById('content');
var scripts = content.getElementsByTagName('script');
var length = scripts.length; // required to avoid infinite loop
for (var i=0; i < length; i++) {
var script = document.createElement('script');
script.text = scripts[i].text;
content.appendChild(script);
}
var as = document.getElementById('menu').getElementsByTagName('a');
var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1');
for (var i=0; i < as.length; i++) {
if (href == as[i].href) {
as[i].className = 'active';
} else if (as[i].className == 'active') {
as[i].className = '';
}
}
var dump = document.getElementById('dump');
if (dump) {
var match = /&(select|table)=([^&]+)/.exec(href);
dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : '');
}
//! modify Change database hidden fields
if (window.jush) {
jush.highlight_tag('code', 0);
}
}
var dump = document.getElementById('dump');
if (dump) {
var match = /&(select|table)=([^&]+)/.exec(href);
dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : '');
}
//! modify Change database hidden fields
if (window.jush) {
jush.highlight_tag('code', 0);
}
}
}, data);
}
/** Load content to #content
* @param string
* @param [string]
* @param [MouseEvent]
* @return XMLHttpRequest or false in case of an error
*/
function ajaxMain(url, data, event) {
if (!history.pushState || (event && (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey))) {
return false;
}
history.pushState(data, '', url);
return ajaxSend(url, data);
}
/** Revive page from history
* @param PopStateEvent
* @param PopStateEvent|history
*/
window.onpopstate = function (event) {
onpopstate = function (event) {
if (ajaxState || event.state) {
ajaxSend(location.href, event.state);
ajaxSend(location.href, (event.state && confirm(areYouSure) ? event.state : ''), 1); // 1 - disable pushState
} else {
ajaxState++;
}
}
@@ -336,6 +378,9 @@ window.onpopstate = function (event) {
* @return XMLHttpRequest or false in case of an error
*/
function ajaxForm(form, data) {
if (/&(database|scheme|create|view|sql|user|dump|call)=/.test(location.href) && !/\./.test(data)) { // . - type="image"
return false;
}
var params = [ ];
for (var i=0; i < form.elements.length; i++) {
var el = form.elements[i];
@@ -349,9 +394,9 @@ function ajaxForm(form, data) {
params.push(data);
}
if (form.method == 'post') {
return ajaxMain((/\?/.test(form.action) ? form.action : location.href), params.join('&')); // ? - always part of Adminer URL
return ajaxSend((/\?/.test(form.action) ? form.action : location.href), params.join('&')); // ? - always part of Adminer URL
}
return ajaxMain((form.action || location.pathname) + '?' + params.join('&'));
return ajaxSend((form.action || location.href).replace(/\?.*/, '') + '?' + params.join('&'));
}
@@ -365,9 +410,6 @@ function selectDblClick(td, event, text) {
td.ondblclick = function () { };
var pos = event.rangeOffset;
var value = (td.firstChild.alt ? td.firstChild.alt : (td.textContent ? td.textContent : td.innerText));
if (value == '\u00A0' || td.getElementsByTagName('i').length) { // &nbsp; or i - NULL
value = '';
}
var input = document.createElement(text ? 'textarea' : 'input');
input.style.width = Math.max(td.clientWidth - 14, 20) + 'px'; // 14 = 2 * (td.border + td.padding + input.border)
if (text) {
@@ -376,9 +418,9 @@ function selectDblClick(td, event, text) {
rows++;
});
input.rows = rows;
input.onkeypress = function (event) {
return textareaKeypress(input, event || window.event, false, document.getElementById('save'));
};
}
if (value == '\u00A0' || td.getElementsByTagName('i').length) { // &nbsp; or i - NULL
value = '';
}
if (document.selection) {
var range = document.selection.createRange();
@@ -392,9 +434,11 @@ function selectDblClick(td, event, text) {
td.appendChild(input);
input.focus();
if (text == 2) { // long text
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (text) {
input.value = text;
input.name = td.id;
return ajax(location.href + '&' + encodeURIComponent(td.id) + '=', function (xmlhttp) {
if (xmlhttp.status) {
input.value = xmlhttp.responseText;
input.name = td.id;
}
});
}
input.value = value;
@@ -417,7 +461,7 @@ function selectDblClick(td, event, text) {
* @return bool
*/
function bodyClick(event, db, ns) {
if (event.button) {
if (event.button || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) {
return;
}
if (event.getPreventDefault ? event.getPreventDefault() : event.returnValue === false) {
@@ -427,12 +471,12 @@ function bodyClick(event, db, ns) {
if (/^a$/i.test(el.parentNode.tagName)) {
el = el.parentNode;
}
if (/^a$/i.test(el.tagName) && !/^https?:|#|&download=/i.test(el.getAttribute('href')) && /[&?]username=/.exec(el.href)) {
if (/^a$/i.test(el.tagName) && !/^:|#|&download=/i.test(el.getAttribute('href')) && /[&?]username=/.test(el.href)) {
var match = /&db=([^&]*)/.exec(el.href);
var match2 = /&ns=([^&]*)/.exec(el.href);
return !(db == (match ? match[1] : '') && ns == (match2 ? match2[1] : '') && ajaxMain(el.href, '', event));
return !(db == (match ? match[1] : '') && ns == (match2 ? match2[1] : '') && ajaxSend(el.href));
}
if (/^input$/i.test(el.tagName) && (el.type == 'image' || (el.type == 'submit' && !/&(database|scheme|create|view|sql|user|dump|call)=/.test(location.href)))) {
if (/^input$/i.test(el.tagName) && /image|submit/.test(el.type)) {
return !ajaxForm(el.form, (el.name ? encodeURIComponent(el.name) + (el.type == 'image' ? '.x' : '') + '=1' : ''));
}
return true;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

@@ -9,7 +9,7 @@ if ($_POST && !$error && in_array($_POST["Timing"], $trigger_options["Timing"])
$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) . " $_POST[Type]\n$_POST[Statement]",
"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.'),
@@ -37,8 +37,8 @@ if ($_POST) {
<p><?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
<p><?php textarea("Statement", $row["Statement"]); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
<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 } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -20,7 +20,6 @@ if ($_POST) {
<form action="" method="post">
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php
if ($TYPE != "") {
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
@@ -30,4 +29,5 @@ if ($TYPE != "") {
echo "<p><input type='submit' value='" . lang('Save') . "'>\n";
}
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>

View File

@@ -162,7 +162,7 @@ foreach (array(
echo "</table>\n";
?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if (isset($_GET["host"])) { ?><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

@@ -28,7 +28,8 @@ if ($_POST) {
<p><?php echo lang('Name'); ?>: <input name="name" value="<?php echo h($row["name"]); ?>" maxlength="64">
<p><?php textarea("select", $row["select"]); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?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; ?>">
</form>

View File

@@ -1,3 +1,27 @@
Adminer 3.2.2 (released 2011-03-28):
Fix AJAX history after reload
Adminer 3.2.1 (released 2011-03-23):
Ability to save expression in edit
Respect default database collation (bug #3191489)
Don't export triggers without table (bug #3193489)
Esc to focus next field in Tab textarea (thanks to David Grudl)
Send forms by Ctrl+Enter on <select>
Enum editor and textarea Ctrl+Enter working in IE
AJAX forms in Google Chrome
Parse UTF-16 and UTF-8 BOM in all text uploads
Display ; in history (thanks to Jan Cerny)
Use DELIMITER in history
Show databases even with skip_show_database in MySQL 5 (thanks to Radoslaw Kowalewski)
Disable maxlength with functions in edit
Better placement of AJAX icon
Table header in CSV export (Editor)
Time format hint (Editor)
Respect order after search (Editor)
Set MySQL time zone by PHP setting (Editor)
Allow own code in <head> (customization)
Polish translation
Adminer 3.2.0 (released 2011-02-24):
Get long texts and slow information by AJAX
Most links and forms by AJAX in browsers with support for history.pushState

View File

@@ -262,6 +262,7 @@ foreach (array("adminer", "editor") as $project) {
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
$file = preg_replace("~'\\.\\./adminer/static/(loader\\.gif|favicon\\.ico)~", "location.pathname+'?file=\\1&amp;version=$VERSION", $file);
$file = preg_replace('~\\.\\./adminer/static/(loader\\.gif)~', "'+location.pathname+'?file=\\1&amp;version=$VERSION", $file);
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);

View File

@@ -13,7 +13,7 @@ if ($adminer->homepage()) {
$name = $adminer->tableName($row);
if (isset($row["Engine"]) && $name != "") {
echo '<tr' . odd() . '><td>' . checkbox("tables[]", $table, in_array($table, (array) $_POST["tables"], true), "", "formUncheck('check-all');");
echo '<th><a href="' . h(ME) . 'select=' . urlencode($table) . '">' . h($name) . '</a>';
echo "<th><a href='" . h(ME) . 'select=' . urlencode($table) . "'>$name</a>";
$val = number_format($row["Rows"], 0, '.', lang(','));
echo "<td align='right'><a href='" . h(ME . "edit=") . urlencode($table) . "'>" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "</a>";
}

View File

@@ -31,6 +31,10 @@ class Adminer {
header("X-XSS-Protection: 0");
}
function head() {
return true;
}
function loginForm() {
?>
<table cellspacing="0">
@@ -46,6 +50,8 @@ document.getElementById('username').focus();
}
function login($login, $password) {
global $connection;
$connection->query("SET time_zone = " . q(substr_replace(@date("O"), ":", -2, 0))); // date("P") available since PHP 5.1.3, @ - requires date.timezone since PHP 5.3.0
return true;
}
@@ -164,13 +170,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return = "<img src='$link' alt='$return'>";
}
}
if (ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && $return != "&nbsp;") { // bool
if (like_bool($field) && $return != "&nbsp;") { // bool
$return = '<img src="' . ($val ? "../adminer/static/plus.gif" : "../adminer/static/cross.gif") . '" alt="' . h($val) . '">';
}
if ($link) {
$return = "<a href='$link'>$return</a>";
}
if (!$link && !ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && ereg('int|float|double|decimal', $field["type"])) {
if (!$link && !like_bool($field) && ereg('int|float|double|decimal', $field["type"])) {
$return = "<div class='number'>$return</div>"; // Firefox doesn't support <colgroup>
} elseif (ereg('date', $field["type"])) {
$return = "<div class='datetime'>$return</div>";
@@ -250,9 +256,15 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
}
if ($orders) {
echo '<fieldset><legend>' . lang('Sort') . "</legend><div>";
echo "<select name='index_order'>" . optionlist(array("" => "") + $orders, $_GET["index_order"], true) . "</select>";
echo "<select name='index_order'>" . optionlist(array("" => "") + $orders, ($_GET["order"][0] != "" ? "" : $_GET["index_order"]), true) . "</select>";
echo "</div></fieldset>\n";
}
if ($_GET["order"]) {
echo "<div style='display: none;'>" . hidden_fields(array(
"order" => array(1 => reset($_GET["order"])),
"desc" => ($_GET["desc"] ? array(1 => 1) : array()),
)) . "</div>\n";
}
}
function selectLimitPrint($limit) {
@@ -275,7 +287,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
print_fieldset("email", lang('E-mail'), $_POST["email_append"]);
echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
echo "<p><textarea name='email_message' rows='15' cols='75' onkeypress='return textareaKeypress(this, event, false, this.form.email);'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
echo "<p><textarea name='email_message' rows='15' cols='75'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n"; //! Ctrl+Enter for this.form.email
echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
echo "<p>" . lang('Attachments') . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
@@ -322,10 +334,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
}
function selectOrderProcess($fields, $indexes) {
if ($_GET["order"]) {
return array(idf_escape($_GET["order"][0]) . (isset($_GET["desc"][0]) ? " DESC" : ""));
}
$index_order = $_GET["index_order"];
if ($index_order != "") {
unset($_GET["order"][1]);
}
if ($_GET["order"]) {
return array(idf_escape(reset($_GET["order"])) . ($_GET["desc"] ? " DESC" : ""));
}
foreach (($index_order != "" ? array($indexes[$index_order]) : $indexes) as $index) {
if ($index_order != "" || $index["type"] == "INDEX") {
$desc = false;
@@ -396,7 +411,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if ($field["null"] && ereg('blob', $field["type"])) {
$return["NULL"] = lang('empty');
}
$return[""] = ($field["null"] || $field["auto_increment"] || ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) ? "" : "*");
$return[""] = ($field["null"] || $field["auto_increment"] || like_bool($field) ? "" : "*");
//! respect driver
if (ereg('date|time', $field["type"])) {
$return["now"] = lang('now');
@@ -417,11 +432,18 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
if ($options) {
return "<select$attrs>" . optionlist($options, $value, true) . "</select>";
}
if (ereg("(tinyint|bit)\\(1\\)", $field["full_type"])) { // bool
if (like_bool($field)) {
return '<input type="checkbox" value="' . h($value ? $value : 1) . '"' . ($value ? ' checked' : '') . "$attrs>";
}
$hint = "";
if (ereg('time', $field["type"])) {
$hint = lang('HH:MM:SS');
}
if (ereg('date|timestamp', $field["type"])) {
return "<input value='" . h($value) . "'$attrs> (" . lang('[yyyy]-mm-dd') . ")"; //! maxlength
$hint = lang('[yyyy]-mm-dd') . ($hint ? " [$hint]" : "");
}
if ($hint) {
return "<input value='" . h($value) . "'$attrs> ($hint)"; //! maxlength
}
if (eregi('_(md5|sha1)$', $field["field"])) {
return "<input type='password' value='" . h($value) . "'$attrs>";
@@ -438,7 +460,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
}
$return = ($field["type"] == "bit" && ereg('^[0-9]+$', $value) ? $return : q($return));
if (!ereg('char|text', $field["type"]) && !ereg("(tinyint|bit)\\(1\\)", $field["full_type"]) && $value == "") {
if (!ereg('char|text', $field["type"]) && !like_bool($field) && $value == "") {
$return = "NULL";
} elseif (ereg('^(md5|sha1)$', $function)) {
$return = "$function($return)";
@@ -466,6 +488,10 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
$result = $connection->query($query, 1); // 1 - MYSQLI_USE_RESULT
if ($result) {
while ($row = $result->fetch_assoc()) {
if ($style == "table") {
dump_csv(array_keys($row));
$style = "INSERT";
}
dump_csv($row);
}
}
@@ -505,8 +531,8 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
?>
<form action="" method="post">
<p class="logout">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" name="logout" value="<?php echo lang('Logout'); ?>" onclick="eventStop(event);">
<input type="hidden" name="token" value="<?php echo $token; ?>">
</p>
</form>
<?php

View File

@@ -43,3 +43,11 @@ function send_mail($email, $subject, $message, $from = "", $files = array("error
;
return mail($email, email_header($subject), $beginning . $message . $attachments, $headers);
}
/** Check whether the column looks like boolean
* @param array single field returned from fields()
* @return bool
*/
function like_bool($field) {
return ereg("bool|(tinyint|bit)\\(1\\)", $field["full_type"]);
}

View File

@@ -1,4 +1,7 @@
// Editor specific functions
function bodyLoad(version) {
if (history.state !== undefined) {
onpopstate(history);
}
}

2
externals/jush vendored

16
plugins/edit-textarea.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
/** Use <textarea> for char and varchar
* @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 AdminerEditTextarea {
function editInput($table, $field, $attrs, $value) {
if (ereg('char', $field["type"])) {
return "<textarea cols='30' rows='1' style='height: 1.2em;'$attrs>" . h($value) . '</textarea>';
}
}
}

47
plugins/login-servers.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
/** Display constant list of servers in login form
* @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 AdminerLoginServers {
var $servers;
/** Set supported servers
* @param array array($domain) or array($domain => $description) or array($category => array())
*/
function AdminerLoginServers($servers) {
$this->servers = $servers;
}
function login($login, $password) {
// check if server is allowed
foreach ($this->servers as $key => $val) {
$servers = $val;
if (!is_array($val)) {
$servers = array($key => $val);
}
foreach ($servers as $k => $v) {
if ((is_string($k) ? $k : $v) == SERVER) {
return;
}
}
}
return false;
}
function loginForm() {
?>
<table cellspacing="0">
<tr><th><?php echo lang('Server'); ?><td><input type="hidden" name="driver" value="server"><select name="server"><?php echo optionlist($this->servers, SERVER); ?></select>
<tr><th><?php echo lang('Username'); ?><td><input id="username" name="username" value="<?php echo h($_GET["username"]); ?>">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
</table>
<p><input type="submit" value="<?php echo lang('Login'); ?>">
<?php
echo checkbox("permanent", 1, $_COOKIE["adminer_permanent"], lang('Permanent login')) . "\n";
return true;
}
}

View File

@@ -17,13 +17,16 @@ CREATE TABLE login (
class AdminerLoginTable {
var $database;
/** Set database of login table
* @param string
*/
function AdminerLoginTable($database) {
$this->database = $database;
}
function login($login, $password) {
$connection = connection();
return (bool) $connection->result($q = "SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . $connection->quote($login) . " AND password_sha1 = " . $connection->quote(sha1($password)));
return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . q($login) . " AND password_sha1 = " . q(sha1($password)));
}
}

View File

@@ -8,14 +8,40 @@
class AdminerPlugin extends Adminer {
var $plugins;
/**
* @param array
function _findRootClass($class) {
do {
$return = $class;
} while ($class = get_parent_class($class));
return $return;
}
/** Register plugins
* @param array object instances or null to register all classes starting by 'Adminer'
*/
function AdminerPlugin($plugins) {
if (!isset($plugins)) {
$plugins = array();
foreach (get_declared_classes() as $class) {
if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { // can use interface since PHP 5
$plugins[$class] = new $class;
}
}
}
$this->plugins = $plugins;
// it is possible to use ReflectionObject in PHP 5 to find out which plugins defines which methods at once
}
function _callParent($function, $args) {
switch (count($args)) { // call_user_func_array(array('parent', $function), $args) works since PHP 5
case 0: return parent::$function();
case 1: return parent::$function($args[0]);
case 2: return parent::$function($args[0], $args[1]);
case 3: return parent::$function($args[0], $args[1], $args[2]);
case 4: return parent::$function($args[0], $args[1], $args[2], $args[3]);
default: trigger_error('Too many parameters.', E_USER_WARNING);
}
}
function _applyPlugin($function, $args) {
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
@@ -32,11 +58,11 @@ class AdminerPlugin extends Adminer {
}
}
}
return call_user_func_array(array($this, "parent::$function"), $args);
return $this->_callParent($function, $args);
}
function _appendPlugin($function, $args) {
$return = call_user_func_array(array($this, "parent::$function"), $args);
$return = $this->_callParent($function, $args);
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
$return += call_user_func_array(array($plugin, $function), $args);
@@ -89,6 +115,11 @@ class AdminerPlugin extends Adminer {
return $this->_applyPlugin(__FUNCTION__, $args);
}
function head() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);
}
function loginForm() {
$args = func_get_args();
return $this->_applyPlugin(__FUNCTION__, $args);

View File

@@ -43,7 +43,7 @@
</tr>
<tr>
<td>clickAndWait</td>
<td>//form[@id='form']/p[3]/input[2]</td>
<td>//input[@value='Save']</td>
<td></td>
</tr>
<tr>

View File

@@ -1,6 +1,6 @@
Transactions in export
Create view and routine options
Variables editation, especially timezone, or set by PHP date("0")
Variables editation
Highlight SQL textarea - may use external CodeMirror
Blob download and image display in edit form (important for Editor with hidden fields in select and SQL command)
Add title to Logout, edit (in select) and select (in menu) for style "hever"
@@ -9,18 +9,19 @@ Export by GET parameters
Only first part of big BZ2 export is readable, files are missing in TAR
Double click in select - Esc to abort editation
Draggable columns in alter table (thanks to Michal Manak)
<option class> for system databases and schemas - information_schema and driver-specific (thanks to Vaclav Novotny)
Define indexes and foreign keys name - http://forum.zdrojak.root.cz/index.php?topic=185.msg1255#msg1255
? Filter by value in row under <thead> in select
? Column and table names auto-completition in SQL textarea - http://blog.quplo.com/2010/06/css-code-completion-in-your-browser/
? Aliasing of built-in functions can save 7 KB, function minification can save 7 KB, substitution of repetitive $a["a"] can save 4 KB, substitution of $_GET and friends can save 2 KB, aliasing of $connection->query can save 24 B, JS Closure compiler can save 2 KB, not enclosing HTML attribute values can save 1.2 KB, replacing \\n by \n can save .3 KB
? Branch binary_compile: LZW compression of translations can save 30 KB, LZW compression of all texts can save 11 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB
Editor:
Checkbox for boolean searches
Three-state checkbox for boolean searches
JavaScript data validation - columns containing word email, url, ...
Joining tables - PRIMARY KEY (table, joining)
Rank, Tree structure
Add whisperer to fields with foreign key to big table
JS calendar for date fields
MySQL:
Data longer than max_allowed_packet can be sent by mysqli_stmt_send_long_data()
@@ -38,7 +39,6 @@ Users - SELECT * FROM pg_user
ORDER BY COUNT(*)
Export - http://www.postgresql.org/docs/8.4/static/functions-info.html
Column rights - http://www.postgresql.org/docs/8.4/static/functions-info.html
bool in Editor
MS SQL:
Display default value