mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-17 05:47:03 +01:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14fe45bda8 | ||
|
|
72ff461b45 | ||
|
|
96fe7d46ba | ||
|
|
d40cdeb65e | ||
|
|
4130df7bf9 | ||
|
|
6e176cdda7 | ||
|
|
bdb171dc6d | ||
|
|
801471a105 | ||
|
|
f86cb53bd9 | ||
|
|
435e1b3b4b | ||
|
|
4b17d76144 | ||
|
|
d96ebe4282 | ||
|
|
e5c5e7dc5e | ||
|
|
fe593dcb09 | ||
|
|
b1056a19a3 | ||
|
|
048c47f7f3 |
File diff suppressed because one or more lines are too long
4
CodeMirror-2.36/lib/codemirror-compressed.js
Normal file
4
CodeMirror-2.36/lib/codemirror-compressed.js
Normal file
File diff suppressed because one or more lines are too long
83
CodeMirror-2.36/theme/ambiance.css
Normal file
83
CodeMirror-2.36/theme/ambiance.css
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/* ambiance theme for codemirror */
|
||||||
|
|
||||||
|
/* Color scheme */
|
||||||
|
|
||||||
|
.cm-s-ambiance .cm-keyword { color: #cda869; }
|
||||||
|
.cm-s-ambiance .cm-atom { color: #CF7EA9; }
|
||||||
|
.cm-s-ambiance .cm-number { color: #78CF8A; }
|
||||||
|
.cm-s-ambiance .cm-def { color: #aac6e3; }
|
||||||
|
.cm-s-ambiance .cm-variable { color: #ffb795; }
|
||||||
|
.cm-s-ambiance .cm-variable-2 { color: #eed1b3; }
|
||||||
|
.cm-s-ambiance .cm-variable-3 { color: #faded3; }
|
||||||
|
.cm-s-ambiance .cm-property { color: #eed1b3; }
|
||||||
|
.cm-s-ambiance .cm-operator {color: #fa8d6a;}
|
||||||
|
.cm-s-ambiance .cm-comment { color: #555; font-style:italic; }
|
||||||
|
.cm-s-ambiance .cm-string { color: #8f9d6a; }
|
||||||
|
.cm-s-ambiance .cm-string-2 { color: #9d937c; }
|
||||||
|
.cm-s-ambiance .cm-meta { color: #D2A8A1; }
|
||||||
|
.cm-s-ambiance .cm-error { color: #AF2018; }
|
||||||
|
.cm-s-ambiance .cm-qualifier { color: yellow; }
|
||||||
|
.cm-s-ambiance .cm-builtin { color: #9999cc; }
|
||||||
|
.cm-s-ambiance .cm-bracket { color: #24C2C7; }
|
||||||
|
.cm-s-ambiance .cm-tag { color: #fee4ff }
|
||||||
|
.cm-s-ambiance .cm-attribute { color: #9B859D; }
|
||||||
|
.cm-s-ambiance .cm-header {color: blue;}
|
||||||
|
.cm-s-ambiance .cm-quote { color: #24C2C7; }
|
||||||
|
.cm-s-ambiance .cm-hr { color: pink; }
|
||||||
|
.cm-s-ambiance .cm-link { color: #F4C20B; }
|
||||||
|
.cm-s-ambiance .cm-special { color: #FF9D00; }
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; }
|
||||||
|
.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; }
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-selected {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
}
|
||||||
|
.CodeMirror-focused .cm-s-ambiance .CodeMirror-selected {
|
||||||
|
background: rgba(255, 255, 255, 0.10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Editor styling */
|
||||||
|
|
||||||
|
.cm-s-ambiance {
|
||||||
|
line-height: 1.40em;
|
||||||
|
font-family: Monaco, Menlo,"Andale Mono","lucida console","Courier New",monospace !important;
|
||||||
|
color: #E6E1DC;
|
||||||
|
background-color: #202020;
|
||||||
|
-webkit-box-shadow: inset 0 0 10px black;
|
||||||
|
-moz-box-shadow: inset 0 0 10px black;
|
||||||
|
-o-box-shadow: inset 0 0 10px black;
|
||||||
|
box-shadow: inset 0 0 10px black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-gutter {
|
||||||
|
background: #3D3D3D;
|
||||||
|
padding: 0 5px;
|
||||||
|
text-shadow: #333 1px 1px;
|
||||||
|
border-right: 1px solid #4D4D4D;
|
||||||
|
box-shadow: 0 10px 20px black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-gutter .CodeMirror-gutter-text {
|
||||||
|
text-shadow: 0px 1px 1px #4d4d4d;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-lines {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance .CodeMirror-lines .CodeMirror-cursor {
|
||||||
|
border-left: 1px solid #7991E8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance .activeline {
|
||||||
|
background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-ambiance {
|
||||||
|
background: #202020;
|
||||||
|
}
|
||||||
|
.cm-s-ambiance .CodeMirror-gutter {
|
||||||
|
background: #3d3d3d;
|
||||||
|
}
|
||||||
26
CodeMirror-2.36/theme/twilight.css
Normal file
26
CodeMirror-2.36/theme/twilight.css
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
.cm-s-twilight { background: #141414; color: #f7f7f7; } /**/
|
||||||
|
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
|
||||||
|
|
||||||
|
.cm-s-twilight .CodeMirror-gutter { background: #222; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-gutter-text { color: #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
|
||||||
|
.cm-s-twilight .cm-atom { color: #FC0; }
|
||||||
|
.cm-s-twilight .cm-number { color: #ca7841; } /**/
|
||||||
|
.cm-s-twilight .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
|
||||||
|
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
|
||||||
|
.cm-s-twilight .cm-operator { color: #cda869; } /**/
|
||||||
|
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
|
||||||
|
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
|
||||||
|
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
|
||||||
|
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
|
||||||
|
.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
|
||||||
|
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
|
||||||
|
.cm-s-twilight .cm-tag { color: #997643; } /**/
|
||||||
|
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
|
||||||
|
.cm-s-twilight .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-twilight .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; font-underline:none; } /**/
|
||||||
|
|
||||||
46
CodeMirror-2.36/theme/xq-dark.css
Normal file
46
CodeMirror-2.36/theme/xq-dark.css
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2011 by MarkLogic Corporation
|
||||||
|
Author: Mike Brevoort <mike@brevoort.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }
|
||||||
|
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }
|
||||||
|
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
||||||
|
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
|
||||||
|
.cm-s-xq-dark span.cm-number {color: #164;}
|
||||||
|
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
|
||||||
|
.cm-s-xq-dark span.cm-variable {color: #FFF;}
|
||||||
|
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
|
||||||
|
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
|
||||||
|
.cm-s-xq-dark span.cm-property {}
|
||||||
|
.cm-s-xq-dark span.cm-operator {}
|
||||||
|
.cm-s-xq-dark span.cm-comment {color: gray;}
|
||||||
|
.cm-s-xq-dark span.cm-string {color: #9FEE00;}
|
||||||
|
.cm-s-xq-dark span.cm-meta {color: yellow;}
|
||||||
|
.cm-s-xq-dark span.cm-error {color: #f00;}
|
||||||
|
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
|
||||||
|
.cm-s-xq-dark span.cm-builtin {color: #30a;}
|
||||||
|
.cm-s-xq-dark span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-xq-dark span.cm-tag {color: #FFBD40;}
|
||||||
|
.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
|
||||||
@@ -18,7 +18,7 @@ if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder
|
|||||||
$activeLineBG = $ICEcoder["theme"]=="eclipse" || $ICEcoder["theme"]=="elegant" || $ICEcoder["theme"]=="neat" ? "#ccc" : "#000";
|
$activeLineBG = $ICEcoder["theme"]=="eclipse" || $ICEcoder["theme"]=="elegant" || $ICEcoder["theme"]=="neat" ? "#ccc" : "#000";
|
||||||
?>">
|
?>">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; top: 0px; width: 100%; z-index: 1}
|
.CodeMirror {position: absolute; width: 0; background-color: #fff; color: #000; top: 0px; width: 100%; font-size: 13px; z-index: 1}
|
||||||
.CodeMirror-scroll {height: auto; overflow: visible}
|
.CodeMirror-scroll {height: auto; overflow: visible}
|
||||||
/* Make sure this next one remains the 3rd item, updated with JS */
|
/* Make sure this next one remains the 3rd item, updated with JS */
|
||||||
.cm-s-activeLine {background: <?php echo $activeLineBG;?> !important}
|
.cm-s-activeLine {background: <?php echo $activeLineBG;?> !important}
|
||||||
|
|||||||
17
files.php
17
files.php
@@ -31,8 +31,23 @@ class SortingIterator implements IteratorAggregate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
|
||||||
|
function getChildren() {
|
||||||
|
try {
|
||||||
|
if (!isset($GLOBALS['ICEcoder']['bannedPaths']) ||
|
||||||
|
!in_array($this->key(), $GLOBALS['ICEcoder']['bannedPaths'])) {
|
||||||
|
return parent::getChildren();
|
||||||
|
} else {
|
||||||
|
return new RecursiveArrayIterator(array());
|
||||||
|
}
|
||||||
|
} catch(UnexpectedValueException $e) {
|
||||||
|
return new RecursiveArrayIterator(array());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get a full list of dirs & files and begin sorting using above class & function
|
// Get a full list of dirs & files and begin sorting using above class & function
|
||||||
$objectList = new SortingIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort');
|
$objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort');
|
||||||
|
|
||||||
// With that done, create arrays for out final ordered list and a temp container of files
|
// With that done, create arrays for out final ordered list and a temp container of files
|
||||||
$finalArray = $tempArray = array();
|
$finalArray = $tempArray = array();
|
||||||
|
|||||||
BIN
images/nest-tag-bg.gif
Normal file
BIN
images/nest-tag-bg.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 B |
@@ -116,7 +116,7 @@ window.onbeforeunload = function() {
|
|||||||
<div id="editor" class="editor">
|
<div id="editor" class="editor">
|
||||||
<div id="tabsBar" class="tabsBar" onContextMenu="return false">
|
<div id="tabsBar" class="tabsBar" onContextMenu="return false">
|
||||||
<?php
|
<?php
|
||||||
for ($i=1;$i<=10;$i++) {
|
for ($i=1;$i<=100;$i++) {
|
||||||
echo '<div id="tab'.$i.'" class="tab" draggable="true" onClick="ICEcoder.canSwitchTabs ? ICEcoder.switchTab('.$i.') : ICEcoder.canSwitchTabs=true"></div>';
|
echo '<div id="tab'.$i.'" class="tab" draggable="true" onClick="ICEcoder.canSwitchTabs ? ICEcoder.switchTab('.$i.') : ICEcoder.canSwitchTabs=true"></div>';
|
||||||
}
|
}
|
||||||
?><div class="newTab" onClick="ICEcoder.newTab()"><img src="images/nav-new.png"></div>
|
?><div class="newTab" onClick="ICEcoder.newTab()"><img src="images/nav-new.png"></div>
|
||||||
@@ -160,7 +160,7 @@ window.onbeforeunload = function() {
|
|||||||
|
|
||||||
<div class="footer" id="footer" onContextMenu="return false">
|
<div class="footer" id="footer" onContextMenu="return false">
|
||||||
<div class="nesting" id="nestValid">Nesting OK</div>
|
<div class="nesting" id="nestValid">Nesting OK</div>
|
||||||
<div class="nestLoc">Cursor nest location</div>
|
<div class="nestLoc">cursor nest location</div>
|
||||||
<div class="nestDisplay" id="nestDisplay"></div>
|
<div class="nestDisplay" id="nestDisplay"></div>
|
||||||
<div class="charDisplay" id="charDisplay"><span id="char"></span></div>
|
<div class="charDisplay" id="charDisplay"><span id="char"></span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ $ICEcoder = array(
|
|||||||
"lockedNav" => true,
|
"lockedNav" => true,
|
||||||
"accountPassword" => "",
|
"accountPassword" => "",
|
||||||
"bannedFiles" => array("_coder","ICEcoder"),
|
"bannedFiles" => array("_coder","ICEcoder"),
|
||||||
|
"bannedPaths" => array("/var/www/.git","/var/www/sites/all/modules","/var/www/sites/default/files"),
|
||||||
"allowedIPs" => array("*"),
|
"allowedIPs" => array("*"),
|
||||||
"plugins" => array(
|
"plugins" => array(
|
||||||
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
|
array("Adminer","plugins/adminer/icon.png","margin-top: 3px","plugins/adminer/adminer-3.4.0-mysql-en.php","_blank",""),
|
||||||
array("Zip It!","plugins/zip-it/icon.png","margin-top: 3px; margin-left: 3px","plugins/zip-it/?zip=|&exclude=*.doc*.gif*.jpg*.jpeg*.pdf*.png*.swf*.xml*.zip","fileControl:<b>Zipping Files</b>","30"),
|
array("Zip It!","plugins/zip-it/icon.png","margin-top: 3px; margin-left: 3px","plugins/zip-it/?zip=|&exclude=*.doc*.gif*.jpg*.jpeg*.pdf*.png*.swf*.xml*.zip","fileControl:<b>Zipping Files</b>","30"),
|
||||||
array("ICErepo","plugins/ice-repo/icon.png","margin-top: 3px","plugins/ice-repo","_blank",""),
|
array("ICErepo","plugins/ice-repo/icon.png","margin-top: 3px","plugins/ice-repo","_blank",""),
|
||||||
array("Dochub","plugins/dochub/icon.png","margin-top: 3px","http://dochub.io","_blank","")
|
array("Dochub","plugins/dochub/icon.png","margin-top: 3px","http://dochub.io","_blank",""),
|
||||||
|
array("Terminal","plugins/terminal/icon.gif","margin-top: 3px","plugins/terminal","_blank","")
|
||||||
),
|
),
|
||||||
"theme" => "default",
|
"theme" => "default",
|
||||||
"tabWidth" => 4,
|
"tabWidth" => 4,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if ($_GET['action']=="load") {
|
|||||||
|
|
||||||
// If we're due to add a new folder...
|
// If we're due to add a new folder...
|
||||||
if ($_GET['action']=="newFolder") {
|
if ($_GET['action']=="newFolder") {
|
||||||
if (is_writable($docRoot.$fileLoc)) {
|
if (!$demoMode && is_writable($docRoot.$fileLoc)) {
|
||||||
mkdir($file, 0705);
|
mkdir($file, 0705);
|
||||||
// Reload file manager
|
// Reload file manager
|
||||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
|
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');action="newFolder";</script>';
|
||||||
@@ -54,20 +54,37 @@ if ($_GET['action']=="newFolder") {
|
|||||||
|
|
||||||
// If we're due to paste a new file...
|
// If we're due to paste a new file...
|
||||||
if ($_GET['action']=="paste") {
|
if ($_GET['action']=="paste") {
|
||||||
$location = $docRoot.strClean(str_replace("|","/",$_GET['location']));
|
$source = $file;
|
||||||
if (is_writable($location)) {
|
$dest = $docRoot.strClean(str_replace("|","/",$_GET['location']))."/".basename($source);
|
||||||
copy($file, $location."/".basename($file));
|
if (!$demoMode && is_writable(dirname($dest))) {
|
||||||
|
if (is_dir($source)) {
|
||||||
|
if (!is_dir($dest)) {
|
||||||
|
mkdir($dest, 0705);
|
||||||
|
}
|
||||||
|
foreach ($iterator = new RecursiveIteratorIterator(
|
||||||
|
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
|
RecursiveIteratorIterator::SELF_FIRST) as $item
|
||||||
|
) {
|
||||||
|
if ($item->isDir()) {
|
||||||
|
mkdir($dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName(), 0705);
|
||||||
|
} else {
|
||||||
|
copy($item, $dest.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
copy($source, $dest);
|
||||||
|
}
|
||||||
// Reload file manager
|
// Reload file manager
|
||||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.str_replace($docRoot,"",$location).'\',\''.$fileName.'\');action="pasteFile";</script>';
|
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.strClean(str_replace("|","/",$_GET['location'])).'\',\''.$fileName.'\');action="pasteFile";</script>';
|
||||||
} else {
|
} else {
|
||||||
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy file into \\n".$location."')</script>";
|
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy \\n".str_replace($docRoot,"",$source)."\\n into \\n".str_replace($docRoot,"",$dest)."')</script>";
|
||||||
}
|
}
|
||||||
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're due to rename a file/folder...
|
// If we're due to rename a file/folder...
|
||||||
if ($_GET['action']=="rename") {
|
if ($_GET['action']=="rename") {
|
||||||
if (is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
|
if (!$demoMode && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {
|
||||||
rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName);
|
rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName);
|
||||||
// Reload file manager
|
// Reload file manager
|
||||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');';
|
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');';
|
||||||
@@ -80,7 +97,7 @@ if ($_GET['action']=="rename") {
|
|||||||
|
|
||||||
// If we're due to replace text in a file...
|
// If we're due to replace text in a file...
|
||||||
if ($_GET['action']=="replaceText") {
|
if ($_GET['action']=="replaceText") {
|
||||||
if (is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {
|
||||||
$file = str_replace("|","/",strClean($_GET['fileRef']));
|
$file = str_replace("|","/",strClean($_GET['fileRef']));
|
||||||
$loadedFile = file_get_contents($file);
|
$loadedFile = file_get_contents($file);
|
||||||
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
|
$newContent = str_replace(strClean($_GET['find']),strClean($_GET['replace']),$loadedFile);
|
||||||
@@ -96,7 +113,7 @@ if ($_GET['action']=="replaceText") {
|
|||||||
|
|
||||||
// If we're due to change permissions on a file/folder...
|
// If we're due to change permissions on a file/folder...
|
||||||
if ($_GET['action']=="perms") {
|
if ($_GET['action']=="perms") {
|
||||||
if (is_writable($file)) {
|
if (!$demoMode && is_writable($file)) {
|
||||||
chmod($file,octdec(numClean($_GET['perms'])));
|
chmod($file,octdec(numClean($_GET['perms'])));
|
||||||
// Reload file manager
|
// Reload file manager
|
||||||
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
|
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'chmod\',\''.$fileLoc.'\',\''.$fileName.'\',\''.numClean($_GET['perms']).'\');';
|
||||||
@@ -111,7 +128,7 @@ if ($_GET['action']=="perms") {
|
|||||||
if ($_GET['action']=="delete") {
|
if ($_GET['action']=="delete") {
|
||||||
$filesArray = explode(";",$file); // May contain more than one file here
|
$filesArray = explode(";",$file); // May contain more than one file here
|
||||||
for ($i=0;$i<=count($filesArray)-1;$i++) {
|
for ($i=0;$i<=count($filesArray)-1;$i++) {
|
||||||
if (is_writable($iceRoot.$filesArray[$i])) {
|
if (!$demoMode && is_writable($iceRoot.$filesArray[$i])) {
|
||||||
is_dir($iceRoot.$filesArray[$i])
|
is_dir($iceRoot.$filesArray[$i])
|
||||||
? rrmdir($iceRoot.$filesArray[$i])
|
? rrmdir($iceRoot.$filesArray[$i])
|
||||||
: unlink($iceRoot.$filesArray[$i]);
|
: unlink($iceRoot.$filesArray[$i]);
|
||||||
@@ -146,7 +163,7 @@ if ($_GET['action']=="save") {
|
|||||||
echo '<script>action="save";</script>';
|
echo '<script>action="save";</script>';
|
||||||
// on the form posting via a reload, save the file
|
// on the form posting via a reload, save the file
|
||||||
if (isset($_POST['contents'])) {
|
if (isset($_POST['contents'])) {
|
||||||
if ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="") {
|
if (!$demoMode && ((file_exists($file) && is_writable($file)) || isset($_POST['newFileName']) && $_POST['newFileName']!="")) {
|
||||||
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
|
if (filemtime($file)==$_GET['fileMDT']||!(isset($_GET['fileMDT']))) {
|
||||||
$fh = fopen($file, 'w') or die("Sorry, cannot save");
|
$fh = fopen($file, 'w') or die("Sorry, cannot save");
|
||||||
fwrite($fh, $_POST['contents']);
|
fwrite($fh, $_POST['contents']);
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
|
|||||||
|
|
||||||
.footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2}
|
.footer {position: fixed; display: inline-block; width: 100%; height: 30px; bottom: 0; background-color: rgba(0,0,0,0.7); left: 0; z-index: 2}
|
||||||
.footer .nesting {display: inline-block; padding: 5px 8px; margin: 4px 0 0 15px; font-weight: bold; font-size: 10px; color: #fff; background-color: #0b0}
|
.footer .nesting {display: inline-block; padding: 5px 8px; margin: 4px 0 0 15px; font-weight: bold; font-size: 10px; color: #fff; background-color: #0b0}
|
||||||
.footer .nestLoc {position: absolute; display: inline-block; width: 120px; padding: 5px 0 0 8px; margin-top: 3px; left: 112px; font-weight: bold; font-size: 12px; color: #fff; text-align: right}
|
.footer .nestLoc {position: absolute; display: inline-block; width: 120px; padding: 5px 0 0 8px; margin-top: 2px; left: 112px; font-weight: bold; font-size: 12px; color: #fff; text-align: right}
|
||||||
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 255px; font-size: 12px; color: #fff; text-align: right}
|
.footer .nestDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 0px; left: 255px; font-size: 12px; color: #fff; text-align: right}
|
||||||
.footer .charDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 100%; font-weight: bold; font-size: 12px; color: #fff; text-align: right; width: 200px; text-align: right; margin-left: -220px}
|
.footer .charDisplay {position: absolute; display: inline-block; padding: 5px 0 0 8px; margin-top: 3px; left: 100%; font-weight: bold; font-size: 12px; color: #fff; text-align: right; width: 200px; text-align: right; margin-left: -220px}
|
||||||
|
|
||||||
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
|
.textbox {box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.4)}
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ var ICEcoder = {
|
|||||||
endPos.ch = cM.getLine(endPos.line).indexOf("</"+top.ICEcoder.htmlTagArray[nestPos]+">")+top.ICEcoder.htmlTagArray[nestPos].length+3;
|
endPos.ch = cM.getLine(endPos.line).indexOf("</"+top.ICEcoder.htmlTagArray[nestPos]+">")+top.ICEcoder.htmlTagArray[nestPos].length+3;
|
||||||
// Set the selection or escape out of not selecting
|
// Set the selection or escape out of not selecting
|
||||||
!top.ICEcoder.dontSelect ? cM.setSelection(startPos,endPos) : top.ICEcoder.dontSelect = false;
|
!top.ICEcoder.dontSelect ? cM.setSelection(startPos,endPos) : top.ICEcoder.dontSelect = false;
|
||||||
|
cM.scrollIntoView(startPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -508,8 +509,8 @@ var ICEcoder = {
|
|||||||
shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");
|
shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");
|
||||||
// No reason why we can't open a file (so far)
|
// No reason why we can't open a file (so far)
|
||||||
canOpenFile = true;
|
canOpenFile = true;
|
||||||
// Limit to 10 files open at a time
|
// Limit to 100 files open at a time
|
||||||
if (top.ICEcoder.openFiles.length<10) {
|
if (top.ICEcoder.openFiles.length<100) {
|
||||||
// check if we've already got it in our array
|
// check if we've already got it in our array
|
||||||
if (top.ICEcoder.openFiles.indexOf(shortURL)>-1 && shortURL!="/[NEW]") {
|
if (top.ICEcoder.openFiles.indexOf(shortURL)>-1 && shortURL!="/[NEW]") {
|
||||||
// we have, so instead, switch to that tab
|
// we have, so instead, switch to that tab
|
||||||
@@ -517,8 +518,8 @@ var ICEcoder = {
|
|||||||
top.ICEcoder.switchTab(i+1);
|
top.ICEcoder.switchTab(i+1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// show a message because we have 10 files open
|
// show a message because we have 100 files open
|
||||||
top.ICEcoder.message('Sorry, you can only have 10 files open at a time!');
|
top.ICEcoder.message('Sorry, you can only have 100 files open at a time!');
|
||||||
canOpenFile = false;
|
canOpenFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,8 +951,11 @@ var ICEcoder = {
|
|||||||
|
|
||||||
// Then for all the array items, output as the nest display
|
// Then for all the array items, output as the nest display
|
||||||
for (var i=0;i<ICEcoder.htmlTagArray.length;i++) {
|
for (var i=0;i<ICEcoder.htmlTagArray.length;i++) {
|
||||||
ICEcoder.nestDisplay.innerHTML += '<a onMouseover="top.ICEcoder.highlightBlock('+i+')" onMouseout="top.ICEcoder.highlightBlock('+i+',\'hide\')" onClick="top.ICEcoder.setPosition('+i+',top.ICEcoder.startPosLine,\''+ICEcoder.htmlTagArray[i]+'\')" style="cursor: pointer">'+ICEcoder.htmlTagArray[i]+'</a>';
|
if (i==0) {ICEcoder.nestDisplay.innerHTML += '<div style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif)"></div>'};
|
||||||
if(i<ICEcoder.htmlTagArray.length-1) {ICEcoder.nestDisplay.innerHTML += " > "};
|
ICEcoder.nestDisplay.innerHTML += '<a onMouseover="top.ICEcoder.highlightBlock('+i+')" onMouseout="top.ICEcoder.highlightBlock('+i+',\'hide\')" onClick="top.ICEcoder.setPosition('+i+',top.ICEcoder.startPosLine,\''+ICEcoder.htmlTagArray[i]+'\')" style="display: inline-block; cursor: pointer; background: #333; padding: 7px 2px 7px 7px; margin-top: -5px; height: 30px">'+ICEcoder.htmlTagArray[i]+'</a>';
|
||||||
|
ICEcoder.nestDisplay.innerHTML += i<ICEcoder.htmlTagArray.length-1
|
||||||
|
? '<div style="display: inline-block; width: 8px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -7px 0"></div>'
|
||||||
|
: '<div style="display: inline-block; width: 7px; margin-top: -5px; height: 30px; background-image: url(images/nest-tag-bg.gif); background-position: -15px 0"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,19 @@ include($settingsFile);
|
|||||||
|
|
||||||
// Add ICEcoder settings to beginning of $ICEcoder array
|
// Add ICEcoder settings to beginning of $ICEcoder array
|
||||||
$ICEcoder = array(
|
$ICEcoder = array(
|
||||||
"versionNo" => "1.1",
|
"versionNo" => "1.2",
|
||||||
"codeMirrorDir" => "CodeMirror-2.35"
|
"codeMirrorDir" => "CodeMirror-2.36",
|
||||||
|
"demoMode" => false
|
||||||
)+$ICEcoder;
|
)+$ICEcoder;
|
||||||
|
|
||||||
$onLoadExtras = "";
|
$onLoadExtras = "";
|
||||||
$pluginsDisplay = "";
|
$pluginsDisplay = "";
|
||||||
|
|
||||||
|
if ($ICEcoder['demoMode'] && $ICEcoder['accountPassword']!="") {$_SESSION['loggedIn']=true;};
|
||||||
|
$demoMode = $ICEcoder['demoMode'];
|
||||||
|
|
||||||
// Update this config file?
|
// Update this config file?
|
||||||
if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
|
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_POST["theme"]) && $_POST["theme"]) {
|
||||||
$settingsContents = file_get_contents($settingsFile);
|
$settingsContents = file_get_contents($settingsFile);
|
||||||
// Replace our settings vars
|
// Replace our settings vars
|
||||||
$repPosStart = strpos($settingsContents,'"root"');
|
$repPosStart = strpos($settingsContents,'"root"');
|
||||||
@@ -134,7 +138,7 @@ if ($_SESSION['loggedIn'] && isset($_GET["saveFiles"]) && $_GET['saveFiles']) {
|
|||||||
// Replace our previousFiles var with the the current
|
// Replace our previousFiles var with the the current
|
||||||
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
|
$repPosStart = strpos($settingsContents,'previousFiles" => "')+20;
|
||||||
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
|
$repPosEnd = strpos($settingsContents,'",',$repPosStart)-$repPosStart;
|
||||||
if ($_GET['saveFiles']!="CLEAR") {
|
if (!$demoMode && $_GET['saveFiles']!="CLEAR") {
|
||||||
$saveFiles=strClean($_GET['saveFiles']);
|
$saveFiles=strClean($_GET['saveFiles']);
|
||||||
$saveFilesArray = explode(",",$saveFiles);
|
$saveFilesArray = explode(",",$saveFiles);
|
||||||
$saveFiles="";
|
$saveFiles="";
|
||||||
|
|||||||
BIN
plugins/terminal/icon.gif
Normal file
BIN
plugins/terminal/icon.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
201
plugins/terminal/index.php
Normal file
201
plugins/terminal/index.php
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
include("../../lib/settings.php");
|
||||||
|
if ($demoMode || !$_SESSION['loggedIn']) {
|
||||||
|
die("You must be logged in to access Terminal");
|
||||||
|
}
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
@session_start();
|
||||||
|
|
||||||
|
if (isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
$_SESSION['user'] = $_SERVER['PHP_AUTH_USER'];
|
||||||
|
$_SESSION['pass'] = generateHash(strClean($_SERVER['PHP_AUTH_PW']),$ICEcoder["accountPassword"]);
|
||||||
|
}
|
||||||
|
$passwd = array($_SESSION['user'] => $ICEcoder["accountPassword"]);
|
||||||
|
$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 ($_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);
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>PHP Terminal</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="terminal.css" />
|
||||||
|
<script type="text/javascript" language="JavaScript">
|
||||||
|
var current_line = 0;
|
||||||
|
var command_hist = new Array(<?php echo $_SESSION['js_command_hist']; ?>);
|
||||||
|
var last = 0;
|
||||||
|
|
||||||
|
function key(e) {
|
||||||
|
if (!e) var e = window.event;
|
||||||
|
if (e.keyCode == 38 && current_line < command_hist.length-1) {
|
||||||
|
command_hist[current_line] = document.shell.command.value;
|
||||||
|
current_line++;
|
||||||
|
document.shell.command.value = command_hist[current_line];
|
||||||
|
}
|
||||||
|
if (e.keyCode == 40 && current_line > 0) {
|
||||||
|
command_hist[current_line] = document.shell.command.value;
|
||||||
|
current_line--;
|
||||||
|
document.shell.command.value = command_hist[current_line];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
document.shell.setAttribute("autocomplete", "off");
|
||||||
|
document.shell.output.scrollTop = document.shell.output.scrollHeight;
|
||||||
|
document.shell.command.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="init()">
|
||||||
|
|
||||||
|
<div class="head"><?php echo $_SESSION['prompt'].":"."$_SESSION[cwd]"; ?></div>
|
||||||
|
|
||||||
|
<form name="shell" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
|
||||||
|
<textarea name="output" readonly="readonly" rows="24"><?php
|
||||||
|
$lines = substr_count($_SESSION['output'], "\n");
|
||||||
|
$padding = str_repeat("\n", max(0, 25 - $lines));
|
||||||
|
echo "\n\n".trim($padding . $_SESSION['output'])."\n";
|
||||||
|
?>
|
||||||
|
</textarea>
|
||||||
|
<p class="commandLine">$> <input class="command" name="command" type="text" size='50' onkeyup="key(event)" tabindex="1"></p>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php } ?>
|
||||||
28
plugins/terminal/terminal.css
Normal file
28
plugins/terminal/terminal.css
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* 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}
|
||||||
Reference in New Issue
Block a user