From 2b87adaef5c78bfa6220fff9b9998d3b9c171838 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Thu, 24 Mar 2005 05:57:48 +0000 Subject: write_config() descriptions and only write_config() if something actually changed --- usr/local/www/system_routes.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php index 0d870dc..043f74c 100755 --- a/usr/local/www/system_routes.php +++ b/usr/local/www/system_routes.php @@ -36,17 +36,10 @@ if (!is_array($config['staticroutes']['route'])) staticroutes_sort(); $a_routes = &$config['staticroutes']['route']; +$changedesc = "Static Routes: "; if ($_POST) { - if ($_POST['enablefastrouting'] == "") { - unset($config['staticroutes']['enablefastrouting']); - write_config(); - } else { - $config['staticroutes']['enablefastrouting'] = "enabled"; - write_config(); - } - $pconfig = $_POST; if ($_POST['apply']) { @@ -64,14 +57,29 @@ if ($_POST) { config_unlock(); } } + } else { + if ($_POST['enablefastrouting'] == "") { + /* Only update config if something changed */ + if (isset($config['staticroutes']['enablefastrouting'])) { + $changedesc .= " disable fast routing"; + unset($config['staticroutes']['enablefastrouting']); + write_config($changedesc); + } + } else { + /* Only update config if something changed */ + if (!isset($config['staticroutes']['enablefastrouting'])) { + $changedesc .= " enable fast routing"; + $config['staticroutes']['enablefastrouting'] = "enabled"; + write_config($changedesc); + } + } } - } if ($_GET['act'] == "del") { if ($a_routes[$_GET['id']]) { unset($a_routes[$_GET['id']]); - write_config(); + write_config("Static Routes: removed route to {$_GET['id']}"); touch($d_staticroutesdirty_path); header("Location: system_routes.php"); exit; -- cgit v1.1