Permalink
Browse files

Add timezone switch

Add select for timezone switching and use selected timezone in mysql
drivers.

TODO: Add timezone set to other drivers.

TODO: Place switch to some nice location at the page.
  • Loading branch information...
1 parent 2b78d06 commit 2ba1640ac9be423473e098fe7203c4d5f95e977b @jkufner committed Feb 22, 2014
@@ -30,6 +30,11 @@ function connect($server, $username, $password) {
} else {
$this->query("SET NAMES utf8");
}
+ if (method_exists($this, 'set_timezone')) {
+ $this->set_timezone($TIMEZONE);
+ } else {
+ $this->query("SET time_zone = '".get_timezone()."';");
+ }
}
return $return;
}
@@ -80,6 +85,11 @@ function connect($server, $username, $password) {
} else {
$this->query("SET NAMES utf8");
}
+ if (method_exists($this, 'set_timezone')) {
+ $this->set_timezone($TIMEZONE);
+ } else {
+ $this->query("SET time_zone = '".get_timezone()."';");
+ }
} else {
$this->error = mysql_error();
}
@@ -213,6 +223,7 @@ class Min_DB extends Min_PDO {
function connect($server, $username, $password) {
$this->dsn("mysql:charset=utf8;host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\\d)~', ';port=\\1', $server)), $username, $password);
$this->query("SET NAMES utf8"); // charset in DSN is ignored before PHP 5.3.6
+ $this->query("SET time_zone = '".get_timezone()."'");
return true;
}
View
@@ -17,12 +17,11 @@
echo "-- Adminer $VERSION " . $drivers[DRIVER] . " dump\n\n";
if ($jush == "sql") {
echo "SET NAMES utf8;
-SET time_zone = '+00:00';
+SET time_zone = '", get_timezone(), "';
" . ($_POST["data_style"] ? "SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
" : "") . "
";
- $connection->query("SET time_zone = '+00:00';");
}
}
@@ -58,6 +58,7 @@
include "../adminer/include/lang.inc.php";
include "../adminer/lang/$LANG.inc.php";
+include "../adminer/include/timezone.inc.php";
include "../adminer/include/pdo.inc.php";
include "../adminer/include/driver.inc.php";
include "../adminer/drivers/sqlite.inc.php";
@@ -114,6 +114,7 @@ function page_footer($missing = "") {
</div>
<?php switch_lang(); ?>
+<?php switch_timezone(); ?>
<?php if ($missing != "auth") { ?>
<form action="" method="post">
<p class="logout">
Oops, something went wrong.

0 comments on commit 2ba1640

Please sign in to comment.