-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminerTimezone.php
More file actions
44 lines (39 loc) · 1.12 KB
/
AdminerTimezone.php
File metadata and controls
44 lines (39 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
class AdminerTimezone extends Adminer\Plugin {
private $timezone;
/**
* @param str $timezone
*/
function __construct($timezone = "Europe/Stockholm") {
$this->timezone = trim($timezone);
}
function afterConnect() {
$timezone = Adminer\get_setting("timezone", "adminer_config", $this->timezone);
if ($timezone != '') {
$conn = Adminer\connection();
switch (Adminer\JUSH) {
case 'sql':
$conn->query("SET time_zone = '$timezone'");
break;
case 'pgsql':
$conn->query("SET time_zone TO '$timezone'");
break;
default:
if (method_exists($conn, 'time_zone')) {
$conn->time_zone($timezone);
}
}
}
}
function config() {
$timezone = Adminer\get_setting("timezone", "adminer_config", $this->timezone);
return array($this->lang('Connection timezone') => '<input type="text" name="config[timezone]" value="' . Adminer\h($timezone) . '" class=""> ' . $this->lang('timezone'));
}
protected $translations = array(
'sv' => array(
'' => 'Ställer in tidszon för varje anslutning',
'Connection timezone' => 'Anslutning tidszon',
'timezone' => 'Tidszon',
),
);
}