array("name" => gettext("VPN Logins"),
"shortcut" => "poes"),
"poes" => array("name" => gettext("PPPoE Service"),
"shortcut" => "pppoes"),
"l2tps" => array("name" => gettext("L2TP Service"),
"shortcut" => "l2tps"),
);
// The logs to display are specified in a GET argument. Default to 'system' logs
if (!$_GET['logfile']) {
$logfile = 'vpn';
$vpntype = "poes";
} else {
$logfile = $_GET['logfile'];
$vpntype = $_GET['vpntype'];
if (!array_key_exists($logfile, $allowed_logs)) {
/* Do not let someone attempt to load an unauthorized log. */
$logfile = 'vpn';
$vpntype = "poes";
}
}
if ($vpntype == 'poes') { $allowed_logs['vpn']['name'] = gettext("PPPoE Logins"); }
if ($vpntype == 'l2tp') { $allowed_logs['vpn']['name'] = gettext("L2TP Logins"); }
// Log Filter Submit - VPN
log_filter_form_vpn_submit();
// Manage Log Section - Code
manage_log_code();
// Status Logs Common - Code
status_logs_common_code();
if ($filtertext) {
$filtertextmeta="?filtertext=$filtertext";
}
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("VPN"), gettext($allowed_logs[$logfile]["name"]));
include("head.inc");
if (!$input_errors && $savemsg) {
print_info_box($savemsg, 'success');
$manage_log_active = false;
}
// Tab Array
tab_array_logs_common();
// Manage Log - Section/Form
if ($system_logs_manage_log_form_hidden) {
manage_log_section();
}
// Filter Section/Form - VPN
filter_form_vpn();
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
if ($filterlogentries_submit) {
$filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
} else {
$filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext);
}
// Remove those not of the selected vpn type (poes / l2tp).
if ($logfile == "vpn") {
foreach ($filterlog as $key => $filterent) {
if (!preg_match('/' . $vpntype . '/', $filterent['type'])) {
unset($filterlog[$key]);
}
}
}
?>
=gettext("Time")?> |
=gettext("Action")?> |
=gettext("User")?> |
=gettext("IP Address")?> |
=htmlspecialchars($filterent['time'])?>
|
=htmlspecialchars($filterent['action'])?>
|
=htmlspecialchars($filterent['user'])?>
|
=htmlspecialchars($filterent['ip_address'])?>
|
=gettext("Time")?> |
=gettext("Type")?> |
=gettext("PID")?> |
=gettext("Log Message")?> |
=htmlspecialchars($filterent['time'])?>
|
=htmlspecialchars($filterent['type'])?>
|
=htmlspecialchars($filterent['pid'])?>
|
=htmlspecialchars($filterent['message'])?>
|
=gettext("Last ")?>=$nentries?> =gettext($allowed_logs[$logfile]["name"])?>=gettext(" log entries")?>
\n";
echo "" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . " | \n";
if ($llent[0] == "login") {
echo " | \n";
} else {
echo " | \n";
}
echo "" . htmlspecialchars($llent[3]) . " | \n";
echo "" . htmlspecialchars($llent[2]) . " | \n";
echo "\n";
}
return($rows);
}
?>
setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
$section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state);
if ($logfile == "vpn") {
$group = new Form_Group('');
$group->add(new Form_Input(
'filterlogentries_time',
null,
'text',
$filterfieldsarray['time']
))->setWidth(3)->setHelp('Time');
$group->add(new Form_Input(
'filterlogentries_action',
null,
'text',
$filterfieldsarray['action']
))->setWidth(3)->setHelp('Action');
$group->add(new Form_Input(
'filterlogentries_qty',
null,
'number',
$filterlogentries_qty,
['placeholder' => $nentries]
))->setWidth(2)->setHelp('Quantity');
$section->add($group);
$group = new Form_Group('');
$group->add(new Form_Input(
'filterlogentries_user',
null,
'text',
$filterfieldsarray['user']
))->setWidth(3)->setHelp('User');
$group->add(new Form_Input(
'filterlogentries_ip_address',
null,
'text',
$filterfieldsarray['ip_address']
))->setWidth(4)->setHelp('IP Address');
} else {
$group = new Form_Group('');
$group->add(new Form_Input(
'filterlogentries_time',
null,
'text',
$filterfieldsarray['time']
))->setWidth(3)->setHelp('Time');
$group->add(new Form_Input(
'filterlogentries_type',
null,
'text',
$filterfieldsarray['type']
))->setWidth(2)->setHelp('Type');
$group->add(new Form_Input(
'filterlogentries_pid',
null,
'text',
$filterfieldsarray['pid']
))->setWidth(2)->setHelp('PID');
$group->add(new Form_Input(
'filterlogentries_qty',
null,
'number',
$filterlogentries_qty,
['placeholder' => $nentries]
))->setWidth(2)->setHelp('Quantity');
$section->add($group);
$group = new Form_Group('');
$group->add(new Form_Input(
'filterlogentries_message',
null,
'text',
$filterfieldsarray['message']
))->setWidth(7)->setHelp('Log Message');
}
$btnsubmit = new Form_Button(
'filterlogentries_submit',
' ' . gettext('Apply Filter'),
null,
'fa-filter'
);
} else { // Simple log filter form
$form = new Form(false);
$form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
$section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE|$panel_body_state);
$group = new Form_Group('');
$group->add(new Form_Input(
'filtertext',
null,
'text',
$filtertext
))->setWidth(6)->setHelp('Filter Expression');
$group->add(new Form_Input(
'filterlogentries_qty',
null,
'number',
$filterlogentries_qty,
['placeholder' => $nentries]
))->setWidth(2)->setHelp('Quantity');
$btnsubmit = new Form_Button(
'filtersubmit',
' ' . gettext('Apply Filter'),
null,
'fa-filter'
);
}
$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
$group->add(new Form_StaticText(
'',
$btnsubmit
));
$group->setHelp('' . gettext('Regular expression reference') . ' ' . gettext('Precede with exclamation (!) to exclude match.'));
$section->add($group);
$form->add($section);
print $form;
}
?>