mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
PUSHPROD Settings 0.2
This commit is contained in:
@@ -11,12 +11,44 @@
|
||||
// ###################################
|
||||
// ## TimeZone processing start
|
||||
// ###################################
|
||||
$config_file = "../config/pialert.conf";
|
||||
$config_file_lines = file($config_file);
|
||||
|
||||
$configFolderPath = "/home/pi/pialert/config/";
|
||||
$config_file = "pialert.conf";
|
||||
$logFolderPath = "/home/pi/pialert/front/log/";
|
||||
$log_file = "pialert_front.log";
|
||||
|
||||
|
||||
$fullConfPath = $configFolderPath.$config_file;
|
||||
|
||||
chmod($fullConfPath, 0777);
|
||||
|
||||
$config_file_lines = file($fullConfPath);
|
||||
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
|
||||
$timezone_line = explode("'", $config_file_lines_timezone[0]);
|
||||
$Pia_TimeZone = $timezone_line[1];
|
||||
date_default_timezone_set($Pia_TimeZone);
|
||||
|
||||
$timeZone = "";
|
||||
|
||||
foreach ($config_file_lines as $line)
|
||||
{
|
||||
if( preg_match('/TIMEZONE(.*?)/', $line, $match) == 1 )
|
||||
{
|
||||
if (preg_match('/\'(.*?)\'/', $line, $match) == 1) {
|
||||
$timeZone = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($timeZone == "")
|
||||
{
|
||||
$timeZone = "Europe/Berlin";
|
||||
}
|
||||
|
||||
date_default_timezone_set($timeZone);
|
||||
|
||||
$date = new DateTime("now", new DateTimeZone($timeZone) );
|
||||
$timestamp = $date->format('Y-m-d_H-i-s');
|
||||
|
||||
// ###################################
|
||||
// ## TimeZone processing end
|
||||
// ###################################
|
||||
|
||||
Reference in New Issue
Block a user