Revision 7eed2174
Added by Cyrill B over 12 years ago
usr/local/www/widgets/widgets/captive_portal_status.widget.php | ||
---|---|---|
44 | 44 |
|
45 | 45 |
<?php |
46 | 46 |
|
47 |
if ($_GET['act'] == "del") { |
|
47 |
if (($_GET['act'] == "del") && (!empty($_GET['zone']))) { |
|
48 |
$cpzone = $_GET['zone']; |
|
48 | 49 |
captiveportal_disconnect_client($_GET['id']); |
49 | 50 |
} |
50 | 51 |
|
... | ... | |
59 | 60 |
$config['captiveportal'] = array(); |
60 | 61 |
$a_cp =& $config['captiveportal']; |
61 | 62 |
|
62 |
$cpdb = array(); |
|
63 |
$cpdb_all = array();
|
|
63 | 64 |
|
64 | 65 |
foreach ($a_cp as $cpzone => $cp) { |
65 |
if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.db")) { |
|
66 |
$captiveportallck = lock('captiveportaldb'); |
|
67 |
$cpcontents = file("{$g['vardb_path']}/captiveportal_{$cpzone}.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
68 |
unlock($captiveportallck); |
|
69 |
foreach ($cpcontents as $cpcontent) { |
|
70 |
$cpent = explode(",", $cpcontent); |
|
71 |
$sessionid = $cpent[5]; |
|
72 |
if ($_GET['showact']) |
|
73 |
$cpent[5] = captiveportal_get_last_activity($cpent[2]); |
|
74 |
$cpdb[$sessionid] = $cpent; |
|
75 |
} |
|
66 |
$cpdb = captiveportal_read_db(); |
|
67 |
foreach ($cpdb as $cpent) { |
|
68 |
$cpent[10] = $cpzone; |
|
69 |
if ($_GET['showact']) |
|
70 |
$cpent[11] = captiveportal_get_last_activity($cpent[2]); |
|
71 |
$cpdb_all[] = $cpent; |
|
76 | 72 |
} |
77 | 73 |
} |
78 | 74 |
|
... | ... | |
85 | 81 |
$order = 4; |
86 | 82 |
else if ($_GET['order'] == "lastact") |
87 | 83 |
$order = 5; |
84 |
else if ($_GET['order'] == "zone") |
|
85 |
$order = 10; |
|
88 | 86 |
else |
89 | 87 |
$order = 0; |
90 |
usort($cpdb, "clientcmp"); |
|
88 |
usort($cpdb_all, "clientcmp");
|
|
91 | 89 |
} |
92 | 90 |
?> |
93 | 91 |
<table class="sortable" name="sortabletable" id="sortabletable" width="100%" border="0" cellpadding="0" cellspacing="0"> |
... | ... | |
100 | 98 |
<td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>"><?=gettext("Last activity");?></a></td> |
101 | 99 |
<?php endif; ?> |
102 | 100 |
</tr> |
103 |
<?php foreach ($cpdb as $sid => $cpent): ?>
|
|
101 |
<?php foreach ($cpdb_all as $cpent): ?>
|
|
104 | 102 |
<tr> |
105 | 103 |
<td class="listlr"><?=$cpent[2];?></td> |
106 | 104 |
<td class="listr"><?=$cpent[3];?> </td> |
107 | 105 |
<td class="listr"><?=$cpent[4];?> </td> |
108 | 106 |
<?php if ($_GET['showact']): ?> |
109 | 107 |
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> |
110 |
<td class="listr"><?php if ($cpent[5]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[5]));?></td>
|
|
108 |
<td class="listr"><?php if ($cpent[11] && ($cpent[11] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[11]));?></td>
|
|
111 | 109 |
<?php endif; ?> |
112 | 110 |
<td valign="middle" class="list" nowrap> |
113 |
<a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&id=<?=$sid;?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
|
111 |
<a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
|
114 | 112 |
</tr> |
115 | 113 |
<?php endforeach; ?> |
116 | 114 |
</table> |
Also available in: Unified diff
Fix: Captive Portal status widget