From 9bda6218ad5ed9389bfde4fa79a2944e0f271b9c Mon Sep 17 00:00:00 2001 From: doktornotor Date: Tue, 18 Aug 2015 19:33:24 +0200 Subject: asterisk - code style cleanup - Fix copyright header - Code style and indentation fixes - XHTML validation --- config/asterisk/asterisk_log.php | 110 +++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 62 deletions(-) (limited to 'config/asterisk/asterisk_log.php') diff --git a/config/asterisk/asterisk_log.php b/config/asterisk/asterisk_log.php index f4a752d2..44ba8acf 100644 --- a/config/asterisk/asterisk_log.php +++ b/config/asterisk/asterisk_log.php @@ -1,15 +1,11 @@ . - Copyright (C) 2012 robi + asterisk_log.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Scott Ullrich + Copyright (C) 2012 robi Copyright (C) 2012 Marcello Coutinho - All rights reserved. - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2005 Manuel Kasper . + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -33,7 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_MODULE: asterisk */ @@ -51,94 +47,84 @@ $shortcut_section = "asterisk"; include("head.inc"); /* Path to Asterisk log file */ -//if ($g['platform'] == "nanobsd") -// $log = "/tmp/asterisk.log"; -//else $log = "/var/log/asterisk/messages"; ?> /tmp/trimmed_asterisk.log && rm '$log' && mv /tmp/trimmed_asterisk.log '$log' && chown asterisk:asterisk '$log' && chmod g+w '$log'"); - header( 'Location: asterisk_log.php?savemsg=Log+trimmed.') ; + $trimres = shell_exec("/usr/bin/tail -n 50 '$log' > /tmp/trimmed_asterisk.log && /bin/rm '$log' && /bin/mv /tmp/trimmed_asterisk.log '$log' && /usr/sbin/chown asterisk:asterisk '$log' && /bin/chmod g+w '$log'"); + header('Location: asterisk_log.php?savemsg=Log+trimmed.'); } if ($cmd == "clear") { - $trimres=shell_exec("rm '$log' && touch '$log' && chown asterisk:asterisk '$log' && chmod g+w '$log'"); - header( 'Location: asterisk_log.php?savemsg=Log+cleared.') ; + $trimres = shell_exec("/bin/rm '$log' && /usr/bin/touch '$log' && /usr/sbin/chown asterisk:asterisk '$log' && /bin/chmod g+w '$log'"); + header('Location: asterisk_log.php?savemsg=Log+cleared.'); } } ?> - - + + + +
+ - - - - - -
- -
-
- - - - - - + - -
Last 50 Asterisk log entries
- +
+
+ + + + + + "; + echo ""; ?> -
Last 50 Asterisk log entries
-
"; - echo "
"; + echo "
-
-
+
+ +
-

+

-This log may be lost when rebooting the system."; -?> - - + This log may be lost when rebooting the system."; + } + ?>
-- cgit v1.2.3