Command: Integrate new editor, include Clip Library.

This commit is contained in:
reliberate
2016-03-17 15:50:18 -06:00
parent 989c17b6df
commit e1d192b501
11 changed files with 422 additions and 225 deletions

View File

@@ -1,93 +1,117 @@
<?php
$text['title-command']['en-us'] = "Command";
$text['title-command']['es-cl'] = "Comando";
$text['title-command']['pt-pt'] = "Comando";
$text['title-command']['fr-fr'] = "Commande";
$text['title-command']['pt-br'] = "Comando";
$text['title-command']['pl'] = "Polecenie";
$text['title-command']['sv-se'] = "Kommando";
$text['title-command']['uk'] = "Команди";
$text['title-command']['de-at'] = "Befehl";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['es-cl'] = "Comando de switch";
$text['label-switch']['pt-pt'] = "Comando Freeswitch";
$text['label-switch']['fr-fr'] = "Commande CLI Freeswitch";
$text['label-switch']['pt-br'] = "Comando Freeswitch ";
$text['label-switch']['pl'] = "PBX";
$text['label-switch']['sv-se'] = "Switch";
$text['label-switch']['uk'] = "FreeSwitch";
$text['label-switch']['de-at'] = "Switch";
$text['label-shell']['en-us'] = "Shell";
$text['label-shell']['es-cl'] = "Terminal de Comandos";
$text['label-shell']['pt-pt'] = "Comando Shell";
$text['label-shell']['fr-fr'] = "Commande Shell";
$text['label-shell']['pt-br'] = "Comando Shell ";
$text['label-shell']['pl'] = "Powłoka (shell)";
$text['label-shell']['sv-se'] = "Shell";
$text['label-shell']['uk'] = "Консоль";
$text['label-shell']['de-at'] = "Shell";
$text['label-php']['en-us'] = "PHP";
$text['label-php']['es-cl'] = "Comando PHP";
$text['label-php']['pt-pt'] = "Comandos PHP";
$text['label-php']['fr-fr'] = "Commande PHP";
$text['label-php']['pt-br'] = "Comandos PHP ";
$text['label-php']['pl'] = "PHP";
$text['label-php']['sv-se'] = "PHP";
$text['label-php']['uk'] = "PHP";
$text['label-php']['de-at'] = "PHP";
$text['label-execute']['en-us'] = "Execute Command";
$text['label-execute']['es-cl'] = "Ejecutar Comando";
$text['label-execute']['pt-pt'] = "Executar Comando";
$text['label-execute']['fr-fr'] = "Executer la Commande";
$text['label-execute']['pt-br'] = "Executar";
$text['label-execute']['pl'] = "Wykonywanie poleceń";
$text['label-execute']['sv-se'] = "Utför Kommando";
$text['label-execute']['uk'] = "Виконання команд";
$text['label-execute']['de-at'] = "Ausführen";
$text['description-switch']['en-us'] = "For a list of the valid commands use: help";
$text['description-switch']['es-cl'] = "Para un listado de comandos válidos use: help";
$text['description-switch']['pt-pt'] = "Para uma lista dos comandos válidos utilize: help";
$text['description-switch']['fr-fr'] = "Pour la liste des commandes valides, utiliser : help";
$text['description-switch']['pt-br'] = "Para verificar a lista de comandos válidos utilize: Ajuda";
$text['description-switch']['pl'] = "Aby uzyskać listę poprawnych poleceń użyj pomocy";
$text['description-switch']['sv-se'] = "För en lista med giltiga kommandon använd: help";
$text['description-switch']['uk'] = "Для перегляду списку команд виконайте команду: help";
$text['description-switch']['de-at'] = "Um eine Liste der gültigen Befehle zu bekommen tippen Sie: 'help'";
$text['description-shell']['en-us'] = "System commands.";
$text['description-shell']['es-cl'] = "Comandos de sistema";
$text['description-shell']['pt-pt'] = "Comandos do sistema.";
$text['description-shell']['fr-fr'] = "Commande Système";
$text['description-shell']['pt-br'] = "Comando do sistema";
$text['description-shell']['pl'] = "Polecenia systemowe.";
$text['description-shell']['sv-se'] = "System Kommandon.";
$text['description-shell']['uk'] = "Системні команди";
$text['description-shell']['de-at'] = "System Befehle";
$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['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>Manual PHP";
$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual";
$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/fr/index.php' target='_blank'>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: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual</a>";
$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
$text['title-command']['en-us'] = "Command";
$text['title-command']['es-cl'] = "Comando";
$text['title-command']['pt-pt'] = "Comando";
$text['title-command']['fr-fr'] = "Commande";
$text['title-command']['pt-br'] = "Comando";
$text['title-command']['pl'] = "Polecenie";
$text['title-command']['sv-se'] = "Kommando";
$text['title-command']['uk'] = "Команди";
$text['title-command']['de-at'] = "Befehl";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['es-cl'] = "Comando de switch";
$text['label-switch']['pt-pt'] = "Comando Freeswitch";
$text['label-switch']['fr-fr'] = "Commande CLI Freeswitch";
$text['label-switch']['pt-br'] = "Comando Freeswitch ";
$text['label-switch']['pl'] = "PBX";
$text['label-switch']['sv-se'] = "Switch";
$text['label-switch']['uk'] = "FreeSwitch";
$text['label-switch']['de-at'] = "Switch";
$text['label-shell']['en-us'] = "Shell";
$text['label-shell']['es-cl'] = "Terminal de Comandos";
$text['label-shell']['pt-pt'] = "Comando Shell";
$text['label-shell']['fr-fr'] = "Commande Shell";
$text['label-shell']['pt-br'] = "Comando Shell ";
$text['label-shell']['pl'] = "Powłoka (shell)";
$text['label-shell']['sv-se'] = "Shell";
$text['label-shell']['uk'] = "Консоль";
$text['label-shell']['de-at'] = "Shell";
$text['label-response']['en-us'] = "Response";
$text['label-response']['es-cl'] = "Respuesta";
$text['label-response']['pt-pt'] = "Resposta";
$text['label-response']['fr-fr'] = "Réponse";
$text['label-response']['pt-br'] = "Resposta";
$text['label-response']['pl'] = "Odpowiedź";
$text['label-response']['sv-se'] = "Respons";
$text['label-response']['uk'] = "Відповідь";
$text['label-response']['de-at'] = "Antwort";
$text['label-reset']['en-us'] = "Reset";
$text['label-reset']['es-cl'] = "Reajustar";
$text['label-reset']['pt-pt'] = "Restabelecer";
$text['label-reset']['fr-fr'] = "Remettre";
$text['label-reset']['pt-br'] = "Restabelecer";
$text['label-reset']['pl'] = "Resetuj";
$text['label-reset']['he'] = "אפס";
$text['label-reset']['uk'] = "Скинути";
$text['label-reset']['sv-se'] = "Återställ";
$text['label-reset']['de-at'] = "Zurücksetzen";
$text['label-reset']['ro'] = "Inițializare";
$text['label-reset']['fa'] = "";
$text['label-reset']['ar-eg'] = "إعادة تعيين";
$text['label-php']['en-us'] = "PHP";
$text['label-php']['es-cl'] = "Comando PHP";
$text['label-php']['pt-pt'] = "Comandos PHP";
$text['label-php']['fr-fr'] = "Commande PHP";
$text['label-php']['pt-br'] = "Comandos PHP ";
$text['label-php']['pl'] = "PHP";
$text['label-php']['sv-se'] = "PHP";
$text['label-php']['uk'] = "PHP";
$text['label-php']['de-at'] = "PHP";
$text['label-execute']['en-us'] = "Execute Command";
$text['label-execute']['es-cl'] = "Ejecutar Comando";
$text['label-execute']['pt-pt'] = "Executar Comando";
$text['label-execute']['fr-fr'] = "Executer la Commande";
$text['label-execute']['pt-br'] = "Executar";
$text['label-execute']['pl'] = "Wykonywanie poleceń";
$text['label-execute']['sv-se'] = "Utför Kommando";
$text['label-execute']['uk'] = "Виконання команд";
$text['label-execute']['de-at'] = "Ausführen";
$text['description-switch']['en-us'] = "For a list of the valid commands use: help";
$text['description-switch']['es-cl'] = "Para un listado de comandos válidos use: help";
$text['description-switch']['pt-pt'] = "Para uma lista dos comandos válidos utilize: help";
$text['description-switch']['fr-fr'] = "Pour la liste des commandes valides, utiliser : help";
$text['description-switch']['pt-br'] = "Para verificar a lista de comandos válidos utilize: Ajuda";
$text['description-switch']['pl'] = "Aby uzyskać listę poprawnych poleceń użyj pomocy";
$text['description-switch']['sv-se'] = "För en lista med giltiga kommandon använd: help";
$text['description-switch']['uk'] = "Для перегляду списку команд виконайте команду: help";
$text['description-switch']['de-at'] = "Um eine Liste der gültigen Befehle zu bekommen tippen Sie: 'help'";
$text['description-shell']['en-us'] = "System commands.";
$text['description-shell']['es-cl'] = "Comandos de sistema";
$text['description-shell']['pt-pt'] = "Comandos do sistema.";
$text['description-shell']['fr-fr'] = "Commande Système";
$text['description-shell']['pt-br'] = "Comando do sistema";
$text['description-shell']['pl'] = "Polecenia systemowe.";
$text['description-shell']['sv-se'] = "System Kommandon.";
$text['description-shell']['uk'] = "Системні команди";
$text['description-shell']['de-at'] = "System Befehle";
$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['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>Manual PHP";
$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual";
$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/fr/index.php' target='_blank'>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: <a href='http://php.net/manual/en/index.php' target='_blank'>PHP Manual</a>";
$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.";
?>

View File

@@ -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 " <script language=\"javascript\" type=\"text/javascript\" src=\"".PROJECT_PATH."/resources/edit_area/edit_area_full.js\"></script>\n";
echo " <script language=\"Javascript\" type=\"text/javascript\">\n";
echo " // initialisation //load,\n";
echo " editAreaLoader.init({\n";
echo " id: \"shell_cmd\" // id of the textarea to transform //, |, help\n";
echo " ,start_highlight: false\n";
echo " ,display: \"later\"\n";
echo " ,font_size: \"8\"\n";
echo " ,allow_toggle: true\n";
echo " ,language: \"en\"\n";
echo " ,syntax: \"html\"\n";
echo " ,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
echo " ,plugins: \"charmap\"\n";
echo " ,charmap_default: \"arrows\"\n";
echo " });\n";
echo "\n";
echo " editAreaLoader.init({\n";
echo " id: \"php_cmd\" // id of the textarea to transform //, |, help\n";
echo " ,start_highlight: false\n";
echo " ,display: \"later\"\n";
echo " ,font_size: \"8\"\n";
echo " ,allow_toggle: true\n";
echo " ,language: \"en\"\n";
echo " ,syntax: \"php\"\n";
echo " ,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
echo " ,plugins: \"charmap\"\n";
echo " ,charmap_default: \"arrows\"\n";
echo " });\n";
echo "\n";
echo " editAreaLoader.init({\n";
echo " id: \"switch_cmd\" // id of the textarea to transform //, |, help\n";
echo " ,start_highlight: false\n";
echo " ,display: \"later\"\n";
echo " ,font_size: \"8\"\n";
echo " ,allow_toggle: true\n";
echo " ,language: \"en\"\n";
echo " ,syntax: \"php\"\n";
echo " ,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
echo " ,plugins: \"charmap\"\n";
echo " ,charmap_default: \"arrows\"\n";
echo " });\n";
echo " </script>";
//scripts and styles
?>
<script language="JavaScript" type="text/javascript">
function submit_check() {
document.getElementById('cmd').value = editor.getSession().getValue();
if (document.getElementById('cmd').value == '') {
focus_editor();
return false;
}
return true;
}
function toggle_option(opt) {
switch (opt) {
case 'numbering': toggle_option_do('showLineNumbers'); toggle_option_do('fadeFoldWidgets'); break;
case 'invisibles': toggle_option_do('showInvisibles'); break;
case 'indenting': toggle_option_do('displayIndentGuides'); break;
}
focus_editor();
}
function toggle_option_do(opt_name) {
var opt_val = editor.getOption(opt_name);
editor.setOption(opt_name, ((opt_val) ? false : true));
}
function insert_clip(before, after) {
var selected_text = editor.session.getTextRange(editor.getSelectionRange());
editor.insert(before + selected_text + after);
focus_editor();
}
function focus_editor() {
editor.focus();
}
function set_handler(handler) {
switch (handler) {
case 'switch':
document.getElementById('description').innerHTML = "<?php echo $text['description-switch'];?>";
editor.getSession().setMode('ace/mode/text');
$('#mode option[value=text]').prop('selected',true);
break;
case 'php':
document.getElementById('description').innerHTML = "<?php echo $text['description-php'];?>";
editor.getSession().setMode('ace/mode/php');
$('#mode option[value=php]').prop('selected',true);
break;
case 'shell':
document.getElementById('description').innerHTML = "<?php echo $text['description-shell'];?>";
editor.getSession().setMode('ace/mode/text');
$('#mode option[value=text]').prop('selected',true);
break;
}
focus_editor();
}
function reset_editor() {
editor.getSession().setValue('');
$('#cmd').val('');
$('#response').hide();
focus_editor();
}
</script>
<style>
img.control {
cursor: pointer;
width: auto;
height: 23px;
border: none;
opacity: 0.5;
}
img.control:hover {
opacity: 1.0;
}
div#editor {
box-shadow: 0 3px 10px #333;
text-align: left;
width: 100%;
height: calc(100% - 30px);
font-size: 12px;
}
</style>
<?php
//show the header
echo "<b>".$text['label-execute']."</b>\n";
@@ -100,98 +155,216 @@ else {
echo $text['description-execute']."\n";
echo "<br><br>";
//html form
echo "<form method='post' name='frm' id='frm' action='' style='margin: 0;' onsubmit='return submit_check();'>\n";
echo "<textarea name='cmd' id='cmd' style='display: none;'></textarea>";
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n";
echo " <tr>";
echo " <td width='210' valign='top' nowrap>";
echo " <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
echo " <tr>";
echo " <td valign='top' height='130'>";
echo " <table cellpadding='0' cellspacing='3' border='0'>\n";
if (permission_exists('exec_switch')) { echo "<tr><td valign='middle'><input type='radio' name='handler' id='handler_switch' value='switch' ".(($handler == 'switch') ? 'checked' : null)." onclick=\"set_handler('switch');\"></td><td valign='bottom' style='padding-top: 3px;'><label for='handler_switch'> ".$text['label-switch']."</label></td></tr>\n"; }
if (permission_exists('exec_php_command')) { echo "<tr><td valign='middle'><input type='radio' name='handler' id='handler_php' value='php' ".(($handler == 'php') ? 'checked' : null)." onclick=\"set_handler('php');\"></td><td valign='bottom' style='padding-top: 3px;'><label for='handler_php'> ".$text['label-php']."</label></td></tr>\n"; }
if (permission_exists('exec_command_line')) { echo "<tr><td valign='middle'><input type='radio' name='handler' id='handler_shell' value='shell' ".(($handler == 'shell') ? 'checked' : null)." onclick=\"set_handler('shell');\"></td><td valign='bottom' style='padding-top: 3px;'><label for='handler_shell'> ".$text['label-shell']."</label></td></tr>\n"; }
echo " </table>\n";
echo " <br />";
echo " <input type='button' class='btn' title=\"".$text['button-execute']." [Ctrl + Enter]\" value=\" ".$text['button-execute']." \" onclick=\"$('form#frm').submit();\">";
echo " &nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)' onclick='reset_editor();'>".$text['label-reset']."</a>\n";
echo " <br /><br /><br />";
echo " </td>";
echo " </tr>";
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/") && permission_exists('script_editor_view')) {
echo " <tr>";
echo " <td valign='top' height='100%'>";
echo " <iframe id='clip_list' src='".PROJECT_PATH."/app/edit/cliplist.php' style='border: none; border-top: 1px solid #ccc; height: 100%; width: calc(100% - 15px);'></iframe>\n";
echo " </td>";
echo " </tr>";
}
echo " </table>";
echo " </td>";
echo " <td width='100%' valign='top' style='height: 400px;'>"
?>
<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
<tr>
<td valign='middle' style='padding: 0 6px;' width='100%'><span id='description'><?php echo $text['description-'.(($handler != '') ? $handler : 'switch')]; ?></span></td>
<td valign='middle' style='padding: 0;'><img src='resources/images/blank.gif' style='width: 1px; height: 30px; border: none;'></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_numbering.png' title='Toggle Line Numbers' class='control' onclick="toggle_option('numbering');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_invisibles.png' title='Toggle Invisibles' class='control' onclick="toggle_option('invisibles');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_indenting.png' title='Toggle Indent Guides' class='control' onclick="toggle_option('indenting');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_replace.png' title='Show Find/Replace [Ctrl+H]' class='control' onclick="editor.execCommand('replace');"></td>
<td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_goto.png' title='Show Go To Line' class='control' onclick="editor.execCommand('gotoline');"></td>
<td valign='middle' style='padding-left: 10px;'>
<select id='mode' style='height: 23px;' onchange="editor.getSession().setMode('ace/mode/' + this.options[this.selectedIndex].value); focus_editor();">
<?php
$modes['php'] = 'PHP';
$modes['css'] = 'CSS';
$modes['html'] = 'HTML';
$modes['javascript'] = 'JS';
$modes['json'] = 'JSON';
$modes['ini'] = 'Conf';
$modes['lua'] = 'Lua';
$modes['text'] = 'Text';
$modes['xml'] = 'XML';
$modes['sql'] = 'SQL';
$preview = ($setting_preview == 'true') ? "onmouseover=\"editor.getSession().setMode('ace/mode/' + this.value);\"" : null;
foreach ($modes as $value => $label) {
$selected = ($value == $mode) ? 'selected' : null;
echo "<option value='".$value."' ".$selected." ".$preview.">".$label."</option>\n";
}
?>
</select>
</td>
<td valign='middle' style='padding-left: 4px;'>
<select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
<?php
$sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
$preview = ($setting_preview == 'true') ? "onmouseover=\"document.getElementById('editor').style.fontSize = this.value;\"" : null;
if (!in_array($setting_size, $sizes)) {
echo "<option value='".$setting_size."' ".$preview.">".$setting_size."</option>\n";
echo "<option value='' disabled='disabled'></option>\n";
}
foreach ($sizes as $size) {
$selected = ($size == $setting_size) ? 'selected' : null;
echo "<option value='".$size."' ".$selected." ".$preview.">".$size."</option>\n";
}
?>
</select>
</td>
<td valign='middle' style='padding-left: 4px; padding-right: 0px;'>
<select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
<?php
$themes['Bright']['chrome']= 'Chrome';
$themes['Bright']['clouds']= 'Clouds';
$themes['Bright']['crimson_editor']= 'Crimson Editor';
$themes['Bright']['dawn']= 'Dawn';
$themes['Bright']['dreamweaver']= 'Dreamweaver';
$themes['Bright']['eclipse']= 'Eclipse';
$themes['Bright']['github']= 'GitHub';
$themes['Bright']['iplastic']= 'IPlastic';
$themes['Bright']['solarized_light']= 'Solarized Light';
$themes['Bright']['textmate']= 'TextMate';
$themes['Bright']['tomorrow']= 'Tomorrow';
$themes['Bright']['xcode']= 'XCode';
$themes['Bright']['kuroir']= 'Kuroir';
$themes['Bright']['katzenmilch']= 'KatzenMilch';
$themes['Bright']['sqlserver']= 'SQL Server';
$themes['Dark']['ambiance']= 'Ambiance';
$themes['Dark']['chaos']= 'Chaos';
$themes['Dark']['clouds_midnight']= 'Clouds Midnight';
$themes['Dark']['cobalt']= 'Cobalt';
$themes['Dark']['idle_fingers']= 'idle Fingers';
$themes['Dark']['kr_theme']= 'krTheme';
$themes['Dark']['merbivore']= 'Merbivore';
$themes['Dark']['merbivore_soft']= 'Merbivore Soft';
$themes['Dark']['mono_industrial']= 'Mono Industrial';
$themes['Dark']['monokai']= 'Monokai';
$themes['Dark']['pastel_on_dark']= 'Pastel on dark';
$themes['Dark']['solarized_dark']= 'Solarized Dark';
$themes['Dark']['terminal']= 'Terminal';
$themes['Dark']['tomorrow_night']= 'Tomorrow Night';
$themes['Dark']['tomorrow_night_blue']= 'Tomorrow Night Blue';
$themes['Dark']['tomorrow_night_bright']= 'Tomorrow Night Bright';
$themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
$themes['Dark']['twilight']= 'Twilight';
$themes['Dark']['vibrant_ink']= 'Vibrant Ink';
$preview = ($setting_preview == 'true') ? "onmouseover=\"editor.setTheme('ace/theme/' + this.value);\"" : null;
foreach ($themes as $optgroup => $theme) {
echo "<optgroup label='".$optgroup."'>\n";
foreach ($theme as $value => $label) {
$selected = (strtolower($label) == strtolower($setting_theme)) ? 'selected' : null;
echo "<option value='".$value."' ".$selected." ".$preview.">".$label."</option>\n";
}
echo "</optgroup>\n";
}
?>
</select>
</td>
</tr>
</table>
<div id='editor'><?php echo $cmd; ?></div>
<?php
echo " </td>";
echo " </tr>\n";
echo "</table>";
echo "</form>";
echo "<br /><br />";
?>
<script type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/ace/ace.js" charset="utf-8"></script>
<script type="text/javascript">
//load ace editor
var editor = ace.edit("editor");
editor.setOptions({
mode: 'ace/mode/<?php echo $mode;?>',
theme: 'ace/theme/'+document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value,
selectionStyle: 'text',
cursorStyle: 'smooth',
showInvisibles: <?php echo $setting_invisibles;?>,
displayIndentGuides: <?php echo $setting_indenting;?>,
showLineNumbers: <?php echo $setting_numbering;?>,
showGutter: true,
scrollPastEnd: true,
fadeFoldWidgets: <?php echo $setting_numbering;?>,
showPrintMargin: false,
highlightGutterLine: false,
useSoftTabs: false
});
document.getElementById('editor').style.fontSize='<?php echo $setting_size;?>';
focus_editor();
//keyboard shortcuts
$(window).keypress(function(event) {
//execute command [Ctrl+Enter]
if (((event.which == 13 || event.which == 10) && event.ctrlKey) || (event.which == 19)) {
$('form#frm_edit').submit();
return false;
}
//otherwise, default action
else {
return true;
}
});
</script>
<?php
//show the result
echo "<form method='post' name='frm' action=''>\n";
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n";
if (count($_POST)>0) {
echo " <tr>\n";
echo " <td colspan='2' align=\"left\">\n";
//shell_cmd
if (strlen($shell_cmd) > 0 && permission_exists('exec_command_line')) {
echo "<b>$shell_cmd</b>\n";
echo "<!--\n";
$shell_result = shell_exec($shell_cmd);
echo "-->\n";
echo "<pre>";
echo htmlentities($shell_result);
echo "</pre>\n";
}
//php_cmd
if (strlen($php_cmd) > 0 && permission_exists('exec_php_command')) {
//echo "<b></b>\n";
echo "<pre>";
$php_result = eval($php_cmd);
echo htmlentities($php_result);
echo "</pre>\n";
}
//fs cmd
if (strlen($switch_cmd) > 0 && permission_exists('exec_switch')) {
echo "<b>$switch_cmd</b>\n";
echo "<pre>";
$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 "<span id='response'>";
echo "<b>".$text['label-response']."</b>\n";
echo "<br /><br />\n";
echo ($handler == 'switch') ? "<textarea style='width: 100%; height: 450px; font-family: monospace; padding: 15px;' wrap='off'>".$result."</textarea>\n" : "<pre>".$result."</pre>";
echo "</span>";
}
echo "</pre>\n";
}
echo " <br />\n";
echo " </td>\n";
echo " </tr>";
}
//html form
if (permission_exists('exec_command_line')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\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='formfld' style='width: 100%;' wrap='off'>$shell_cmd</textarea>\n";
echo " <br />\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 " ".$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='formfld' style='width: 100%;' wrap='off'>$php_cmd</textarea>\n";
echo " <br />\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 " ".$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='formfld' style='width: 100%;' wrap='off'>$switch_cmd</textarea>\n";
echo " <br />\n";
echo " ".$text['description-switch']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-execute']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
//show the footer
require_once "resources/footer.php";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B