Portions created by the Initial Developer are Copyright (C) 2008-2016 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'; $setting_preview = ($_SESSION["editor"]["live_preview"]["boolean"] != '') ? $_SESSION["editor"]["live_preview"]["boolean"] : 'true'; //get the html values and set them as variables $handler = ($_REQUEST["handler"] != '') ? trim($_REQUEST["handler"]) : ((permission_exists('exec_switch')) ? 'switch' : null); $cmd = trim($_POST["cmd"]); //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 voicemail database connection if (permission_exists('exec_sql')) { require_once "sql_query_pdo.php"; } //scripts and styles ?> \n"; echo ""; echo " "; echo " "; echo " "; echo " "; echo " \n"; echo "
"; echo " ".$text['label-execute']."\n"; echo " "; 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('script_editor_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) { echo " "; echo " "; echo " "; } echo "
"; echo " \n"; echo "
"; echo "
" ?>
"; echo "
"; echo ""; echo "

"; ?> 0) { if ($cmd != '') { switch ($handler) { case 'shell': if (permission_exists('exec_command')) { $result = htmlentities(shell_exec($cmd)); } break; case 'php': if (permission_exists('exec_php')) { ob_start(); eval($cmd); $result = ob_get_contents(); ob_end_clean(); } 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 "
"; } } } //sql result if (permission_exists('exec_sql')) { echo ""; } //show the footer require_once "resources/footer.php"; ?>