exec.php 20 KB

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