diff options
author | Ermal <eri@pfsense.org> | 2010-11-03 13:25:54 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-11-03 13:25:54 +0000 |
commit | 9cb94dd46bf45155d55585e0f8c3e432705d8ca2 (patch) | |
tree | 297616ba01a3996ae2461fc495dbdb031451e7ef /usr | |
parent | 729931965e68a3c8ab1de307446410f6810c4433 (diff) | |
download | pfsense-9cb94dd46bf45155d55585e0f8c3e432705d8ca2.zip pfsense-9cb94dd46bf45155d55585e0f8c3e432705d8ca2.tar.gz |
Ticket #980. Bring CP widget up to date. Also bind lighty for CP to 127.0.0.1 it should not be accessible otherwise.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/status_captiveportal.php | 6 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/captive_portal_status.widget.php | 56 |
2 files changed, 33 insertions, 29 deletions
diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index 292b9ea..8000281 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -74,9 +74,8 @@ if (file_exists("{$g['vardb_path']}/captiveportal.db")) { $captiveportallck = lock('captiveportal'); $cpcontents = file("/var/db/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); unlock($captiveportallck); -} else { +} else $cpcontents = array(); -} $concurrent = count($cpcontents); @@ -84,7 +83,7 @@ foreach ($cpcontents as $cpcontent) { $cpent = explode(",", $cpcontent); if ($_GET['showact']) $cpent[5] = captiveportal_get_last_activity($cpent[2]); - $cpdb[] = $cpent; + $cpdb[] = $cpent; } if ($_GET['order']) { if ($_GET['order'] == "ip") @@ -99,6 +98,7 @@ if ($_GET['order']) { $order = 0; usort($cpdb, "clientcmp"); } + ?> <?php if (isset($config['voucher']['enable'])): ?> diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 1b74d26..1ca7007 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +require_once("globals.inc"); require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); @@ -53,49 +54,53 @@ function clientcmp($a, $b) { } $cpdb = array(); -if (file_exists("{$g['vardb_path']}/captiveportal.db")) +if (file_exists("{$g['vardb_path']}/captiveportal.db")) { + $captiveportallck = lock('captiveportal'); $cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); -else + unlock($captiveportallck); +} else $cpcontents = array(); $concurrent = count($cpcontents); -if ($fp) { - - foreach ($cpcontents as $cpcontent) { - $cpent = explode(",", $cpcontent); - if ($_GET['showact']) - $cpent[5] = captiveportal_get_last_activity($cpent[2]); - $cpdb[] = $cpent; - } +foreach ($cpcontents as $cpcontent) { + $cpent = explode(",", $cpcontent); + if ($_GET['showact']) + $cpent[5] = captiveportal_get_last_activity($cpent[2]); + $cpdb[] = $cpent; +} - if ($_GET['order']) { - if ($_GET['order'] == "ip") - $order = 2; - else if ($_GET['order'] == "mac") - $order = 3; - else if ($_GET['order'] == "user") - $order = 4; - else if ($_GET['order'] == "lastact") - $order = 5; - else - $order = 0; - usort($cpdb, "clientcmp"); - } +if ($_GET['order']) { + if ($_GET['order'] == "ip") + $order = 2; + else if ($_GET['order'] == "mac") + $order = 3; + else if ($_GET['order'] == "user") + $order = 4; + else if ($_GET['order'] == "lastact") + $order = 5; + else + $order = 0; + usort($cpdb, "clientcmp"); } ?> <table class="sortable" name="sortabletable" id="sortabletable" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="listhdrr"><a href="?order=ip&showact=<?=$_GET['showact'];?>">IP address</a></td> <td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>">MAC address</a></td> - <td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>">Session start</a></td> + <td class="listhdrr"><a href="?order=user&showact=<?=$_GET['showact'];?>"><?=gettext("Username");?></a></td> + <?php if ($_GET['showact']): ?> + <td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td> + <td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>"><?=gettext("Last activity");?></a></td> + <?php endif; ?> </tr> <?php foreach ($cpdb as $cpent): ?> <tr> <td class="listlr"><?=$cpent[2];?></td> <td class="listr"><?=$cpent[3];?> </td> - <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> + <td class="listr"><?=$cpent[4];?> </td> <?php if ($_GET['showact']): ?> + <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> <td class="listr"><?php if ($cpent[5]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[5]));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> @@ -103,4 +108,3 @@ if ($fp) { </tr> <?php endforeach; ?> </table> - |