From deb4fcb23a39d56c9aa6efe49f28323885ad89bd Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 27 Apr 2005 23:25:28 +0000 Subject: * Add carp enable disable toggle feature (and make it work) * Center enable disable button correctly --- packages/carp_status.php | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'packages/carp_status.php') diff --git a/packages/carp_status.php b/packages/carp_status.php index 55eaad2b..f6f085b6 100644 --- a/packages/carp_status.php +++ b/packages/carp_status.php @@ -35,20 +35,36 @@ function gentitle_pkg($pgname) { return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname; } +/* grab the current status of carp */ +$status = `/sbin/sysctl net.inet.carp.allow`; +$status = str_replace("\n","",$status); +$status = str_replace(" ","",$status); +$status = split(":", $status); + $carp_counter=0; if($_POST['disablecarp'] <> "") { - if($config['installedpackages']['carpsettings']['config'] != "") { - foreach($config['installedpackages']['carpsettings']['config'] as $carp) { - $carp_counter++; - } - } - if($carp_counter > 0) { - for($x=0; $x<$carp_counter; $x++) { + $status = `/sbin/sysctl net.inet.carp.allow`; + $status = str_replace("\n","",$status); + $status = str_replace(" ","",$status); + $status = split(":", $status); + if($status[1] == "1") { + $savemsg = "{$carp_counter} items have been disabled."; + $carp_counter=find_number_of_created_carp_interfaces(); + for($x=0; $x<$carp_counter; $x++) mwexec("/sbin/ifconfig carp{$x} delete"); - } + mwexec("/sbin/sysctl net.inet.carp.allow=0"); + } else { + $savemsg = "Carp has been enabled."; + mwexec("/sbin/sysctl net.inet.carp.allow=1"); + mwexec("/usr/local/pkg/pf/carp.sh"); } } +/* grab the current status of carp */ +$status = `/sbin/sysctl net.inet.carp.allow`; +$status = str_replace("\n","",$status); +$status = str_replace(" ","",$status); +$status = split(":", $status); ?> @@ -79,7 +95,14 @@ include("fbegin.inc"); - +
"; + } else { + echo "
"; + } +?> + -- cgit v1.2.3