Project

General

Profile

« Previous | Next » 

Revision 43a68abc

Added by Jim Pingle over 14 years ago

Fix clearing of PPTP/PPPoE/L2TP server raw logs. Fixes #1340

View differences:

usr/local/www/diag_logs_vpn.php
49 49
if (!$nentries)
50 50
	$nentries = 50;
51 51

  
52
$vpntype = (htmlspecialchars($_GET['vpntype'])) ? htmlspecialchars($_GET['vpntype']) : "pptp";
53
$mode = (htmlspecialchars($_GET['mode'])) ? htmlspecialchars($_GET['mode']) : "login";
52
if (htmlspecialchars($_POST['vpntype']))
53
	$vpntype = htmlspecialchars($_POST['vpntype']);
54
elseif (htmlspecialchars($_GET['vpntype']))
55
	$vpntype = htmlspecialchars($_GET['vpntype']);
56
else
57
	$vpntype = "pptp";
58

  
59
if (htmlspecialchars($_POST['mode']))
60
	$mode = htmlspecialchars($_POST['mode']);
61
elseif (htmlspecialchars($_GET['mode']))
62
	$mode = htmlspecialchars($_GET['mode']);
63
else
64
	$mode = "login";
65

  
66
switch ($vpntype) {
67
	case 'pptp':
68
		$logname = "pptps";
69
		break;
70
	case 'poes':
71
		$logname = "poes";
72
		break;
73
	case 'l2tp':
74
		$logname = "l2tps";
75
		break;
76
}
54 77

  
55
if ($_POST['clear']) 
56
	clear_log_file("/var/log/vpn.log");
78
if ($_POST['clear']) {
79
	if ($mode != "raw")
80
		clear_log_file("/var/log/vpn.log");
81
	else
82
		clear_log_file("/var/log/{$logname}.log");
83
}
57 84

  
58 85
function dump_clog_vpn($logfile, $tail) {
59 86
	global $g, $config, $vpntype;
......
151 178
		</tr>
152 179
			<?php dump_clog_vpn("/var/log/vpn.log", $nentries); ?>
153 180
		<?php else: 
154
			switch ($vpntype) {
155
				case 'pptp':
156
					$logname = "pptps";
157
					break;
158
				case 'poes':
159
					$logname = "poes";
160
					break;
161
				case 'l2tp':
162
					$logname = "l2tps";
163
					break;
164
			}
165 181
			dump_clog("/var/log/{$logname}.log", $nentries);
166 182
		      endif; ?>
167 183
	</table>
168 184
	<br />
169 185
	<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype;?>">
186
	<input type="hidden" name="mode" id="mode" value="<?=$mode;?>">
170 187
	<input name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log"); ?>">
171 188
	</form>
172 189
	</td>

Also available in: Unified diff