aboutsummaryrefslogtreecommitdiffstats
path: root/config/asterisk/asterisk_log.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-24 07:44:16 -0300
committerRenato Botelho <renato@netgate.com>2015-08-24 07:44:16 -0300
commitb7bad5e5ab2c88efb7884c1e264deca2e0f5ad33 (patch)
treea37189f02505c5f906ef5a64613658bf6fd4790b /config/asterisk/asterisk_log.php
parent4a3a907f0cd4f7a2f192f304156d7fe7d7e16f1a (diff)
parent8b2aba56e93b619841a5424d3820ca1cf42e1adb (diff)
downloadpfsense-packages-b7bad5e5ab2c88efb7884c1e264deca2e0f5ad33.tar.gz
pfsense-packages-b7bad5e5ab2c88efb7884c1e264deca2e0f5ad33.tar.bz2
pfsense-packages-b7bad5e5ab2c88efb7884c1e264deca2e0f5ad33.zip
Merge pull request #1011 from doktornotor/patch-8
Diffstat (limited to 'config/asterisk/asterisk_log.php')
-rw-r--r--config/asterisk/asterisk_log.php110
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"); ?>