Commit 6482172a authored by Franco Fichtner's avatar Franco Fichtner

inc: merge duplicated code into get_zoneinfo() for #242

parent 3e3d6913
...@@ -187,6 +187,14 @@ function get_country_codes() ...@@ -187,6 +187,14 @@ function get_country_codes()
return $dn_cc; return $dn_cc;
} }
function get_zoneinfo()
{
return array_map(
function ($path) { return str_replace('/usr/share/zoneinfo/', '', $path); },
glob('/usr/share/zoneinfo/*/*')
);
}
function get_searchdomains() function get_searchdomains()
{ {
global $config; global $config;
...@@ -1229,10 +1237,7 @@ function system_timezone_configure() ...@@ -1229,10 +1237,7 @@ function system_timezone_configure()
/* extract appropriate timezone file */ /* extract appropriate timezone file */
$timezone = $syscfg['timezone']; $timezone = $syscfg['timezone'];
$timezones = array_map( $timezones = get_zoneinfo();
function ($path) { return str_replace('/usr/share/zoneinfo/', '', $path); },
glob('/usr/share/zoneinfo/*/*')
);
// Reset to default if empty or not existend // Reset to default if empty or not existend
if (empty($timezone) || !in_array($timezone, $timezones)) { if (empty($timezone) || !in_array($timezone, $timezones)) {
......
...@@ -79,10 +79,7 @@ if ($pconfig['timezone'] <> $_POST['timezone']) { ...@@ -79,10 +79,7 @@ if ($pconfig['timezone'] <> $_POST['timezone']) {
filter_pflog_start(); filter_pflog_start();
} }
$timezonelist = array_map( $timezonelist = get_zoneinfo();
function ($path) { return str_replace('/usr/share/zoneinfo/', '', $path); },
glob('/usr/share/zoneinfo/*/*')
);
$multiwan = false; $multiwan = false;
$interfaces = get_configured_interface_list(); $interfaces = get_configured_interface_list();
......
...@@ -678,12 +678,7 @@ function showchange() { ...@@ -678,12 +678,7 @@ function showchange() {
break; break;
case "timezone_select": case "timezone_select":
$timezonelist = array_map( $timezonelist = get_zoneinfo();
function ($path) {
return str_replace('/usr/share/zoneinfo/', '', $path);
},
glob('/usr/share/zoneinfo/*/*')
);
if ($field['displayname']) { if ($field['displayname']) {
echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment