$pconfig['relayd'] = isset($config['syslog']['relayd']); $pconfig['hostapd'] = isset($config['syslog']['hostapd']); $pconfig['logall'] = isset($config['syslog']['logall']); $pconfig['system'] = isset($config['syslog']['system']); $pconfig['enable'] = isset($config['syslog']['enable']); $pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']); $pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']); $pconfig['logbogons'] = empty($config['syslog']['nologbogons']); $pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']); $pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']); $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions']; $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']); $pconfig['logfilesize'] = !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null; } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") { clear_all_log_files(); $savemsg = gettext("The log files have been reset."); } elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") { $savemsg = gettext('RRD data has been cleared.'); mwexec('/bin/rm /var/db/rrd/*'); enable_rrd_graphing(); setup_gateways_monitor(); } else { $input_errors = array(); $pconfig = $_POST; /* input validation */ if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1."); } if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
$pconfig['logbogons'] = !isset($config['syslog']['nologbogons']); $pconfig['logprivatenets'] = !isset($config['syslog']['nologprivatenets']); $pconfig['lognginx'] = !isset($config['syslog']['nolognginx']); $pconfig['rawfilter'] = isset($config['syslog']['rawfilter']); $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions']; $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']); $pconfig['logfilesize'] = $config['syslog']['logfilesize']; if (!$pconfig['nentries']) { $pconfig['nentries'] = 50; } function is_valid_syslog_server($target) { return is_ipaddr($target) || is_ipaddrwithport($target) || is_hostname($target) || is_hostnamewithport($target); } if ($_POST['resetlogs'] == gettext("Reset Log Files")) { clear_all_log_files(true); $savemsg .= gettext("The log files have been reset."); } elseif ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable'] && !is_valid_syslog_server($_POST['remoteserver'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1."); } if ($_POST['enable'] && $_POST['remoteserver2'] && !is_valid_syslog_server($_POST['remoteserver2'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2."); } if ($_POST['enable'] && $_POST['remoteserver3'] && !is_valid_syslog_server($_POST['remoteserver3'])) { $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3."); } if ($_POST['nentries'] < 5 || $_POST['nentries'] > 2000) {