From 24d5c2b1e61a47520d884e53cf186ef40ca90e68 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Tue, 18 Aug 2015 16:23:37 +0200 Subject: asterisk - code style cleanup - Fix copyright header - Code style and indentation fixes - XHTML validation fixes - Improve cache handling --- config/asterisk/asterisk_calls.php | 181 ++++++++++++++++++------------------- 1 file changed, 86 insertions(+), 95 deletions(-) (limited to 'config/asterisk') diff --git a/config/asterisk/asterisk_calls.php b/config/asterisk/asterisk_calls.php index 75f24b2f..5150c95f 100644 --- a/config/asterisk/asterisk_calls.php +++ b/config/asterisk/asterisk_calls.php @@ -1,14 +1,10 @@ . + asterisk_calls.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 Scott Ullrich Copyright (C) 2013 robi - 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 @@ -32,7 +28,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/* pfSense_MODULE: asterisk */ @@ -53,127 +49,122 @@ include("head.inc"); $callog = "/var/log/asterisk/cdr-csv/Master.csv"; /* Data input processing */ -$cmd = $_GET['cmd']; +$cmd = $_GET['cmd']; $file = $_SERVER["SCRIPT_NAME"]; -$break = Explode('/', $file); -$pfile = $break[count($break) - 1]; +$break = explode('/', $file); +$pfile = $break[count($break) - 1]; -if (file_exists($callog)) - switch ($cmd){ +if (file_exists($callog)) { + switch ($cmd) { case "trim": - $trimres=shell_exec("tail -50 '$callog' > /tmp/trimmed_asterisk.csv && rm '$callog' && mv /tmp/trimmed_asterisk.csv '$callog' && chown asterisk:asterisk '$callog' && chmod g+w '$callog'"); - header( 'Location: asterisk_calls.php?savemsg=Calls+log+trimmed.') ; - break; + $trimres = shell_exec("/usr/bin/tail -n 50 '$callog' > /tmp/trimmed_asterisk.csv && /bin/rm '$callog' && /bin/mv /tmp/trimmed_asterisk.csv '$callog' && /usr/sbin/chown asterisk:asterisk '$callog' && /bin/chmod g+w '$callog'"); + header('Location: asterisk_calls.php?savemsg=Calls+log+trimmed.'); + break; case "clear": - $trimres=shell_exec("rm '$callog' && touch '$callog' && chown asterisk:asterisk '$callog' && chmod g+w '$callog'"); - header( 'Location: asterisk_calls.php?savemsg=Calls+log+cleared.') ; - break; + $trimres=shell_exec("/bin/rm '$callog' && /usr/bin/touch '$callog' && /usr/sbin/chown asterisk:asterisk '$callog' && /bin/chmod g+w '$callog'"); + header('Location: asterisk_calls.php?savemsg=Calls+log+cleared.'); + break; case "download": - // session_cache_limiter('none'); //*Use before session_start() - // session_start(); - header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename='.basename($callog)); + header('Content-Disposition: attachment; filename=' . basename($callog)); header('Content-Transfer-Encoding: binary'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); + header('Cache-Control: no-cache, must-revalidate'); + header('Pragma: no-cache'); header('Content-Length: ' . filesize($callog)); ob_clean(); flush(); readfile($callog); exit; - break; + break; } +} ?> - - + + + + + +
+ - - - - - - - -
- -
-
- - - - - - - - - - - - - - " . $out; - $out = "" . $out; - $out = "" . $out; - } - } - fclose($file_handle); - } - echo $out; - echo ""; - ?> -
Last 50 Asterisk calls
" . utf8_decode(str_replace('"', '', $lin[4])) . "" . $lin[2] . "" . $lin[9] . "" . $lin[11] . "" . gmdate("G:i:s", $lin[12]) . "" . $lin[14] . "
"; - echo ""; - echo "
-
-
- -

+

+
+ + + + + + + + + + + + + + " . $out; + $out = "" . $out; + $out = "" . $out; + } + } + fclose($file_handle); + } + echo $out; + echo ""; + ?> +
Last 50 Asterisk calls
" . utf8_decode(str_replace('"', '', $lin[4])) . "" . $lin[2] . "" . $lin[9] . "" . $lin[11] . "" . gmdate("G:i:s", $lin[12]) . "" . $lin[14] . "
"; + echo ""; + echo "
+
+
+ +

-
-
+
+
This log may be lost when rebooting the system."; +if ($g['platform'] == "nanobsd") { + echo "
This log may be lost when rebooting the system."; +} ?> - -
- + -- cgit v1.2.3