diff --git a/src/www/diag_logs_gateways.php b/src/www/diag_logs_gateways.php
index 019439311..ea4deecbe 100644
--- a/src/www/diag_logs_gateways.php
+++ b/src/www/diag_logs_gateways.php
@@ -1,90 +1,6 @@
.
- All rights reserved.
+$logfile = '/var/log/gateways.log';
+$logclog = true;
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-require_once("guiconfig.inc");
-require_once("services.inc");
-require_once("system.inc");
-require_once("interfaces.inc");
-
-$system_logfile = '/var/log/gateways.log';
-$filtertext = '';
-$nentries = 50;
-
-if (isset($config['syslog']['nentries'])) {
- $nentries = $config['syslog']['nentries'];
-}
-
-if (!empty($_POST['clear'])) {
- clear_clog($system_logfile);
-}
-
-if (isset($_POST['filtertext'])) {
- $filtertext = htmlspecialchars($_POST['filtertext']);
-}
-
-include("head.inc");
-?>
-
-
-
-
-
-
- 0) print_input_errors($input_errors); ?>
-
-
-
-
-
-
+require_once 'diag_logs_template.inc';
diff --git a/src/www/diag_logs_template.inc b/src/www/diag_logs_template.inc
new file mode 100644
index 000000000..aab110e36
--- /dev/null
+++ b/src/www/diag_logs_template.inc
@@ -0,0 +1,100 @@
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require_once("guiconfig.inc");
+require_once("system.inc");
+require_once("interfaces.inc");
+
+/* expects $logfile to point to the system path */
+/* expects $logclog to be true or false */
+
+$filtertext = '';
+$nentries = 50;
+
+if (isset($config['syslog']['nentries'])) {
+ $nentries = $config['syslog']['nentries'];
+}
+
+if (!empty($_POST['clear'])) {
+ if ($logclog) {
+ clear_clog($logfile);
+ } else {
+ clear_log($logfile);
+ }
+}
+
+if (isset($_POST['filtertext'])) {
+ $filtertext = htmlspecialchars($_POST['filtertext']);
+}
+
+include("head.inc");
+
+?>
+
+
+
+
+