From e12b438b9c19e9dc3009344c487bd2bf72adb831 Mon Sep 17 00:00:00 2001 From: plumbeo Date: Tue, 20 Dec 2016 16:26:11 +0100 Subject: Captive Portal: convert active sessions table to a sortable table Convert the active sessions table in the captive portal status page to a sortable table and remove the old sorting code. The conversion fixes both sorting by ip address and by last activity time. --- src/usr/local/www/status_captiveportal.php | 95 ++++++++---------------------- 1 file changed, 26 insertions(+), 69 deletions(-) diff --git a/src/usr/local/www/status_captiveportal.php b/src/usr/local/www/status_captiveportal.php index 5c88bc2..cd4a702 100644 --- a/src/usr/local/www/status_captiveportal.php +++ b/src/usr/local/www/status_captiveportal.php @@ -66,33 +66,8 @@ if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid) && isset($_GET[ exit; } -function clientcmp($a, $b) { - global $order; - return strcmp($a[$order], $b[$order]); -} - -$cp_status_orders = array('ip', 'mac', 'user', 'lastact', 'start'); if (!empty($cpzone)) { $cpdb = captiveportal_read_db(); - - if ($_GET['order']) { - /* If an invalid order was submitted, clear it. */ - if (!in_array($_GET['order'], $cp_status_orders)) { - unset($_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"); - } } $pgtitle = array(gettext("Status"), gettext("Captive Portal")); @@ -148,41 +123,30 @@ if (!empty($cpzone)): ?>

- - - - - - - - +
- - - - - - - -
+ + + + + + - + - - + + + + - - - + + - + + - - + + - + - - + + +
- -
- - +
} } ?>   - -   - - - + - - - - "> -
+ "> +
@@ -240,8 +199,6 @@ endif;
- - -- cgit v1.1