diff --git a/app/exec/app_languages.php b/app/exec/app_languages.php
index 94059c5b21..99b43b7d34 100644
--- a/app/exec/app_languages.php
+++ b/app/exec/app_languages.php
@@ -1,93 +1,117 @@
-PHP Manual";
-$text['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: Manual PHP";
-$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: PHP Manual";
-$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: Manuel PHP";
-$text['description-php']['pt-br'] = "Utilize a ligação seguinte como referência para o PHP: PHP Manual ";
-$text['description-php']['pl'] = "Aby użyć odniesienia do PHP kliknij na ten link: PHP manual";
-$text['description-php']['sv-se'] = "Använd följande länk som en referens gällande PHP: PHP Manual ";
-$text['description-php']['uk'] = "Посилання на довідку PHP: PHP Manual";
-$text['description-php']['de-at'] = "Benutzen Sie folgenden Link als PHP Referenz: PHP Manual";
-
-$text['description-execute']['en-us'] = "Provides a conventient way to execute system, PHP, and switch commands.";
-$text['description-execute']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
-$text['description-execute']['pt-pt'] = "Oferece uma maneira fácil de executar comandos de sistema, PHP, e switch.";
-$text['description-execute']['fr-fr'] = "Fournir un moyen pour executer des commandes système, PHP et switch. ";
-$text['description-execute']['pt-br'] = "Utilize facilmente a execução de comandos do sistema, PHP e switch ";
-$text['description-execute']['pl'] = "Ta funkcja zapewnia dogodny sposób wykonywania poleceń systemowych, PHP oraz switch.";
-$text['description-execute']['sv-se'] = "Erbjuder ett smidigt sätt att köra system, PHP och switch kommandon.";
-$text['description-execute']['uk'] = "Забезпечує зручний спосіб виконати команди PHP, switch, а також системні команди";
-$text['description-execute']['de-at'] = "Bietet die Möglichkeit System, PHP und Switch Kommandos auszuführen.";
-
+PHP Manual";
+$text['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: Manual PHP";
+$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: PHP Manual";
+$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: Manuel PHP";
+$text['description-php']['pt-br'] = "Utilize a ligação seguinte como referência para o PHP: PHP Manual ";
+$text['description-php']['pl'] = "Aby użyć odniesienia do PHP kliknij na ten link: PHP manual";
+$text['description-php']['sv-se'] = "Använd följande länk som en referens gällande PHP: PHP Manual ";
+$text['description-php']['uk'] = "Посилання на довідку PHP: PHP Manual";
+$text['description-php']['de-at'] = "Benutzen Sie folgenden Link als PHP Referenz: PHP Manual";
+
+$text['description-execute']['en-us'] = "Provides a conventient way to execute system, PHP, and switch commands.";
+$text['description-execute']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
+$text['description-execute']['pt-pt'] = "Oferece uma maneira fácil de executar comandos de sistema, PHP, e switch.";
+$text['description-execute']['fr-fr'] = "Fournir un moyen pour executer des commandes système, PHP et switch. ";
+$text['description-execute']['pt-br'] = "Utilize facilmente a execução de comandos do sistema, PHP e switch ";
+$text['description-execute']['pl'] = "Ta funkcja zapewnia dogodny sposób wykonywania poleceń systemowych, PHP oraz switch.";
+$text['description-execute']['sv-se'] = "Erbjuder ett smidigt sätt att köra system, PHP och switch kommandon.";
+$text['description-execute']['uk'] = "Забезпечує зручний спосіб виконати команди PHP, switch, а також системні команди";
+$text['description-execute']['de-at'] = "Bietet die Möglichkeit System, PHP und Switch Kommandos auszuführen.";
+
?>
\ No newline at end of file
diff --git a/app/exec/exec.php b/app/exec/exec.php
index e92aee7f6d..dcd57df2f5 100644
--- a/app/exec/exec.php
+++ b/app/exec/exec.php
@@ -39,60 +39,115 @@ else {
$language = new text;
$text = $language->get();
+// load editor preferences/defaults
+ $setting_size = ($_SESSION["editor"]["font_size"]["text"] != '') ? $_SESSION["editor"]["font_size"]["text"] : '12px';
+ $setting_theme = ($_SESSION["editor"]["theme"]["text"] != '') ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
+ $setting_invisibles = ($_SESSION["editor"]["invisibles"]["boolean"] != '') ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
+ $setting_indenting = ($_SESSION["editor"]["indent_guides"]["boolean"] != '') ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
+ $setting_numbering = ($_SESSION["editor"]["line_numbers"]["boolean"] != '') ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
+ $setting_preview = ($_SESSION["editor"]["live_preview"]["boolean"] != '') ? $_SESSION["editor"]["live_preview"]["boolean"] : 'true';
+
//get the html values and set them as variables
- if (count($_POST)>0) {
- $shell_cmd = trim($_POST["shell_cmd"]);
- $php_cmd = trim($_POST["php_cmd"]);
- $switch_cmd = trim($_POST["switch_cmd"]);
+ $handler = ($_POST["handler"] != '') ? trim($_POST["handler"]) : 'switch';
+ $cmd = trim($_POST["cmd"]);
+
+//set editor mode
+ switch ($handler) {
+ case 'php': $mode = 'php'; break;
+ default: $mode = 'text';
}
//show the header
require_once "resources/header.php";
$document['title'] = $text['title-command'];
-//edit area
- echo " \n";
- echo " ";
+//scripts and styles
+ ?>
+
+
+
+".$text['label-execute']."\n";
@@ -100,98 +155,216 @@ else {
echo $text['description-execute']."\n";
echo "
";
+//html form
+ echo "
\n";
-
- //shell_cmd
- if (strlen($shell_cmd) > 0 && permission_exists('exec_command_line')) {
- echo "$shell_cmd\n";
- echo "\n";
- echo ""; - echo htmlentities($shell_result); - echo "\n"; - } - - //php_cmd - if (strlen($php_cmd) > 0 && permission_exists('exec_php_command')) { - //echo "\n"; - echo " "; - $php_result = eval($php_cmd); - echo htmlentities($php_result); - echo "\n"; - } - - //fs cmd - if (strlen($switch_cmd) > 0 && permission_exists('exec_switch')) { - echo "$switch_cmd\n"; - echo " ";
- $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if ($fp) {
- $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
- //$switch_result = eval($switch_cmd);
- echo htmlentities($switch_result);
+ if (count($_POST) > 0) {
+ if ($cmd != '') {
+ switch ($handler) {
+ case 'shell':
+ if (permission_exists('exec_command_line')) {
+ $result = htmlentities(shell_exec($cmd));
+ }
+ break;
+ case 'php':
+ if (permission_exists('exec_php_command')) {
+ ob_start();
+ eval($cmd);
+ $result = ob_get_contents();
+ ob_end_clean();
+ $result = htmlentities($result);
+ }
+ break;
+ case 'switch':
+ if (permission_exists('exec_switch')) {
+ $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+ if ($fp) { $result = htmlentities(event_socket_request($fp, 'api '.$cmd)); }
+ }
+ break;
+ }
+ if ($result != '') {
+ echo "";
+ echo "".$text['label-response']."\n";
+ echo "\n";
}
- echo " \n"; - echo " | \n";
- echo " |
| \n"; - echo " ".$text['label-shell']."\n"; - echo " | \n"; - echo "\n";
- echo " \n";
- echo " \n"; - echo " ".$text['description-shell']."\n"; - echo " | \n";
- echo "
| \n"; - echo " ".$text['label-php']."\n"; - echo " | \n"; - echo "\n";
- echo " \n";
- echo " \n"; - echo " ".$text['description-php']."\n"; - echo " | \n";
- echo "
| \n"; - echo " ".$text['label-switch']."\n"; - echo " | \n"; - echo "\n";
- echo " \n";
- echo " \n"; - echo " ".$text['description-switch']."\n"; - echo " | \n";
- echo "
| \n";
- echo " "; - echo " \n"; - echo " | \n";
- echo " |