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()
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()
{
global $config;
......@@ -1229,10 +1237,7 @@ function system_timezone_configure()
/* extract appropriate timezone file */
$timezone = $syscfg['timezone'];
$timezones = array_map(
function ($path) { return str_replace('/usr/share/zoneinfo/', '', $path); },
glob('/usr/share/zoneinfo/*/*')
);
$timezones = get_zoneinfo();
// Reset to default if empty or not existend
if (empty($timezone) || !in_array($timezone, $timezones)) {
......
......@@ -79,10 +79,7 @@ if ($pconfig['timezone'] <> $_POST['timezone']) {
filter_pflog_start();
}
$timezonelist = array_map(
function ($path) { return str_replace('/usr/share/zoneinfo/', '', $path); },
glob('/usr/share/zoneinfo/*/*')
);
$timezonelist = get_zoneinfo();
$multiwan = false;
$interfaces = get_configured_interface_list();
......
......@@ -678,12 +678,7 @@ function showchange() {
break;
case "timezone_select":
$timezonelist = array_map(
function ($path) {
return str_replace('/usr/share/zoneinfo/', '', $path);
},
glob('/usr/share/zoneinfo/*/*')
);
$timezonelist = get_zoneinfo();
if ($field['displayname']) {
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