diff options
author | Phil Davis <phil.davis@inf.org> | 2015-05-30 18:46:51 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-05-30 18:46:51 +0545 |
commit | d38bd8402862723dc03b4f27289cb6cc3c91c08e (patch) | |
tree | 3075ab89fdb3a16fdfa1344f33bd953277c939b2 /usr/local/www/system_routes.php | |
parent | 5dcec9f242a94894086dd425ecf9d2f00ccdebd5 (diff) | |
download | pfsense-d38bd8402862723dc03b4f27289cb6cc3c91c08e.zip pfsense-d38bd8402862723dc03b4f27289cb6cc3c91c08e.tar.gz |
Code style system h and r
Diffstat (limited to 'usr/local/www/system_routes.php')
-rw-r--r-- | usr/local/www/system_routes.php | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php index 2e037cd..a001444 100644 --- a/usr/local/www/system_routes.php +++ b/usr/local/www/system_routes.php @@ -46,8 +46,9 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); -if (!is_array($config['staticroutes']['route'])) +if (!is_array($config['staticroutes']['route'])) { $config['staticroutes']['route'] = array(); +} $a_routes = &$config['staticroutes']['route']; $a_gateways = return_gateways_array(true, true, true); @@ -63,8 +64,9 @@ if ($_POST) { if (file_exists("{$g['tmp_path']}/.system_routes.apply")) { $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply")); - foreach ($toapplylist as $toapply) + foreach ($toapplylist as $toapply) { mwexec("{$toapply}"); + } @unlink("{$g['tmp_path']}/.system_routes.apply"); } @@ -75,26 +77,30 @@ if ($_POST) { setup_gateways_monitor(); $savemsg = get_std_save_message($retval); - if ($retval == 0) + if ($retval == 0) { clear_subsystem_dirty('staticroutes'); + } } } function delete_static_route($id) { global $config, $a_routes, $changedesc_prefix; - if (!isset($a_routes[$id])) + if (!isset($a_routes[$id])) { return; + } $targets = array(); if (is_alias($a_routes[$id]['network'])) { foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) { - if (is_ipaddrv4($tgt)) + if (is_ipaddrv4($tgt)) { $tgt .= "/32"; - else if (is_ipaddrv6($tgt)) + } else if (is_ipaddrv6($tgt)) { $tgt .= "/128"; - if (!is_subnet($tgt)) + } + if (!is_subnet($tgt)) { continue; + } $targets[] = $tgt; } } else { @@ -136,7 +142,7 @@ if (isset($_POST['del_x'])) { } else if ($_GET['act'] == "toggle") { if ($a_routes[$_GET['id']]) { - if(isset($a_routes[$_GET['id']]['disabled'])) { + if (isset($a_routes[$_GET['id']]['disabled'])) { unset($a_routes[$_GET['id']]['disabled']); $changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$id]['network']; } else { @@ -145,8 +151,9 @@ if (isset($_POST['del_x'])) { $changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$id]['network']; } - if (write_config($changedesc)) + if (write_config($changedesc)) { mark_subsystem_dirty('staticroutes'); + } header("Location: system_routes.php"); exit; } @@ -165,38 +172,45 @@ if (isset($_POST['del_x'])) { /* copy all routes < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { - if (!in_array($i, $_POST['route'])) + if (!in_array($i, $_POST['route'])) { $a_routes_new[] = $a_routes[$i]; + } } /* copy all selected routes */ for ($i = 0; $i < count($a_routes); $i++) { - if ($i == $movebtn) + if ($i == $movebtn) { continue; - if (in_array($i, $_POST['route'])) + } + if (in_array($i, $_POST['route'])) { $a_routes_new[] = $a_routes[$i]; + } } /* copy $movebtn route */ - if ($movebtn < count($a_routes)) + if ($movebtn < count($a_routes)) { $a_routes_new[] = $a_routes[$movebtn]; + } /* copy all routes > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_routes); $i++) { - if (!in_array($i, $_POST['route'])) + if (!in_array($i, $_POST['route'])) { $a_routes_new[] = $a_routes[$i]; + } } - if (count($a_routes_new) > 0) + if (count($a_routes_new) > 0) { $a_routes = $a_routes_new; + } - if (write_config()) + if (write_config()) { mark_subsystem_dirty('staticroutes'); + } header("Location: system_routes.php"); exit; } } -$pgtitle = array(gettext("System"),gettext("Static Routes")); +$pgtitle = array(gettext("System"), gettext("Static Routes")); $shortcut_section = "routing"; include("head.inc"); @@ -244,7 +258,10 @@ include("head.inc"); </table> </td> </tr> - <?php $i = 0; foreach ($a_routes as $route): ?> + <?php + $i = 0; + foreach ($a_routes as $route): + ?> <tr valign="top" id="fr<?=$i;?>"> <?php $iconfn = "pass"; @@ -252,8 +269,9 @@ include("head.inc"); $textss = "<span class=\"gray\">"; $textse = "</span>"; $iconfn .= "_d"; - } else + } else { $textss = $textse = ""; + } ?> <td class="listt"> <input type="checkbox" id="frc<?=$i;?>" name="route[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /> @@ -314,7 +332,10 @@ include("head.inc"); </table> </td> </tr> - <?php $i++; endforeach; ?> + <?php + $i++; + endforeach; + ?> <tr> <td class="list" colspan="6"></td> <td class="list nowrap" valign="middle"> |