exec.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2019
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. James Rose <[email protected]>
  21. */
  22. //includes
  23. include "root.php";
  24. require_once "resources/require.php";
  25. require_once "resources/check_auth.php";
  26. //permissions
  27. if (permission_exists('exec_view')) {
  28. //access granted
  29. }
  30. else {
  31. echo "access denied";
  32. exit;
  33. }
  34. //add multi-lingual support
  35. $language = new text;
  36. $text = $language->get();
  37. // load editor preferences/defaults
  38. $setting_size = ($_SESSION["editor"]["font_size"]["text"] != '') ? $_SESSION["editor"]["font_size"]["text"] : '12px';
  39. $setting_theme = ($_SESSION["editor"]["theme"]["text"] != '') ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
  40. $setting_invisibles = ($_SESSION["editor"]["invisibles"]["boolean"] != '') ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
  41. $setting_indenting = ($_SESSION["editor"]["indent_guides"]["boolean"] != '') ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
  42. $setting_numbering = ($_SESSION["editor"]["line_numbers"]["boolean"] != '') ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
  43. //get the html values and set them as variables
  44. $handler = ($_REQUEST["handler"] != '') ? trim($_REQUEST["handler"]) : ((permission_exists('exec_switch')) ? 'switch' : null);
  45. $code = trim($_POST["code"]);
  46. $command = trim($_POST["command"]);
  47. //check the captcha
  48. $command_authorized = false;
  49. if (strlen($code) > 0) {
  50. if (strtolower($_SESSION['captcha']) == strtolower($code)) {
  51. $command_authorized = true;
  52. }
  53. }
  54. //set editor moder
  55. switch ($handler) {
  56. case 'php': $mode = 'php'; break;
  57. case 'sql': $mode = 'sql'; break;
  58. default: $mode = 'text';
  59. }
  60. //show the header
  61. require_once "resources/header.php";
  62. $document['title'] = $text['title-command'];
  63. //pdo database connection
  64. if (permission_exists('exec_sql')) {
  65. require_once "sql_query_pdo.php";
  66. }
  67. //scripts and styles
  68. ?>
  69. <script language="JavaScript" type="text/javascript">
  70. function submit_check() {
  71. document.getElementById('command').value = editor.getSession().getValue();
  72. if (document.getElementById('mode').value == 'sql') {
  73. $('#frm').prop('target', 'iframe').prop('action', 'sql_query_result.php?code='+ document.getElementById('code').value);
  74. $('#sql_response').show();
  75. }
  76. else {
  77. if (document.getElementById('command').value == '') {
  78. focus_editor();
  79. return false;
  80. }
  81. $('#frm').prop('target', '').prop('action', '');
  82. }
  83. return true;
  84. }
  85. function toggle_option(opt) {
  86. switch (opt) {
  87. case 'numbering': toggle_option_do('showLineNumbers'); toggle_option_do('fadeFoldWidgets'); break;
  88. case 'invisibles': toggle_option_do('showInvisibles'); break;
  89. case 'indenting': toggle_option_do('displayIndentGuides'); break;
  90. }
  91. focus_editor();
  92. }
  93. function toggle_option_do(opt_name) {
  94. var opt_val = editor.getOption(opt_name);
  95. editor.setOption(opt_name, ((opt_val) ? false : true));
  96. }
  97. function insert_clip(before, after) {
  98. var selected_text = editor.session.getTextRange(editor.getSelectionRange());
  99. editor.insert(before + selected_text + after);
  100. focus_editor();
  101. }
  102. function focus_editor() {
  103. editor.focus();
  104. }
  105. function set_handler(handler) {
  106. switch (handler) {
  107. <?php if (permission_exists('exec_switch')) { ?>
  108. case 'switch':
  109. document.getElementById('description').innerHTML = "<?php echo $text['description-switch'];?>";
  110. editor.getSession().setMode('ace/mode/text');
  111. $('#mode option[value=text]').prop('selected',true);
  112. <?php if (permission_exists('exec_sql')) { ?>
  113. $('.sql_controls').hide();
  114. document.getElementById('sql_type').selectedIndex = 0;
  115. document.getElementById('table_name').selectedIndex = 0;
  116. $('#iframe').prop('src','');
  117. $('#sql_response').hide();
  118. <?php } ?>
  119. $('#response').show();
  120. break;
  121. <?php } ?>
  122. <?php if (permission_exists('exec_php')) { ?>
  123. case 'php':
  124. document.getElementById('description').innerHTML = "<?php echo $text['description-php'];?>";
  125. editor.getSession().setMode({path:'ace/mode/php', inline:true}); //highlight without opening tag
  126. $('#mode option[value=php]').prop('selected',true);
  127. <?php if (permission_exists('exec_sql')) { ?>
  128. $('.sql_controls').hide();
  129. document.getElementById('sql_type').selectedIndex = 0;
  130. document.getElementById('table_name').selectedIndex = 0;
  131. $('#iframe').prop('src','');
  132. $('#sql_response').hide();
  133. <?php } ?>
  134. $('#response').show();
  135. break;
  136. <?php } ?>
  137. <?php if (permission_exists('exec_command')) { ?>
  138. case 'shell':
  139. document.getElementById('description').innerHTML = "<?php echo $text['description-shell'];?>";
  140. editor.getSession().setMode('ace/mode/text');
  141. $('#mode option[value=text]').prop('selected',true);
  142. <?php if (permission_exists('exec_sql')) { ?>
  143. $('.sql_controls').hide();
  144. document.getElementById('sql_type').selectedIndex = 0;
  145. document.getElementById('table_name').selectedIndex = 0;
  146. $('#iframe').prop('src','');
  147. $('#sql_response').hide();
  148. <?php } ?>
  149. $('#response').show();
  150. break;
  151. <?php } ?>
  152. <?php if (permission_exists('exec_sql')) { ?>
  153. case 'sql':
  154. document.getElementById('description').innerHTML = "<?php echo $text['description-sql'];?>";
  155. editor.getSession().setMode('ace/mode/sql');
  156. $('#mode option[value=sql]').prop('selected',true);
  157. $('.sql_controls').show();
  158. $('#response').hide();
  159. break;
  160. <?php } ?>
  161. default:
  162. break;
  163. }
  164. focus_editor();
  165. }
  166. function reset_editor() {
  167. editor.getSession().setValue('');
  168. $('#command').val('');
  169. $('#response').hide();
  170. <?php if (permission_exists('exec_sql')) { ?>
  171. $('#iframe').prop('src','');
  172. $('#sql_response').hide();
  173. <?php } ?>
  174. focus_editor();
  175. }
  176. </script>
  177. <style>
  178. img.control {
  179. cursor: pointer;
  180. width: auto;
  181. height: 23px;
  182. border: none;
  183. opacity: 0.5;
  184. }
  185. img.control:hover {
  186. opacity: 1.0;
  187. }
  188. div#editor {
  189. box-shadow: 0 3px 10px #333;
  190. text-align: left;
  191. width: 100%;
  192. height: calc(100% - 30px);
  193. font-size: 12px;
  194. }
  195. </style>
  196. <?php
  197. //generate the captcha image
  198. $_SESSION['captcha'] = generate_password(7, 2);
  199. $captcha = new captcha;
  200. $captcha->code = $_SESSION['captcha'];
  201. $image_base64 = $captcha->image_base64();
  202. //show the header
  203. echo "<form method='post' name='frm' id='frm' action='exec.php' style='margin: 0;' onsubmit='return submit_check();'>\n";
  204. echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
  205. echo " <tr>";
  206. echo " <td valign='top' align='left' width='50%'>";
  207. echo " <b>".$text['label-execute']."</b>\n";
  208. echo " </td>";
  209. echo " <td valign='top' align='right' nowrap='nowrap'>";
  210. //add the captcha
  211. echo " <img src=\"data:image/png;base64, ".$image_base64."\" /><input type='text' class='txt' style='width: 150px; margin-left: 15px;' name='code' id='code' value=''>\n";
  212. echo " &nbsp; &nbsp; &nbsp;\n";
  213. if (permission_exists('exec_switch') || permission_exists('exec_php') || permission_exists('exec_command') || permission_exists('exec_sql')) {
  214. echo " <select name='handler' id='handler' class='formfld' style='width:100px;' onchange=\"handler=this.value;set_handler(this.value);\">\n";
  215. if (permission_exists('exec_switch')) { echo "<option value='switch' ".(($handler == 'switch') ? "selected='selected'" : null).">".$text['label-switch']."</option>\n"; }
  216. if (permission_exists('exec_php')) { echo "<option value='php' ".(($handler == 'php') ? "selected='selected'" : null).">".$text['label-php']."</option>\n"; }
  217. if (permission_exists('exec_command')) { echo "<option value='shell' ".(($handler == 'shell') ? "selected='selected'" : null).">".$text['label-shell']."</option>\n"; }
  218. if (permission_exists('exec_sql')) { echo "<option value='sql' ".(($handler == 'sql') ? "selected='selected'" : null).">".$text['label-sql']."</option>\n"; }
  219. echo " </select>\n";
  220. }
  221. //sql controls
  222. if (permission_exists('exec_sql')) {
  223. echo " <span class='sql_controls' ".(($handler != 'sql') ? "style='display: none;'" : null).">";
  224. //echo " ".$text['label-table']."<br />";
  225. echo " <select name='table_name' id='table_name' class='formfld'>\n";
  226. echo " <option value=''></option>\n";
  227. switch ($db_type) {
  228. case 'sqlite': $sql = "select name from sqlite_master where type='table' order by name;"; break;
  229. case 'pgsql': $sql = "select table_name as name from information_schema.tables where table_schema='public' and table_type='BASE TABLE' order by table_name"; break;
  230. case 'mysql': $sql = "show tables"; break;
  231. }
  232. $database = new database;
  233. $result = $database->select($sql, null, 'all');
  234. if (is_array($result) && @sizeof($result) != 0) {
  235. foreach ($result as &$row) {
  236. $row = array_values($row);
  237. echo " <option value='".escape($row[0])."'>".escape($row[0])."</option>\n";
  238. }
  239. }
  240. unset($sql, $result, $row);
  241. echo " </select>\n";
  242. //echo " <br /><br />\n";
  243. //echo " ".$text['label-result_type']."<br />";
  244. echo " <select name='sql_type' id='sql_type' class='formfld'>\n";
  245. echo " <option value=''>".$text['option-result_type_view']."</option>\n";
  246. echo " <option value='csv'>".$text['option-result_type_csv']."</option>\n";
  247. echo " <option value='inserts'>".$text['option-result_type_insert']."</option>\n";
  248. echo " </select>\n";
  249. echo " </span>";
  250. }
  251. echo " <input type='button' class='btn' style='margin-top: 0px;' title=\"".$text['button-execute']." [Ctrl+Enter]\" value=\" ".$text['button-execute']." \" onclick=\"$('form#frm').submit();\">";
  252. echo " <input type='button' class='btn' style='margin-top: 0px;' title=\"\" value=\" ".$text['button-reset']." \" onclick=\"reset_editor();\">";
  253. //if (permission_exists('exec_sql')) {
  254. // echo " <span class='sql_controls' ".(($handler != 'sql') ? "style='display: none;'" : null).">";
  255. // //echo " <input type='button' class='btn' alt='".$text['button-select_database']."' onclick=\"document.location.href='sql_query_db.php'\" value='".$text['button-select_database']."'>\n";
  256. // if (permission_exists('exec_sql_backup')) {
  257. // echo " <input type='button' class='btn' alt='".$text['button-backup']."' onclick=\"document.location.href='sql_backup.php".((strlen($_REQUEST['id']) > 0) ? "?id=".$_REQUEST['id'] : null)."'\" value='".$text['button-backup']."'>\n";
  258. // }
  259. // echo " </span>";
  260. //}
  261. echo " </td>";
  262. echo " </tr>";
  263. echo " <tr><td colspan='2'>\n";
  264. echo $text['description-execute']."\n";
  265. echo " </tr>\n";
  266. echo "</table>";
  267. echo "<br>";
  268. //html form
  269. echo "<input type='hidden' name='id' value='".escape($_REQUEST['id'])."'>\n"; //sql db id
  270. echo "<textarea name='command' id='command' style='display: none;'></textarea>";
  271. echo "<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>\n";
  272. echo " <tr>";
  273. echo " <td style='width: 280px;' valign='top' nowrap>";
  274. echo " <table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
  275. if (permission_exists('edit_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) {
  276. echo " <tr>";
  277. echo " <td valign='top' height='100%'>";
  278. echo " <iframe id='clip_list' src='".PROJECT_PATH."/app/edit/clip_list.php' style='border: none; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; height: calc(100% - 2px); width: calc(100% - 15px);'></iframe>\n";
  279. echo " </td>";
  280. echo " </tr>";
  281. }
  282. echo " </table>";
  283. echo " </td>";
  284. echo " <td valign='top' style='height: 400px;'>"
  285. ?>
  286. <table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
  287. <tr>
  288. <td valign='middle' style='padding: 0 6px;' width='100%'><span id='description'><?php echo $text['description-'.$handler]; ?></span></td>
  289. <td valign='middle' style='padding: 0;'><img src='resources/images/blank.gif' style='width: 1px; height: 30px; border: none;'></td>
  290. <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>
  291. <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_invisibles.png' title='Toggle Invisibles' class='control' onclick="toggle_option('invisibles');"></td>
  292. <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>
  293. <!--<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>-->
  294. <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>
  295. <td valign='middle' style='padding-left: 10px;'>
  296. <select id='mode' style='height: 23px;' onchange="editor.getSession().setMode((this.options[this.selectedIndex].value == 'php') ? {path:'ace/mode/php', inline:true} : 'ace/mode/' + this.options[this.selectedIndex].value); focus_editor();">
  297. <?php
  298. $modes['php'] = 'PHP';
  299. $modes['css'] = 'CSS';
  300. $modes['html'] = 'HTML';
  301. $modes['javascript'] = 'JS';
  302. $modes['json'] = 'JSON';
  303. $modes['ini'] = 'Conf';
  304. $modes['lua'] = 'Lua';
  305. $modes['text'] = 'Text';
  306. $modes['xml'] = 'XML';
  307. $modes['sql'] = 'SQL';
  308. foreach ($modes as $value => $label) {
  309. $selected = $value == $mode ? 'selected' : null;
  310. echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
  311. }
  312. ?>
  313. </select>
  314. </td>
  315. <td valign='middle' style='padding-left: 4px;'>
  316. <select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
  317. <?php
  318. $sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
  319. if (!in_array($setting_size, $sizes)) {
  320. echo "<option value='".$setting_size."'>".escape($setting_size)."</option>\n";
  321. echo "<option value='' disabled='disabled'></option>\n";
  322. }
  323. foreach ($sizes as $size) {
  324. $selected = ($size == $setting_size) ? 'selected' : null;
  325. echo "<option value='".$size."' ".$selected.">".escape($size)."</option>\n";
  326. }
  327. ?>
  328. </select>
  329. </td>
  330. <td valign='middle' style='padding-left: 4px; padding-right: 0px;'>
  331. <select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
  332. <?php
  333. $themes['Light']['chrome']= 'Chrome';
  334. $themes['Light']['clouds']= 'Clouds';
  335. $themes['Light']['crimson_editor']= 'Crimson Editor';
  336. $themes['Light']['dawn']= 'Dawn';
  337. $themes['Light']['dreamweaver']= 'Dreamweaver';
  338. $themes['Light']['eclipse']= 'Eclipse';
  339. $themes['Light']['github']= 'GitHub';
  340. $themes['Light']['iplastic']= 'IPlastic';
  341. $themes['Light']['solarized_light']= 'Solarized Light';
  342. $themes['Light']['textmate']= 'TextMate';
  343. $themes['Light']['tomorrow']= 'Tomorrow';
  344. $themes['Light']['xcode']= 'XCode';
  345. $themes['Light']['kuroir']= 'Kuroir';
  346. $themes['Light']['katzenmilch']= 'KatzenMilch';
  347. $themes['Light']['sqlserver']= 'SQL Server';
  348. $themes['Dark']['ambiance']= 'Ambiance';
  349. $themes['Dark']['chaos']= 'Chaos';
  350. $themes['Dark']['clouds_midnight']= 'Clouds Midnight';
  351. $themes['Dark']['cobalt']= 'Cobalt';
  352. $themes['Dark']['idle_fingers']= 'idle Fingers';
  353. $themes['Dark']['kr_theme']= 'krTheme';
  354. $themes['Dark']['merbivore']= 'Merbivore';
  355. $themes['Dark']['merbivore_soft']= 'Merbivore Soft';
  356. $themes['Dark']['mono_industrial']= 'Mono Industrial';
  357. $themes['Dark']['monokai']= 'Monokai';
  358. $themes['Dark']['pastel_on_dark']= 'Pastel on dark';
  359. $themes['Dark']['solarized_dark']= 'Solarized Dark';
  360. $themes['Dark']['terminal']= 'Terminal';
  361. $themes['Dark']['tomorrow_night']= 'Tomorrow Night';
  362. $themes['Dark']['tomorrow_night_blue']= 'Tomorrow Night Blue';
  363. $themes['Dark']['tomorrow_night_bright']= 'Tomorrow Night Bright';
  364. $themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
  365. $themes['Dark']['twilight']= 'Twilight';
  366. $themes['Dark']['vibrant_ink']= 'Vibrant Ink';
  367. foreach ($themes as $optgroup => $theme) {
  368. echo "<optgroup label='".$optgroup."'>\n";
  369. foreach ($theme as $value => $label) {
  370. $selected = strtolower($label) == strtolower($setting_theme) ? 'selected' : null;
  371. echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
  372. }
  373. echo "</optgroup>\n";
  374. }
  375. ?>
  376. </select>
  377. </td>
  378. </tr>
  379. </table>
  380. <div id='editor'><?php echo $command; ?></div>
  381. <?php
  382. echo " </td>";
  383. echo " </tr>\n";
  384. echo "</table>";
  385. echo "</form>";
  386. echo "<br /><br />";
  387. ?>
  388. <script type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/ace/ace.js" charset="utf-8"></script>
  389. <script type="text/javascript">
  390. //load ace editor
  391. var editor = ace.edit("editor");
  392. editor.setOptions({
  393. mode: 'ace/mode/<?php echo $mode;?>',
  394. theme: 'ace/theme/'+document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value,
  395. selectionStyle: 'text',
  396. cursorStyle: 'smooth',
  397. showInvisibles: <?php echo $setting_invisibles;?>,
  398. displayIndentGuides: <?php echo $setting_indenting;?>,
  399. showLineNumbers: <?php echo $setting_numbering;?>,
  400. showGutter: true,
  401. scrollPastEnd: true,
  402. fadeFoldWidgets: <?php echo $setting_numbering;?>,
  403. showPrintMargin: false,
  404. highlightGutterLine: false,
  405. useSoftTabs: false
  406. });
  407. <?php if ($mode == 'php') { ?>
  408. editor.getSession().setMode({path:'ace/mode/php', inline:true});
  409. <?php } ?>
  410. document.getElementById('editor').style.fontSize='<?php echo escape($setting_size);?>';
  411. focus_editor();
  412. //keyboard shortcut to execute command
  413. <?php key_press('ctrl+enter', 'down', 'window', null, null, "$('form#frm').submit();", false); ?>
  414. //remove certain keyboard shortcuts
  415. editor.commands.bindKey("Ctrl-T", null); //disable transpose letters - prefer new browser tab
  416. editor.commands.bindKey("Ctrl-F", null); //disable find - control broken with bootstrap
  417. editor.commands.bindKey("Ctrl-H", null); //disable replace - control broken with bootstrap
  418. </script>
  419. <?php
  420. //show the result
  421. if (is_array($_POST)) {
  422. if ($command != '') {
  423. $result = '';
  424. switch ($handler) {
  425. case 'shell':
  426. if (permission_exists('exec_command') && $command_authorized) {
  427. $result = shell_exec($command . " 2>&1");
  428. }
  429. break;
  430. case 'php':
  431. if (permission_exists('exec_php') && $command_authorized) {
  432. ob_start();
  433. eval($command);
  434. $result = ob_get_contents();
  435. ob_end_clean();
  436. }
  437. break;
  438. case 'switch':
  439. if (permission_exists('exec_switch') && $command_authorized) {
  440. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  441. if ($fp) {
  442. $result = event_socket_request($fp, 'api '.$command);
  443. }
  444. }
  445. break;
  446. }
  447. if ($result != '') {
  448. echo "<span id='response'>";
  449. echo "<b>".$text['label-response']."</b>\n";
  450. echo "<br /><br />\n";
  451. echo ($handler == 'switch') ? "<textarea style='width: 100%; height: 450px; font-family: monospace; padding: 15px;' wrap='off'>".$result."</textarea>\n" : "<pre>".escape($result)."</pre>";
  452. echo "</span>";
  453. }
  454. }
  455. }
  456. //sql result
  457. if (permission_exists('exec_sql')) {
  458. echo "<span id='sql_response' style='display: none;'>";
  459. echo "<b>".$text['label-results']."</b>\n";
  460. echo "<br /><br />\n";
  461. echo "<iframe name='iframe' id='iframe' style='width: calc(100% - 3px); height: 500px; background-color: #fff; border: 1px solid #c0c0c0;'></iframe>\n";
  462. echo "</span>";
  463. }
  464. //show the footer
  465. require_once "resources/footer.php";
  466. ?>