Merge branch 'fix_timezone'
This commit is contained in:
+3
-18
@@ -4,25 +4,10 @@
|
||||
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
|
||||
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
||||
|
||||
$sys_timezone = "";
|
||||
// If we can get the timezome from the systems timezone file ust that
|
||||
if (file_exists('/etc/timezone')) {
|
||||
$tz_data = file_get_contents('/etc/timezone');
|
||||
if ($tz_data !== false) {
|
||||
$sys_timezone = trim($tz_data);
|
||||
}
|
||||
} else {
|
||||
// Else get timezone from the timedatectl command
|
||||
$tz_data = shell_exec('timedatectl show');
|
||||
$tz_data_array = parse_ini_string($tz_data);
|
||||
if (is_array($tz_data_array) && array_key_exists('Timezone', $tz_data_array)) {
|
||||
$sys_timezone = $tz_data_array['Timezone'];
|
||||
}
|
||||
}
|
||||
//Finally if we have a valod timezone, set it as the one PHP uses
|
||||
if ($sys_timezone !== "") {
|
||||
date_default_timezone_set($sys_timezone);
|
||||
if(!isset($_SESSION['my_timezone'])) {
|
||||
$_SESSION['my_timezone'] = trim(shell_exec('timedatectl show --value --property=Timezone'));
|
||||
}
|
||||
date_default_timezone_set($_SESSION['my_timezone']);
|
||||
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
|
||||
+6
-20
@@ -4,27 +4,13 @@
|
||||
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
|
||||
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
||||
|
||||
$sys_timezone = "";
|
||||
// If we can get the timezome from the systems timezone file ust that
|
||||
if (file_exists('/etc/timezone')) {
|
||||
$tz_data = file_get_contents('/etc/timezone');
|
||||
if ($tz_data !== false) {
|
||||
$sys_timezone = trim($tz_data);
|
||||
}
|
||||
} else {
|
||||
// else get timezone from the timedatectl command
|
||||
$tz_data = shell_exec('timedatectl show');
|
||||
$tz_data_array = parse_ini_string($tz_data);
|
||||
if (is_array($tz_data_array) && array_key_exists('Timezone', $tz_data_array)) {
|
||||
$sys_timezone = $tz_data_array['Timezone'];
|
||||
}
|
||||
}
|
||||
// finally if we have a valod timezone, set it as the one PHP uses
|
||||
if ($sys_timezone !== "") {
|
||||
date_default_timezone_set($sys_timezone);
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['my_timezone'])) {
|
||||
$_SESSION['my_timezone'] = trim(shell_exec('timedatectl show --value --property=Timezone'));
|
||||
}
|
||||
date_default_timezone_set($_SESSION['my_timezone']);
|
||||
|
||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||
$user = trim($user);
|
||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||
|
||||
+6
-2
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
error_reporting(E_ERROR);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
if(!isset($_SESSION['my_timezone'])) {
|
||||
$_SESSION['my_timezone'] = trim(shell_exec('timedatectl show --value --property=Timezone'));
|
||||
}
|
||||
date_default_timezone_set($_SESSION['my_timezone']);
|
||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||
$home = trim($home);
|
||||
@@ -114,6 +117,7 @@ if(isset($_GET["latitude"])){
|
||||
|
||||
if(isset($timezone) && in_array($timezone, DateTimeZone::listIdentifiers())) {
|
||||
shell_exec("sudo timedatectl set-timezone ".$timezone);
|
||||
$_SESSION['my_timezone'] = $timezone;
|
||||
date_default_timezone_set($timezone);
|
||||
echo "<script>setTimeout(
|
||||
function() {
|
||||
@@ -688,7 +692,7 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
|
||||
Select a timezone
|
||||
</option>
|
||||
<?php
|
||||
$current_timezone = trim(shell_exec("cat /etc/timezone"));
|
||||
$current_timezone = trim(shell_exec("timedatectl show --value --property=Timezone"));
|
||||
$timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
|
||||
|
||||
$n = 425;
|
||||
|
||||
@@ -5,6 +5,11 @@ ini_set('session.gc_maxlifetime', 7200);
|
||||
ini_set('user_agent', 'PHP_Flickr/1.0');
|
||||
session_set_cookie_params(7200);
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['my_timezone'])) {
|
||||
$_SESSION['my_timezone'] = trim(shell_exec('timedatectl show --value --property=Timezone'));
|
||||
}
|
||||
date_default_timezone_set($_SESSION['my_timezone']);
|
||||
$myDate = date('Y-m-d');
|
||||
$chart = "Combo-$myDate.png";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user