/web/acc/manager/htdocs/group_new.php |
---|
6,14 → 6,22 |
include("../lib/langues.php"); |
//update Filter-Id for protocol filtering |
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id'])) |
if (isset($_POST['Filter-Proto']) && isset($_POST['Status-Open-Required']) && isset($_POST['Filter-Id'])) |
{ |
$upId = (int)$_POST['Filter-Proto']; |
$downId = (int)$_POST['Filter-Id']; |
$upId = $upId+$downId; |
$upId = str_pad($upId, 8, '0', STR_PAD_LEFT); |
$_POST['Filter-Id'] = $upId; |
$filterId = (int)$_POST['Filter-Id']; |
$FilterProto = (int)$_POST['Filter-Proto']; |
$statusOpenRequired = (int)($_POST['Status-Open-Required'].'000'); |
$filterId = $filterId+$FilterProto+$statusOpenRequired; |
$_POST['Filter-Id'] = str_pad($filterId, 8, '0', STR_PAD_LEFT); |
} |
if (isset($_POST['Status-Open-Required'])) { |
if ($_POST['Status-Open-Required'] === '0') { |
$_POST['Idle-Timeout'] = '600'; // 10 minutes |
} else { |
$_POST['Idle-Timeout'] = ''; |
} |
$_POST['Idle-Timeout_op'] = '='; |
} |
require('/etc/freeradius-web/config.php'); |
172,6 → 180,7 |
EOM; |
foreach($show_attrs as $key => $desc){ |
if ($key === 'Idle-Timeout') continue; |
$name = $attrmap["$key"]; |
if ($name == 'none') |
continue; |
434,7 → 443,21 |
<option value=\"01000000\" >$l_proto_2</option> |
<option value=\"00100000\" >$l_proto_3</option> |
</select></td></tr>"; |
// User need to keep status page open |
print <<<EOM |
<tr class="advanced-field"> |
<td class="etiquette" colspan="$colspan"> |
<a href="help/statusOpenRequired_help.html" target=help onclick="window.open('help/statusOpenRequired_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_statusOpenRequired</font></a> |
</td> |
EOM; |
echo "<td width=20> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"1\" checked>$l_yes</label> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"0\">$l_no</label> |
</select></td> |
</tr>"; |
echo "</table><BR>"; |
} |
if ($create == 1) |
echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>"; |
/web/acc/manager/htdocs/help/statusOpenRequired_help.html |
---|
0,0 → 1,27 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<HTML> |
<HEAD> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<title>Help Page</title> |
<link rel="stylesheet" href="/css/style.css" type="text/css"> |
</HEAD> |
<body> |
<center> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>Déconnexion page status fermée - Disconnection status page closed</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td valign="middle" align="left"> |
Cet attribut définit si l'usager doit laisser la page status ouverte durant sa session. Dans le cas contraire, il sera déconnecté.<br> |
Si cet attribut n'est activé, l'état de l'activité de l'usager sera défini en fonction de l'activité réseau de sa machine de consultation. |
<HR> |
This attribute defines whether the user should leave the status page open during his session. If not, it will be disconnected.<br> |
If this attribute is not activated, the activity status of the user will be defined according to the network activity of his lookup machine. |
</td></tr> |
</table> |
<br> |
<a href="javascript:window.close();"><b>Fermer / Close</b></a> |
</center> |
</body> |
</html> |
/web/acc/manager/htdocs/user_edit.php |
---|
6,14 → 6,22 |
include("../lib/langues.php"); |
//update Filter-Id for protocol filtering |
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id0'])) |
if (isset($_POST['Filter-Proto']) && isset($_POST['Status-Open-Required']) && isset($_POST['Filter-Id0'])) |
{ |
$upId = (int)$_POST['Filter-Proto']; |
$downId = (int)$_POST['Filter-Id0']; |
$upId = $upId+$downId; |
$upId = str_pad($upId, 8, '0', STR_PAD_LEFT); |
$_POST['Filter-Id0'] = $upId; |
$filterId = (int)$_POST['Filter-Id0']; |
$FilterProto = (int)$_POST['Filter-Proto']; |
$statusOpenRequired = (int)($_POST['Status-Open-Required'].'000'); |
$filterId = $filterId+$FilterProto+$statusOpenRequired; |
$_POST['Filter-Id0'] = str_pad($filterId, 8, '0', STR_PAD_LEFT); |
} |
if (isset($_POST['Status-Open-Required'])) { |
if ($_POST['Status-Open-Required'] === '0') { |
$_POST['Idle-Timeout0'] = '600'; // 10 minutes |
} else { |
$_POST['Idle-Timeout0'] = ''; |
} |
$_POST['Idle-Timeout0_op'] = '='; |
} |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
189,6 → 197,7 |
$login = $login_saved; |
foreach ($show_attrs as $key => $desc) { |
if ($key === 'Idle-Timeout') continue; |
$name = $attrmap["$key"]; |
$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : ''; |
if ($name == 'none') |
303,6 → 312,12 |
$grp_proto = $l_proto_0; |
} |
if ($val[4] === '1') { |
$grp_statusOpenRequired = $l_yes; |
} else { |
$grp_statusOpenRequired = $l_no; |
} |
break; |
} |
} |
370,6 → 385,7 |
} |
foreach($show_attrs as $key => $desc){ |
if ($key === 'Idle-Timeout') continue; |
$name = $attrmap["$key"]; |
$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : ''; |
if ($name == 'none') |
739,7 → 755,28 |
</select></td> |
</tr>"; |
// User need to keep status page open |
print <<<EOM |
<tr class="advanced-field"> |
<td class="etiquette" colspan="$colspan"> |
<a href="help/statusOpenRequired_help.html" target=help onclick="window.open('help/statusOpenRequired_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_statusOpenRequired</font></a> |
</td> |
EOM; |
if(isset($member_groups) && $user_type != 'group') { |
echo "<td bgcolor=\"#BEBEBE\">$grp_statusOpenRequired</td>"; |
} |
if ($val[4] === '1') { |
$selected = true; |
} else { |
$selected = false; |
} |
echo "<td width=20> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"1\"".(($selected) ? ' checked' : '').">$l_yes</label> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"0\"".((!$selected) ? ' checked' : '').">$l_no</label> |
</select></td> |
</tr>"; |
if ($user_type != 'group') { |
echo <<<EOM |
<tr> |
/web/acc/manager/htdocs/user_new.php |
---|
5,6 → 5,26 |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
//update Filter-Id for protocol filtering |
if (isset($_POST['Filter-Proto']) && isset($_POST['Status-Open-Required']) && isset($_POST['Filter-Id'])) |
{ |
$filterId = (int)$_POST['Filter-Id']; |
$FilterProto = (int)$_POST['Filter-Proto']; |
$statusOpenRequired = (int)($_POST['Status-Open-Required'].'000'); |
$filterId = $filterId+$FilterProto+$statusOpenRequired; |
$_POST['Filter-Id'] = str_pad($filterId, 8, '0', STR_PAD_LEFT); |
} |
if (isset($_POST['Status-Open-Required'])) { |
if ($_POST['Status-Open-Required'] === '0') { |
$_POST['Idle-Timeout'] = '600'; // 10 minutes |
} else { |
$_POST['Idle-Timeout'] = ''; |
} |
$_POST['Idle-Timeout_op'] = '='; |
} |
require('/etc/freeradius-web/config.php'); |
if(!isset($create)) $create=0; |
if(!isset($show)) $show=0; |
if(!isset($login)) $login = ''; |
14,17 → 34,6 |
if(!isset($selected)) $selected = array(); |
if(!isset($selected['='])) $selected['='] = ''; |
//update Filter-Id for protocol filtering |
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id'])) |
{ |
$upId = (int)$_POST['Filter-Proto']; |
$downId = (int)$_POST['Filter-Id']; |
$upId = $upId+$downId; |
$upId = str_pad($upId, 8, '0', STR_PAD_LEFT); |
$_POST['Filter-Id'] = $upId; |
} |
require('/etc/freeradius-web/config.php'); |
require('../lib/attrshow.php'); |
require('../lib/defaults.php'); |
246,6 → 255,7 |
EOM; |
} |
foreach ($show_attrs as $key => $desc) { |
if ($key === 'Idle-Timeout') continue; |
$name = $attrmap["$key"]; |
if ($name == 'none') |
continue; |
508,7 → 518,21 |
<option value=\"00100000\" >$l_proto_3</option> |
</select></td></tr>"; |
// User need to keep status page open |
print <<<EOM |
<tr class="advanced-field"> |
<td class="etiquette" colspan="$colspan"> |
<a href="help/statusOpenRequired_help.html" target=help onclick="window.open('help/statusOpenRequired_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_statusOpenRequired</font></a> |
</td> |
EOM; |
echo "<td width=20> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"1\" checked>$l_yes</label> |
<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"0\">$l_no</label> |
</select></td> |
</tr>"; |
print <<<EOM |
<tr> |
<td class="etiquette" colspan="$colspan"> |
$l_lang_ticket |
/web/acc/manager/lib/langues.php |
---|
130,6 → 130,9 |
$l_empty="Vide"; |
$l_ipAddress="Adresse IP"; |
$l_rule="Règle"; |
$l_statusOpenRequired="Déconnexion page status fermée"; |
$l_yes="Oui"; |
$l_no="Non"; |
break; |
default : |
//English |
253,6 → 256,9 |
$l_empty="Empty"; |
$l_ipAddress="IP address"; |
$l_rule="Rule"; |
$l_statusOpenRequired="Disconnection status page closed"; |
$l_yes="Yes"; |
$l_no="No"; |
break; |
} |
?> |
/web/status.php |
---|
311,35 → 311,8 |
$cn = (!empty($row['name'])) ? $row['name'] : $user[5]; |
} |
} |
// Store the user @IP in a file (to test if he is still active). |
$filename = '/var/tmp/havp/current_users.txt'; |
if (file_exists($filename)) { |
$current_users_file = fopen($filename, 'r'); |
$content = file($filename); |
fclose($current_users_file); |
if (empty($content)) { |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL); |
} else { |
$change_me = 1; // avoid duplicate user @IP |
// if we found duplicate IP, we will not write user @IP (just set change_me = 0) |
foreach ($content as $line) { |
$line = preg_replace('/\s+/', '', $line); |
if ($line === $_SERVER['REMOTE_ADDR']) { |
$change_me = 0; |
} |
} |
// if user @IP does not exist, we write it |
if ($change_me) { |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL, FILE_APPEND); |
} |
} |
} else { |
// we create filename and we write user @IP. |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL); |
} |
} |
} |
// Cleaning the cache |
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT'); |
/web/still_connected.php |
---|
2,38 → 2,26 |
//store user @IP who can join this page (still have their status.php tab open) in a file. |
$filename='/var/tmp/havp/current_users.txt'; |
$change_me = 1; |
$user_ip = $_SERVER['REMOTE_ADDR']; |
//check if file exists |
if(file_exists($filename)){ |
$current_users_file = fopen($filename, "r"); |
$content = file($filename); |
fclose($current_users_file); |
// if file is empty, we put user @IP in it. |
if(empty($content)) |
{ |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL); |
if ((!file_exists($filename)) || (filesize($filename) === 0)) { |
// Creating file and write user @IP. |
file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL); |
} else { |
// If we found duplicate user IP, it will not be writen again |
$found = false; |
$fh = fopen($filename, 'r'); |
while (!feof($fh)) { |
$line = fgets($fh, 1024); |
if (preg_match('/^'.preg_quote($user_ip).':/', $line)) { |
$found = true; |
break; |
} |
else |
{ |
// if we found duplicate user IP, it will not be writen again |
foreach($content as $line){ |
$line = preg_replace('/\s+/', '', $line); #remove whitespace |
if($line == $_SERVER['REMOTE_ADDR']) |
{ |
$change_me = 0; |
} |
} |
fclose($fh); |
// else we write user IP in the file |
if($change_me) |
{ |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL , FILE_APPEND); |
if (!$found) { |
file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL, FILE_APPEND); |
} |
} |
} |
else |
{ |
//The file doesn't exist. We create it and write user @IP. |
file_put_contents($filename, $_SERVER['REMOTE_ADDR'].PHP_EOL); |
} |
?> |