diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-06-30 18:15:14 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-06-30 18:16:09 +0000 |
commit | 0d64af597505a0e9c21d48669aafc8e1448b102b (patch) | |
tree | dc7101c26d46efc532af66aaaadf7825bd8e8bf2 /usr/local/www | |
parent | d44d94c5c51c7bd7c6de810abfe0c3266cf947b1 (diff) | |
download | pfsense-0d64af597505a0e9c21d48669aafc8e1448b102b.zip pfsense-0d64af597505a0e9c21d48669aafc8e1448b102b.tar.gz |
Clear guiconfig from all sort junk functions and put them on the specific pages where they are needed.
Remove some sort functions not used.
Diffstat (limited to 'usr/local/www')
36 files changed, 214 insertions, 332 deletions
diff --git a/usr/local/www/firewall_nat_1to1.php b/usr/local/www/firewall_nat_1to1.php index 63fc39c..29f7585 100755 --- a/usr/local/www/firewall_nat_1to1.php +++ b/usr/local/www/firewall_nat_1to1.php @@ -43,7 +43,6 @@ if (!is_array($config['nat']['onetoone'])) { $config['nat']['onetoone'] = array(); } $a_1to1 = &$config['nat']['onetoone']; -nat_1to1_rules_sort(); if ($_POST) { diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php index dee8b27..466e451 100755 --- a/usr/local/www/firewall_nat_1to1_edit.php +++ b/usr/local/www/firewall_nat_1to1_edit.php @@ -36,6 +36,18 @@ ##|*MATCH=firewall_nat_1to1_edit.php* ##|-PRIV +function nat_1to1_rules_sort() { + global $g, $config; + + if (!is_array($config['nat']['onetoone'])) + return; + + function nat1to1cmp($a, $b) { + return ipcmp($a['external'], $b['external']); + } + + usort($config['nat']['onetoone'], "nat1to1cmp"); +} require("guiconfig.inc"); @@ -123,6 +135,7 @@ if ($_POST) { $natent['descr'] = $_POST['descr']; $natent['interface'] = $_POST['interface']; + nat_1to1_rules_sort(); if (isset($id) && $a_1to1[$id]) $a_1to1[$id] = $natent; else diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index fc7cc9b..10fb84d 100755 --- a/usr/local/www/firewall_nat_edit.php +++ b/usr/local/www/firewall_nat_edit.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); if (!is_array($config['nat']['rule'])) { $config['nat']['rule'] = array(); } -//nat_rules_sort(); $a_nat = &$config['nat']['rule']; $id = $_GET['id']; diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 596771a..ca1e04e 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -45,7 +45,6 @@ if (!is_array($config['nat']['advancedoutbound']['rule'])) $config['nat']['advancedoutbound']['rule'] = array(); $a_out = &$config['nat']['advancedoutbound']['rule']; -//nat_out_rules_sort(); $id = $_GET['id']; if (isset($_POST['id'])) diff --git a/usr/local/www/firewall_nat_server_edit.php b/usr/local/www/firewall_nat_server_edit.php index b6aeb37..07cc295 100755 --- a/usr/local/www/firewall_nat_server_edit.php +++ b/usr/local/www/firewall_nat_server_edit.php @@ -38,6 +38,18 @@ ##|*MATCH=firewall_nat_server_edit.php* ##|-PRIV +function nat_server_rules_sort() { + global $g, $config; + + if (!is_array($config['nat']['servernat'])) + return; + + function natservercmp($a, $b) { + return ipcmp($a['ipaddr'], $b['ipaddr']); + } + + usort($config['nat']['servernat'], "natservercmp"); +} require("guiconfig.inc"); @@ -99,7 +111,8 @@ if ($_POST) { $natent = array(); $natent['ipaddr'] = $_POST['ipaddr']; $natent['descr'] = $_POST['descr']; - + + nat_server_rules_sort(); if (isset($id) && $a_snat[$id]) { /* modify all inbound NAT rules with this address */ for ($i = 0; isset($config['nat']['rule'][$i]); $i++) { diff --git a/usr/local/www/firewall_schedule.php b/usr/local/www/firewall_schedule.php index a5eaf23..888a2b1 100644 --- a/usr/local/www/firewall_schedule.php +++ b/usr/local/www/firewall_schedule.php @@ -49,7 +49,6 @@ require("guiconfig.inc"); if (!is_array($config['schedules']['schedule'])) $config['schedules']['schedule'] = array(); -schedule_sort(); $a_schedules = &$config['schedules']['schedule']; diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php index fc30c18..aa88e2e 100644 --- a/usr/local/www/firewall_schedule_edit.php +++ b/usr/local/www/firewall_schedule_edit.php @@ -37,6 +37,19 @@ ##|*MATCH=firewall_schedule_edit.php* ##|-PRIV +function schedule_sort(){ + global $g, $config; + + if (!is_array($config['schedules']['schedule'])) + return; + + function schedulecmp($a, $b) { + return strcmp($a['name'], $b['name']); + } + + usort($config['schedules']['schedule'], "schedulecmp"); + +} $pgtitle = array("Firewall","Schedules","Edit"); require("guiconfig.inc"); @@ -158,6 +171,7 @@ if ($_POST) { else $schedule['schedlabel'] = uniqid(); + schedule_sort(); if (isset($id) && $a_schedules[$id]){ $a_schedules[$id] = $schedule; } diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 0ccec83..d5096b9 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -238,26 +238,6 @@ EOF2; } -function exec_rc_script($scriptname) { - - global $d_sysrebootreqd_path; - - $execoutput = ""; - $retval = ""; - exec($scriptname . " >/dev/null 2>&1", $execoutput, $retval); - return $retval; -} - -function exec_rc_script_async($scriptname) { - - global $d_sysrebootreqd_path; - $execoutput = ""; - $retval = ""; - - exec("nohup " . $scriptname . " >/dev/null 2>&1 &", $execoutput, $retval); - return $retval; -} - function verify_gzip_file($fname) { $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname)); @@ -376,45 +356,6 @@ function pprint_port($port) { return $pport; } -function captiveportal_users_sort() { - global $g, $config; - - if (!is_array($config['captiveportal']['user'])) - return; - - function cpusercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['captiveportal']['user'], "cpusercmp"); -} - -function admin_groups_sort() { - global $g, $config; - - if (!is_array($config['system']['group'])) - return; - - function cpusercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['system']['group'], "cpusercmp"); -} - -function admin_users_sort() { - global $g, $config; - - if (!is_array($config['system']['user'])) - return; - - function cpusercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['system']['user'], "cpusercmp"); -} - /* sort by interface only, retain the original order of rules that apply to the same interface */ function filter_rules_sort() { @@ -438,158 +379,6 @@ function filter_rules_sort() { unset($config['filter']['rule'][$i]['seq']); } -function nat_rules_sort() { - global $config; - - if (!is_array($config['nat']['rule'])) - return; - - function natcmp($a, $b) { - if ($a['external-address'] == $b['external-address']) { - if ($a['protocol'] == $b['protocol']) { - if ($a['external-port'] == $b['external-port']) { - return 0; - } else { - return ($a['external-port'] - $b['external-port']); - } - } else { - return strcmp($a['protocol'], $b['protocol']); - } - } else if (!$a['external-address']) - return 1; - else if (!$b['external-address']) - return -1; - else - return ipcmp($a['external-address'], $b['external-address']); - } - - usort($config['nat']['rule'], "natcmp"); -} - -function nat_1to1_rules_sort() { - global $g, $config; - - if (!is_array($config['nat']['onetoone'])) - return; - - function nat1to1cmp($a, $b) { - return ipcmp($a['external'], $b['external']); - } - - usort($config['nat']['onetoone'], "nat1to1cmp"); -} - -function nat_server_rules_sort() { - global $g, $config; - - if (!is_array($config['nat']['servernat'])) - return; - - function natservercmp($a, $b) { - return ipcmp($a['ipaddr'], $b['ipaddr']); - } - - usort($config['nat']['servernat'], "natservercmp"); -} - -function nat_out_rules_sort() { - global $g, $config; - - function natoutcmp($a, $b) { - return strcmp($a['source']['network'], $b['source']['network']); - } - - usort($config['nat']['advancedoutbound']['rule'], "natoutcmp"); -} - -function pptpd_users_sort() { - global $g, $config; - - if (!is_array($config['ppptpd']['user'])) - return; - - function usercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['pptpd']['user'], "usercmp"); -} - -function l2tp_users_sort() { - global $g, $config; - - if (!is_array($config['l2tp']['user'])) - return; - - function usercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['l2tp']['user'], "usercmp"); -} - -function openvpn_users_sort() { - global $g, $config; - - if (!is_array($config['openvpn']['user'])) - return; - - function usercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['openvpn']['user'], "usercmp"); -} - -function pppoe_users_sort() { - global $g, $config; - - if (!is_array($config['pppoe']['user'])) - return; - - function usercmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['pppoe']['user'], "usercmp"); -} - -function staticroutes_sort() { - global $g, $config; - - if (!is_array($config['staticroutes']['route'])) - return; - - function staticroutecmp($a, $b) { - return strcmp($a['network'], $b['network']); - } - - usort($config['staticroutes']['route'], "staticroutecmp"); -} - -function hosts_sort() { - global $g, $config; - - if (!is_array($config['dnsmasq']['hosts'])) - return; - - function hostcmp($a, $b) { - return strcasecmp($a['host'], $b['host']); - } - - usort($config['dnsmasq']['hosts'], "hostcmp"); -} - -function staticmaps_sort($ifgui) { - global $g, $config; - - function staticmapcmp($a, $b) { - return ipcmp($a['ipaddr'], $b['ipaddr']); - } - - usort($config['dhcpd'][$ifgui]['staticmap'], "staticmapcmp"); -} - function aliases_sort() { global $g, $config; @@ -601,95 +390,6 @@ function aliases_sort() { usort($config['aliases']['alias'], "aliascmp"); } -function schedule_sort(){ - global $g, $config; - - if (!is_array($config['schedules']['schedule'])) - return; - - function schedulecmp($a, $b) { - return strcmp($a['name'], $b['name']); - } - - usort($config['schedules']['schedule'], "schedulecmp"); - -} - -function ipsec_mobilekey_sort() { - global $g, $config; - - function mobilekeycmp($a, $b) { - return strcmp($a['ident'][0], $b['ident'][0]); - } - - usort($config['ipsec']['mobilekey'], "mobilekeycmp"); -} - -function proxyarp_sort() { - global $g, $config; - - function proxyarpcmp($a, $b) { - if (isset($a['network'])) - list($ast,$asn) = explode("/", $a['network']); - else if (isset($a['range'])) { - $ast = $a['range']['from']; - $asn = 32; - } - if (isset($b['network'])) - list($bst,$bsn) = explode("/", $b['network']); - else if (isset($b['range'])) { - $bst = $b['range']['from']; - $bsn = 32; - } - if (ipcmp($ast, $bst) == 0) - return ($asn - $bsn); - else - return ipcmp($ast, $bst); - } - - usort($config['proxyarp']['proxyarpnet'], "proxyarpcmp"); -} - -function passthrumacs_sort() { - global $g, $config; - - function passthrumacscmp($a, $b) { - return strcmp($a['mac'], $b['mac']); - } - - usort($config['captiveportal']['passthrumac'],"passthrumacscmp"); -} - -function cpelements_sort() { - global $g, $config; - - function cpelementscmp($a, $b) { - return strcasecmp($a['name'], $b['name']); - } - - usort($config['captiveportal']['element'],"cpelementscmp"); -} - -function allowedips_sort() { - global $g, $config; - - function allowedipscmp($a, $b) { - return strcmp($a['ip'], $b['ip']); - } - - usort($config['captiveportal']['allowedip'],"allowedipscmp"); -} - -function wol_sort() { - global $g, $config; - - function wolcmp($a, $b) { - return strcmp($a['descr'], $b['descr']); - } - - usort($config['wol']['wolentry'], "wolcmp"); -} - function gentitle($title) { global $navlevelsep; if(!is_array($title)) @@ -895,16 +595,6 @@ function is_specialnet($net) { return false; } -function ipsec_ca_sort() { - global $g, $config; - - function ipseccacmp($a, $b) { - return strcmp($a['ident'], $b['ident']); - } - - usort($config['ipsec']['cacert'], "ipseccacmp"); -} - //function to create widget tabs when called function display_widget_tabs(& $tab_array) { echo "<div id='tabs'>"; diff --git a/usr/local/www/services_captiveportal_filemanager.php b/usr/local/www/services_captiveportal_filemanager.php index 3466f77..898323b 100755 --- a/usr/local/www/services_captiveportal_filemanager.php +++ b/usr/local/www/services_captiveportal_filemanager.php @@ -36,6 +36,15 @@ ##|*MATCH=services_captiveportal_filemanager.php* ##|-PRIV +function cpelements_sort() { + global $g, $config; + + function cpelementscmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['captiveportal']['element'],"cpelementscmp"); +} $pgtitle = array("Services","Captive portal"); diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php index 1296909..093c3a7 100755 --- a/usr/local/www/services_captiveportal_ip.php +++ b/usr/local/www/services_captiveportal_ip.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); if (!is_array($config['captiveportal']['allowedip'])) $config['captiveportal']['allowedip'] = array(); -allowedips_sort(); $a_allowedips = &$config['captiveportal']['allowedip'] ; if ($_POST) { diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 9efc033..19e2595 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -35,6 +35,15 @@ ##|*MATCH=services_captiveportal_ip_edit.php* ##|-PRIV +function allowedips_sort() { + global $g, $config; + + function allowedipscmp($a, $b) { + return strcmp($a['ip'], $b['ip']); + } + + usort($config['captiveportal']['allowedip'],"allowedipscmp"); +} $pgtitle = array("Services","Captive portal","Edit allowed IP address"); require("guiconfig.inc"); @@ -86,6 +95,7 @@ if ($_POST) { $ip['descr'] = $_POST['descr']; $ip['dir'] = $_POST['dir']; + allowedips_sort(); if (isset($id) && $a_allowedips[$id]) $a_allowedips[$id] = $ip; else diff --git a/usr/local/www/services_captiveportal_mac.php b/usr/local/www/services_captiveportal_mac.php index 0579749..5282b29 100755 --- a/usr/local/www/services_captiveportal_mac.php +++ b/usr/local/www/services_captiveportal_mac.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); if (!is_array($config['captiveportal']['passthrumac'])) $config['captiveportal']['passthrumac'] = array(); -passthrumacs_sort(); $a_passthrumacs = &$config['captiveportal']['passthrumac'] ; if ($_POST) { diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index 0b6b329..c4e138f 100755 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -35,6 +35,15 @@ ##|*MATCH=services_captiveportal_mac_edit.php* ##|-PRIV +function passthrumacs_sort() { + global $g, $config; + + function passthrumacscmp($a, $b) { + return strcmp($a['mac'], $b['mac']); + } + + usort($config['captiveportal']['passthrumac'],"passthrumacscmp"); +} $pgtitle = array("Services","Captive portal","Edit pass-through MAC address"); require("guiconfig.inc"); @@ -86,6 +95,7 @@ if ($_POST) { $mac['mac'] = $_POST['mac']; $mac['descr'] = $_POST['descr']; + passthrumacs_sort(); if (isset($id) && $a_passthrumacs[$id]) $a_passthrumacs[$id] = $mac; else diff --git a/usr/local/www/services_captiveportal_vouchers_edit.php b/usr/local/www/services_captiveportal_vouchers_edit.php index dff7cb3..701b4de 100644 --- a/usr/local/www/services_captiveportal_vouchers_edit.php +++ b/usr/local/www/services_captiveportal_vouchers_edit.php @@ -43,7 +43,6 @@ if (!is_array($config['voucher'])) { if (!is_array($config['voucher']['roll'])) { $config['voucher']['roll'] = array(); } -// captiveportal_users_sort(); $a_roll = &$config['voucher']['roll']; $id = $_GET['id']; diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 7856828..418c75a 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -143,7 +143,6 @@ if (is_array($config['dhcpd'][$if])){ $pconfig['netmask'] = $config['dhcpd'][$if]['netmask']; if (!is_array($config['dhcpd'][$if]['staticmap'])) $config['dhcpd'][$if]['staticmap'] = array(); - staticmaps_sort($if); $a_maps = &$config['dhcpd'][$if]['staticmap']; } diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php index b5718fa..2430dea 100755 --- a/usr/local/www/services_dhcp_edit.php +++ b/usr/local/www/services_dhcp_edit.php @@ -36,6 +36,16 @@ ##|*MATCH=services_dhcp_edit.php* ##|-PRIV +function staticmaps_sort($ifgui) { + global $g, $config; + + function staticmapcmp($a, $b) { + return ipcmp($a['ipaddr'], $b['ipaddr']); + } + + usort($config['dhcpd'][$ifgui]['staticmap'], "staticmapcmp"); +} + require_once('globals.inc'); if(!$g['services_dhcp_server_enable']) { @@ -138,6 +148,7 @@ if ($_POST) { $mapent['hostname'] = $_POST['hostname']; $mapent['descr'] = $_POST['descr']; + staticmaps_sort($if); if (isset($id) && $a_maps[$id]) $a_maps[$id] = $mapent; else diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php index 42482ac..55d433f 100755 --- a/usr/local/www/services_dnsmasq.php +++ b/usr/local/www/services_dnsmasq.php @@ -49,7 +49,6 @@ if (!is_array($config['dnsmasq']['hosts'])) if (!is_array($config['dnsmasq']['domainoverrides'])) $config['dnsmasq']['domainoverrides'] = array(); -hosts_sort(); $a_hosts = &$config['dnsmasq']['hosts']; $a_domainOverrides = &$config['dnsmasq']['domainoverrides']; diff --git a/usr/local/www/services_dnsmasq_edit.php b/usr/local/www/services_dnsmasq_edit.php index 93d2a06..c2df114 100755 --- a/usr/local/www/services_dnsmasq_edit.php +++ b/usr/local/www/services_dnsmasq_edit.php @@ -36,6 +36,18 @@ ##|*MATCH=services_dnsmasq_edit.php* ##|-PRIV +function hosts_sort() { + global $g, $config; + + if (!is_array($config['dnsmasq']['hosts'])) + return; + + function hostcmp($a, $b) { + return strcasecmp($a['host'], $b['host']); + } + + usort($config['dnsmasq']['hosts'], "hostcmp"); +} require("guiconfig.inc"); @@ -94,6 +106,7 @@ if ($_POST) { $hostent['ip'] = $_POST['ip']; $hostent['descr'] = $_POST['descr']; + hosts_sort(); if (isset($id) && $a_hosts[$id]) $a_hosts[$id] = $hostent; else diff --git a/usr/local/www/services_proxyarp.php b/usr/local/www/services_proxyarp.php index c93d51d..d02c2d6 100755 --- a/usr/local/www/services_proxyarp.php +++ b/usr/local/www/services_proxyarp.php @@ -44,7 +44,6 @@ require("guiconfig.inc"); if (!is_array($config['proxyarp']['proxyarpnet'])) { $config['proxyarp']['proxyarpnet'] = array(); } -proxyarp_sort(); $a_proxyarp = &$config['proxyarp']['proxyarpnet']; if ($_POST) { diff --git a/usr/local/www/services_proxyarp_edit.php b/usr/local/www/services_proxyarp_edit.php index b24f4b9..0e93924 100755 --- a/usr/local/www/services_proxyarp_edit.php +++ b/usr/local/www/services_proxyarp_edit.php @@ -36,6 +36,30 @@ ##|*MATCH=services_proxyarp_edit.php* ##|-PRIV +function proxyarp_sort() { + global $g, $config; + + function proxyarpcmp($a, $b) { + if (isset($a['network'])) + list($ast,$asn) = explode("/", $a['network']); + else if (isset($a['range'])) { + $ast = $a['range']['from']; + $asn = 32; + } + if (isset($b['network'])) + list($bst,$bsn) = explode("/", $b['network']); + else if (isset($b['range'])) { + $bst = $b['range']['from']; + $bsn = 32; + } + if (ipcmp($ast, $bst) == 0) + return ($asn - $bsn); + else + return ipcmp($ast, $bst); + } + + usort($config['proxyarp']['proxyarpnet'], "proxyarpcmp"); +} require("guiconfig.inc"); @@ -125,6 +149,7 @@ if ($_POST) { $arpent['network'] = $_POST['subnet'] . "/" . $_POST['subnet_bits']; $arpent['descr'] = $_POST['descr']; + proxyarp_sort(); if (isset($id) && $a_proxyarp[$id]) $a_proxyarp[$id] = $arpent; else diff --git a/usr/local/www/services_wol.php b/usr/local/www/services_wol.php index a04920b..89c3636 100755 --- a/usr/local/www/services_wol.php +++ b/usr/local/www/services_wol.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); if (!is_array($config['wol']['wolentry'])) { $config['wol']['wolentry'] = array(); } -wol_sort(); $a_wol = &$config['wol']['wolentry']; if($_GET['wakeall'] <> "") { diff --git a/usr/local/www/services_wol_edit.php b/usr/local/www/services_wol_edit.php index de0b3cd..30f710b 100755 --- a/usr/local/www/services_wol_edit.php +++ b/usr/local/www/services_wol_edit.php @@ -36,6 +36,15 @@ ##|*MATCH=services_wol_edit.php* ##|-PRIV +function wol_sort() { + global $g, $config; + + function wolcmp($a, $b) { + return strcmp($a['descr'], $b['descr']); + } + + usort($config['wol']['wolentry'], "wolcmp"); +} require("guiconfig.inc"); @@ -85,6 +94,7 @@ if ($_POST) { $wolent['mac'] = $_POST['mac']; $wolent['descr'] = $_POST['descr']; + wol_sort(); if (isset($id) && $a_wol[$id]) $a_wol[$id] = $wolent; else diff --git a/usr/local/www/system_firmware.php b/usr/local/www/system_firmware.php index b133334..c78a128 100755 --- a/usr/local/www/system_firmware.php +++ b/usr/local/www/system_firmware.php @@ -89,11 +89,11 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { } if ($mode) { if ($mode == "enable") { - exec_rc_script("/etc/rc.firmware enable"); + mwexec("/etc/rc.firmware enable"); conf_mount_rw(); mark_subsystem_dirty('firmware'); } else if ($mode == "disable") { - exec_rc_script("/etc/rc.firmware disable"); + mwexec("/etc/rc.firmware disable"); conf_mount_ro(); clear_subsystem_dirty('firmware'); } else if ($mode == "upgrade") { @@ -104,7 +104,7 @@ if ($_POST && !is_subsystem_dirty('firmwarelock')) { else if (!file_exists($_FILES['ulfile']['tmp_name'])) { /* probably out of memory for the MFS */ $input_errors[] = "Image upload failed (out of memory?)"; - exec_rc_script("/etc/rc.firmware disable"); + mwexec("/etc/rc.firmware disable"); clear_subsystem_dirty('firmware'); } else { /* move the image so PHP won't delete it */ diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php index 65c894f..b4ad6e9 100755 --- a/usr/local/www/system_firmware_auto.php +++ b/usr/local/www/system_firmware_auto.php @@ -177,7 +177,7 @@ if($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) { } else { update_output_window("{$g['product_name']} is now upgrading.\\n\\nThe firewall will reboot once the operation is completed."); echo "\n<script language=\"JavaScript\">document.progressbar.style.visibility='hidden';\n</script>"; - exec_rc_script_async("{$external_upgrade_helper_text}"); + mwexec("nohup {$external_upgrade_helper_text}"); } /* diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php index 3b202f8..2b30626 100644 --- a/usr/local/www/system_groupmanager.php +++ b/usr/local/www/system_groupmanager.php @@ -49,7 +49,6 @@ $pgtitle = array("System", "Group manager"); if (!is_array($config['system']['group'])) $config['system']['group'] = array(); -admin_groups_sort(); $a_group = &$config['system']['group']; $id = $_GET['id']; diff --git a/usr/local/www/system_groupmanager_addprivs.php b/usr/local/www/system_groupmanager_addprivs.php index 9e625c5..98736a8 100644 --- a/usr/local/www/system_groupmanager_addprivs.php +++ b/usr/local/www/system_groupmanager_addprivs.php @@ -35,6 +35,18 @@ ##|*MATCH=system_groupmanager_addprivs.php* ##|-PRIV +function admin_groups_sort() { + global $g, $config; + + if (!is_array($config['system']['group'])) + return; + + function cpusercmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['system']['group'], "cpusercmp"); +} require("guiconfig.inc"); @@ -88,6 +100,8 @@ if ($_POST) { local_user_set($user); } + admin_groups_sort(); + $retval = write_config(); $savemsg = get_std_save_message($retval); diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php index cea51b9..a142a3a 100755 --- a/usr/local/www/system_routes.php +++ b/usr/local/www/system_routes.php @@ -45,7 +45,6 @@ if (!is_array($config['staticroutes']['route'])) if (!is_array($config['gateways']['gateway_item'])) $config['gateways']['gateway_item'] = array(); -staticroutes_sort(); $a_routes = &$config['staticroutes']['route']; $a_gateways = &$config['gateways']['gateway_item']; $changedesc = "Static Routes: "; diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 28c9edd..e83b88a 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -36,6 +36,18 @@ ##|*MATCH=system_routes_edit.php* ##|-PRIV +function staticroutes_sort() { + global $g, $config; + + if (!is_array($config['staticroutes']['route'])) + return; + + function staticroutecmp($a, $b) { + return strcmp($a['network'], $b['network']); + } + + usort($config['staticroutes']['route'], "staticroutecmp"); +} require("guiconfig.inc"); @@ -112,6 +124,7 @@ if ($_POST) { $route['gateway'] = $_POST['gateway']; $route['descr'] = $_POST['descr']; + staticroutes_sort(); if (isset($id) && $a_routes[$id]) $a_routes[$id] = $route; else diff --git a/usr/local/www/system_usermanager.php b/usr/local/www/system_usermanager.php index e8b4d3d..931721f 100644 --- a/usr/local/www/system_usermanager.php +++ b/usr/local/www/system_usermanager.php @@ -57,7 +57,6 @@ if (isAllowedPage("system_usermanager")) { if (!is_array($config['system']['user'])) $config['system']['user'] = array(); - admin_users_sort(); $a_user = &$config['system']['user']; if ($_GET['act'] == "deluser") { diff --git a/usr/local/www/system_usermanager_addprivs.php b/usr/local/www/system_usermanager_addprivs.php index 85238c3..123875b 100644 --- a/usr/local/www/system_usermanager_addprivs.php +++ b/usr/local/www/system_usermanager_addprivs.php @@ -35,6 +35,18 @@ ##|*MATCH=system_usermanager_addprivs.php* ##|-PRIV +function admin_users_sort() { + global $g, $config; + + if (!is_array($config['system']['user'])) + return; + + function cpusercmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['system']['user'], "cpusercmp"); +} require("guiconfig.inc"); @@ -87,6 +99,7 @@ if ($_POST) { else $a_user['priv'] = array_merge($a_user['priv'], $pconfig['sysprivs']); + admin_users_sort(); local_user_set($a_user); $retval = write_config(); $savemsg = get_std_save_message($retval); diff --git a/usr/local/www/vpn_l2tp_users.php b/usr/local/www/vpn_l2tp_users.php index 9bd96b1..7aa358d 100644 --- a/usr/local/www/vpn_l2tp_users.php +++ b/usr/local/www/vpn_l2tp_users.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); if (!is_array($config['l2tp']['user'])) { $config['l2tp']['user'] = array(); } -l2tp_users_sort(); $a_secret = &$config['l2tp']['user']; if ($_POST) { diff --git a/usr/local/www/vpn_l2tp_users_edit.php b/usr/local/www/vpn_l2tp_users_edit.php index 5502015..4b5a8f5 100644 --- a/usr/local/www/vpn_l2tp_users_edit.php +++ b/usr/local/www/vpn_l2tp_users_edit.php @@ -37,6 +37,19 @@ $pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("User"),gettext("Edit")); +function l2tp_users_sort() { + global $g, $config; + + if (!is_array($config['l2tp']['user'])) + return; + + function usercmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['l2tp']['user'], "usercmp"); +} + require("guiconfig.inc"); if (!is_array($config['l2tp']['user'])) { @@ -110,6 +123,7 @@ if ($_POST) { if ($_POST['passwordfld']) $secretent['password'] = $_POST['passwordfld']; + l2tp_users_sort(); if (isset($id) && $a_secret[$id]) $a_secret[$id] = $secretent; else diff --git a/usr/local/www/vpn_pppoe_users.php b/usr/local/www/vpn_pppoe_users.php index e0ac942..b92fcef 100755 --- a/usr/local/www/vpn_pppoe_users.php +++ b/usr/local/www/vpn_pppoe_users.php @@ -41,7 +41,6 @@ require("guiconfig.inc"); if (!is_array($config['pppoe']['user'])) { $config['pppoe']['user'] = array(); } -pppoe_users_sort(); $a_secret = &$config['pppoe']['user']; if ($_POST) { diff --git a/usr/local/www/vpn_pppoe_users_edit.php b/usr/local/www/vpn_pppoe_users_edit.php index 816772b..ce43e08 100755 --- a/usr/local/www/vpn_pppoe_users_edit.php +++ b/usr/local/www/vpn_pppoe_users_edit.php @@ -35,6 +35,18 @@ ##|*MATCH=vpn_pppoe_users_edit.php* ##|-PRIV +function pppoe_users_sort() { + global $g, $config; + + if (!is_array($config['pppoe']['user'])) + return; + + function usercmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['pppoe']['user'], "usercmp"); +} require("guiconfig.inc"); @@ -103,6 +115,7 @@ if ($_POST) { if ($_POST['password']) $secretent['password'] = $_POST['password']; + pppoe_users_sort(); if (isset($id) && $a_secret[$id]) $a_secret[$id] = $secretent; else diff --git a/usr/local/www/vpn_pptp_users.php b/usr/local/www/vpn_pptp_users.php index bc5079f..31aa0ad 100755 --- a/usr/local/www/vpn_pptp_users.php +++ b/usr/local/www/vpn_pptp_users.php @@ -41,7 +41,6 @@ require("guiconfig.inc"); if (!is_array($config['pptpd']['user'])) { $config['pptpd']['user'] = array(); } -pptpd_users_sort(); $a_secret = &$config['pptpd']['user']; if ($_POST) { diff --git a/usr/local/www/vpn_pptp_users_edit.php b/usr/local/www/vpn_pptp_users_edit.php index b3299ca..07961da 100755 --- a/usr/local/www/vpn_pptp_users_edit.php +++ b/usr/local/www/vpn_pptp_users_edit.php @@ -36,6 +36,19 @@ ##|-PRIV +function pptpd_users_sort() { + global $g, $config; + + if (!is_array($config['ppptpd']['user'])) + return; + + function usercmp($a, $b) { + return strcasecmp($a['name'], $b['name']); + } + + usort($config['pptpd']['user'], "usercmp"); +} + require("guiconfig.inc"); if (!is_array($config['pptpd']['user'])) { @@ -103,6 +116,7 @@ if ($_POST) { if ($_POST['password']) $secretent['password'] = $_POST['password']; + pptpd_users_sort(); if (isset($id) && $a_secret[$id]) $a_secret[$id] = $secretent; else |