From 4956a4e77d3b0bba09163b68df067174997c6233 Mon Sep 17 00:00:00 2001
From: doktornotor <notordoktor@gmail.com>
Date: Tue, 18 Aug 2015 16:40:04 +0200
Subject: asterisk - code style cleanup

- Fix copyright header
- Code style and indentation fixes
- XHTML validation fixes
---
 config/asterisk/asterisk_cmd.php | 132 +++++++++++++++++++--------------------
 1 file changed, 65 insertions(+), 67 deletions(-)

(limited to 'config/asterisk/asterisk_cmd.php')

diff --git a/config/asterisk/asterisk_cmd.php b/config/asterisk/asterisk_cmd.php
index da684cde..5ba1b460 100644
--- a/config/asterisk/asterisk_cmd.php
+++ b/config/asterisk/asterisk_cmd.php
@@ -1,14 +1,10 @@
 <?php
-/* $Id$ */
 /*
-	status_asterisk.php
-	part of pfSense
-	Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>.
+	asterisk_cmd.php
+	part of pfSense (https://www.pfSense.org/)
+	Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>
 	Copyright (C) 2013 robi <robreg@zsurob.hu>
-	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
@@ -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
 */
 
@@ -56,73 +52,75 @@ include("head.inc");
 
 <?php
 /* Data input processing */
-$cmd =  $_GET['cmd'];
-$cmd  = str_replace("+", " ", $cmd);
+$cmd = $_GET['cmd'];
+$cmd = str_replace("+", " ", $cmd);
 
 if ($cmd == "") {
 	$cmd = "core show settings";
 }
 
 $file = $_SERVER["SCRIPT_NAME"];
-$break = Explode('/', $file);
-$pfile = $break[count($break) - 1]; 
-
+$break = explode('/', $file);
+$pfile = $break[count($break) - 1];
 ?>
-	<table width="100%" border="0" cellpadding="0" cellspacing="0">
-		<tr>
-			<td>
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td>
+	<?php
+		$tab_array = array();
+		$tab_array[0] = array(gettext("Commands"), true, "asterisk_cmd.php");
+		$tab_array[1] = array(gettext("Calls"), false, "asterisk_calls.php");
+		$tab_array[2] = array(gettext("Log"), false, "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 class="listtopic">
+			<table>
+				<tr>
+					<?php
+					/* Print command buttons */
+					echo "<td align='center'><a href='$pfile?cmd=sip+show+registry'><input type='button' name='command' value='SIP Registry' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=sip+show+peers'><input type='button' name='command' value='SIP Peers' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=sip+show+channels'><input type='button' name='command' value='SIP Channels' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+show+channels'><input type='button' name='command' value='Channels' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+show+codecs+audio'><input type='button' name='command' value='Codecs' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+show+translation+recalc+10'><input type='button' name='command' value='Translation' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=sip+show+settings'><input type='button' name='command' value='SIP Settings' class='formbtns' style='width: 100px' /></a></td>";
+					?>
+				</tr>
+				<tr>
+					<?php
+					echo "<td align='center'><a href='$pfile?cmd=sip+reload'><input type='button' name='command' value='Reload SIP' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=dialplan+reload'><input type='button' name='command' value='Reload Extensions' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+reload'><input type='button' name='command' value='Reload Core' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+show+uptime'><input type='button' name='command' value='Uptime' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='center'><a href='$pfile?cmd=core+restart+now'><input type='button' name='command' value='Restart Asterisk' class='formbtns' style='width: 100px' /></a></td>";
+					echo "<td align='right' colspan='2'><form name='input' action='$pfile' method='get'><input type='text' name='cmd' style='width: 145px' /><input type='submit' value='SEND' class='formbtns' style='width: 50px' /></form></td>";
+					?>
+				</tr>
+			</table>
+		</td></tr>
+		<tr valign="top">
+			<td class="listlr" nowrap="nowrap">
 				<?php
-					$tab_array = array();
-					$tab_array[0] = array(gettext("Commands"), true, "asterisk_cmd.php");
-					$tab_array[1] = array(gettext("Calls"), false, "asterisk_calls.php");
-					$tab_array[2] = array(gettext("Log"), false, "asterisk_log.php");
-					$tab_array[3] = array(gettext("Edit configuration"), false, "asterisk_edit_file.php");
-					display_top_tabs($tab_array);
+				/* Run commands and print results */
+				$asterisk_command = shell_exec("/usr/local/sbin/asterisk -rx '$cmd'");
+				echo "<pre style='font-size: 11px; background: white'>";
+				echo $asterisk_command;
+				echo "</pre>";
 				?>
 			</td>
 		</tr>
-		<tr>
-			<td>
-				<div id="mainarea">
-				<table class="tabcont sortable" width="100%" border="0" cellpadding="6" cellspacing="0">
-					<tr>
-						<td class="listtopic">
-						<table><tr>
-						<?php
-						/* Print command buttons */
-						echo "<td align='center'><a href='$pfile?cmd=sip+show+registry'><input type='button' name='command' value='SIP Registry' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=sip+show+peers'><input type='button' name='command' value='SIP Peers' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=sip+show+channels'><input type='button' name='command' value='SIP Channels' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+show+channels'><input type='button' name='command' value='Channels' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+show+codecs+audio'><input type='button' name='command' value='Codecs' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+show+translation+recalc+10'><input type='button' name='command' value='Translation' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=sip+show+settings'><input type='button' name='command' value='SIP Settings' class='formbtns' style='width: 100px'></a></td>";
-						echo "</tr><tr>";
-						//echo "<td></td>";
-						echo "<td align='center'><a href='$pfile?cmd=sip+reload'><input type='button' name='command' value='Reload SIP' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=dialplan+reload'><input type='button' name='command' value='Reload Extensions' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+reload'><input type='button' name='command' value='Reload Core' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+show+uptime'><input type='button' name='command' value='Uptime' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='center'><a href='$pfile?cmd=core+restart+now'><input type='button' name='command' value='Restart Asterisk' class='formbtns' style='width: 100px'></a></td>";
-						echo "<td align='right' colspan='2'><form name='input' action='$pfile' method='get'><input type='text' name='cmd' style='width: 145px'><input type='submit' value='SEND' class='formbtns' style='width: 50px'></form> </td>";
-						?>
-						</tr></table>
-						</td>
-					</tr>
-					<tr valign="top">
-						<td class="listlr" nowrap>
-						<?php
-						/* Run commands and print results */
-						$asterisk_command=shell_exec("asterisk -rx '$cmd'");
-						echo "<pre style='font-size:11px; background:white'>";
-						echo $asterisk_command;
-						echo "</pre>";
-						?>
-						</td>
-					</tr>
-				</table>
-				</div>
-			</td>
-		</tr>
-	</table>
+		</table>
+	</div>
+</td></tr>
+</table>
+
 <?php include("fend.inc"); ?>
+</body>
+</html>
-- 
cgit v1.2.3