Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ //includes include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //permissions if (permission_exists('exec_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $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'; //get the html values and set them as variables $handler = ($_REQUEST["handler"] != '') ? trim($_REQUEST["handler"]) : ((permission_exists('exec_switch')) ? 'switch' : null); $code = trim($_POST["code"]); $command = trim($_POST["command"]); //check the captcha $command_authorized = false; if (strlen($code) > 0) { if (strtolower($_SESSION['captcha']) == strtolower($code)) { $command_authorized = true; } } //set editor moder switch ($handler) { case 'php': $mode = 'php'; break; case 'sql': $mode = 'sql'; break; default: $mode = 'text'; } //show the header require_once "resources/header.php"; $document['title'] = $text['title-command']; //pdo database connection if (permission_exists('exec_sql')) { require_once "sql_query_pdo.php"; } //scripts and styles ?> code = $_SESSION['captcha']; $image_base64 = $captcha->image_base64(); //show the header echo "
\n"; echo ""; echo " "; echo " "; echo " "; echo " "; echo " \n"; echo "
"; echo " ".$text['label-execute']."\n"; echo " "; //add the captcha echo " \n"; echo "      \n"; if (permission_exists('exec_switch') || permission_exists('exec_php') || permission_exists('exec_command') || permission_exists('exec_sql')) { echo " \n"; } //sql controls if (permission_exists('exec_sql')) { echo " "; //echo " ".$text['label-table']."
"; echo " \n"; //echo "

\n"; //echo " ".$text['label-result_type']."
"; echo " \n"; echo "
"; } echo " "; echo " "; //if (permission_exists('exec_sql')) { // echo " "; // //echo " \n"; // if (permission_exists('exec_sql_backup')) { // echo " 0) ? "?id=".$_REQUEST['id'] : null)."'\" value='".$text['button-backup']."'>\n"; // } // echo " "; //} echo "
\n"; echo $text['description-execute']."\n"; echo "
"; echo "
"; //html form echo "\n"; //sql db id echo ""; echo "\n"; echo " "; echo " "; echo " \n"; echo "
"; echo " "; if (permission_exists('edit_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) { echo " "; echo " "; echo " "; } echo "
"; echo " \n"; echo "
"; echo "
" ?>
"; echo "
"; echo "
"; echo "

"; ?> &1"); } break; case 'php': if (permission_exists('exec_php') && $command_authorized) { ob_start(); eval($command); $result = ob_get_contents(); ob_end_clean(); } break; case 'switch': if (permission_exists('exec_switch') && $command_authorized) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $result = event_socket_request($fp, 'api '.$command); } } break; } if ($result != '') { echo ""; echo "".$text['label-response']."\n"; echo "

\n"; echo ($handler == 'switch') ? "\n" : "
".escape($result)."
"; echo "
"; } } } //sql result if (permission_exists('exec_sql')) { echo ""; } //show the footer require_once "resources/footer.php"; ?>