From e1d192b501d1394c4c25b40cc67e82feafc89ff1 Mon Sep 17 00:00:00 2001 From: reliberate Date: Thu, 17 Mar 2016 15:50:18 -0600 Subject: [PATCH] Command: Integrate new editor, include Clip Library. --- app/exec/app_languages.php | 208 +++++---- app/exec/exec.php | 439 ++++++++++++------ app/exec/resources/images/blank.gif | Bin 0 -> 49 bytes app/exec/resources/images/icon_file.png | Bin 0 -> 257 bytes app/exec/resources/images/icon_folder.png | Bin 0 -> 224 bytes app/exec/resources/images/icon_gear.png | Bin 0 -> 726 bytes app/exec/resources/images/icon_goto.png | Bin 0 -> 417 bytes app/exec/resources/images/icon_indenting.png | Bin 0 -> 324 bytes app/exec/resources/images/icon_invisibles.png | Bin 0 -> 821 bytes app/exec/resources/images/icon_numbering.png | Bin 0 -> 521 bytes app/exec/resources/images/icon_replace.png | Bin 0 -> 504 bytes 11 files changed, 422 insertions(+), 225 deletions(-) create mode 100644 app/exec/resources/images/blank.gif create mode 100644 app/exec/resources/images/icon_file.png create mode 100644 app/exec/resources/images/icon_folder.png create mode 100644 app/exec/resources/images/icon_gear.png create mode 100644 app/exec/resources/images/icon_goto.png create mode 100644 app/exec/resources/images/icon_indenting.png create mode 100644 app/exec/resources/images/icon_invisibles.png create mode 100644 app/exec/resources/images/icon_numbering.png create mode 100644 app/exec/resources/images/icon_replace.png 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"; + echo ""; + echo "\n"; + echo " "; + echo " "; + echo " \n"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + if (file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/") && permission_exists('script_editor_view')) { + echo " "; + echo " "; + echo " "; + } + echo "
"; + echo " \n"; + if (permission_exists('exec_switch')) { echo "\n"; } + if (permission_exists('exec_php_command')) { echo "\n"; } + if (permission_exists('exec_command_line')) { echo "\n"; } + echo "
\n"; + echo "
"; + echo " "; + echo "     ".$text['label-reset']."\n"; + echo "


"; + echo "
"; + echo " \n"; + echo "
"; + echo "
" + ?> + + + + + + + + + + + + + +
+ + + + + +
+
+ "; + echo "
"; + echo "
"; + echo "

"; + ?> + + + + +\n"; - echo "\n"; - if (count($_POST)>0) { - echo " \n"; - echo " \n"; - echo " "; } -//html form - if (permission_exists('exec_command_line')) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - if (permission_exists('exec_php_command')) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - if (permission_exists('exec_switch')) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo " \n"; - echo " \n"; - echo " "; - 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 ($handler == 'switch') ? "\n" : "
".$result."
"; + echo "
"; } - echo "
\n"; } - echo "
\n"; - echo "
\n"; - echo " ".$text['label-shell']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-shell']."\n"; - echo "
\n"; - echo " ".$text['label-php']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-php']."\n"; - echo "
\n"; - echo " ".$text['label-switch']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo " ".$text['description-switch']."\n"; - echo "
\n"; - echo "
"; - echo " \n"; - echo "
"; - echo "

"; - echo ""; - //show the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/app/exec/resources/images/blank.gif b/app/exec/resources/images/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..75b945d2553848b8b6f41fe5e24599c0687b8472 GIT binary patch literal 49 zcmZ?wbhEHbWMp7unE0RJ|Ns9C3=9Vj8~~DvKUo+V7?>DzfNY>Fh|Ltj$Y2csQN9XW literal 0 HcmV?d00001 diff --git a/app/exec/resources/images/icon_file.png b/app/exec/resources/images/icon_file.png new file mode 100644 index 0000000000000000000000000000000000000000..c8d71de0c4ad9a7a8f4349f7b5afecf4d97e0bb7 GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY55O6*3aqU4E)2*A_r%sCn&Dx^)?Ph~mWJ}XY zrZ<;%OrBu7XQP2rM}k|9&Yrt9?;aW%FbSys6x+fwGkHS0-;^IU8mk^$ydLQcFw|Q4~G%p-ze-6lZA1 zk{YU&jWJLtl2luXAT35+s4IzP5wP1Qy|jX>NX zY6>kWouRP6I1Di30+9*7jc4`Vz2}|#?#Ti62XR1ef0A%dsJ7Yj1aToT9Sj6(0HC3< zp@U;{^1lC=>F8|l?9ub-odUVm+!B9frB{^1Vm`-e093Nj<-B3aG8uopSosRzU;%=r z2!bHMv0QqEul%mQN6{3y=L&)#RGW{ROAH2vC_Gnio9FlpS(c$F3IM=hFo0ngBPkRaFf14>|yB3P=fQT3VEfIhIS8Wf|e{$ng82AzvsIS_c4+$Mb}w$YGz~?*RZw zl2*iIVg>*~0ze=TsF{pRJqG|qQ4o(s`?ekfKqwSikHupzx9*c)CVGQy!TSI-ohj<} zd1I$l00nBBspC=rh}yc^r`}5!ZyAloG)>d6n34`@8(L2^8dU+n>2#*KT&|Xrj#D-O zIC3<@!Db(`jgE}IrU7Uc-g3f}WikQ)!!U5W-DNaI59Oc9e?@@;Z{e?(x=Sx?O=Yv$ zbhE{52maV#R zCP+CDZ^t6%2E?zR@=4fI%UvKo1jHObya0&viF9!|5U&AZQ6Rnw#FucTb6y}`1$6-k zHv=&v9+&4pQx8b|01(Tdn29A5u>{5oRzWBO_IdaS&iZ5;Fs0WvJJ&>H*@vK+KFS z5}^Pj{tSo@qGzI2Xpu%PJ_$1u+2x0!>Gdy#1>sq^H->Bl4G>@e&gR^+SeU!>00000 LNkvXXu0mjfF9@U- literal 0 HcmV?d00001 diff --git a/app/exec/resources/images/icon_indenting.png b/app/exec/resources/images/icon_indenting.png new file mode 100644 index 0000000000000000000000000000000000000000..c6d4c733f126b55a393fb5c1550b66340c69a6f2 GIT binary patch literal 324 zcmV-K0lWT*P)%Q5972jAIQ4=e6olE>*nR--6DJ1a(#ry~j}({V(u-_( zBapHN;y;XxjPpq}9IIYNV$->>u<$V^CZ-4=e)RI?OX{W;W@ctfpsO|mnF3T#EkGB8 zupZEYQ^ckgxZ(f){qqN6DIk^uVi&9~fmoml3L<22TzZL4Ei5c>rMKU{eQQP4)B+51 z5OoQd0PLxrS`-x(K|v7#H0Ti!5T%EaE=4Xh#-9Q4BQnbtOueIJ3q`4AWL0wj0R{l= WHTrvIz+7Yi0000}#2@UW1Hq1KuRbX2Ya?I0C@d))q#Fd-wWOxz zs4;o~bLVgxU6G37y$MXB6L4py%7uEqH$HhuyduZcNUZwEOEYr2pRl$q5Py)BzJNNX zQKF7aDt!lQnV)LTB4-ic@U-eM4MeHPNknUiTo2gL0Oz|{*=v=G(A0HY-axH(gT3)Y z>$J?1LC}v3#>>Icz$9weq?Gi+ju~@124(`VN+39X%98>0KaGy|{#+K3CrDx&%;B=R zE#m1J%zD^e(0#BYWi&35UI=^ZcOd4md_Lbg_VvrnnHu`SiEPC96pAZK)kwb<4Zh)> z-w!@Jl!BbK3!-B2I>OhXFXX*{9XZ9Dfi_r(tczXBAj*Eyd|$VH6&c zgpaq>18@&EuYmoLy}n{{=5iQhb6`v5w?!sZl_P?j6JFdRxQE#I zMv0vAERRX_2zXzj){GC=q^w8qevBC$VZ+FvCG zU*Nt}bKABRP1BS#O=;%}_tM_DNYGrO*=*)_?)$!p2U9Rk@%4pUGX^Fl%F+R!#j@N` z`p_792+qJbxCM(6<}O&tmBq5G08(WW8ektx7qSqEq}6Iwayv(@L(bf1-9iTx0bRm8 zDs>CY_h7aO(=KSRjM~s$=mzVSOrTrtO5IYc)qZCcx=N zjTA4gl%K$9#tuu^ywoi)uR~U;EU4Q#Yel+S>at}S{>=@HZvh4XFCx-qlh}c#00000 LNkvXXu0mjfcthUG literal 0 HcmV?d00001 diff --git a/app/exec/resources/images/icon_replace.png b/app/exec/resources/images/icon_replace.png new file mode 100644 index 0000000000000000000000000000000000000000..4b2ec2178852b59198baa3ae49a0eb6f321fa83c GIT binary patch literal 504 zcmVz$>{0~W;E)ZWv)(8#}5COwTKnRGZ0r3}*IxP4E)KU;= z2jbP}uEJ%w0@M{SgFr6r1L9_=As?XPKY(~Wl)ao7!?}R?6jZ}~Aojo#l(IlP7tJS2 zuo=#RCYAxjra=4>YVb`ghCc@42Smjvn#&(RU6PGMIXe(fz!C?miE;UPXt1ooVYoFA zYXb2msG+bFcMO|iM&wk2B`IR4M>3RPh@iXN6v+@64Z^2^_%9ZN<$+iX8b^-^g*mn~ zT@J*|I2?EeswSV9q=;29)st-xCe;8BdM8=6h{ONPXOW+ApVSG0LZY9Xck{YV$VXi0Gr_{Nb+jXGUXD~a8PP_ z0xeH`ftU@5TaYZ6iyZOzN=0PA3d9o7VByCi-;89z0$3eEtl`9fdL#=#C8P*74F`c5 usNtZX)1bEDAdm^ImB8jP4%rGCAix0otSfUDlILLn0000