mirror of
https://github.com/aunefyren/wrapperr
synced 2025-03-04 14:37:14 +00:00
Added timezone test
This commit is contained in:
parent
aee99df64a
commit
4625414b43
1 changed files with 25 additions and 2 deletions
|
@ -29,10 +29,33 @@ if(!$config->is_configured() || !$admin->is_configured()) {
|
|||
|
||||
echo json_encode(array("message" => "Wrapperr is not configured.", "error" => true));
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
// Set time-zone to the one configured
|
||||
date_default_timezone_set($config->timezone);
|
||||
// Confirm timezone in config is valid
|
||||
$timezone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$valid_timezone = false;
|
||||
for ($i = 0; $i < count($timezone_identifiers); $i++) {
|
||||
if($config->timezone === $timezone_identifiers[$i]) {
|
||||
$valid_timezone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set time-zone to the one configured or return error
|
||||
if($valid_timezone) {
|
||||
|
||||
date_default_timezone_set($config->timezone);
|
||||
|
||||
} else {
|
||||
|
||||
// Log activity
|
||||
$log->log_activity('get_stats.php', 'unknown', 'Timezone not accepted. Not found in \'DateTimeZone::listIdentifiers()\' list.');
|
||||
|
||||
echo json_encode(array("message" => "Configured timezone invalid.", "error" => true));
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
// Set maximum run-time
|
||||
set_time_limit(1200);
|
||||
|
|
Loading…
Add table
Reference in a new issue