From 93798fce9355f52ff520844134a9945a68e57502 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Mon, 24 Feb 2014 09:11:06 +0000 Subject: [PATCH] Terminal removed, now a plugin It's not a core part of a code editor, so moved back to being a plugin again --- images/terminal.png | Bin 1810 -> 0 bytes terminal/index.php | 201 ------------------------------------------ terminal/terminal.css | 28 ------ 3 files changed, 229 deletions(-) delete mode 100644 images/terminal.png delete mode 100644 terminal/index.php delete mode 100644 terminal/terminal.css diff --git a/images/terminal.png b/images/terminal.png deleted file mode 100644 index c3df5a6d99beba17857dc0cc2cd5c4f7928f2755..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1810 zcmaJ?Yfuws6b+P8U#MtNp(;yI3@QmpNPqx^Ktc%^3?U|fiiTtZD<&H@3kh+kAT&b`Ws{6)b|GfC6I0jttrjiuOn8&hCDXIp^Gazk7BzofrI_ z#XOsNI2_J`6TsqQ<4WT*#~gbj7EexKgEh(yLqlO1sum+4jwywsK!76`M}vG&EKQ7S z0X=cJFYu5c3=QLMVn|>)QEbEzHF71!#^F4@HA=B07DRz4Fd9;L;YTn3h6f<27hXi; zI&+nNUbtP zdf`7L6~^TOelP+8G$PeW;!Gw3bUKmjLZj2k8v%+lnL={LZn_iMg+Ze;D6YWA3y(!Z zq%sDd<^M4jw(`Qqps12TBB|ACqMAyCk!TXx-QC@&L7_Nd2q#sd0u^hV6e{}}1s151 zAdnJ;UfH z)hfqnJeSMhC{(CeAptooFFd9|gdiz{=}Y%>ab?rVOe&L1W>ei+ZZvl`jZR^cX)I?d zb%x7=CGm1lfzEKHpSiBHa*bAyE3wEd5P=dvsXqeCf$5SN(CoRm%&Pa1E1f+T+N@j> zmJG?**nc&8W(#wVar()&*y5A%K?UY^1haJvVRH-iwdgo3ra<$sOc)ffHDqzl8rSrY zB?T}21T3DOSTIs140)WHQQW}|$w)i@ycq4RI5@&$Jr1)nTaNd&Wb&B2<-#9@A+Ek- zq<6GkyIgXpiyif)i7nStPo3H`dPyZS-2QX?)hm5|eqG3p9q;eRE?ngX1XNisFwZ!- zJu>p`#Kc5nQ)A<`;NW2GmMvROcE3n?|7%2f@J2Up?2{4iq^y` z6eH^r3{wU}Nl;B~?caq}Rb$j;<>lpf$HyrzMn+oA%X5cN#ys;>^`%!Dz`A9>pUuuL%*;*H&j(uTfTM_ zpeV{yt7{tS23|o0Z|d%iElTl8b~{S&@W>X5MEZ(~!|OL}NSAO63kwAi5rG~a9$6;$ zB^7;_YHRcQ`XuWKguJXQo2NI52L~aJL)+?5pEU~?%H?vas_g7D5aAT ztLxG|%3;Q---ky=zB9R#Ad~3~0|Syk$HoSOK^C{KiFd@t#s;}?e$-7@Qc~goRq=k} z{Suqg>3hQP>{+_nGpYWOY`a|Uq$?45<|GZg?4=FouN9KboLv!b@71|Wt|>kDPFd~5 Y?Q*MW9jhMx-uRc|u!C6@zB~8*1C}k_L;wH) diff --git a/terminal/index.php b/terminal/index.php deleted file mode 100644 index 017d7eb..0000000 --- a/terminal/index.php +++ /dev/null @@ -1,201 +0,0 @@ - $ICEcoder["password"]); -} - -$aliases = array('la' => 'ls -la', - 'll' => 'ls -lvhF', - 'dir' => 'ls' ); - -class phpTerm { - function phpTerm() {} // constructor - - function formatPrompt() { - $user=shell_exec("whoami"); - $host=explode(".", shell_exec("uname -n")); - $_SESSION['prompt'] = rtrim($user)."@".rtrim($host[0]); - } - - function checkPassword($passwd) { - if( !isset($_SERVER['PHP_AUTH_USER'])|| - !isset($_SERVER['PHP_AUTH_PW']) || - !isset($passwd[$_SERVER['PHP_AUTH_USER']]) || - $passwd[$_SERVER['PHP_AUTH_USER']] != $_SESSION['pass']) { - return false; - } else { - return true; - } - } - - function logout() { - header('WWW-Authenticate: Basic realm="Terminal"'); - header('HTTP/1.0 401 Unauthorized'); - exit(); - } - - function initVars() { - if (empty($_SESSION['cwd']) || @!empty($_GET['reset'])) { - $_SESSION['cwd'] = getcwd(); - $_SESSION['history'] = array(); - $_SESSION['output'] = ''; - $_REQUEST['command'] =''; - } - } - - function buildCommandHistory() { - if(!empty($_REQUEST['command'])) { - if(get_magic_quotes_gpc()) { - $_REQUEST['command'] = stripslashes($_REQUEST['command']); - } - - // drop old commands from list if exists - if (($i = array_search($_REQUEST['command'], $_SESSION['history'])) !== false) { - unset($_SESSION['history'][$i]); - } - array_unshift($_SESSION['history'], $_REQUEST['command']); - - // append commmand */ - $_SESSION['output'] .= "{$_SESSION['prompt']}".":>"."{$_REQUEST['command']}"."\n"; - } - } - - function buildJavaHistory() { - // build command history for use in the JavaScript - if (empty($_SESSION['history'])) { - $_SESSION['js_command_hist'] = '""'; - } else { - $escaped = array_map('addslashes', $_SESSION['history']); - $_SESSION['js_command_hist'] = '"", "'.implode('", "', $escaped).'"'; - } - } - - function outputHandle($aliases) { - if (preg_match('/^[[:blank:]]*cd[[:blank:]]*$/', @$_REQUEST['command'])) { - $_SESSION['cwd'] = getcwd(); //dirname(__FILE__); - } - elseif(preg_match('/^[[:blank:]]*cd[[:blank:]]+([^;]+)$/', @$_REQUEST['command'], $regs)) { - // The current command is 'cd', which we have to handle as an internal shell command. - // absolute/relative path ?" - ($regs[1][0] == '/') ? $new_dir = $regs[1] : $new_dir = $_SESSION['cwd'].'/'.$regs[1]; - - // cosmetics - while (strpos($new_dir, '/./') !== false) { - $new_dir = str_replace('/./', '/', $new_dir); - } - while (strpos($new_dir, '//') !== false) { - $new_dir = str_replace('//', '/', $new_dir); - } - while (preg_match('|/\.\.(?!\.)|', $new_dir)) { - $new_dir = preg_replace('|/?[^/]+/\.\.(?!\.)|', '', $new_dir); - } - - if(empty($new_dir)): $new_dir = "/"; endif; - - (@chdir($new_dir)) ? $_SESSION['cwd'] = $new_dir : $_SESSION['output'] .= "could not change to: $new_dir\n"; - } else { - /* The command is not a 'cd' command, so we execute it after - changing the directory and save the output. */ - chdir($_SESSION['cwd']); - - /* Alias expansion. */ - $length = strcspn(@$_REQUEST['command'], " \t"); - $token = substr(@$_REQUEST['command'], 0, $length); - if (isset($aliases[$token])) - $_REQUEST['command'] = $aliases[$token] . substr($_REQUEST['command'], $length); - - $p = proc_open(@$_REQUEST['command'], - array(1 => array('pipe', 'w'), - 2 => array('pipe', 'w')), $io); - - /* Read output sent to stdout. */ - while (!feof($io[1])) { - $_SESSION['output'] .= htmlspecialchars(fgets($io[1]),ENT_COMPAT, 'UTF-8'); - } - /* Read output sent to stderr. */ - while (!feof($io[2])) { - $_SESSION['output'] .= htmlspecialchars(fgets($io[2]),ENT_COMPAT, 'UTF-8'); - } - - fclose($io[1]); - fclose($io[2]); - proc_close($p); - } - } -} - -$terminal = new phpTerm; - -if (isset($_REQUEST['command']) && $_REQUEST['command']=="logout") { - $terminal->logout(); -} - -if(!$terminal->checkPassword($passwd)) { - header('WWW-Authenticate: Basic realm="Terminal"'); - header('HTTP/1.0 401 Unauthorized'); -} else { - $terminal->initVars(); - $terminal->buildCommandHistory(); - $terminal->buildJavaHistory(); - if(!isset($_SESSION['prompt'])):$terminal->formatPrompt(); endif; - $terminal->outputHandle($aliases); -?> - - - -PHP Terminal - - - - - - -
- -
- -

$>

-
- - - - \ No newline at end of file diff --git a/terminal/terminal.css b/terminal/terminal.css deleted file mode 100644 index 1677005..0000000 --- a/terminal/terminal.css +++ /dev/null @@ -1,28 +0,0 @@ -/* First, reset everything to a standard */ -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, input, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - font-family: verdana, arial, monospace, sans-serif; - border: 0; - margin: 0; - padding: 0; - outline: 0; - font-size: 12px; - vertical-align: top; -} - -html, body {width: 100%; height: 100%; background: #000} - -.head {position: fixed; top: 0; padding: 2px; background: rgba(124,124,124,0.8); color: #fff; font-weight: bold; z-index: 1} -textarea {position: absolute; display: block; top: 0; padding: 0; width: 100%; height: 100%; min-height: 100%; border: 0; background: #000; color: #0c0} -textarea:focus {outline: none} -p {color: #0c0} -.commandLine {position: fixed; width: 100%; bottom: 0; padding: 2px; background: rgba(32,32,32,0.9); z-index: 1} -.command {width: 95%; font-family: verdana, arial, monospace, sans-serif; border: none; background: transparent; color: #0c0} -.command:focus {outline: none} \ No newline at end of file