Ver Fonte

app->exec, added preliminary support for translations.

James Rose há 13 anos atrás
pai
commit
59c2016f29
2 ficheiros alterados com 60 adições e 9 exclusões
  1. 43 0
      app_languages.php
  2. 17 9
      exec.php

+ 43 - 0
app_languages.php

@@ -0,0 +1,43 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+	James Rose <[email protected]>
+*/
+	
+
+	$text['label-execute']['en-us'] = 'Execute Command';
+	$text['description-execute']['en-us'] = 'Provides a conventient way to execute system, PHP, and switch commands.';
+	$text['label-shell']['en-us'] = 'Shell command';
+	$text['description-shell']['en-us'] = 'System commands.';
+	$text['label-php']['en-us'] = 'PHP command';
+	$text['description-php']['en-us'] = "Use the following link as a reference for PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual";
+
+	$text['label-switch']['en-us'] = 'Switch Command';
+	$text['description-switch']['en-us'] = 'For a list of the valid commands use: help';
+	$text['button-execute']['en-us'] = 'Execute';
+
+
+	
+
+?>

+ 17 - 9
exec.php

@@ -22,6 +22,7 @@
 
 	Contributor(s):
 	Mark J Crane <[email protected]>
+	James Rose <[email protected]>
 */
 include "root.php";
 require_once "includes/require.php";
@@ -34,6 +35,13 @@ else {
 	exit;
 }
 
+//add multi-lingual support
+	require_once "app_languages.php";
+	foreach($text as $key => $value) {
+		$text[$key] = $value[$_SESSION['domain']['language']['code']];
+	}
+
+
 //get the html values and set them as variables
 	if (count($_POST)>0) {
 		$shell_cmd = trim($_POST["shell_cmd"]);
@@ -92,11 +100,11 @@ else {
 	echo "<div align='center'>";
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
 	echo "<tr>\n";
-	echo "<td colspan='2' align='left' nowrap=\"nowrap\"><b>Execute Command</b></td>\n";
+	echo "<td colspan='2' align='left' nowrap=\"nowrap\"><b>".$text['label-execute']."</b></td>\n";
 	echo "</tr>\n";
 	echo "<tr>\n";
 	echo "	<td align=\"left\" colspan='2'>\n";
-	echo "		Provides a conventient way to execute system, PHP, and switch commands.\n";
+	echo "		".$text['description-execute']."\n";
 	echo "	<br />\n";
 	echo "	<br />\n";
 	echo "	</td>\n";
@@ -150,42 +158,42 @@ else {
 	if (permission_exists('exec_command_line')) {
 		echo "<tr>\n";
 		echo "<td class='vncell' valign='top' align='left' nowrap>\n";
-		echo "	Shell command:\n";
+		echo "	".$text['label-shell'].":\n";
 		echo "</td>\n";
 		echo "<td class='vtable' align='left'>\n";
 		echo "	<textarea name='shell_cmd' id='shell_cmd' rows='2' class='txt' wrap='off'>$shell_cmd</textarea\n";
 		echo "	<br />\n";
-		echo "	System commands.\n";
+		echo "	".$text['description-shell']."\n";
 		echo "</td>\n";
 		echo "</tr>\n";
 	}
 	if (permission_exists('exec_php_command')) {
 		echo "<tr>\n";
 		echo "<td class='vncell' valign='top' align='left' nowrap>\n";
-		echo "	PHP command:\n";
+		echo "	".$text['label-php'].":\n";
 		echo "</td>\n";
 		echo "<td class='vtable' align='left'>\n";
 		echo "	<textarea name='php_cmd' id='php_cmd' rows='7' class='txt' wrap='off'>$php_cmd</textarea\n";
 		echo "	<br />\n";
-		echo "	Use the following link as a reference for PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual</a>\n";
+		echo "	".$text['description-php']."</a>\n";
 		echo "</td>\n";
 		echo "</tr>\n";
 	}
 	if (permission_exists('exec_switch')) {
 		echo "<tr>\n";
 		echo "<td class='vncell' valign='top' align='left' nowrap>\n";
-		echo "	Switch Command:\n";
+		echo "	".$text['label-switch'].":\n";
 		echo "</td>\n";
 		echo "<td class='vtable' align='left'>\n";
 		echo "	<textarea name='switch_cmd' id='switch_cmd' rows='2' class='txt' wrap='off'>$switch_cmd</textarea\n";
 		echo "	<br />\n";
-		echo "	For a list of the valid commands use: help\n";
+		echo "	".$text['description-switch']."\n";
 		echo "</td>\n";
 		echo "</tr>\n";
 	}
 	echo "	<tr>\n";
 	echo "		<td colspan='2' align='right'>\n";
-	echo "			<input type='submit' name='submit' class='btn' value='Execute'>\n";
+	echo "			<input type='submit' name='submit' class='btn' value='".$text['button-execute']."'>\n";
 	echo "		</td>\n";
 	echo "	</tr>";
 	echo "</form>";