diff options
author | doktornotor <notordoktor@gmail.com> | 2015-08-18 19:33:24 +0200 |
---|---|---|
committer | doktornotor <notordoktor@gmail.com> | 2015-08-18 19:33:24 +0200 |
commit | 9bda6218ad5ed9389bfde4fa79a2944e0f271b9c (patch) | |
tree | 7d43cf6c29abf5a8a7699c80b69bcb23888a2e15 /config/asterisk | |
parent | 8c46f64b8a9835973e592d4b0a5c7fe91cef3dbd (diff) | |
download | pfsense-packages-9bda6218ad5ed9389bfde4fa79a2944e0f271b9c.tar.gz pfsense-packages-9bda6218ad5ed9389bfde4fa79a2944e0f271b9c.tar.bz2 pfsense-packages-9bda6218ad5ed9389bfde4fa79a2944e0f271b9c.zip |
asterisk - code style cleanup
- Fix copyright header
- Code style and indentation fixes
- XHTML validation
Diffstat (limited to 'config/asterisk')
-rw-r--r-- | config/asterisk/asterisk_log.php | 110 |
1 files changed, 48 insertions, 62 deletions
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 @@ <?php -/* $Id$ */ /* - status_asterisk_log.php - part of pfSense - Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>. - Copyright (C) 2012 robi <robreg@zsurob.hu> + asterisk_log.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com> + Copyright (C) 2012 robi <robreg@zsurob.hu> Copyright (C) 2012 Marcello Coutinho - All rights reserved. - - originally part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. + 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"; ?> <?php /* Data input processing */ -$cmd = $_GET['cmd']; -//$cmd = str_replace("+", " ", $cmd); +$cmd = $_GET['cmd']; +//$cmd = str_replace("+", " ", $cmd); $file = $_SERVER["SCRIPT_NAME"]; -$break = Explode('/', $file); -$pfile = $break[count($break) - 1]; +$break = explode('/', $file); +$pfile = $break[count($break) - 1]; if (file_exists($log)) { if ($cmd == "trim") { - $trimres=shell_exec("tail -50 '$log' > /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.'); } } ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - <?php include("fbegin.inc"); ?> - <?php +<?php include("fbegin.inc"); ?> +<?php $savemsg = $_GET["savemsg"]; if ($savemsg) { - print_info_box($savemsg); + print_info_box($savemsg); } +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td> + <?php + $tab_array = array(); + $tab_array[0] = array(gettext("Commands"), false, "asterisk_cmd.php"); + $tab_array[1] = array(gettext("Calls"), false, "asterisk_calls.php"); + $tab_array[2] = array(gettext("Log"), true, "asterisk_log.php"); + $tab_array[3] = array(gettext("Edit configuration"), false, "asterisk_edit_file.php"); + display_top_tabs($tab_array); ?> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td> - <?php - $tab_array = array(); - $tab_array[0] = array(gettext("Commands"), false, "asterisk_cmd.php"); - $tab_array[1] = array(gettext("Calls"), false, "asterisk_calls.php"); - $tab_array[2] = array(gettext("Log"), true, "asterisk_log.php"); - $tab_array[3] = array(gettext("Edit configuration"), false, "asterisk_edit_file.php"); - display_top_tabs($tab_array); - ?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td colspan="2" class="listtopic">Last 50 Asterisk log entries</td> - </tr> - - <tr valign="top"><td class="listlr" nowrap> - +</td></tr> +<tr><td> + <div id="mainarea"> + <table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td colspan="2" class="listtopic">Last 50 Asterisk log entries</td> + </tr> + <tr valign="top"><td class="listlr" nowrap="nowrap"> <?php $showlog_command=shell_exec("tail -50 '$log'"); echo nl2br($showlog_command); ?> - </td></tr> + </td></tr> <?php - echo "<tr><td colspan='6'><a href='$pfile?cmd=trim'><input type='button' name='command' value='Trim log' class='formbtn'></a>"; - echo "<a href='$pfile?cmd=clear'><input type='button' name='command' value='Clear log' class='formbtn'></a></td></tr>"; + echo "<tr><td colspan='6'><a href='$pfile?cmd=trim'><input type='button' name='command' value='Trim log' class='formbtn' /></a>"; + echo "<a href='$pfile?cmd=clear'><input type='button' name='command' value='Clear log' class='formbtn' /></a></td></tr>"; ?> - </table> - </div> - </td> - </tr> - </table> + </table> + </div> +</td></tr> +</table> -<p/> +<br /> <span class="vexpl"> <span class="red"> <strong><?=gettext("Note:");?><br /></strong> </span> <?=gettext("Trim keeps the last 50 lines of the log.");?> -<? -if ($g['platform'] == "nanobsd") - echo "<br>This log may be lost when rebooting the system."; -?> - - + <?php + if ($g['platform'] == "nanobsd") { + echo "<br />This log may be lost when rebooting the system."; + } + ?> </span> <?php include("fend.inc"); ?> |