Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('exec_command_line') || permission_exists('exec_php_command') || permission_exists('exec_switch')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //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"]); } //show the header require_once "resources/header.php"; $document['title'] = $text['title-command']; //edit area echo " \n"; echo " "; //show the header echo "".$text['label-execute']."\n"; echo "

"; echo $text['description-execute']."\n"; echo "

"; //show the result 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);
			}
			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"; ?>