Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
41d8d4dcaa |
Before Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 2.7 MiB |
|
@ -1,13 +0,0 @@
|
|||
|
||||
|
||||
<!--
|
||||
Copyright (c) 2019 by Andrew M Barfield (https://codepen.io/AndrewBarfield/pen/qEqWMq)
|
||||
|
||||
|
||||
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.
|
||||
-->
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
A Pen created at CodePen.io. You can find this one at https://codepen.io/AndrewBarfield/pen/qEqWMq.
|
||||
|
||||
A console for the Web written completely in JavaScript. The console supports Web versions of Linux commands.
|
32
README.md
|
@ -1,30 +1,6 @@
|
|||
# DremJS
|
||||
A multitasking (as of 0.1.2b) web OS featuring 3rd party support, an IDE (coming soon!), and much more (coming soon too.).
|
||||
A web OS featuring 3rd party support, an IDE, and much more.
|
||||
It's free and completly hosted on GitHub. No more building needed!!!
|
||||
Alternatively, you can also download this and upload it to your own web server (as this project is open source). Just give credit for the original source code.
|
||||
|
||||
DremJS is free and completly hosted on GitHub/a web server. No more building needed!
|
||||
Just download this and upload it to your own web server (as this project is open source and licensed under the terms of the GNU General Public License v3). Just give credit for the original source code.
|
||||
|
||||
Alternatively, you can fork this repository and go to the following site after setting up GitHub pages:
|
||||
<code>yourusername.github.io/DremJS</code>
|
||||
However, this is not recommended as updating and installing apps is much harder.
|
||||
|
||||
# DremJS Updates Frequently
|
||||
## How to manualy update your DremJS Desktop
|
||||
Updating the DremJS Desktop is quite easy, as long as you know what you're doing.
|
||||
### Step 1
|
||||
Go into the index-open.html file and copy your application list to clipbord or to a txt file.
|
||||
|
||||
### Step 2
|
||||
Download the repository and unzip the zip file to your DremJS Desktop. Overwrite all files.
|
||||
|
||||
### Step 3
|
||||
Copy your DremJS Desktop application list with the new application list in the new index-open.html file.
|
||||
|
||||
Note: You should delete any duplicate application listings!
|
||||
|
||||
And that's it! Now you have the latest version of DremJS installed on your web server!
|
||||
|
||||
A system to update with a single click of a button and to install applications from DremJS itself is coming soon.
|
||||
<br />
|
||||
<br />
|
||||
© Innovation Inc. 2020
|
||||
(C) Innovation Inc. 2018
|
||||
|
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 2.6 KiB |
|
@ -1,238 +0,0 @@
|
|||
<?php
|
||||
$file = "/home/user/Pictures/Default.png";
|
||||
|
||||
function GenerateTagForMedia($path) {
|
||||
global $file;
|
||||
// What even is this massive statement? The answer may shock you.
|
||||
// (it's laziness)
|
||||
if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "shuffle") {
|
||||
return ShuffleMusic();
|
||||
}
|
||||
if(isset($_REQUEST["openfile"])) {
|
||||
if(file_exists($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]) && !is_dir($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"])) {
|
||||
$mime = mime_content_type($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
if(strstr($mime, "video/")){
|
||||
return "<video class='media' controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</video>";
|
||||
// This basically depends on the video tag to support the video and is dumb.
|
||||
}else if(strstr($mime, "image/")){
|
||||
return "<img class='media' src='".$_REQUEST['openfile']."'>";
|
||||
}else if(strstr($mime, "audio/")){
|
||||
return "<audio controls autoplay>\
|
||||
<source src='".$_REQUEST["openfile"]."' type='".$mime."'>\
|
||||
</audio>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
} else {
|
||||
return "<img class='media' src='assets/images/Default.png'>";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
// Build array of all music in the user's Music directory
|
||||
$files = scandir("/home/user/Music/");
|
||||
$music = array();
|
||||
$temp = "";
|
||||
|
||||
// Find all files that have .mp3, .wav, or .ogg (not case sensitive) and put them into the $music array
|
||||
for ($i = 0; $i < count($files); $i++) {
|
||||
if (count($temp) >= 5) {
|
||||
$temp = substr($files[$i], count($files[$i]-4));
|
||||
} else {
|
||||
$temp = "StringTooSmallSkipping";
|
||||
}
|
||||
if($temp == ".mp3" || $temp == ".wav" || $temp == ".ogg") {
|
||||
$music[] = $files[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if($_REQUEST["action"] == "shuffle") {
|
||||
ShufleMusic();
|
||||
}*/
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
background-color: white;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
.actionbar {
|
||||
height: 42px;
|
||||
width: 100%;
|
||||
background-color: black;
|
||||
}
|
||||
.actionbarbutton {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 10px;
|
||||
}
|
||||
.media {
|
||||
height: 95%;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["<hr />", ""],
|
||||
["Shuffle", "ShuffleMusic();"],
|
||||
["<hr />", ""],
|
||||
["Toggle Light", "ToggleLight();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
}
|
||||
|
||||
CurrentFile = "/home/user/";
|
||||
var MediaTag = "";
|
||||
|
||||
function Init() {
|
||||
//document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
MediaTag = "<?php echo GenerateTagForMedia("/home/user/Pictures/Default.png"); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
|
||||
document.getElementById('MediaBox').innerHTML=MediaTag;
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function ToggleLight() {
|
||||
if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "white";
|
||||
} else {
|
||||
document.getElementsByTagName("body")[0].style.backgroundColor = "black";
|
||||
}
|
||||
}
|
||||
|
||||
function ShuffleMusic() {
|
||||
$.ajax({
|
||||
type:'POST',
|
||||
url:'index.php',
|
||||
data:'action=shuffle',
|
||||
success:function(data) {
|
||||
if(data=="Something") {
|
||||
// Do Something
|
||||
} else {
|
||||
// Do Something
|
||||
}
|
||||
}
|
||||
});
|
||||
window.location.href = "index.php?action=shuffle";
|
||||
}
|
||||
</script>
|
||||
<!--<div id="actionBar" class="actionbar">
|
||||
<div id="light" class="actionbarbutton left">
|
||||
<img style="width:42px;height:42px;" src="assets/images/lightbulb-on-white.png" />
|
||||
</div>
|
||||
</div>-->
|
||||
<center>
|
||||
<div id="MediaBox">
|
||||
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the media file you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="cinema.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Cinema</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens a media file.<br />
|
||||
Toggle Light: Toggles the background to be white or black (easier on the eyes)<br />
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Cinema
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: cinema.png
|
||||
Category: /Media
|
|
@ -1,2 +0,0 @@
|
|||
[27-Oct-2020 09:43:56 America/Chicago] PHP Parse error: syntax error, unexpected '}' in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/cinema/index.php on line 46
|
||||
[27-Oct-2020 09:45:05 America/Chicago] PHP Notice: Undefined index: action in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/cinema/index.php on line 53
|
Before Width: | Height: | Size: 2.8 KiB |
|
@ -1,9 +0,0 @@
|
|||
<!-- File Manager Forwarder -->
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="0;url=../../home/user/index.php" />
|
||||
</head>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: File Manager
|
||||
Author: Innovation Science
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: filemanager.png
|
||||
Category: /
|
|
@ -1,211 +0,0 @@
|
|||
<?php
|
||||
//if(!isset($_POST["open"])) {
|
||||
$file = "/home/user/Documents/NewFile.txt";
|
||||
//} else {
|
||||
//$file = $_POST["open"];
|
||||
//}
|
||||
function GetFileContents() {
|
||||
global $file;
|
||||
if(isset($_REQUEST["openfile"]))
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$_REQUEST["openfile"]);
|
||||
return file_get_contents($_SERVER["DOCUMENT_ROOT"].$file);
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//$currentUser = $_SERVER["DOCUMENT_ROOT"]."/home/user";
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$_REQUEST["file"], "w");
|
||||
fwrite($writeto, $_REQUEST["text"]);
|
||||
fclose($writeto);
|
||||
}
|
||||
if (isset($_REQUEST["action"])) {
|
||||
if($_REQUEST["action"] == "save") {
|
||||
SaveDocument();
|
||||
} elseif ($_REQUEST["action"] == "open") {
|
||||
global $file;
|
||||
$file = $_REQUEST["openfile"];
|
||||
if(!is_file($_SERVER["DOCUMENT_ROOT"].$file)) {
|
||||
$writeto = fopen($_SERVER["DOCUMENT_ROOT"].$file, "w");
|
||||
fclose($writeto);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
.openDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aboutDialog {
|
||||
position: absolute;
|
||||
background: #D3D3D3;
|
||||
top: 5%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="Init();">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script>
|
||||
CurrentFile = "<?php echo $file; ?>";
|
||||
|
||||
function Init() {
|
||||
document.getElementById("writingto").innerHTML = "Writing to: " + CurrentFile;
|
||||
document.getElementById("inputbox").value = "<?php echo GetFileContents(); //echo file_get_contents($_SERVER["DOCUMENT_ROOT"].$file); ?>";
|
||||
document.getElementById("open").value = CurrentFile;
|
||||
}
|
||||
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Open", "OpenDocumentDialog();"],
|
||||
["Save", "SaveDocument();"],
|
||||
["<hr />", ""],
|
||||
["Copy", "CopyText();"],
|
||||
["Paste", "PasteText();"],
|
||||
["<hr />", ""],
|
||||
["About", "About();"]
|
||||
];
|
||||
// Scrapped
|
||||
// ["New", "NewDocument();"],
|
||||
// ["Save As...", "SaveDocumentAs();"],
|
||||
// ["Delete", "DeleteSelected();"],
|
||||
}
|
||||
|
||||
function SaveDocument() {
|
||||
//document.getElementById("form").submit();
|
||||
//console.log(document.getElementById("inputbox").value);
|
||||
$.ajax({
|
||||
url : window.location.href,
|
||||
type: "POST",
|
||||
data : {action : "save", text : document.getElementById("inputbox").value, file : CurrentFile},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Saved");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});
|
||||
//Init();
|
||||
}
|
||||
|
||||
function OpenDocumentDialog() {
|
||||
document.getElementById("openDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function OpenDocument() {
|
||||
/*$.ajax({
|
||||
url : window.location.href,
|
||||
type : "POST",
|
||||
data : {action : "open", open : document.getElementById("open").value},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
//console.log(data);// You can see the result which is created in chat.php
|
||||
console.log("Successfully Opened");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(textStatus);// if there is an error
|
||||
}
|
||||
});*/
|
||||
//CurrentFile = document.getElementById("open").value;
|
||||
//CancelOpen();
|
||||
//Init();
|
||||
//console.log(document.getElementById("open").value);
|
||||
window.location.href = "index.php?action=open&openfile=" + document.getElementById("open").value;
|
||||
}
|
||||
|
||||
function CancelOpen() {
|
||||
document.getElementById("openDialog").style.display = "none";
|
||||
}
|
||||
|
||||
function CopyText() {
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
function PasteText() {
|
||||
box = document.getElementById("inputbox");
|
||||
box.focus();
|
||||
navigator.clipboard.readText()
|
||||
.then(text => {
|
||||
loc = box.value.slice(0, box.selectionStart).length;
|
||||
value = document.getElementById("inputbox").value;
|
||||
document.getElementById("inputbox").value = value.substring(0, loc) + text + value.substring(loc, value.length);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to read clipboard contents: ', err);
|
||||
});
|
||||
}
|
||||
|
||||
function About() {
|
||||
document.getElementById("aboutDialog").style.display = "block";
|
||||
}
|
||||
|
||||
function CloseAbout() {
|
||||
document.getElementById("aboutDialog").style.display = "none";
|
||||
}
|
||||
</script>
|
||||
<!--<form>
|
||||
<label>DremJS Notepad</label>
|
||||
<br />
|
||||
<textarea id="inputbox" name="inputbox" rows="50" columns="500"></textarea>
|
||||
</form>-->
|
||||
<div id="openDialog" class="openDialog">
|
||||
<p>Input the path to the document you would like to open. You can use the File Manager to find the path.</p>
|
||||
<!--<form action="index.php" method="POST">
|
||||
<input type="hidden" name="action" value="open" />-->
|
||||
<input type="text" id="open" name="open" size="50" />
|
||||
<input type="submit" id="OpenFile" onclick="OpenDocument()" value="Open File" />
|
||||
<!--</form>-->
|
||||
<input type="button" onclick="CancelOpen()" value="Cancel" />
|
||||
</div>
|
||||
<div id="aboutDialog" class="aboutDialog container">
|
||||
<div class="left">
|
||||
<img src="notepad.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS Notepad</h1>
|
||||
<h2>Version: 0.1.0b</h2>
|
||||
</div>
|
||||
<p>
|
||||
Open: Opens or creates a new document.<br />
|
||||
Save: Saves the current document.<br />
|
||||
Copy: Copies selected text to the clipboard.<br />
|
||||
Paste: Pastes the text in the clipboard to where the cursor is (requires clipboard access).
|
||||
</p>
|
||||
<center><input type="button" onclick="CloseAbout()" value="Close" /></center>
|
||||
<p>
|
||||
|
||||
</div>
|
||||
<textarea id="inputbox" name="text" rows="23" cols="90"></textarea>
|
||||
<p id="writingto"></p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Notepad
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: notepad.png
|
||||
Categpry: /Tools
|
Before Width: | Height: | Size: 94 KiB |
|
@ -1,27 +0,0 @@
|
|||
[25-Aug-2020 21:42:10 America/Chicago] PHP Notice: Undefined variable: file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 76
|
||||
[25-Aug-2020 21:42:10 America/Chicago] PHP Notice: Undefined variable: file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 80
|
||||
[25-Aug-2020 21:42:18 America/Chicago] PHP Notice: Undefined variable: file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 76
|
||||
[25-Aug-2020 21:42:18 America/Chicago] PHP Notice: Undefined variable: file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 80
|
||||
[25-Aug-2020 21:44:42 America/Chicago] PHP Parse error: syntax error, unexpected 'return' (T_RETURN), expecting ';' in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 10
|
||||
[25-Aug-2020 21:50:40 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:12 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:22 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:24 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:32 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:41 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:51:48 America/Chicago] PHP Notice: Undefined index: open in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:52:43 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:52:46 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:52:47 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:53:04 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:53:06 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:53:45 America/Chicago] PHP Parse error: syntax error, unexpected '<', expecting end of file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 213
|
||||
[25-Aug-2020 21:53:47 America/Chicago] PHP Parse error: syntax error, unexpected '<', expecting end of file in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 213
|
||||
[25-Aug-2020 21:53:54 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:53:54 America/Chicago] PHP Notice: Undefined index: action in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 212
|
||||
[25-Aug-2020 21:55:30 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:55:33 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:59:29 America/Chicago] PHP Notice: Undefined index: openfile in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 211
|
||||
[25-Aug-2020 21:59:29 America/Chicago] PHP Notice: Undefined index: action in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 212
|
||||
[26-Aug-2020 08:55:57 America/Chicago] PHP Warning: file_get_contents(/mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/home/user/Documents/NewFile.txt): failed to open stream: No such file or directory in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 11
|
||||
[27-Oct-2020 09:13:28 America/Chicago] PHP Warning: file_get_contents(/mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/home/user/Documents/NewFile.txt): failed to open stream: No such file or directory in /mnt/c/Users/Sam/Documents/dremjs/DremJS-0.1.6b/apps/notepad/index.php on line 11
|
|
@ -1,2 +0,0 @@
|
|||
<h1>it works</h1>
|
||||
<a href="/DremJS/index.html"><p>Home</p></a>
|
|
@ -1,2 +0,0 @@
|
|||
<h1>it works</h1>
|
||||
<a href="/DremJS/index.html"><p>Home</p></a>
|
Before Width: | Height: | Size: 794 B |
|
@ -1,173 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>About DremJS</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
padding: 0px;
|
||||
}
|
||||
.left {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.right {
|
||||
margin-left: 5%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
function GetDremJSMenuFunctions() {
|
||||
return [
|
||||
["Secret", "SecretFunctionLol();"]
|
||||
];
|
||||
}
|
||||
function SecretFunctionLol() {
|
||||
window.location.replace("https://www.youtube.com/embed/fC7oUOUEEi4");
|
||||
}
|
||||
</script>
|
||||
<section class="container">
|
||||
<div class="left">
|
||||
<img src="logo.png" style="width:128px;height:128px" />
|
||||
</div>
|
||||
<div class="right">
|
||||
<h1>About DremJS</h1>
|
||||
<h2>Version: 0.1.7b</h2>
|
||||
<h2>Agenda WM 0.1.2b</h2>
|
||||
</div>
|
||||
</section>
|
||||
<p>Changelog:<br />
|
||||
Version 0.1.7b<br />
|
||||
+File Manager<br />
|
||||
+Notepad<br />
|
||||
+A right-click context menu<br />
|
||||
+Added new folders<br />
|
||||
+ /etc - Used for holding configuration files<br />
|
||||
+ /assets - Holds assets for use by DremJS<br />
|
||||
+ /assets/media/images - Holds specifically images<br />
|
||||
Spring cleaning<br />
|
||||
-Removed ambient music on all applications<br />
|
||||
-Removed 404 error screen (since it wasn't used anyway)<br />
|
||||
-Removed background.png (same reason as the above)<br />
|
||||
-Removed the old favicon<br />
|
||||
~Made the terminal portable<br />
|
||||
~General system stability improvements to enhance the user's experience.<br /><br />
|
||||
Version 0.1.6b<br />
|
||||
+Widget support (see wiki for more information)<br />
|
||||
+Made clicking apps in the taskbar move applications to the front instead of minimizing.<br />
|
||||
+Cowsay (PHP and JS interfacing experiment)<br />
|
||||
+Changed the start menu to the Drem Logo<br />
|
||||
+Added a task manager (combined with Server Status application)<br />
|
||||
+Added a CPU/memory monitor (see wiki for more information)<br />
|
||||
~Windows now have a shaded background<br />
|
||||
~Fixed a bug in terminal where white-space is ignored by output().<br />
|
||||
~Made terminal themes consistent (no more cookies)<br />
|
||||
~General system stability improvements to enhance the user's experience.<br /><br />
|
||||
Version 0.1.5b<br />
|
||||
+Readded the start menu<br />
|
||||
+A lite theme for the terminal, if that's your thing. You can toggle the theme with "settheme".<br />
|
||||
~DremJS went on a strict diet and lost about 15MBs<br />
|
||||
~Changed DremJS's font to Calibri<br />
|
||||
~Overhauled the About application a lot.
|
||||
~General system stability improvements to enhance the user's experience.
|
||||
NOTE: Even though DremJS's font is Calibri, it does NOT mean that applications will automagically change to Calibri. Developers need to set their own font if they want a custom one.<br /><br />
|
||||
Version 0.1.4b<br />
|
||||
+Added ProcMan (Process Manager) to the terminal which allows you to list all processes or kill a process<br />
|
||||
+Added insmod (Install Module). It's on its first prototype so it's not able to do much.<br />
|
||||
~Separated Terminal from Debug and made it accessible when not in Debug mode.<br />
|
||||
~Updated Terminal image.<br />
|
||||
~Probable a ton more changes that I forgot about before I went on a break<br />
|
||||
~Updated to Agenda WM 0.1.0b, which adds some new features and tweaks including, but not limited to:<br />
|
||||
~Made Agenda its own .js file<br />
|
||||
~Moved the taskbar that was originally in DremJS into Agenda WM<br />
|
||||
+Added the ability to minimize and restore applications (hence the taskbar move)<br /><br />
|
||||
Version 0.1.3b<br />
|
||||
~Updated to Agenda WM 0.0.4b, which adds some new features and tweaks including, but not limited to:<br />
|
||||
+A maximize button<br />
|
||||
+The ability to launch applications with a specific size.<br /><br />
|
||||
Version 0.1.2b (Hotfix 1)<br />
|
||||
~Fixed a bug where multiple instances of the same app will have the same (supposed to be) unique identifier, which caused problems with closing and layering.<br /><br />
|
||||
Version 0.1.2b<br />
|
||||
This is a very important and large release for DremJS!<br />
|
||||
We are going to hard code the start menu to stay open at all times for a while until we care enough to reimpliment it better.<br />
|
||||
<!-- Maybe in 0.1.3b... -->
|
||||
<!--+++We're very glad to present a very basic application installation program! It only works on MiniWeb. I don't know if it will work on Apache servers or not.-->
|
||||
+++With the brand new Agenda WM, you can now multitask in DremJS!<br />
|
||||
+Added 'cmd_fm' command to terminal. CMD.FM is a free online radio service that looks like a computer terminal. <br /><br />
|
||||
Version 0.1.1b<br />
|
||||
+A terminal that is accessable from the Debug Menu. It's based off of <a href="https://codepen.io/AndrewBarfield/pen/qEqWMq?css-preprocessor=scss">Andrew Barfield's HTML5 Web Terminal</a>.<br />
|
||||
~Some UI Tweaks<br />
|
||||
~Bug Fixes<br />
|
||||
~Made the shutdown function actually shut DremJS down<br /><br />
|
||||
Version 0.1.0b<br />
|
||||
+A taskbar<br />
|
||||
++Home button moved to taskbar<br />
|
||||
++About app is on taskbar for defaults. Because we are still working on the taskbar, documentation for adding or removing icons from the taskbar will not be released yet.<br />
|
||||
~Some apps moved to the Marketplace to make DremJS smaller. The most important apps stay (About, DremJS Market, How to Install Apps, Report a Bug)<br /><br />
|
||||
Version 0.0.9-1a<br />
|
||||
+PVT Counter<br />
|
||||
~Improved 404 screen that isn't an eye sore when you look at it in the dark<br />
|
||||
~Bug Fixes<br />
|
||||
~Made the GUI more centered and prettier<br /><br />
|
||||
Version 0.0.8-2a<br />
|
||||
=More WAV to MP3 fixes<br /><br />
|
||||
Version 0.0.8-1a<br />
|
||||
+A crash handler for 404 errors, should you have any.<br />
|
||||
+A little debug menu that can be found in the bug report application. Uncommenting it will enable it. At the moment, it is mostly useless.<br />
|
||||
~A few minor patches<br /><br />
|
||||
Version 0.0.8a<br />
|
||||
+Shutdown animation<br />
|
||||
+Added icons for downloadable apps (apps in DremJS Market)<br />
|
||||
=Better Shop app (no iframe inside an iframe)<br />
|
||||
=Better way of getting downloads from DremJS Market (GitHub Releases)<br />
|
||||
=To prevent having to resize div in index-open.html, the start menu takes up the entire left hand side of the open page<br />
|
||||
=SO MANY MORE BUG FIXES!!!<br /><br />
|
||||
Version 0.0.7-3a<br />
|
||||
Removed the underlines and made all application links black in the start menu.<br /><br />
|
||||
Version 0.0.7-2a<br />
|
||||
Ironically, fixed a bug in the debug application which caused DremJS to open in a new tab when clicking "Go Back" by simply removing it. That's the home button's job anyway!<br /><br />
|
||||
Version 0.0.7-1a<br />
|
||||
~Compatibility Update<br />
|
||||
Turned some .wav files into mp3 files for consistancy, and for better support for MiniWeb<br />
|
||||
Made the Debug application an application with the purpose of bug reporting<br /><br />
|
||||
Version 0.0.7a<br />
|
||||
~Compatibility Update<br />
|
||||
+Changed iframes to use %'s rather than px. This will make the OS grow or shrink per the device's size. This was mainly added for smaller devices such as phones and tablets.<br /><br />
|
||||
Version 0.0.6-1a<br />
|
||||
+Open menu sound added<br />
|
||||
+Ambient music added in some built in applications<br /><br />
|
||||
Version 0.0.6a<br />
|
||||
This update was really only made for fun and to make the OS overall prettier.<br />
|
||||
~The Market got moved to the actual DremJS-Market repository so that everyone has the same DremJS Market<br />
|
||||
+App Icons!<br />
|
||||
+Favicon!<br />
|
||||
+Shutdown Button<br />
|
||||
+Shutdown Sound<br />
|
||||
+Startup Sound<br />
|
||||
+A few more small tweaks to make the OS prettier<br /><br />
|
||||
Version 0.0.5a<br />
|
||||
+Whats that?! It's a gradualy improving app store!! You must download DremJS and host it or run it on your browser on your own PC to use it though.<br />
|
||||
Installation instructions are inside the zip that will download from it. Read it before you install!!!<br /><br />
|
||||
Version 0.0.4a<br />
|
||||
+Sam&Yoe Group: The Video Game<br />
|
||||
~Music has some problems<br /><br />
|
||||
Version 0.0.3a<br />
|
||||
Now for some functionality.<br />
|
||||
+TinyMCE Text Editor<br />
|
||||
+Paint app<br /><br />
|
||||
Version 0.0.2a<br />
|
||||
+This version actually used javascript for the home button! Now DremJS really is DremJS! Seriously though, when installing web apps on this thing that don't have a home button, this button is a life saver.<br />
|
||||
-All built-in apps have gotten their home buttons removed due to the "master" home button.<br />
|
||||
-Test Apps Removed (from start menu)<br /><br />
|
||||
Version 0.0.1a<br />
|
||||
The first ever version. Doesn't even have JS yet, despite the name. Don't expect much.<br />
|
||||
Future ideas:<br />
|
||||
To be able to go back to the home screen easier, I will soon add a home button by loading apps using iframe instead.</p>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 508 KiB |
|
@ -1,6 +0,0 @@
|
|||
Name: About
|
||||
Author: Innovation Inc.
|
||||
Width: 800
|
||||
Height: 500
|
||||
Icon: about.png
|
||||
Category: /
|
Before Width: | Height: | Size: 385 B |
|
@ -1,39 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Notice</title>
|
||||
</head>
|
||||
|
||||
<style type="text/css">
|
||||
code {
|
||||
background-color: #eee;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<embed src="https://sparrdrem.github.io/DremJS/apps/debug/chord.mp3" width="0" height="0" loop="true" autostart="true" hidden="true" />
|
||||
<h1>
|
||||
Notice
|
||||
</h1>
|
||||
<hr />
|
||||
<br />
|
||||
<br />
|
||||
<p>
|
||||
This will transfer you to the GitReports page in a new tab.<br />
|
||||
To go back, press home now.
|
||||
</p>
|
||||
<a target="_blank" href="https://gitreports.com/issue/DremOSDeveloperTeam/DremJS"><button>Proceed</button></a>
|
||||
<hr />
|
||||
<!-- Uncomment everything below to enable the Debug Menu -->
|
||||
<!--<h2>Debug Menu (only works if DremJS is on the root of your HTML server)</h2>
|
||||
<p>Notice: the debug menu is fairly useless at the moment.</p>
|
||||
<a href="/404.html"><button>Initiate 404 Crash</button></a>
|
||||
<a href="/index.html" target="_parent"><button>Force DremJS to go to the Home Menu</button></a>
|
||||
<a href="../../terminal.html"><button>Start Terminal</button></a>-->
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Debug
|
||||
Author: Innovation Inc.
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: debug.png
|
||||
Category: /Tools
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 569 B |
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>How To Install Applications On DremJS</title>
|
||||
</head>
|
||||
<style type="text/css">
|
||||
code {
|
||||
background-color: #eee;
|
||||
color: white;
|
||||
padding: 5px;
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<h1>
|
||||
How to Install Applications On DremJS
|
||||
</h1>
|
||||
<h2>
|
||||
Step 1
|
||||
</h2>
|
||||
<p>
|
||||
Make a directory inside the "apps" directory and copy the program files to it
|
||||
</p>
|
||||
<img src="apps.png" alt="App folder">
|
||||
<h2>
|
||||
Step 2
|
||||
</h2>
|
||||
<p>
|
||||
Go to the index-open.html file on the root of the OS and go to the main <kbd>ul</kbd> block. Insert anywhere within it, changing the image src, and application names to your needs:
|
||||
Note: If there is a "install.txt" file in the application folder, please copy the script from there.
|
||||
</p>
|
||||
<br />
|
||||
<img src="script.png" alt="Script">
|
||||
<p>
|
||||
Thats it! The program will appear in the Start menu and should start to work.
|
||||
</p>
|
||||
<br />
|
||||
<p><a href="https://github.com/SparrOSDeveloperTeam/">SparrOS Developer Team</a> helped develop application. Thanks!</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: How to Install Applications
|
||||
Author: Innovation Inc.
|
||||
Width: 800
|
||||
Height: 500
|
||||
Icon: howto.png
|
||||
Category: /
|
Before Width: | Height: | Size: 4.7 KiB |
|
@ -1,8 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<meta http-equiv = "refresh" content = "0; url = https://sparrdrem.github.io/DremJS-Market/" />
|
||||
</head>
|
||||
</html>
|
Before Width: | Height: | Size: 349 B |
|
@ -1,6 +0,0 @@
|
|||
Name: DremJS Market
|
||||
Author: Innovation Science
|
||||
Width: max
|
||||
Height: max
|
||||
Icon: market.png
|
||||
Category: /
|
|
@ -1,63 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
|
||||
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.buttonA, .buttonB {
|
||||
display: inline-block;
|
||||
}
|
||||
.buttons {
|
||||
width: 100%;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
position: sticky;
|
||||
background-color: #D3D3D3;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var i = 0
|
||||
while (i <= 1000) {
|
||||
if (parent.idExists(i)) {
|
||||
content='<tr><td><p>'+i+'</p></td><td><p>'+parent.idExists(i)+'</p></td><td><button class="sideRight" type="button" onclick="parent.closeApplication('+i+')">Kill</button></td></tr>';
|
||||
var container=document.getElementById("container");
|
||||
container.insertAdjacentHTML("beforeend", content);
|
||||
//console.log(i + "\t\t" + parent.idExists(i));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
});
|
||||
function startRefresh() {
|
||||
$.get("TaskManager.html", function(data) {
|
||||
$(document.body).html(data);
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
setTimeout(startRefresh,1000);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="buttons">
|
||||
<a href="index.php"><button type="button" class="buttonA">Status</button></a>
|
||||
<button type="button" class="buttonB" disabled>Task Manager</button>
|
||||
</div>
|
||||
<table id="container" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Process Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
header('Refresh:10');
|
||||
function displayInfo() {
|
||||
$systemInfo = '<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
|
||||
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var content = \'<center><p>CPU Usage: '.getCpuUsage().'%</p><div id="cpuUsageBar"></div><br /><p>Memory Usage (see docs): '.memory_usage()."KB/".memory_total()."KB".'</p><div id="memoryUsageBar"></div></center>\';
|
||||
|
||||
var parent=document.getElementById("container");
|
||||
parent.insertAdjacentHTML("beforeend", content);
|
||||
|
||||
$( "#cpuUsageBar" ).progressbar({
|
||||
value: '.getCpuUsage().'
|
||||
});
|
||||
$( "#memoryUsageBar" ).progressbar({
|
||||
value: '.round((memory_usage()/memory_total())*100, 2).'
|
||||
});
|
||||
});
|
||||
function startRefresh() {
|
||||
$.get("index.php", function(data) {
|
||||
$(document.body).html(data);
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
setTimeout(startRefresh,5000);
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.buttonA, .buttonB {
|
||||
display: inline-block;
|
||||
}
|
||||
.buttons {
|
||||
width: 100%;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
position: sticky;
|
||||
background-color: #D3D3D3;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
document.addEventListener("contextmenu", event => event.preventDefault());
|
||||
</script>
|
||||
<div class="buttons">
|
||||
<button type="button" class="buttonA" disabled>Status</button>
|
||||
<a href="TaskManager.html"><button type="button" class="buttonB">Task Manager</button></a>
|
||||
</div>
|
||||
<div id="container">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
echo($systemInfo);
|
||||
//ob_flush();
|
||||
//flush();
|
||||
}
|
||||
|
||||
function memory_usage() {
|
||||
return memory_total() - memory_free();
|
||||
}
|
||||
|
||||
function memory_free() {
|
||||
$fh = fopen('/proc/meminfo','r');
|
||||
$mem = 0;
|
||||
while ($line = fgets($fh)) {
|
||||
$pieces = array();
|
||||
if (preg_match('/^MemFree:\s+(\d+)\skB$/', $line, $pieces)) {
|
||||
$mem = $pieces[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
return $mem;
|
||||
}
|
||||
|
||||
function memory_total() {
|
||||
$fh = fopen('/proc/meminfo','r');
|
||||
$mem = 0;
|
||||
while ($line = fgets($fh)) {
|
||||
$pieces = array();
|
||||
if (preg_match('/^MemTotal:\s+(\d+)\skB$/', $line, $pieces)) {
|
||||
$mem = $pieces[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
return $mem;
|
||||
}
|
||||
|
||||
function getCpuUsage() {
|
||||
if(stristr(PHP_OS, 'win')) {
|
||||
$_ENV['typeperfCounter'] = '\processor(_total)\% processor time';
|
||||
exec('typeperf -sc 1 "'.$_ENV['typeperfCounter'].'"', $p);
|
||||
$line = explode(',', $p[2]);
|
||||
$load = trim($line[1], '"');
|
||||
return $load;
|
||||
} else {
|
||||
$usage = sys_getloadavg();
|
||||
return $usage[0];
|
||||
}
|
||||
}
|
||||
|
||||
displayInfo();
|
||||
?>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Server Status
|
||||
Author: Innovation Science
|
||||
Width: 300
|
||||
Height: 300
|
||||
Icon: serverstatus.png
|
||||
Category: /
|
Before Width: | Height: | Size: 1.4 KiB |
|
@ -1,106 +0,0 @@
|
|||
::selection {
|
||||
background: #FF5E99;
|
||||
}
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
font-size: 11pt;
|
||||
font-family: Inconsolata, monospace;
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
#container {
|
||||
padding: .1em 1.5em 1em 1em;
|
||||
}
|
||||
#container output {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
}
|
||||
#container output h3 {
|
||||
margin: 0;
|
||||
}
|
||||
#container output pre {
|
||||
margin: 0;
|
||||
}
|
||||
.input-line {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-align: stretch;
|
||||
display: -moz-box;
|
||||
-moz-box-orient: horizontal;
|
||||
-moz-box-align: stretch;
|
||||
display: box;
|
||||
box-orient: horizontal;
|
||||
box-align: stretch;
|
||||
clear: both;
|
||||
}
|
||||
.input-line > div:nth-child(2) {
|
||||
-webkit-box-flex: 1;
|
||||
-moz-box-flex: 1;
|
||||
box-flex: 1;
|
||||
}
|
||||
.prompt {
|
||||
white-space: nowrap;
|
||||
color: #96b38a;
|
||||
margin-right: 7px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-pack: center;
|
||||
-webkit-box-orient: vertical;
|
||||
display: -moz-box;
|
||||
-moz-box-pack: center;
|
||||
-moz-box-orient: vertical;
|
||||
display: box;
|
||||
box-pack: center;
|
||||
box-orient: vertical;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.cmdline {
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
font: inherit;
|
||||
border: none;
|
||||
color: inherit;
|
||||
}
|
||||
.ls-files {
|
||||
height: 45px;
|
||||
-webkit-column-width: 100px;
|
||||
-moz-column-width: 100px;
|
||||
-o-column-width: 100px;
|
||||
column-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
/* SVG Clock */
|
||||
/************************************************************/
|
||||
|
||||
.clock-container {
|
||||
display: none /*inline-block*/;
|
||||
position: relative;
|
||||
width: 200px;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.clock-container > svg > circle {
|
||||
stroke-width: 2px;
|
||||
stroke: #fff;
|
||||
}
|
||||
|
||||
.hour, .min, .sec {
|
||||
stroke-width: 1px;
|
||||
fill: #333;
|
||||
stroke: #555;
|
||||
}
|
||||
|
||||
.sec {
|
||||
stroke: #f55;
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
::selection {
|
||||
background: #ACCEF7;
|
||||
}
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
font-size: 11pt;
|
||||
font-family: Inconsolata, monospace;
|
||||
color: black;
|
||||
background-color: white;
|
||||
}
|
||||
#container {
|
||||
padding: .1em 1.5em 1em 1em;
|
||||
}
|
||||
#container output {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
}
|
||||
#container output h3 {
|
||||
margin: 0;
|
||||
}
|
||||
#container output pre {
|
||||
margin: 0;
|
||||
}
|
||||
.input-line {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-align: stretch;
|
||||
display: -moz-box;
|
||||
-moz-box-orient: horizontal;
|
||||
-moz-box-align: stretch;
|
||||
display: box;
|
||||
box-orient: horizontal;
|
||||
box-align: stretch;
|
||||
clear: both;
|
||||
}
|
||||
.input-line > div:nth-child(2) {
|
||||
-webkit-box-flex: 1;
|
||||
-moz-box-flex: 1;
|
||||
box-flex: 1;
|
||||
}
|
||||
.prompt {
|
||||
white-space: nowrap;
|
||||
color: #0000ff;
|
||||
margin-right: 7px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-pack: center;
|
||||
-webkit-box-orient: vertical;
|
||||
display: -moz-box;
|
||||
-moz-box-pack: center;
|
||||
-moz-box-orient: vertical;
|
||||
display: box;
|
||||
box-pack: center;
|
||||
box-orient: vertical;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.cmdline {
|
||||
outline: none;
|
||||
background-color: transparent;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
font: inherit;
|
||||
border: none;
|
||||
color: inherit;
|
||||
}
|
||||
.ls-files {
|
||||
height: 45px;
|
||||
-webkit-column-width: 100px;
|
||||
-moz-column-width: 100px;
|
||||
-o-column-width: 100px;
|
||||
column-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
/* SVG Clock */
|
||||
/************************************************************/
|
||||
|
||||
.clock-container {
|
||||
display: none /*inline-block*/;
|
||||
position: relative;
|
||||
width: 200px;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.clock-container > svg > circle {
|
||||
stroke-width: 2px;
|
||||
stroke: #fff;
|
||||
}
|
||||
|
||||
.hour, .min, .sec {
|
||||
stroke-width: 1px;
|
||||
fill: #333;
|
||||
stroke: #555;
|
||||
}
|
||||
|
||||
.sec {
|
||||
stroke: #f55;
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>DremJS Terminal</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" title="dark" href="css/dark.css">
|
||||
<!--<link rel="alternate stylesheet" type="text/css" title="lite" href="css/lite.css">-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
<title>DremJS</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Inconsolata"
|
||||
rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body onload="getTheme();">
|
||||
<script>
|
||||
|
||||
function getTheme() {
|
||||
var path = $('script[src*=terminal]').attr('src').replace('terminal.js', '');
|
||||
jQuery.get(path + 'configs/theme.conf', function(data) {
|
||||
if(data == "1") {
|
||||
var cssLink = $('link[href*="/css/dark.css"]');
|
||||
cssLink.replaceWith('<link href="' + path + 'css/lite.css" type="text/css" rel="stylesheet">');
|
||||
} else {
|
||||
var cssLink = $('link[href*="css/lite.css"]');
|
||||
cssLink.replaceWith('<link href="' + path + 'css/dark.css" type="text/css" rel="stylesheet">');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<!--<script> old script
|
||||
function setTheme() {
|
||||
if (checkCookie('terminalTheme') == false) {
|
||||
document.cookie = "terminalTheme=0";
|
||||
} else {
|
||||
theme = getCookie('terminalTheme');
|
||||
if (theme == 1) {
|
||||
/*var stylesheet = document.getElementById("stylesheet");
|
||||
stylesheet.setAttribute('href', 'css/lite.css');*/
|
||||
var cssLink = $('link[href*="css/dark.css"]');
|
||||
cssLink.replaceWith('<link href="css/lite.css" type="text/css" rel="stylesheet">');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkCookie(cname) {
|
||||
var cookie = getCookie(cname);
|
||||
if (cookie != "") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
var name = cname + "=";
|
||||
var decodedCookie = decodeURIComponent(document.cookie);
|
||||
var ca = decodedCookie.split(';');
|
||||
for(var i = 0; i <ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) == 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
</script>-->
|
||||
<div id="container">
|
||||
<output></output>
|
||||
<div id="input-line" class="input-line">
|
||||
<div class="prompt"></div><div><input class="cmdline" autofocus /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<script src="http://www.codehelper.io/api/ips/?js"></script>-->
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script src="./terminal/terminal.js"></script>
|
||||
|
||||
<div class="clock-container">
|
||||
<svg viewBox="0 0 100 100">
|
||||
<circle cx="50" cy="50" r="45"/>
|
||||
<g>
|
||||
<rect class="hour" x="47.5" y="12.5" width="5" height="40" rx="2.5" ry="2.55" />
|
||||
<rect class="min" x="48.5" y="12.5" width="3" height="40" rx="2" ry="2"/>
|
||||
<line class="sec" x1="50" y1="50" x2="50" y2="16" />
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
<script src="./terminal/index.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Terminal
|
||||
Author: Innovation Science
|
||||
Width: 700
|
||||
Height: 450
|
||||
Icon: terminal.png
|
||||
Category: /
|
|
@ -1,5 +0,0 @@
|
|||
type terminal;
|
||||
name hello;
|
||||
|
||||
output("world");
|
||||
//break;
|
Before Width: | Height: | Size: 20 KiB |
|
@ -1 +0,0 @@
|
|||
0
|
|
@ -1,22 +0,0 @@
|
|||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
$(function() {
|
||||
// Set the command-line prompt to include the user's IP Address
|
||||
//$('.prompt').html('[' + codehelper_ip["IP"] + '@HTML5] # ');
|
||||
$('.prompt').html('[user@DremJS] # ');
|
||||
|
||||
// Initialize a new terminal object
|
||||
var term = new Terminal('#input-line .cmdline', '#container output');
|
||||
term.init();
|
||||
|
||||
// Update the clock every second
|
||||
setInterval(function() {
|
||||
function r(cls, deg) {
|
||||
$('.' + cls).attr('transform', 'rotate('+ deg +' 50 50)')
|
||||
}
|
||||
var d = new Date()
|
||||
r("sec", 6*d.getSeconds())
|
||||
r("min", 6*d.getMinutes())
|
||||
r("hour", 30*(d.getHours()%12) + d.getMinutes()/2)
|
||||
}, 1000);
|
||||
|
||||
});
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
//header('Content-type: text/plain');
|
||||
$inputText = $_REQUEST['inputText'];
|
||||
$skin = $_REQUEST['skin'];
|
||||
$output = "";
|
||||
// Getting some information about the string to figure out how to make the
|
||||
// speech bubble. This is a terrible way of doing it, but that's a problem for
|
||||
// future Sam (aka years after I forget about making this when it breaks).
|
||||
if (strlen($inputText) > 39) {
|
||||
$wrapTextOnceFlag = True;
|
||||
} else {
|
||||
$wrapTextOnceFlag = False;
|
||||
}
|
||||
if (strlen($inputText) > 78) {
|
||||
$wrapTextTwiceFlag = True;
|
||||
} else {
|
||||
$wrapTextTwiceFlag = False;
|
||||
}
|
||||
// Now that we know how to process the speech bubble, we now need to process
|
||||
// the input string.
|
||||
if($wrapTextOnceFlag == True) {
|
||||
$output.=" _________________________________________<br />";
|
||||
if($wrapTextTwiceFlag == True) {
|
||||
$textArray = str_split($inputText, 39);
|
||||
$output.="/ ".$textArray[0]." \<br />";
|
||||
$counter = 1;
|
||||
while($counter < sizeof($textArray)-2) {
|
||||
$output.="| ".$textArray[$counter]." |<br />";
|
||||
//$output.="Adding line ".$counter." of ".sizeof($textArray)-2."<br /";
|
||||
$counter++;
|
||||
}
|
||||
$output.="\ ".$textArray[sizeof($textArray)-1].str_repeat(' ', 39-strlen($textArray[sizeof($textArray)-1]))." /<br />";
|
||||
$output.=" -----------------------------------------<br />";
|
||||
//$output.=$textArray[sizeof($textArray)-1];
|
||||
} else {
|
||||
$textArray = str_split($inputText, 39);
|
||||
$output.="/ ".$textArray[0]." \<br />";
|
||||
$output.="\ ".$textArray[1].str_repeat(' ', 39-strlen($textArray[1]))." /<br />";
|
||||
$output.=" -----------------------------------------<br />";
|
||||
}
|
||||
} else {
|
||||
$output.=" _".str_repeat("_", strlen($inputText))."_<br />";
|
||||
$output.="< ".$inputText." ><br />";
|
||||
$output.=" -".str_repeat("-", strlen($inputText))."-<br />";
|
||||
}
|
||||
if($skin == "tux") {
|
||||
$output.=" \\ .--.<br />";
|
||||
$output.=" \\ |_ |<br />";
|
||||
$output.=" |:_/ |<br />";
|
||||
$output.=" // \\ \\<br />";
|
||||
$output.=" (| | )<br />";
|
||||
$output.=" /'\\_ _/`\\<br />";
|
||||
$output.=" \\___)=(___/";
|
||||
/*
|
||||
\ .--.
|
||||
\ |_ |
|
||||
|:_/ |
|
||||
// \ \
|
||||
(| | )
|
||||
/'\_ _/`\
|
||||
\___)=(___/
|
||||
*/
|
||||
} else {
|
||||
$output.=" \\ ^__^<br />";
|
||||
$output.=" \\ (oo)\\_______<br />";
|
||||
$output.=" (__)\\ )\\/\\<br />";
|
||||
$output.=" ||----w |<br />";
|
||||
$output.=" || ||";
|
||||
/*
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
*/
|
||||
}
|
||||
echo $output;
|
||||
?>
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
$theme = file_get_contents('../configs/theme.conf');
|
||||
|
||||
if($theme == "1") {
|
||||
file_put_contents('../configs/theme.conf', '0');
|
||||
} else {
|
||||
file_put_contents('../configs/theme.conf', '1');
|
||||
}
|
||||
|
||||
?>
|
Before Width: | Height: | Size: 928 KiB |
|
@ -1,421 +0,0 @@
|
|||
var util = util || {};
|
||||
var infinateLoopDetect;
|
||||
var i = 0;
|
||||
var f = 0;
|
||||
var moduleTypeFlag = 0;
|
||||
var cmdString = "";
|
||||
var modules = [];
|
||||
var moduleCode = [];
|
||||
var modInstall;
|
||||
var firstLine = "";
|
||||
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
|
||||
util.toArray = function(list) {
|
||||
return Array.prototype.slice.call(list || [], 0);
|
||||
};
|
||||
|
||||
function show_image(src, width, height, alt) {
|
||||
var img = document.createElement("img");
|
||||
img.src = src;
|
||||
img.width = width;
|
||||
img.height = height;
|
||||
img.alt = alt;
|
||||
|
||||
// This next line will just add it to the <body> tag
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
|
||||
var Terminal = Terminal || function(cmdLineContainer, outputContainer) {
|
||||
window.URL = window.URL || window.webkitURL;
|
||||
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
|
||||
|
||||
var cmdLine_ = document.querySelector(cmdLineContainer);
|
||||
var output_ = document.querySelector(outputContainer);
|
||||
|
||||
cmds = [
|
||||
'cat', 'clear', 'clock', 'date', 'echo', 'help', 'uname', 'cmd_fm', 'procman', 'insmod', 'rmmod', 'swaptheme', 'cowsay'
|
||||
];
|
||||
|
||||
var fs_ = null;
|
||||
var cwd_ = null;
|
||||
var history_ = [];
|
||||
var histpos_ = 0;
|
||||
var histtemp_ = 0;
|
||||
|
||||
window.addEventListener('click', function(e) {
|
||||
cmdLine_.focus();
|
||||
}, false);
|
||||
|
||||
cmdLine_.addEventListener('click', inputTextClick_, false);
|
||||
cmdLine_.addEventListener('keydown', historyHandler_, false);
|
||||
cmdLine_.addEventListener('keydown', processNewCommand_, false);
|
||||
|
||||
//
|
||||
function inputTextClick_(e) {
|
||||
this.value = this.value;
|
||||
}
|
||||
|
||||
//
|
||||
function historyHandler_(e) {
|
||||
if (history_.length) {
|
||||
if (e.keyCode == 38 || e.keyCode == 40) {
|
||||
if (history_[histpos_]) {
|
||||
history_[histpos_] = this.value;
|
||||
} else {
|
||||
histtemp_ = this.value;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.keyCode == 38) { // up
|
||||
histpos_--;
|
||||
if (histpos_ < 0) {
|
||||
histpos_ = 0;
|
||||
}
|
||||
} else if (e.keyCode == 40) { // down
|
||||
histpos_++;
|
||||
if (histpos_ > history_.length) {
|
||||
histpos_ = history_.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.keyCode == 38 || e.keyCode == 40) {
|
||||
this.value = history_[histpos_] ? history_[histpos_] : histtemp_;
|
||||
this.value = this.value; // Sets cursor to end of input.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
function processNewCommand_(e) {
|
||||
|
||||
if (e.keyCode == 9) { // tab
|
||||
e.preventDefault();
|
||||
// Implement tab suggest.
|
||||
} else if (e.keyCode == 13) { // enter
|
||||
// Save shell history.
|
||||
if (this.value) {
|
||||
history_[history_.length] = this.value;
|
||||
histpos_ = history_.length;
|
||||
}
|
||||
|
||||
// Duplicate current input and append to output section.
|
||||
var line = this.parentNode.parentNode.cloneNode(true);
|
||||
line.removeAttribute('id')
|
||||
line.classList.add('line');
|
||||
var input = line.querySelector('input.cmdline');
|
||||
input.autofocus = false;
|
||||
input.readOnly = true;
|
||||
output_.appendChild(line);
|
||||
|
||||
if (this.value && this.value.trim()) {
|
||||
/*var args = this.value.split(' ').filter(function(val, i) {
|
||||
return val;
|
||||
});*/
|
||||
var args = [].concat.apply([], this.value.split('"').map(function(v,i){
|
||||
return i%2 ? v : v.split(' ')
|
||||
})).filter(Boolean);
|
||||
var cmd = args[0].toLowerCase();
|
||||
args = args.splice(1); // Remove cmd from arg list.
|
||||
}
|
||||
//infinateLoopDetect = setTimeout(function(){ alert("Infinate Loop!"); }, 10000);
|
||||
switch (cmd) {
|
||||
case 'cat':
|
||||
var url = args.join(' ');
|
||||
if (!url) {
|
||||
output('Usage: ' + cmd + ' https://s.codepen.io/...');
|
||||
output('Example: ' + cmd + ' https://s.codepen.io/AndrewBarfield/pen/LEbPJx.js');
|
||||
break;
|
||||
}
|
||||
$.get( url, function(data) {
|
||||
var encodedStr = data.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
|
||||
return '&#'+i.charCodeAt(0)+';';
|
||||
});
|
||||
output('<pre>' + encodedStr + '</pre>');
|
||||
});
|
||||
break;
|
||||
case 'clear':
|
||||
output_.innerHTML = '';
|
||||
this.value = '';
|
||||
return;
|
||||
case 'clock':
|
||||
var appendDiv = jQuery($('.clock-container')[0].outerHTML);
|
||||
appendDiv.attr('style', 'display:inline-block');
|
||||
output_.appendChild(appendDiv[0]);
|
||||
break;
|
||||
case 'date':
|
||||
output( new Date() );
|
||||
break;
|
||||
case 'echo':
|
||||
output( args.join(' ') );
|
||||
break;
|
||||
case 'help':
|
||||
if (!arguments || (args[0] != "modules")) {
|
||||
cmdString = "";
|
||||
output('DremJS Terminal Help Menu');
|
||||
output('All default commands (without modules) for the terminal are as follows:');
|
||||
for (i = 0; i < cmds.length; i++)
|
||||
cmdString += cmds[i] + " ";
|
||||
output(cmdString);
|
||||
cmdString = "";
|
||||
output('Module commands:');
|
||||
for (i = 0; i < modules.length; i++)
|
||||
cmdString += modules[i] + " ";
|
||||
output(cmdString);
|
||||
cmdString = "";
|
||||
output('For information on Modules, run "help modules"');
|
||||
} else if (args[0] == "modules") {
|
||||
output('DremJS Terminal Help Menu - Modules');
|
||||
output('What are Modules?');
|
||||
output('Modules are a simple way to temporarily add new functionality to DremJS. Modules have a .djsm (DremJS Module) file extension and contain JavaScript code which can be ran immediately or from a terminal. DremJS Modules can also be installed in batch with a .djsms (DremJS Module Script). These scripts will automatically handle installations of modules that may be too complex to fit into one file and therefor have multiple modules.\n\n');
|
||||
output('Currently, there are three different types of modules: immediate, terminal, and parentscript. An immediate module does exactly what it says: run the code immediately. A terminal module adds functionality to the terminal, such as a new command. However, terminal modules are not persistent after you close the terminal (yet). A parentscript module adds functionality to the main Agenda WM script.\n\n');
|
||||
output('The pros and cons of modules');
|
||||
output('The pros of modules is that you can add new functionality to DremJS or the terminal without having to install an application.');
|
||||
output('The cons of a module is that, since it adds or runs code on-the-fly to DremJS, they are very insecure. A man-in-the-middle attack or other naughty module can cause your data to be stolen (please never use DremJS with any personal data), DremJS to become unstable, or completely crash. This is why we made it so modules are not permanently installed. If you want code that stays put, it is recommended to use an application.');
|
||||
}
|
||||
break;
|
||||
case 'uname':
|
||||
output(navigator.appVersion);
|
||||
break;
|
||||
/*case 'whoami':
|
||||
var result = "<img src=\"" + codehelper_ip["Flag"]+ "\"><br><br>";
|
||||
for (var prop in codehelper_ip)
|
||||
result += prop + ": " + codehelper_ip[prop] + "<br>";
|
||||
output(result);
|
||||
break;*/
|
||||
case 'cmd_fm':
|
||||
window.open("https://cmd.to/fm","_self")
|
||||
break;
|
||||
case 'spin':
|
||||
//show_image('spin.gif', 100, 100, 'Spinny');
|
||||
output('<img align="left" src="' + $('script[src*=terminal]').attr('src').replace('terminal.js', '') +'/spin.gif" width="100" height="100">');
|
||||
break;
|
||||
case 'procman':
|
||||
var arguments = args.join(' ');
|
||||
if (!arguments || (args[0] != "list" && args[0] != "kill")) {
|
||||
output('Process Manager (procman) help');
|
||||
output('procman kill - kill a process');
|
||||
output('procman list - list all processes');
|
||||
break;
|
||||
} else if (args[0] == "list") {
|
||||
var i = 0;
|
||||
output('ID\t\tName');
|
||||
while (i <= 1000) {
|
||||
if (parent.idExists(i))
|
||||
output(i + "\t\t" + parent.idExists(i));
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
} else if (args[0] == "kill") {
|
||||
if (!args[1]) {
|
||||
output("fatal: no application ID provided!");
|
||||
} else if (parent.idExists(args[1])) {
|
||||
output("Killing application with ID " + args[1]);
|
||||
parent.closeApplication(args[1])
|
||||
} else {
|
||||
output("fatal: application ID " + args[1] + " does not exist.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'insmod':
|
||||
i=0;
|
||||
modInstall="";
|
||||
firstLine="";
|
||||
if (!arguments || (args[0] != "remote" && args[0] != "local")) {
|
||||
output('Install Module (insmod) help');
|
||||
output('NOTICE: insmod is currently a prototype and is not yet feature-complete or secured at all. NEVER INSTALL A MODULE UNLESS YOU ARE ON YOUR LOCAL NETWORK!');
|
||||
output('To install a module not inside the DremJS folder (not recommended, insecure):');
|
||||
output('insmod remote https://example.com/path/to/foo.djsm\n');
|
||||
output('To install a module inside the DremJS folder');
|
||||
output('insmod remote http://your.local.ip.address/path/to/foo.djsm');
|
||||
output('Planned features that aren\'t yet implimented:');
|
||||
output('Batch installs (DremJS Module Installation Scripts)');
|
||||
output('Local installations');
|
||||
//output('insmod local path/to/module.djsm\n');
|
||||
//output('To run a module installation script for batch installations that is not inside the DremJS folder:');
|
||||
//output('insmod remote https://example.com/foo.djsms\n');
|
||||
//output('To run a module installation script that is not inside the DremJS folder:');
|
||||
//output('insmod local path/to/script.djsms\n');
|
||||
output('For more information on modules, please run: help modules');
|
||||
} else if (args[0] == "remote") {
|
||||
if (args[1] != undefined) {
|
||||
if ((args[1].substring(args[1].length-5)) == ".djsm") {
|
||||
output('[insmod] Loading modue at ' + args[1] + '...');
|
||||
var modInstall;
|
||||
jQuery.get(args[1], function(data) {
|
||||
// Welcome to callback hell
|
||||
modInstall = data;
|
||||
output('[insmod] Parsing module...');
|
||||
i=0;
|
||||
while (modInstall.charAt(i) != ';' && i < 50) {
|
||||
firstLine += modInstall.charAt(i);
|
||||
i++;
|
||||
}
|
||||
modInstall = modInstall.substring(i+1, modInstall.length);
|
||||
if (firstLine == "type immediate") {
|
||||
output('[insmod] module type is immediate');
|
||||
moduleTypeFlag = 1;
|
||||
output('[insmod] fatal: module type "immediate" not implimented. Maybe 0.1.6b?');
|
||||
} else if (firstLine == "type terminal") {
|
||||
output('[insmod] module type is terminal');
|
||||
moduleTypeFlag = 2;
|
||||
firstLine = "";
|
||||
i=0;
|
||||
while (modInstall.charAt(i) != ';' && i < 50) {
|
||||
firstLine += modInstall.charAt(i);
|
||||
i++;
|
||||
}
|
||||
newCmdName = firstLine.substring(6, firstLine.length);
|
||||
output('[insmod] adding command with name "' + newCmdName + '" to terminal modules list...');
|
||||
modules.push(newCmdName);
|
||||
output('[insmod] installing module...');
|
||||
modInstall = modInstall.substring(3+firstLine.length, modInstall.length);
|
||||
moduleCode.push(modInstall);
|
||||
} else if (firstLine == "type parentscript") {
|
||||
output('[insmod] module type is parentscript');
|
||||
moduleTypeFlag = 3;
|
||||
output('[insmod] fatal: module type "parentscript" not implimented. Maybe 0.1.6b?');
|
||||
} else {
|
||||
output('[insmod] fatal: the input file is not a DremJS Module or DremJS Module Script');
|
||||
moduleTypeFlag = 0;
|
||||
}
|
||||
/*if (moduleTypeFlag = 1) {
|
||||
output('[insmod] fatal: not implimented. Maybe 0.1.6b?');
|
||||
} else if */
|
||||
});
|
||||
|
||||
//output('[insmod] Installing module...');
|
||||
|
||||
break;
|
||||
} else if ((args[1].substring(args[1].length-6)) == ".djsms") {
|
||||
//output('Running module installation script at ' + args[1] + '...');
|
||||
output('[insmod] fatal: module installation scripts are not implimented. Maybe 0.1.6b?');
|
||||
} else {
|
||||
output('[insmod] fatal: the input file is not a DremJS Module or DremJS Module Script');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
output('[insmod] fatal: no input file was provided.');
|
||||
break;
|
||||
}
|
||||
} else if (args[0] == "local") {
|
||||
output('[insmod] fatal: local installation is not yet implimented. Remote installation can do this. For example: insmod remote http://localhost:8000/modules/foo-0.0.0.djsm');
|
||||
}
|
||||
break;
|
||||
case 'rmmod':
|
||||
output('[rmmod] fatal: not implimented. Maybe 0.1.6b?');
|
||||
break;
|
||||
case 'swaptheme':
|
||||
$.ajax({
|
||||
url: 'terminal/scripts/swapTheme.php'
|
||||
});
|
||||
output('Theme swapped. Please restart the terminal and refresh it a few times.');
|
||||
break;
|
||||
case 'cowsay':
|
||||
if(args[0] == null) {
|
||||
output("cowsay [text] <skin><br />Availible skins:<br />default\t\ttux<br />If no skin is provided or it is invalid, the default is used instead.");
|
||||
} else {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.onload = function() {
|
||||
output(this.responseText);
|
||||
};
|
||||
if(args[1] == null)
|
||||
args[1] = "cow";
|
||||
oReq.open("get", "terminal/scripts/cowsay.php?inputText=" + args[0] + "&skin=" + args[1], true);
|
||||
oReq.send();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var notFoundFlag = 1;
|
||||
if (cmd != undefined) {
|
||||
// Checks if the default terminal command exists
|
||||
for (i = 0; i < cmds.length; i++)
|
||||
if (cmd != cmds[i])
|
||||
notFoundFlag = 1;
|
||||
else {
|
||||
notFoundFlag = 0;
|
||||
i = cmds.length;
|
||||
}
|
||||
|
||||
// Checks if a module with the command name is installed
|
||||
for (i = 0; i < modules.length; i++) {
|
||||
if (cmd != modules[i])
|
||||
notFoundFlag = 1;
|
||||
else {
|
||||
notFoundFlag = 0;
|
||||
eval(moduleCode[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmd = "";
|
||||
}
|
||||
|
||||
if (notFoundFlag == 1) {
|
||||
output(cmd + ': command not found');
|
||||
}
|
||||
};
|
||||
|
||||
window.scrollTo(0, getDocHeight_());
|
||||
this.value = ''; // Clear/setup line for next input.
|
||||
}
|
||||
//clearTimeout(infinateLoopDetect);
|
||||
}
|
||||
|
||||
//
|
||||
function formatColumns_(entries) {
|
||||
var maxName = entries[0].name;
|
||||
util.toArray(entries).forEach(function(entry, i) {
|
||||
if (entry.name.length > maxName.length) {
|
||||
maxName = entry.name;
|
||||
}
|
||||
});
|
||||
|
||||
var height = entries.length <= 3 ?
|
||||
'height: ' + (entries.length * 15) + 'px;' : '';
|
||||
|
||||
// 12px monospace font yields ~7px screen width.
|
||||
var colWidth = maxName.length * 7;
|
||||
|
||||
return ['<div class="ls-files" style="-webkit-column-width:',
|
||||
colWidth, 'px;', height, '">'];
|
||||
}
|
||||
|
||||
//
|
||||
function output(html) {
|
||||
output_.insertAdjacentHTML('beforeEnd', '<p style="white-space:pre;">' + html + '</p>');
|
||||
}
|
||||
|
||||
function sleep(delay) {
|
||||
var start = new Date().getTime();
|
||||
while (new Date().getTime() < start + delay);
|
||||
} // Cyclefucker 1000
|
||||
|
||||
function fileToVar(t) {
|
||||
modInstall = t;
|
||||
alert(modInstall);
|
||||
}
|
||||
|
||||
// Cross-browser impl to get document's height.
|
||||
function getDocHeight_() {
|
||||
var d = document;
|
||||
return Math.max(
|
||||
Math.max(d.body.scrollHeight, d.documentElement.scrollHeight),
|
||||
Math.max(d.body.offsetHeight, d.documentElement.offsetHeight),
|
||||
Math.max(d.body.clientHeight, d.documentElement.clientHeight)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
return {
|
||||
init: function() {
|
||||
jQuery.get('terminal/configs/theme.conf', function(data) {
|
||||
if(data == "1") {
|
||||
output('<img align="left" src="/assets/media/images/termlogo-lite.png" width="100" height="100" style="padding: 0px 10px 20px 0px"><h2 style="letter-spacing: 4px">DremJS Terminal</h2><p>' + new Date() + '</p><p>Enter "help" for more information.</p>');
|
||||
} else {
|
||||
output('<img align="left" src="/assets/media/images/termlogo-dark.png" width="100" height="100" style="padding: 0px 10px 20px 0px"><h2 style="letter-spacing: 4px">DremJS Terminal</h2><p>' + new Date() + '</p><p>Enter "help" for more information.</p>');
|
||||
}
|
||||
});
|
||||
},
|
||||
output: output
|
||||
}
|
||||
};
|
|
@ -1,47 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<?php
|
||||
echo "List of availible widgets:<br />";
|
||||
$widgets = array_filter(glob(getenv('DOCUMENT_ROOT').'/widgets/*'), 'is_dir');
|
||||
for($i = 0; $i<=sizeof($widgets)-1; $i++) {
|
||||
$temp = explode("/", $widgets[$i]);
|
||||
echo $temp[sizeof($temp)-1].' ';
|
||||
}
|
||||
echo "<br /><br />Currently enabled widgets:<br />";
|
||||
$enabledWidgets = explode("\n", file_get_contents(getenv('DOCUMENT_ROOT')."/etc/enabled_widgets"));
|
||||
for($i = 0; $i<=sizeof($enabledWidgets)-1; $i++)
|
||||
echo $enabledWidgets[$i].' ';
|
||||
echo "<br />";
|
||||
if(array_key_exists('add', $_POST)) {
|
||||
addWidget();
|
||||
}
|
||||
function addWidget() {
|
||||
$widget = $_REQUEST['widget'];
|
||||
$widgets = array_filter(glob(getenv('DOCUMENT_ROOT').'/widgets/*'), 'is_dir');
|
||||
$enabledWidgets = explode("\n", file_get_contents(getenv('DOCUMENT_ROOT')."/etc/enabled_widgets"));
|
||||
//print($widget.'<br />');
|
||||
//print_r($widgets);
|
||||
//print_r($enabledWidgets);
|
||||
if(in_array(getenv('DOCUMENT_ROOT').'/widgets/'.$widget, $widgets) && !(in_array($widget, $enabledWidgets))) {
|
||||
$file = fopen(getenv('DOCUMENT_ROOT').'/etc/enabled_widgets', 'a');
|
||||
fwrite($file, $widget."\n");
|
||||
fclose($file);
|
||||
echo "Added ".$widget;
|
||||
} else {
|
||||
echo "Can't add widget - it either doesn't exist or is already enabled";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form method="post">
|
||||
<input type="text" name="widget" class="text" />
|
||||
<input type="submit" name="add" class="button" value="Add Widget" />
|
||||
</form>
|
||||
<a href="index.php"><button type=button>Back</button></a>
|
||||
</body>
|
||||
</html>
|
|
@ -1,37 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<?php
|
||||
echo "List of availible widgets:<br />";
|
||||
$widgets = array_filter(glob(getenv('DOCUMENT_ROOT').'/widgets/*'), 'is_dir');
|
||||
for($i = 0; $i<=sizeof($widgets)-1; $i++) {
|
||||
$temp = explode("/", $widgets[$i]);
|
||||
echo $temp[sizeof($temp)-1].' ';
|
||||
}
|
||||
echo "<br /><br />Currently enabled widgets:<br />";
|
||||
$enabledWidgets = explode("\n", file_get_contents(getenv('DOCUMENT_ROOT')."/etc/enabled_widgets"));
|
||||
for($i = 0; $i<=sizeof($enabledWidgets)-1; $i++)
|
||||
echo $enabledWidgets[$i].' ';
|
||||
echo "<br />";
|
||||
if(array_key_exists('add', $_POST)) {
|
||||
addWidgets();
|
||||
} else if(array_key_exists('remove', $_POST)) {
|
||||
removeWidgets();
|
||||
}
|
||||
function addWidgets() {
|
||||
echo "Add";
|
||||
}
|
||||
function removeWidgets() {
|
||||
echo "Remove";
|
||||
}
|
||||
?>
|
||||
<a href="addwidget.php"><button type=button>Add Widget</button></a>
|
||||
<a href="removewidget.php"><button type=button>Clear Widget List</button></a>
|
||||
<p>Changes take effect after restart.</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
Name: Widgets Settings
|
||||
Author: Innovation Science
|
||||
Width: -1
|
||||
Height: -1
|
||||
Icon: widgets-settings.png
|
||||
Category: /Tools
|
|
@ -1,4 +0,0 @@
|
|||
<?php
|
||||
header("Location: index.php");
|
||||
file_put_contents(getenv('DOCUMENT_ROOT').'/etc/enabled_widgets', '');
|
||||
?>
|
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 508 KiB |
Before Width: | Height: | Size: 998 B |
Before Width: | Height: | Size: 508 KiB |
Before Width: | Height: | Size: 508 KiB |
BIN
favicon.ico
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,499 +0,0 @@
|
|||
<?php
|
||||
/********************************
|
||||
Simple PHP File Manager
|
||||
Copyright John Campbell (jcampbell1)
|
||||
|
||||
Liscense: MIT
|
||||
********************************/
|
||||
|
||||
// Thanks for providing such a great PHP application!
|
||||
|
||||
//Disable error report for undefined superglobals
|
||||
error_reporting( error_reporting() & ~E_NOTICE );
|
||||
|
||||
//Security options
|
||||
$allow_delete = true; // Set to false to disable delete button and delete POST request.
|
||||
$allow_upload = true; // Set to true to allow upload files
|
||||
$allow_create_folder = true; // Set to false to disable folder creation
|
||||
$allow_direct_link = true; // Set to false to only allow downloads and not direct link
|
||||
$allow_show_folders = true; // Set to false to hide all subdirectories
|
||||
|
||||
$disallowed_patterns = ['*.php']; // must be an array. Matching files not allowed to be uploaded
|
||||
$hidden_patterns = ['*.php','.*']; // Matching files hidden in directory index
|
||||
|
||||
$PASSWORD = ''; // Set the password, to access the file manager... (optional)
|
||||
|
||||
if($PASSWORD) {
|
||||
|
||||
session_start();
|
||||
if(!$_SESSION['_sfm_allowed']) {
|
||||
// sha1, and random bytes to thwart timing attacks. Not meant as secure hashing.
|
||||
$t = bin2hex(openssl_random_pseudo_bytes(10));
|
||||
if($_POST['p'] && sha1($t.$_POST['p']) === sha1($t.$PASSWORD)) {
|
||||
$_SESSION['_sfm_allowed'] = true;
|
||||
header('Location: ?');
|
||||
}
|
||||
echo '<html><body><form action=? method=post>PASSWORD:<input type=password name=p autofocus/></form></body></html>';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// must be in UTF-8 or `basename` doesn't work
|
||||
setlocale(LC_ALL,'en_US.UTF-8');
|
||||
|
||||
$tmp_dir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
if(DIRECTORY_SEPARATOR==='\\') $tmp_dir = str_replace('/',DIRECTORY_SEPARATOR,$tmp_dir);
|
||||
$tmp = get_absolute_path($tmp_dir . '/' .$_REQUEST['file']);
|
||||
|
||||
if($tmp === false)
|
||||
err(404,'File or Directory Not Found');
|
||||
if(substr($tmp, 0,strlen($tmp_dir)) !== $tmp_dir)
|
||||
err(403,"Forbidden");
|
||||
if(strpos($_REQUEST['file'], DIRECTORY_SEPARATOR) === 0)
|
||||
err(403,"Forbidden");
|
||||
if(preg_match('@^.+://@',$_REQUEST['file'])) {
|
||||
err(403,"Forbidden");
|
||||
}
|
||||
|
||||
|
||||
if(!$_COOKIE['_sfm_xsrf'])
|
||||
setcookie('_sfm_xsrf',bin2hex(openssl_random_pseudo_bytes(16)));
|
||||
if($_POST) {
|
||||
if($_COOKIE['_sfm_xsrf'] !== $_POST['xsrf'] || !$_POST['xsrf'])
|
||||
err(403,"XSRF Failure");
|
||||
}
|
||||
|
||||
$file = $_REQUEST['file'] ?: '.';
|
||||
|
||||
if($_GET['do'] == 'list') {
|
||||
if (is_dir($file)) {
|
||||
$directory = $file;
|
||||
$result = [];
|
||||
$files = array_diff(scandir($directory), ['.','..']);
|
||||
foreach ($files as $entry) if (!is_entry_ignored($entry, $allow_show_folders, $hidden_patterns)) {
|
||||
$i = $directory . '/' . $entry;
|
||||
$stat = stat($i);
|
||||
$result[] = [
|
||||
'mtime' => $stat['mtime'],
|
||||
'size' => $stat['size'],
|
||||
'name' => basename($i),
|
||||
'path' => preg_replace('@^\./@', '', $i),
|
||||
'is_dir' => is_dir($i),
|
||||
'is_deleteable' => $allow_delete && ((!is_dir($i) && is_writable($directory)) ||
|
||||
(is_dir($i) && is_writable($directory) && is_recursively_deleteable($i))),
|
||||
'is_readable' => is_readable($i),
|
||||
'is_writable' => is_writable($i),
|
||||
'is_executable' => is_executable($i),
|
||||
];
|
||||
}
|
||||
usort($result,function($f1,$f2){
|
||||
$f1_key = ($f1['is_dir']?:2) . $f1['name'];
|
||||
$f2_key = ($f2['is_dir']?:2) . $f2['name'];
|
||||
return $f1_key > $f2_key;
|
||||
});
|
||||
} else {
|
||||
err(412,"Not a Directory");
|
||||
}
|
||||
echo json_encode(['success' => true, 'is_writable' => is_writable($file), 'results' =>$result]);
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'delete') {
|
||||
if($allow_delete) {
|
||||
rmrf($file);
|
||||
}
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'mkdir' && $allow_create_folder) {
|
||||
// don't allow actions outside root. we also filter out slashes to catch args like './../outside'
|
||||
$dir = $_POST['name'];
|
||||
$dir = str_replace('/', '', $dir);
|
||||
if(substr($dir, 0, 2) === '..')
|
||||
exit;
|
||||
chdir($file);
|
||||
@mkdir($_POST['name']);
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'upload' && $allow_upload) {
|
||||
foreach($disallowed_patterns as $pattern)
|
||||
if(fnmatch($pattern, $_FILES['file_data']['name']))
|
||||
err(403,"Files of this type are not allowed.");
|
||||
|
||||
$res = move_uploaded_file($_FILES['file_data']['tmp_name'], $file.'/'.$_FILES['file_data']['name']);
|
||||
exit;
|
||||
} elseif ($_GET['do'] == 'download') {
|
||||
foreach($disallowed_patterns as $pattern)
|
||||
if(fnmatch($pattern, $file))
|
||||
err(403,"Files of this type are not allowed.");
|
||||
|
||||
$filename = basename($file);
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
header('Content-Type: ' . finfo_file($finfo, $file));
|
||||
header('Content-Length: '. filesize($file));
|
||||
header(sprintf('Content-Disposition: attachment; filename=%s',
|
||||
strpos('MSIE',$_SERVER['HTTP_REFERER']) ? rawurlencode($filename) : "\"$filename\"" ));
|
||||
ob_flush();
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
function is_entry_ignored($entry, $allow_show_folders, $hidden_patterns) {
|
||||
if ($entry === basename(__FILE__)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_dir($entry) && !$allow_show_folders) {
|
||||
return true;
|
||||
}
|
||||
foreach($hidden_patterns as $pattern) {
|
||||
if(fnmatch($pattern,$entry)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function rmrf($dir) {
|
||||
if(is_dir($dir)) {
|
||||
$files = array_diff(scandir($dir), ['.','..']);
|
||||
foreach ($files as $file)
|
||||
rmrf("$dir/$file");
|
||||
rmdir($dir);
|
||||
} else {
|
||||
unlink($dir);
|
||||
}
|
||||
}
|
||||
function is_recursively_deleteable($d) {
|
||||
$stack = [$d];
|
||||
while($dir = array_pop($stack)) {
|
||||
if(!is_readable($dir) || !is_writable($dir))
|
||||
return false;
|
||||
$files = array_diff(scandir($dir), ['.','..']);
|
||||
foreach($files as $file) if(is_dir($file)) {
|
||||
$stack[] = "$dir/$file";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// from: http://php.net/manual/en/function.realpath.php#84012
|
||||
function get_absolute_path($path) {
|
||||
$path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $path);
|
||||
$absolutes = [];
|
||||
foreach ($parts as $part) {
|
||||
if ('.' == $part) continue;
|
||||
if ('..' == $part) {
|
||||
array_pop($absolutes);
|
||||
} else {
|
||||
$absolutes[] = $part;
|
||||
}
|
||||
}
|
||||
return implode(DIRECTORY_SEPARATOR, $absolutes);
|
||||
}
|
||||
|
||||
function err($code,$msg) {
|
||||
http_response_code($code);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode(['error' => ['code'=>intval($code), 'msg' => $msg]]);
|
||||
exit;
|
||||
}
|
||||
|
||||
function asBytes($ini_v) {
|
||||
$ini_v = trim($ini_v);
|
||||
$s = ['g'=> 1<<30, 'm' => 1<<20, 'k' => 1<<10];
|
||||
return intval($ini_v) * ($s[strtolower(substr($ini_v,-1))] ?: 1);
|
||||
}
|
||||
$MAX_UPLOAD_SIZE = min(asBytes(ini_get('post_max_size')), asBytes(ini_get('upload_max_filesize')));
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<style>
|
||||
body {font-family: "lucida grande","Segoe UI",Arial, sans-serif; font-size: 14px;width:1024;padding:1em;margin:0;}
|
||||
th {font-weight: normal; color: #1F75CC; background-color: #F0F9FF; padding:.5em 1em .5em .2em;
|
||||
text-align: left;cursor:pointer;user-select: none;}
|
||||
th .indicator {margin-left: 6px }
|
||||
thead {border-top: 1px solid #82CFFA; border-bottom: 1px solid #96C4EA;border-left: 1px solid #E7F2FB;
|
||||
border-right: 1px solid #E7F2FB; }
|
||||
#top {height:52px;}
|
||||
#mkdir {display:inline-block;float:right;padding-top:16px;}
|
||||
label { display:block; font-size:11px; color:#555;}
|
||||
#file_drop_target {width:500px; padding:12px 0; border: 4px dashed #ccc;font-size:12px;color:#ccc;
|
||||
text-align: center;float:right;margin-right:20px;}
|
||||
#file_drop_target.drag_over {border: 4px dashed #96C4EA; color: #96C4EA;}
|
||||
#upload_progress {padding: 4px 0;}
|
||||
#upload_progress .error {color:#a00;}
|
||||
#upload_progress > div { padding:3px 0;}
|
||||
.no_write #mkdir, .no_write #file_drop_target {display: none}
|
||||
.progress_track {display:inline-block;width:200px;height:10px;border:1px solid #333;margin: 0 4px 0 10px;}
|
||||
.progress {background-color: #82CFFA;height:10px; }
|
||||
footer {font-size:11px; color:#bbbbc5; padding:4em 0 0;text-align: left;}
|
||||
footer a, footer a:visited {color:#bbbbc5;}
|
||||
#breadcrumb { padding-top:34px; font-size:15px; color:#aaa;display:inline-block;float:left;}
|
||||
#folder_actions {width: 50%;float:right;}
|
||||
a, a:visited { color:#00c; text-decoration: none}
|
||||
a:hover {text-decoration: underline}
|
||||
.sort_hide{ display:none;}
|
||||
table {border-collapse: collapse;width:100%;}
|
||||
thead {max-width: 1024px}
|
||||
td { padding:.2em 1em .2em .2em; border-bottom:1px solid #def;height:30px; font-size:12px;white-space: nowrap;}
|
||||
td.first {font-size:14px;white-space: normal;}
|
||||
td.empty { color:#777; font-style: italic; text-align: center;padding:3em 0;}
|
||||
.is_dir .size {color:transparent;font-size:0;}
|
||||
.is_dir .size:before {content: "--"; font-size:14px;color:#333;}
|
||||
.is_dir .download{visibility: hidden}
|
||||
a.delete {display:inline-block;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADtSURBVHjajFC7DkFREJy9iXg0t+EHRKJDJSqRuIVaJT7AF+jR+xuNRiJyS8WlRaHWeOU+kBy7eyKhs8lkJrOzZ3OWzMAD15gxYhB+yzAm0ndez+eYMYLngdkIf2vpSYbCfsNkOx07n8kgWa1UpptNII5VR/M56Nyt6Qq33bbhQsHy6aR0WSyEyEmiCG6vR2ffB65X4HCwYC2e9CTjJGGok4/7Hcjl+ImLBWv1uCRDu3peV5eGQ2C5/P1zq4X9dGpXP+LYhmYz4HbDMQgUosWTnmQoKKf0htVKBZvtFsx6S9bm48ktaV3EXwd/CzAAVjt+gHT5me0AAAAASUVORK5CYII=) no-repeat scroll 0 2px;
|
||||
color:#d00; margin-left: 15px;font-size:11px;padding:0 0 0 13px;
|
||||
}
|
||||
.name {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABAklEQVRIie2UMW6DMBSG/4cYkJClIhauwMgx8CnSC9EjJKcwd2HGYmAwEoMREtClEJxYakmcoWq/yX623veebZmWZcFKWZbXyTHeOeeXfWDN69/uzPP8x1mVUmiaBlLKsxACAC6cc2OPd7zYK1EUYRgGZFkG3/fPAE5fIjcCAJimCXEcGxKnAiICERkSIcQmeVoQhiHatoWUEkopJEkCAB/r+t0lHyVN023c9z201qiq6s2ZYA9jDIwx1HW9xZ4+Ihta69cK9vwLvsX6ivYf4FGIyJj/rg5uqwccd2Ar7OUdOL/kPyKY5/mhZJ53/2asgiAIHhLYMARd16EoCozj6EzwCYrrX5dC9FQIAAAAAElFTkSuQmCC) no-repeat scroll 0px 12px;
|
||||
padding:15px 0 10px 40px;
|
||||
}
|
||||
.is_dir .name {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAI0SURBVFiF7Vctb1RRED1nZu5977VQVBEQBKZ1GCDBEwy+ISgCBsMPwOH4CUXgsKQOAxq5CaKChEBqShNK222327f79n0MgpRQ2qC2twKOGjE352TO3Jl76e44S8iZsgOww+Dhi/V3nePOsQRFv679/qsnV96ehgAeWvBged3vXi+OJewMW/Q+T8YCLr18fPnNqQq4fS0/MWlQdviwVqNpp9Mvs7l8Wn50aRH4zQIAqOruxANZAG4thKmQA8D7j5OFw/iIgLXvo6mR/B36K+LNp71vVd1cTMR8BFmwTesc88/uLQ5FKO4+k4aarbuPnq98mbdo2q70hmU0VREkEeCOtqrbMprmFqM1psoYAsg0U9EBtB0YozUWzWpVZQgBxMm3YPoCiLpxRrPaYrBKRSUL5qn2AgFU0koMVlkMOo6G2SIymQCAGE/AGHRsWbCRKc8VmaBN4wBIwkZkFmxkWZDSFCwyommZSABgCmZBSsuiHahA8kA2iZYzSapAsmgHlgfdVyGLTFg3iZqQhAqZB923GGUgQhYRVElmAUXIGGVgedQ9AJJnAkqyClCEkkfdM1Pt13VHdxDpnof0jgxB+mYqO5PaCSDRIAbgDgdpKjtmwm13irsnq4ATdKeYcNvUZAt0dg5NVwEQFKrJlpn45lwh/LpbWdela4K5QsXEN61tytWr81l5YSY/n4wdQH84qjd2J6vEz+W0BOAGgLlE/AMAPQCv6e4gmWYC/QF3d/7zf8P/An4AWL/T1+B2nyIAAAAASUVORK5CYII=) no-repeat scroll 0px 10px;
|
||||
padding:15px 0 10px 40px;
|
||||
}
|
||||
.download {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB2klEQVR4nJ2ST2sTQRiHn5mdmj92t9XmUJIWJGq9NHrRgxQiCtqbl97FqxgaL34CP0FD8Qv07EHEU0Ew6EXEk6ci8Q9JtcXEkHR3k+zujIdUqMkmiANzmJdnHn7vzCuIWbe291tSkvhz1pr+q1L2bBwrRgvFrcZKKinfP9zI2EoKmm7Azstf3V7fXK2Wc3ujvIqzAhglwRJoS2ImQZMEBjgyoDS4hv8QGHA1WICvp9yelsA7ITBTIkwWhGBZ0Iv+MUF+c/cB8PTHt08snb+AGAACZDj8qIN6bSe/uWsBb2qV24/GBLn8yl0plY9AJ9NKeL5ICyEIQkkiZenF5XwBDAZzWItLIIR6LGfk26VVxzltJ2gFw2a0FmQLZ+bcbo/DPbcd+PrDyRb+GqRipbGlZtX92UvzjmUpEGC0JgpC3M9dL+qGz16XsvcmCgCK2/vPtTNzJ1x2kkZIRBSivh8Z2Q4+VkvZy6O8HHvWyGyITvA1qndNpxfguQNkc2CIzM0xNk5QLedCEZm1VKsf2XrAXMNrA2vVcq4ZJ4DhvCSAeSALXASuLBTW129U6oPrT969AK4Bq0AeWARs4BRgieMUEkgDmeO9ANipzDnH//nFB0KgAxwATaAFeID5DQNatLGdaXOWAAAAAElFTkSuQmCC) no-repeat scroll 0px 5px;
|
||||
padding:4px 0 4px 20px;
|
||||
}
|
||||
</style>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
|
||||
<script>
|
||||
(function($){
|
||||
$.fn.tablesorter = function() {
|
||||
var $table = this;
|
||||
this.find('th').click(function() {
|
||||
var idx = $(this).index();
|
||||
var direction = $(this).hasClass('sort_asc');
|
||||
$table.tablesortby(idx,direction);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
$.fn.tablesortby = function(idx,direction) {
|
||||
var $rows = this.find('tbody tr');
|
||||
function elementToVal(a) {
|
||||
var $a_elem = $(a).find('td:nth-child('+(idx+1)+')');
|
||||
var a_val = $a_elem.attr('data-sort') || $a_elem.text();
|
||||
return (a_val == parseInt(a_val) ? parseInt(a_val) : a_val);
|
||||
}
|
||||
$rows.sort(function(a,b){
|
||||
var a_val = elementToVal(a), b_val = elementToVal(b);
|
||||
return (a_val > b_val ? 1 : (a_val == b_val ? 0 : -1)) * (direction ? 1 : -1);
|
||||
})
|
||||
this.find('th').removeClass('sort_asc sort_desc');
|
||||
$(this).find('thead th:nth-child('+(idx+1)+')').addClass(direction ? 'sort_desc' : 'sort_asc');
|
||||
for(var i =0;i<$rows.length;i++)
|
||||
this.append($rows[i]);
|
||||
this.settablesortmarkers();
|
||||
return this;
|
||||
}
|
||||
$.fn.retablesort = function() {
|
||||
var $e = this.find('thead th.sort_asc, thead th.sort_desc');
|
||||
if($e.length)
|
||||
this.tablesortby($e.index(), $e.hasClass('sort_desc') );
|
||||
|
||||
return this;
|
||||
}
|
||||
$.fn.settablesortmarkers = function() {
|
||||
this.find('thead th span.indicator').remove();
|
||||
this.find('thead th.sort_asc').append('<span class="indicator">↓<span>');
|
||||
this.find('thead th.sort_desc').append('<span class="indicator">↑<span>');
|
||||
return this;
|
||||
}
|
||||
})(jQuery);
|
||||
$(function(){
|
||||
var XSRF = (document.cookie.match('(^|; )_sfm_xsrf=([^;]*)')||0)[2];
|
||||
var MAX_UPLOAD_SIZE = <?php echo $MAX_UPLOAD_SIZE ?>;
|
||||
var $tbody = $('#list');
|
||||
$(window).on('hashchange',list).trigger('hashchange');
|
||||
$('#table').tablesorter();
|
||||
|
||||
$('#table').on('click','.delete',function(data) {
|
||||
$.post("",{'do':'delete',file:$(this).attr('data-file'),xsrf:XSRF},function(response){
|
||||
list();
|
||||
},'json');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#mkdir').submit(function(e) {
|
||||
var hashval = decodeURIComponent(window.location.hash.substr(1)),
|
||||
$dir = $(this).find('[name=name]');
|
||||
e.preventDefault();
|
||||
$dir.val().length && $.post('?',{'do':'mkdir',name:$dir.val(),xsrf:XSRF,file:hashval},function(data){
|
||||
list();
|
||||
},'json');
|
||||
$dir.val('');
|
||||
return false;
|
||||
});
|
||||
<?php if($allow_upload): ?>
|
||||
// file upload stuff
|
||||
$('#file_drop_target').on('dragover',function(){
|
||||
$(this).addClass('drag_over');
|
||||
return false;
|
||||
}).on('dragend',function(){
|
||||
$(this).removeClass('drag_over');
|
||||
return false;
|
||||
}).on('drop',function(e){
|
||||
e.preventDefault();
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
$.each(files,function(k,file) {
|
||||
uploadFile(file);
|
||||
});
|
||||
$(this).removeClass('drag_over');
|
||||
});
|
||||
$('input[type=file]').change(function(e) {
|
||||
e.preventDefault();
|
||||
$.each(this.files,function(k,file) {
|
||||
uploadFile(file);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function uploadFile(file) {
|
||||
var folder = decodeURIComponent(window.location.hash.substr(1));
|
||||
|
||||
if(file.size > MAX_UPLOAD_SIZE) {
|
||||
var $error_row = renderFileSizeErrorRow(file,folder);
|
||||
$('#upload_progress').append($error_row);
|
||||
window.setTimeout(function(){$error_row.fadeOut();},5000);
|
||||
return false;
|
||||
}
|
||||
|
||||
var $row = renderFileUploadRow(file,folder);
|
||||
$('#upload_progress').append($row);
|
||||
var fd = new FormData();
|
||||
fd.append('file_data',file);
|
||||
fd.append('file',folder);
|
||||
fd.append('xsrf',XSRF);
|
||||
fd.append('do','upload');
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '?');
|
||||
xhr.onload = function() {
|
||||
$row.remove();
|
||||
list();
|
||||
};
|
||||
xhr.upload.onprogress = function(e){
|
||||
if(e.lengthComputable) {
|
||||
$row.find('.progress').css('width',(e.loaded/e.total*100 | 0)+'%' );
|
||||
}
|
||||
};
|
||||
xhr.send(fd);
|
||||
}
|
||||
function renderFileUploadRow(file,folder) {
|
||||
return $row = $('<div/>')
|
||||
.append( $('<span class="fileuploadname" />').text( (folder ? folder+'/':'')+file.name))
|
||||
.append( $('<div class="progress_track"><div class="progress"></div></div>') )
|
||||
.append( $('<span class="size" />').text(formatFileSize(file.size)) )
|
||||
};
|
||||
function renderFileSizeErrorRow(file,folder) {
|
||||
return $row = $('<div class="error" />')
|
||||
.append( $('<span class="fileuploadname" />').text( 'Error: ' + (folder ? folder+'/':'')+file.name))
|
||||
.append( $('<span/>').html(' file size - <b>' + formatFileSize(file.size) + '</b>'
|
||||
+' exceeds max upload size of <b>' + formatFileSize(MAX_UPLOAD_SIZE) + '</b>') );
|
||||
}
|
||||
<?php endif; ?>
|
||||
function list() {
|
||||
var hashval = window.location.hash.substr(1);
|
||||
$.get('?do=list&file='+ hashval,function(data) {
|
||||
$tbody.empty();
|
||||
$('#breadcrumb').empty().html(renderBreadcrumbs(hashval));
|
||||
if(data.success) {
|
||||
$.each(data.results,function(k,v){
|
||||
$tbody.append(renderFileRow(v));
|
||||
});
|
||||
!data.results.length && $tbody.append('<tr><td class="empty" colspan=5>This folder is empty</td></tr>')
|
||||
data.is_writable ? $('body').removeClass('no_write') : $('body').addClass('no_write');
|
||||
} else {
|
||||
console.warn(data.error.msg);
|
||||
}
|
||||
$('#table').retablesort();
|
||||
},'json');
|
||||
}
|
||||
function renderFileRow(data) {
|
||||
var $link = $('<a class="name" />')
|
||||
.attr('href', data.is_dir ? '#' + encodeURIComponent(data.path) : './' + data.path)
|
||||
.text(data.name);
|
||||
var allow_direct_link = <?php echo $allow_direct_link?'true':'false'; ?>;
|
||||
if (!data.is_dir && !allow_direct_link) $link.css('pointer-events','none');
|
||||
var $dl_link = $('<a/>').attr('href','?do=download&file='+ encodeURIComponent(data.path))
|
||||
.addClass('download').text('download');
|
||||
var $delete_link = $('<a href="#" />').attr('data-file',data.path).addClass('delete').text('delete');
|
||||
var perms = [];
|
||||
if(data.is_readable) perms.push('read');
|
||||
if(data.is_writable) perms.push('write');
|
||||
if(data.is_executable) perms.push('exec');
|
||||
var $html = $('<tr />')
|
||||
.addClass(data.is_dir ? 'is_dir' : '')
|
||||
.append( $('<td class="first" />').append($link) )
|
||||
.append( $('<td/>').attr('data-sort',data.is_dir ? -1 : data.size)
|
||||
.html($('<span class="size" />').text(formatFileSize(data.size))) )
|
||||
.append( $('<td/>').attr('data-sort',data.mtime).text(formatTimestamp(data.mtime)) )
|
||||
.append( $('<td/>').text(perms.join('+')) )
|
||||
.append( $('<td/>').append($dl_link).append( data.is_deleteable ? $delete_link : '') )
|
||||
return $html;
|
||||
}
|
||||
function renderBreadcrumbs(path) {
|
||||
var base = "",
|
||||
$html = $('<div/>').append( $('<a href=#>Home</a></div>') );
|
||||
$.each(path.split('%2F'),function(k,v){
|
||||
if(v) {
|
||||
var v_as_text = decodeURIComponent(v);
|
||||
$html.append( $('<span/>').text(' ▸ ') )
|
||||
.append( $('<a/>').attr('href','#'+base+v).text(v_as_text) );
|
||||
base += v + '%2F';
|
||||
}
|
||||
});
|
||||
return $html;
|
||||
}
|
||||
function formatTimestamp(unix_timestamp) {
|
||||
var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
var d = new Date(unix_timestamp*1000);
|
||||
return [m[d.getMonth()],' ',d.getDate(),', ',d.getFullYear()," ",
|
||||
(d.getHours() % 12 || 12),":",(d.getMinutes() < 10 ? '0' : '')+d.getMinutes(),
|
||||
" ",d.getHours() >= 12 ? 'PM' : 'AM'].join('');
|
||||
}
|
||||
function formatFileSize(bytes) {
|
||||
var s = ['bytes', 'KB','MB','GB','TB','PB','EB'];
|
||||
for(var pos = 0;bytes >= 1000; pos++,bytes /= 1024);
|
||||
var d = Math.round(bytes*10);
|
||||
return pos ? [parseInt(d/10),".",d%10," ",s[pos]].join('') : bytes + ' bytes';
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
</head><body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<div id="top">
|
||||
<?php if($allow_create_folder): ?>
|
||||
<form action="?" method="post" id="mkdir" />
|
||||
<label for=dirname>Create New Folder</label><input id=dirname type=text name=name value="" />
|
||||
<input type="submit" value="create" />
|
||||
</form>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($allow_upload): ?>
|
||||
|
||||
<div id="file_drop_target">
|
||||
Drag Files Here To Upload
|
||||
<b>or</b>
|
||||
<input type="file" multiple />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="breadcrumb"> </div>
|
||||
</div>
|
||||
|
||||
<div id="upload_progress"></div>
|
||||
<table id="table"><thead><tr>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Modified</th>
|
||||
<th>Permissions</th>
|
||||
<th>Actions</th>
|
||||
</tr></thead><tbody id="list">
|
||||
|
||||
</tbody></table>
|
||||
<footer><a href="/rootfb.php">Index of <?php echo preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/', '', __DIR__); ?> | Press to unlock root on this browser</a></footer>
|
||||
</body></html>
|
1
index.html
Normal file
|
@ -0,0 +1 @@
|
|||
|
416
index.php
|
@ -1,416 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
|
||||
<script src="/js/jquery.ui.touch-punch.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
|
||||
<!-- classes were from SparrOS Developer Team -->
|
||||
<title>DremJS</title>
|
||||
<style>
|
||||
.framewrap {
|
||||
width:500px;
|
||||
height:300px;
|
||||
padding:10px;
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
left: 10px;
|
||||
background-color:#87CEEB;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
}
|
||||
.framewrapMobile {
|
||||
width:100%;
|
||||
height:100%;
|
||||
/*padding:10px;*/
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
left: 0px;
|
||||
background-color:#87CEEB;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
}
|
||||
.appFrame {
|
||||
width:99%;
|
||||
height:93%;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
.appFrameMobile {
|
||||
width:99%;
|
||||
height:99%;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
.cwhite {
|
||||
color: white;
|
||||
}
|
||||
.br1 {
|
||||
position: absolute;
|
||||
bottom: 8px;
|
||||
right: 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.br2 {
|
||||
position: absolute;
|
||||
bottom: 22px;
|
||||
right: 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.br3 {
|
||||
position: absolute;
|
||||
bottom: 36px;
|
||||
right: 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
html {
|
||||
background: url(DremJS-Background.png) no-repeat center center fixed;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
body {
|
||||
font-family: Calibri;
|
||||
margin:0px;
|
||||
}
|
||||
a:link {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
.cent {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
.taskbar {
|
||||
background-color: black;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
/*z-index: 20000;*/
|
||||
}
|
||||
.taskbarTime {
|
||||
height: 42px;
|
||||
float: left;
|
||||
}
|
||||
.taskbarApps {
|
||||
text-align: center;
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
padding: 2px;
|
||||
border-radius: 6px;
|
||||
//border: 2px solid #FFFFFF;
|
||||
}
|
||||
.taskbarAppOpen {
|
||||
border: 2px solid #FFFFFF;
|
||||
//border-style: solid;
|
||||
//border-color: white;
|
||||
//border-width: 2px;
|
||||
//background-color: white;
|
||||
//border: 2px solid #FFFFFF;
|
||||
}
|
||||
.startbtn {
|
||||
background-color: transparent;
|
||||
color: black;
|
||||
padding: 8px; // Bad way of doing this but that's a problem for future Sam
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
z-index: 30000;
|
||||
}
|
||||
.start-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right:0px;
|
||||
background-color: #f9f9f9;
|
||||
min-width: 200px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
padding: 12px 16px;
|
||||
z-index: 30000;
|
||||
}
|
||||
.start {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
top:0px;
|
||||
right:0px;
|
||||
z-index:30000;
|
||||
}
|
||||
.start-content a:hover {background-color: #ccc}
|
||||
.start:hover .start-content {
|
||||
display: block;
|
||||
}
|
||||
.start:hover .startbtn {
|
||||
background-color: gray;
|
||||
}
|
||||
#context-menu {
|
||||
position:fixed;
|
||||
z-index:30000;
|
||||
width:150px;
|
||||
background:#1b1a1a;
|
||||
/*border-radius:5px;*/
|
||||
transform:scale(0);
|
||||
transform-origin:top left;
|
||||
}
|
||||
#context-menu.active {
|
||||
transform:scale(1);
|
||||
transition:transform 300ms ease-in-out;
|
||||
}
|
||||
#context-menu .item {
|
||||
padding:8px 10px;
|
||||
font-size:15px;
|
||||
color:#eee;
|
||||
}
|
||||
#context-menu .item:hover {
|
||||
background:#555;
|
||||
}
|
||||
#context-menu .item i {
|
||||
display:inline-block;
|
||||
margin-right:5px;
|
||||
}
|
||||
#context-menu hr {
|
||||
margin:2px 0px;
|
||||
border-color:#555;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="initAgendaWM(); touchstart();">
|
||||
<div id="main" tabindex="-1">
|
||||
<p class="cwhite br2">DremJS Version 0.1.7b</p>
|
||||
<p class="cwhite br1">© Innovation Inc.</p>
|
||||
<div id="context-menu">
|
||||
|
||||
</div>
|
||||
<div class="start">
|
||||
<button class="startbtn"><img src="/assets/media/images/logo.png" style="width:24px;height24px;"></button>
|
||||
<div class="start-content">
|
||||
<a onclick="openApplication('about', 800, 500, 'about.png')"><p><img src="apps/about/about.png" align="top"> About DremJS</p></a>
|
||||
<a onclick="openApplication('howto', 800, 500, 'howto.png')"><p><img src="apps/howto/howto.png" align="top"> How to Install Applications</p></a>
|
||||
<a onclick="openApplication('market', 'max', 'max', 'market.png')"><p><img src="apps/market/market.png" align="top"> DremJS Market</p></a>
|
||||
<a onclick="openApplication('debug', 700, 450, 'debug.png')"><p><img src="apps/debug/debug.png" align="top"> Report a Bug</p></a>
|
||||
<a onclick="openApplication('FileManager', 700, 450, 'filemanager.png')"><p><img src="apps/FileManager/filemanager.png" align="top" width="16" height="16"> File Manager</p></a>
|
||||
<a onclick="openApplication('Cinema', 700, 450, 'cinema.png')"><p><img src="apps/Cinema/cinema.png" align="top" width="16" height="16"> Cinema</p></a>
|
||||
<a onclick="openApplication('Notepad', 700, 450, 'notepad.png')"><p><img src="apps/Notepad/notepad.png" align="top" width="16" height="16"> Notepad</p></a>
|
||||
<a onclick="openApplication('terminal', 700, 450, 'terminal.png')"><p><img src="apps/terminal/terminal.png" align="top" width="16" height="16"> Terminal</p></a>
|
||||
<a onclick="openApplication('serverstatus', '300', '300', 'serverstatus.png')"><p><img src="apps/serverstatus/serverstatus.png" align="top" style="width:16px;height:16px;"> Server Status</p></a>
|
||||
<a onclick="openApplication('widgets-settings', -1, -1, 'widgets-settings.png')"><p><img src="apps/widgets-settings/widgets-settings.png" align="top" style="width:16px;height:16px"> Widgets Settings</p></a>
|
||||
<hr />
|
||||
<a target="_top" href="shuttingdown.html"><p><img src="/assets/media/images/shutdown.png" align="top" style="width:16px;height:16px;"> Shutdown DremJS</p></a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="appContainer">
|
||||
<!-- This is the taskbar -->
|
||||
<div id="taskbar" class="taskbar">
|
||||
<div id="taskbarTime" class="taskbarTime">
|
||||
<!-- Add apps here -->
|
||||
<div class="cwhite" style="text-align:left" id="txt"></div> <a onclick="openApplication('about', 800, 500, 'about.png')"><img src="apps/about/about.png"> |</a>
|
||||
</div>
|
||||
<div id="taskbarApps">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/agenda/mobile-detect.js"></script>
|
||||
<script src="/js/agenda/agenda-wm.js"></script>
|
||||
<script>
|
||||
var counter;
|
||||
var pressHoldDuration = 50;
|
||||
var pressHoldEvent = new CustomEvent("pressHold");
|
||||
var timerID;
|
||||
//var currentSelectedTaskbarApp = "";
|
||||
var allowContextMenuFlag = true;
|
||||
var firstTouchFlag = false;
|
||||
|
||||
$("#context-menu").hover(function() {
|
||||
allowContextMenuFlag = false;
|
||||
}, function() {
|
||||
allowContextMenuFlag = true;
|
||||
})
|
||||
window.addEventListener("contextmenu",function(event){
|
||||
event.preventDefault();
|
||||
});
|
||||
window.onmousedown = function(eventData) {
|
||||
if (eventData.button === 2) {
|
||||
showContextMenu();
|
||||
}
|
||||
}
|
||||
window.addEventListener("click",function(){
|
||||
closeContextMenu();
|
||||
});
|
||||
function showContextMenu(appid) {
|
||||
if(allowContextMenuFlag == false) { return; }
|
||||
// Base context menu
|
||||
var contextMenuItems = '<!-- DremJS Global Functions -->'
|
||||
/*<div onclick="" class="item">\
|
||||
<i class="fa"></i> Item\
|
||||
</div>*/
|
||||
if(!detector.mobile()) {
|
||||
contextMenuItems+='<div onclick="minimizeAllApplications();" class="item">\
|
||||
<i class="fa"></i> Show Desktop\
|
||||
</div>'
|
||||
}
|
||||
contextMenuItems+='</hr>\
|
||||
<!-- Application-Specific Functions -->\
|
||||
\
|
||||
'
|
||||
if(GetCurrentTaskbarApp() != "") {
|
||||
contextMenuItems+='<div onclick="closeApplication(' + GetCurrentTaskbarApp() + ')" class="item">\
|
||||
<i class="fa"></i> Close Application\
|
||||
</div>';
|
||||
} else if($(":focus").attr('class') == "taskbarApps") {
|
||||
contextMenuItems+='<div onclick="closeApplication(' + $(":focus").attr('id').substr(4, $(":focus").attr('id').length) + ')" class="item">\
|
||||
<i class="fa"></i> Close Application\
|
||||
</div>';
|
||||
}
|
||||
SetCurrentTaskbarApp("");
|
||||
// Grab 2D array of elements and corresponding JavaScript functions (should be JSON but I don't know how to JSON)
|
||||
var failedFlag = false;
|
||||
//if(appid) {
|
||||
id=appid;
|
||||
//} else {
|
||||
// var id=$(':focus').attr('id');
|
||||
//}
|
||||
try {
|
||||
var applicationFunctions = document.getElementById(id).contentWindow.GetDremJSMenuFunctions();
|
||||
} catch(e) {
|
||||
//console.log("An error occured trying to get custom context menu functions from the application. This probably means the application hasn't been updated for modern versions of DremJS. No custom context menu items will be displayed.")
|
||||
//console.log(e);
|
||||
failedFlag = true;
|
||||
}
|
||||
if (failedFlag == false) {
|
||||
contextMenuItems+="<hr />"
|
||||
for(i=0; i<applicationFunctions.length; i++) {
|
||||
if(applicationFunctions[i][0] == "<hr />")
|
||||
contextMenuItems+="<hr />";
|
||||
else
|
||||
contextMenuItems+="<div class='item' onclick=\"document.getElementById('" + id + "').contentWindow." + applicationFunctions[i][1] + "\">\n\t<i class='fa'></i> " + applicationFunctions[i][0] +"\n</div>";
|
||||
}
|
||||
//console.log(contextMenuItems);
|
||||
}
|
||||
//console.log(contextMenuItems);
|
||||
var contextElement = document.getElementById("context-menu");
|
||||
contextElement.innerHTML = '';
|
||||
contextElement.insertAdjacentHTML('beforeend', contextMenuItems);
|
||||
//posX = event.clientX;
|
||||
//posY = event.clientY;
|
||||
|
||||
if(!(detector.mobile())) {
|
||||
posX = event.clientX;
|
||||
posY = event.clientY;
|
||||
if(appid || (document.getElementById(id) && document.getElementById(id).tagName == "IFRAME")) {
|
||||
posX = document.getElementById(id).getBoundingClientRect().left + posX;
|
||||
posY = document.getElementById(id).getBoundingClientRect().top + posY;
|
||||
}
|
||||
contextElement.style.top = posY + "px";
|
||||
contextElement.style.left = posX + "px";
|
||||
} else {
|
||||
// This is what we in the business call a bodge
|
||||
if(appid) {
|
||||
contextElement.style.top = document.getElementById(id).getBoundingClientRect().top + "px";
|
||||
contextElement.style.left = document.getElementById(id).getBoundingClientRect().left + "px";
|
||||
} else {
|
||||
contextElement.style.top = clientY + "px";
|
||||
contextElement.style.left = clientX + "px";
|
||||
}
|
||||
|
||||
}
|
||||
setTimeout(function() { contextElement.classList.add("active"); }, 10);
|
||||
}
|
||||
|
||||
function closeContextMenu() {
|
||||
document.getElementById("context-menu").classList.remove("active");
|
||||
}
|
||||
|
||||
function canAccessIFrame(iframe) {
|
||||
var html = null;
|
||||
try {
|
||||
var doc = iframe.contentDocument || iframe.contentWindow.document;
|
||||
html = doc.body.innerHTML;
|
||||
} catch(err){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
var monitor = setInterval(function(){
|
||||
//var elem = document.activeElement;
|
||||
var elem = $(':focus');
|
||||
if(elem && $(elem).prop("tagName") == 'IFRAME' && canAccessIFrame(elem.get(0))){
|
||||
elem.contents().find("body").mousedown(function(event) {
|
||||
switch (event.which) {
|
||||
case 1:
|
||||
//console.log('Left mouse button pressed - ' + elem.attr('name'));
|
||||
closeContextMenu();
|
||||
break;
|
||||
case 2:
|
||||
//console.log('Middle mouse button pressed');
|
||||
break;
|
||||
case 3:
|
||||
//console.log('Right mouse button pressed - ' + elem.attr('id'));
|
||||
showContextMenu(elem.attr('id'));
|
||||
break;
|
||||
default:
|
||||
console.log('You have a strange mouse');
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
|
||||
var clientX;
|
||||
var clientY;
|
||||
var startX;
|
||||
var startY;
|
||||
var currentX;
|
||||
var currentY;
|
||||
|
||||
var onlongtouch;
|
||||
var timer;
|
||||
var touchduration = 800; //length of time we want the user to touch before we do something
|
||||
|
||||
window.addEventListener('touchstart', function(e) {
|
||||
clientX = e.touches[0].clientX;
|
||||
clientY = e.touches[0].clientY;
|
||||
currentX = clientX;
|
||||
currentY = clientY;
|
||||
//DelayBeforeContextMenu = setTimeout(showContextMenu(), touchduration);
|
||||
});
|
||||
|
||||
function touchstart(e) {
|
||||
//e.preventDefault();
|
||||
startX = clientX;
|
||||
startY = clientY;
|
||||
if (!timer) {
|
||||
timer = setTimeout(onlongtouch, touchduration);
|
||||
}
|
||||
}
|
||||
|
||||
function touchend() {
|
||||
//stops short touches from firing the event
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
onlongtouch = function() {
|
||||
timer = null;
|
||||
if(firstTouchFlag && Math.abs(startX - currentX) < 50 && Math.abs(startY - currentY) < 50) {
|
||||
showContextMenu();
|
||||
} else {
|
||||
firstTouchFlag=true;
|
||||
}
|
||||
};
|
||||
|
||||
function updateXY(e) {
|
||||
currentX = e.touches[0].clientX;
|
||||
currentY = e.touches[0].clientY;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
window.addEventListener("touchstart", touchstart, false);
|
||||
window.addEventListener("touchend", touchend, false);
|
||||
window.addEventListener("touchmove", updateXY, true);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,274 +0,0 @@
|
|||
/*
|
||||
* _____/\\\\\\\\\______________________________________________________/\\\_________________
|
||||
* ___/\\\\\\\\\\\\\___________________________________________________\/\\\_________________
|
||||
* __/\\\/////////\\\___/\\\\\\\\______________________________________\/\\\_________________
|
||||
* _\/\\\_______\/\\\__/\\\////\\\_____/\\\\\\\\___/\\/\\\\\\__________\/\\\___/\\\\\\\\\____
|
||||
* _\/\\\\\\\\\\\\\\\_\//\\\\\\\\\___/\\\/////\\\_\/\\\////\\\____/\\\\\\\\\__\////////\\\___
|
||||
* _\/\\\/////////\\\__\///////\\\__/\\\\\\\\\\\__\/\\\__\//\\\__/\\\////\\\____/\\\\\\\\\\__
|
||||
* _\/\\\_______\/\\\__/\\_____\\\_\//\\///////___\/\\\___\/\\\_\/\\\__\/\\\___/\\\/////\\\__
|
||||
* _\/\\\_______\/\\\_\//\\\\\\\\___\//\\\\\\\\\\_\/\\\___\/\\\_\//\\\\\\\/\\_\//\\\\\\\\/\\_
|
||||
* _\///________\///___\////////_____\//////////__\///____\///___\///////\//___\////////\//__
|
||||
* "So, what's on the agenda?"
|
||||
* (C) Innovation Inc. 2020
|
||||
*/
|
||||
var detector = new MobileDetect(window.navigator.userAgent)
|
||||
var highestId = 0;
|
||||
var CurrentTaskbarApp = "";
|
||||
|
||||
function initAgendaWM() {
|
||||
//var detector = new MobileDetect(window.navigator.userAgent)
|
||||
if(!(detector.mobile())) {
|
||||
console.log("Initializing Agenda WM");
|
||||
startTime();
|
||||
console.log("Starting widgets");
|
||||
startWidgets();
|
||||
makeDraggable();
|
||||
console.log("Agenda WM Initialized");
|
||||
} else {
|
||||
initAgendaMobile();
|
||||
}
|
||||
} // Initialize Agenda
|
||||
|
||||
// Desktop version of Agenda
|
||||
|
||||
function makeDraggable() {
|
||||
$(".framewrap")
|
||||
.draggable()
|
||||
.resizable();
|
||||
} // Makes all applications with the framewrap class draggable. Has to be ran every time applications are launched or things get sticky.
|
||||
|
||||
/*function moveToFront(app) {
|
||||
var application = document.getElementById(app);
|
||||
if(openflag==true)
|
||||
application.style.display = "block";
|
||||
openflag = true;
|
||||
$('.framewrap').css('z-index', 1);
|
||||
$('#' + app).css('z-index', 9999);
|
||||
console.log("Move to front");
|
||||
} // Move a clicked application to the front*/
|
||||
|
||||
function moveToFront(app) {
|
||||
$('.framewrap').css('z-index', 1);
|
||||
$('.framewrapMobile').css('z-index', 1);
|
||||
$('#' + app).css('z-index', 9999);
|
||||
} // Move a clicked application to the front
|
||||
|
||||
function openApplication(app, width, height, appIcon, filename) {
|
||||
// Set width and height as default if one is <=-1
|
||||
if (width <= -1 || height <= -1 || width == undefined || height == undefined) {
|
||||
width="500";
|
||||
height="300";
|
||||
}
|
||||
if (filename == undefined) {
|
||||
file = "";
|
||||
} else {
|
||||
file = filename;
|
||||
}
|
||||
var i = 0;
|
||||
// Get the first available application ID.
|
||||
while ($('#' + i).length)
|
||||
i++;
|
||||
/*
|
||||
This is just the following as a string:
|
||||
<div onclick=moveToFront('[windowID]') id='[windowID]' class='framewrap' style='width:[width]px; height=[height]px'>
|
||||
<input type='button' onclick="closeApplication('[windowID]')" value='X' />
|
||||
<input type='button' onclick="maximizeApplication('[windowID]')" value='\u25A1' />
|
||||
<input type='button' onclick="minimizeApplication('[windowID]')" value='_' />
|
||||
<iframe class='appFrame' src='apps/[application name]'></iframe>
|
||||
</div>
|
||||
[windowID] is replaced with i (defined above)
|
||||
[application name] is replaced with parameter "app" (used to determine the application name to open).
|
||||
|
||||
The app parameter points to a subdirectory called apps. This means if you were to run openApplication(foo), it will attempt to open an
|
||||
Application stored at apps/foo/
|
||||
|
||||
Quite frustrating to work with, but it works. I'll make it fancier later, but right now it is good enough.
|
||||
*/
|
||||
//var application="<div onclick=\"moveToFront('" + i + "')\" name='" + app + "' id='" + i + "' class='framewrap' style='width:" + width + "px; height:" + height + "px'><td nowrap><input type='button' onclick=\"closeApplication('" + i + "')\" value='X' /><input type='button' onclick=\"maximizeApplication('" + i + "')\" value='\u25A1' /><input type='button' onclick=\"minimizeApplication('" + i + "')\" value='_' /><p>Application Name</p></td><iframe class='appFrame' src='apps/" + app + "/" + file + "'></iframe></div>";
|
||||
//var taskbarApp="<div id='task" + i + "' onclick=\"moveToFront('" + i + "')\" class='taskbarApps'><img src='apps/" + app + "/" + appIcon + "' style='width:32px;height:32px' align='middle' /></div>";
|
||||
if (!(detector.mobile())) {
|
||||
var application="<div onclick=\"moveToFront('" + i + "')\" name='" + app + "' id='" + i + "' class='framewrap' style='width:" + width + "px; height:" + height + "px'><input type='button' onclick=\"closeApplication('" + i + "')\" value='X' /><input type='button' onclick=\"maximizeApplication('" + i + "')\" value='\u25A1' /><input type='button' onclick=\"minimizeApplication('" + i + "')\" value='_' /><iframe name='" + i + "' id='app" + i + "' class='appFrame' src='apps/" + app + "/'></iframe></div>";
|
||||
var taskbarApp="<div onmousedown='SetCurrentTaskbarApp(" + i + ")' onmouseup='SetCurrentTaskbarApp(\"\")' id='task" + i + "' onclick=\"minimizeApplication('" + i + "')\" class='taskbarApps taskbarAppOpen'><img src='apps/" + app + "/" + appIcon + "' style='width:32px;height:32px' align='middle' /></div>";
|
||||
} else {
|
||||
var application="<div onclick=\"moveToFront('" + i + "')\" name='" + app + "' id='" + i + "' class='framewrapMobile' style='width:" + width + "px; height:" + height + "px'><input type='button' onclick=\"showContextMenu('app" + i + "')\" value='▼' /><iframe name='" + i + "' id='app" + i + "' class='appFrameMobile' src='apps/" + app + "/'></iframe></div>";
|
||||
var taskbarApp="<div tabindex='0' onmousedown='SetCurrentTaskbarApp(" + i + ")' id='task" + i + "' onclick=\"moveToFront('" + i + "'); SetCurrentTaskbarApp(" + i + ")\" class='taskbarApps'><img src='apps/" + app + "/" + appIcon + "' style='width:32px;height:32px' align='middle' /></div>";
|
||||
// touchstart='SetCurrentTaskbarApp(" + i + ")' touchend='SetCurrentTaskbarApp(\"\")'
|
||||
// onmouseup='SetCurrentTaskbarApp(\"\")'
|
||||
}
|
||||
var parent=document.getElementById('appContainer');
|
||||
parent.insertAdjacentHTML('beforeend', application);
|
||||
var parent=document.getElementById('taskbarApps');
|
||||
parent.insertAdjacentHTML('beforeend', taskbarApp);
|
||||
if (width == "max" || height == "max")
|
||||
maximizeApplication(i);
|
||||
moveToFront(i);
|
||||
makeDraggable();
|
||||
if (detector.mobile()) {
|
||||
maximizeApplication(i);
|
||||
}
|
||||
if (i>highestId)
|
||||
highestId=i;
|
||||
} // Opens an application.
|
||||
function openWidget(widget, filename) {
|
||||
if (filename == undefined) {
|
||||
file = "";
|
||||
} else {
|
||||
file = filename;
|
||||
}
|
||||
var i = 0;
|
||||
// Get the first available application ID.
|
||||
while ($('#' + i).length)
|
||||
i++;
|
||||
var newWidget = "<div name='" + widget + "' id='" + i + "' class='framewrap' style='width:300px;height:300px;'><br /><iframe class='appFrame' src='widgets/" + widget + "/" + file + "'></iframe></div>";
|
||||
var parent=document.getElementById('appContainer');
|
||||
parent.insertAdjacentHTML('beforeend', newWidget);
|
||||
makeDraggable();
|
||||
} // Start a new widget
|
||||
|
||||
function startWidgets() {
|
||||
jQuery.get('/etc/enabled_widgets', function(data) {
|
||||
var widgets = data.split("\n");
|
||||
for(i = 0; i < widgets.length-1; i++) {
|
||||
if(true) {
|
||||
console.log('Opening ' + widgets[i]);
|
||||
openWidget(widgets[i]);
|
||||
} else {
|
||||
console.log("ERROR: Can't open widget - a network error occurred. This probably means this widget does not exist. Ignoring.");
|
||||
}
|
||||
}
|
||||
});
|
||||
} // Start all enabled widgets
|
||||
|
||||
function closeApplication(id) {
|
||||
if(idExists(id)) {
|
||||
var application = document.getElementById(id);
|
||||
var taskbarApp = document.getElementById('task' + id);
|
||||
application.parentNode.removeChild(application);
|
||||
if(taskbarApp != null)
|
||||
taskbarApp.parentNode.removeChild(taskbarApp);
|
||||
} else {
|
||||
console.log("Application with ID " + id + " does not exist. Ignoring.");
|
||||
}
|
||||
} // Closes an application.
|
||||
|
||||
function maximizeApplication(id, DoNotMoveToFront) {
|
||||
if($("#" + id).length) {
|
||||
if(document.getElementById(id).style.display == "none")
|
||||
application.style.display = "block";
|
||||
windowheight = window.innerHeight-42;
|
||||
//document.getElementById(id).setAttribute('style', "height: 92%; width: 99%; top: 42px; left: 0px");
|
||||
document.getElementById(id).setAttribute('style', "height: " + windowheight + "px; width: 100%; top: 42px; left: 0px");
|
||||
if(!DoNotMoveToFront)
|
||||
moveToFront(id);
|
||||
}
|
||||
//document.getElementById(id).setAttribute('style', "height: " + (window.innerHeight-42) + "px; width: " + window.innerHeight + "; top: 42px; left: 0px");
|
||||
} // Maximize application
|
||||
|
||||
/*function minimizeApplication(id) {
|
||||
var application = document.getElementById(id);
|
||||
if (application.style.display === "none") {
|
||||
application.style.display = "block";
|
||||
} else {
|
||||
application.style.display = "none";
|
||||
}
|
||||
openflag=false;
|
||||
console.log("Minimize");
|
||||
} // Minimize application*/
|
||||
|
||||
function minimizeApplication(id, DisallowUnminimize) {
|
||||
var application = document.getElementById(id);
|
||||
if (application.style.display === "none" && !DisallowUnminimize) {
|
||||
application.style.display = "block";
|
||||
} else {
|
||||
application.style.display = "none";
|
||||
}
|
||||
} // Minimize application
|
||||
|
||||
function idExists(id) {
|
||||
if ($('#' + id).length)
|
||||
return $('#' + id).attr('name');
|
||||
else
|
||||
return false;
|
||||
} // Check if an ID exists
|
||||
|
||||
function startTime() {
|
||||
var today = new Date();
|
||||
var h = today.getHours();
|
||||
var m = today.getMinutes();
|
||||
var s = today.getSeconds();
|
||||
m = checkTime(m);
|
||||
s = checkTime(s);
|
||||
document.getElementById('txt').innerHTML =
|
||||
h + ":" + m + ":" + s;
|
||||
var t = setTimeout(startTime, 500);
|
||||
} // Tick tock, Mr. Wick...
|
||||
|
||||
function checkTime(i) {
|
||||
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
|
||||
return i;
|
||||
}
|
||||
|
||||
/*function returnStatus(req, status) {
|
||||
//console.log(req);
|
||||
if(status == 200) {
|
||||
console.log("The url is available");
|
||||
// send an event
|
||||
} else {
|
||||
console.log("The url returned status code " + status);
|
||||
// send a different event
|
||||
}
|
||||
}*/
|
||||
|
||||
function fetchStatus(address) {
|
||||
var client = new XMLHttpRequest();
|
||||
client.onreadystatechange = function() {
|
||||
// in case of network errors this might not give reliable results
|
||||
if(this.readyState == 4)
|
||||
return this.status;
|
||||
}
|
||||
client.open("HEAD", address);
|
||||
client.send();
|
||||
}
|
||||
|
||||
// Below are helper functions for making the "Close Application" function in DremJS possible. They may come in handy for other reasons, too.
|
||||
function SetCurrentTaskbarApp(id, AutoDisable) {
|
||||
//console.log("SET: " + id);
|
||||
CurrentTaskbarApp = "" + id;
|
||||
} // Sets or mutates CurrentTaskbarApp
|
||||
|
||||
function GetCurrentTaskbarApp() {
|
||||
//console.log("GET: " + CurrentTaskbarApp);
|
||||
return CurrentTaskbarApp;
|
||||
} // Accessor for CurrentTaskbarApp
|
||||
|
||||
// Mobile version of Agenda
|
||||
|
||||
function initAgendaMobile() {
|
||||
console.log("Initializing Agenda Mobile");
|
||||
startTime();
|
||||
console.log("Starting widgets");
|
||||
startWidgets();
|
||||
makeDraggable();
|
||||
console.log("Agenda Mobile Initialized");
|
||||
}
|
||||
|
||||
function maximizeAllApplications() {
|
||||
for(i=0; i<=highestId; i++)
|
||||
maximizeApplication(i, true);
|
||||
}
|
||||
|
||||
function minimizeAllApplications() {
|
||||
for(i=0; i<=highestId; i++)
|
||||
minimizeApplication(i, true);
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
if(detector.mobile())
|
||||
maximizeAllApplications();
|
||||
});
|
||||
|
||||
/*function showContextMenu() {
|
||||
try {
|
||||
parent.showContextMenu();
|
||||
} catch(e) { }
|
||||
}*/
|
11
js/jquery.ui.touch-punch.min.js
vendored
|
@ -1,11 +0,0 @@
|
|||
/*!
|
||||
* jQuery UI Touch Punch 0.2.3
|
||||
*
|
||||
* Copyright 2011–2014, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
*/
|
||||
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
|
508
rootfb.php
|
@ -1,508 +0,0 @@
|
|||
<?php
|
||||
/********************************
|
||||
Simple PHP File Manager
|
||||
Copyright John Campbell (jcampbell1)
|
||||
|
||||
Liscense: MIT
|
||||
********************************/
|
||||
|
||||
// Thanks for providing such a great PHP application!
|
||||
|
||||
//Disable error report for undefined superglobals
|
||||
error_reporting( error_reporting() & ~E_NOTICE );
|
||||
|
||||
//Security options
|
||||
$allow_delete = true; // Set to false to disable delete button and delete POST request.
|
||||
$allow_upload = true; // Set to true to allow upload files
|
||||
$allow_create_folder = true; // Set to false to disable folder creation
|
||||
$allow_direct_link = true; // Set to false to only allow downloads and not direct link
|
||||
$allow_show_folders = true; // Set to false to hide all subdirectories
|
||||
|
||||
$disallowed_patterns = ['*.php']; // must be an array. Matching files not allowed to be uploaded
|
||||
$hidden_patterns = ['*.php','.*']; // Matching files hidden in directory index
|
||||
|
||||
$PASSWORD = 'admin'; // Set the password, to access the file manager... (optional)
|
||||
|
||||
if($PASSWORD) {
|
||||
|
||||
session_start();
|
||||
// Disabled to prevent using cookies to determine if a computer is trusted.
|
||||
if(!$_SESSION['_sfm_allowed']) {
|
||||
// sha1, and random bytes to thwart timing attacks. Not meant as secure hashing.
|
||||
$t = bin2hex(openssl_random_pseudo_bytes(10));
|
||||
if($_POST['p'] && sha1($t.$_POST['p']) === sha1($t.$PASSWORD)) {
|
||||
$_SESSION['_sfm_allowed'] = true;
|
||||
header('Location: ?');
|
||||
}
|
||||
echo '<html><body><form action=? method=post>PASSWORD:<input type=password name=p autofocus/></form></body></html>';
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// must be in UTF-8 or `basename` doesn't work
|
||||
setlocale(LC_ALL,'en_US.UTF-8');
|
||||
|
||||
$tmp_dir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
if(DIRECTORY_SEPARATOR==='\\') $tmp_dir = str_replace('/',DIRECTORY_SEPARATOR,$tmp_dir);
|
||||
$tmp = get_absolute_path($tmp_dir . '/' .$_REQUEST['file']);
|
||||
|
||||
if($tmp === false)
|
||||
err(404,'File or Directory Not Found');
|
||||
if(substr($tmp, 0,strlen($tmp_dir)) !== $tmp_dir)
|
||||
err(403,"Forbidden");
|
||||
if(strpos($_REQUEST['file'], DIRECTORY_SEPARATOR) === 0)
|
||||
err(403,"Forbidden");
|
||||
if(preg_match('@^.+://@',$_REQUEST['file'])) {
|
||||
err(403,"Forbidden");
|
||||
}
|
||||
|
||||
|
||||
if(!$_COOKIE['_sfm_xsrf'])
|
||||
setcookie('_sfm_xsrf',bin2hex(openssl_random_pseudo_bytes(16)));
|
||||
if($_POST) {
|
||||
if($_COOKIE['_sfm_xsrf'] !== $_POST['xsrf'] || !$_POST['xsrf'])
|
||||
err(403,"XSRF Failure");
|
||||
}
|
||||
|
||||
$file = $_REQUEST['file'] ?: '.';
|
||||
|
||||
if($_GET['do'] == 'list') {
|
||||
if (is_dir($file)) {
|
||||
$directory = $file;
|
||||
$result = [];
|
||||
$files = array_diff(scandir($directory), ['.','..']);
|
||||
foreach ($files as $entry) if (!is_entry_ignored($entry, $allow_show_folders, $hidden_patterns)) {
|
||||
$i = $directory . '/' . $entry;
|
||||
$stat = stat($i);
|
||||
$result[] = [
|
||||
'mtime' => $stat['mtime'],
|
||||
'size' => $stat['size'],
|
||||
'name' => basename($i),
|
||||
'path' => preg_replace('@^\./@', '', $i),
|
||||
'is_dir' => is_dir($i),
|
||||
'is_deleteable' => $allow_delete && ((!is_dir($i) && is_writable($directory)) ||
|
||||
(is_dir($i) && is_writable($directory) && is_recursively_deleteable($i))),
|
||||
'is_readable' => is_readable($i),
|
||||
'is_writable' => is_writable($i),
|
||||
'is_executable' => is_executable($i),
|
||||
];
|
||||
}
|
||||
usort($result,function($f1,$f2){
|
||||
$f1_key = ($f1['is_dir']?:2) . $f1['name'];
|
||||
$f2_key = ($f2['is_dir']?:2) . $f2['name'];
|
||||
return $f1_key > $f2_key;
|
||||
});
|
||||
} else {
|
||||
err(412,"Not a Directory");
|
||||
}
|
||||
echo json_encode(['success' => true, 'is_writable' => is_writable($file), 'results' =>$result]);
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'delete') {
|
||||
if($allow_delete) {
|
||||
rmrf($file);
|
||||
}
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'mkdir' && $allow_create_folder) {
|
||||
// don't allow actions outside root. we also filter out slashes to catch args like './../outside'
|
||||
$dir = $_POST['name'];
|
||||
$dir = str_replace('/', '', $dir);
|
||||
if(substr($dir, 0, 2) === '..')
|
||||
exit;
|
||||
chdir($file);
|
||||
@mkdir($_POST['name']);
|
||||
exit;
|
||||
} elseif ($_POST['do'] == 'upload' && $allow_upload) {
|
||||
foreach($disallowed_patterns as $pattern)
|
||||
if(fnmatch($pattern, $_FILES['file_data']['name']))
|
||||
err(403,"Files of this type are not allowed.");
|
||||
|
||||
$res = move_uploaded_file($_FILES['file_data']['tmp_name'], $file.'/'.$_FILES['file_data']['name']);
|
||||
exit;
|
||||
} elseif ($_GET['do'] == 'download') {
|
||||
foreach($disallowed_patterns as $pattern)
|
||||
if(fnmatch($pattern, $file))
|
||||
err(403,"Files of this type are not allowed.");
|
||||
|
||||
$filename = basename($file);
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
header('Content-Type: ' . finfo_file($finfo, $file));
|
||||
header('Content-Length: '. filesize($file));
|
||||
header(sprintf('Content-Disposition: attachment; filename=%s',
|
||||
strpos('MSIE',$_SERVER['HTTP_REFERER']) ? rawurlencode($filename) : "\"$filename\"" ));
|
||||
ob_flush();
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
function is_entry_ignored($entry, $allow_show_folders, $hidden_patterns) {
|
||||
if ($entry === basename(__FILE__)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_dir($entry) && !$allow_show_folders) {
|
||||
return true;
|
||||
}
|
||||
foreach($hidden_patterns as $pattern) {
|
||||
if(fnmatch($pattern,$entry)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function rmrf($dir) {
|
||||
if(is_dir($dir)) {
|
||||
$files = array_diff(scandir($dir), ['.','..']);
|
||||
foreach ($files as $file)
|
||||
rmrf("$dir/$file");
|
||||
rmdir($dir);
|
||||
} else {
|
||||
unlink($dir);
|
||||
}
|
||||
}
|
||||
function is_recursively_deleteable($d) {
|
||||
$stack = [$d];
|
||||
while($dir = array_pop($stack)) {
|
||||
if(!is_readable($dir) || !is_writable($dir))
|
||||
return false;
|
||||
$files = array_diff(scandir($dir), ['.','..']);
|
||||
foreach($files as $file) if(is_dir($file)) {
|
||||
$stack[] = "$dir/$file";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// from: http://php.net/manual/en/function.realpath.php#84012
|
||||
function get_absolute_path($path) {
|
||||
$path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $path);
|
||||
$absolutes = [];
|
||||
foreach ($parts as $part) {
|
||||
if ('.' == $part) continue;
|
||||
if ('..' == $part) {
|
||||
array_pop($absolutes);
|
||||
} else {
|
||||
$absolutes[] = $part;
|
||||
}
|
||||
}
|
||||
return implode(DIRECTORY_SEPARATOR, $absolutes);
|
||||
}
|
||||
|
||||
function err($code,$msg) {
|
||||
http_response_code($code);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode(['error' => ['code'=>intval($code), 'msg' => $msg]]);
|
||||
exit;
|
||||
}
|
||||
|
||||
function asBytes($ini_v) {
|
||||
$ini_v = trim($ini_v);
|
||||
$s = ['g'=> 1<<30, 'm' => 1<<20, 'k' => 1<<10];
|
||||
return intval($ini_v) * ($s[strtolower(substr($ini_v,-1))] ?: 1);
|
||||
}
|
||||
$MAX_UPLOAD_SIZE = min(asBytes(ini_get('post_max_size')), asBytes(ini_get('upload_max_filesize')));
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<style>
|
||||
body {font-family: "lucida grande","Segoe UI",Arial, sans-serif; font-size: 14px;width:1024;padding:1em;margin:0;}
|
||||
th {font-weight: normal; color: #1F75CC; background-color: #F0F9FF; padding:.5em 1em .5em .2em;
|
||||
text-align: left;cursor:pointer;user-select: none;}
|
||||
th .indicator {margin-left: 6px }
|
||||
thead {border-top: 1px solid #82CFFA; border-bottom: 1px solid #96C4EA;border-left: 1px solid #E7F2FB;
|
||||
border-right: 1px solid #E7F2FB; }
|
||||
#top {height:52px;}
|
||||
#mkdir {display:inline-block;float:right;padding-top:16px;}
|
||||
label { display:block; font-size:11px; color:#555;}
|
||||
#file_drop_target {width:500px; padding:12px 0; border: 4px dashed #ccc;font-size:12px;color:#ccc;
|
||||
text-align: center;float:right;margin-right:20px;}
|
||||
#file_drop_target.drag_over {border: 4px dashed #96C4EA; color: #96C4EA;}
|
||||
#upload_progress {padding: 4px 0;}
|
||||
#upload_progress .error {color:#a00;}
|
||||
#upload_progress > div { padding:3px 0;}
|
||||
.no_write #mkdir, .no_write #file_drop_target {display: none}
|
||||
.progress_track {display:inline-block;width:200px;height:10px;border:1px solid #333;margin: 0 4px 0 10px;}
|
||||
.progress {background-color: #82CFFA;height:10px; }
|
||||
footer {font-size:11px; color:#bbbbc5; padding:4em 0 0;text-align: left;}
|
||||
footer a, footer a:visited {color:#bbbbc5;}
|
||||
#breadcrumb { padding-top:34px; font-size:15px; color:#aaa;display:inline-block;float:left;}
|
||||
#folder_actions {width: 50%;float:right;}
|
||||
a, a:visited { color:#00c; text-decoration: none}
|
||||
a:hover {text-decoration: underline}
|
||||
.sort_hide{ display:none;}
|
||||
table {border-collapse: collapse;width:100%;}
|
||||
thead {max-width: 1024px}
|
||||
td { padding:.2em 1em .2em .2em; border-bottom:1px solid #def;height:30px; font-size:12px;white-space: nowrap;}
|
||||
td.first {font-size:14px;white-space: normal;}
|
||||
td.empty { color:#777; font-style: italic; text-align: center;padding:3em 0;}
|
||||
.is_dir .size {color:transparent;font-size:0;}
|
||||
.is_dir .size:before {content: "--"; font-size:14px;color:#333;}
|
||||
.is_dir .download{visibility: hidden}
|
||||
a.delete {display:inline-block;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADtSURBVHjajFC7DkFREJy9iXg0t+EHRKJDJSqRuIVaJT7AF+jR+xuNRiJyS8WlRaHWeOU+kBy7eyKhs8lkJrOzZ3OWzMAD15gxYhB+yzAm0ndez+eYMYLngdkIf2vpSYbCfsNkOx07n8kgWa1UpptNII5VR/M56Nyt6Qq33bbhQsHy6aR0WSyEyEmiCG6vR2ffB65X4HCwYC2e9CTjJGGok4/7Hcjl+ImLBWv1uCRDu3peV5eGQ2C5/P1zq4X9dGpXP+LYhmYz4HbDMQgUosWTnmQoKKf0htVKBZvtFsx6S9bm48ktaV3EXwd/CzAAVjt+gHT5me0AAAAASUVORK5CYII=) no-repeat scroll 0 2px;
|
||||
color:#d00; margin-left: 15px;font-size:11px;padding:0 0 0 13px;
|
||||
}
|
||||
.name {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABAklEQVRIie2UMW6DMBSG/4cYkJClIhauwMgx8CnSC9EjJKcwd2HGYmAwEoMREtClEJxYakmcoWq/yX623veebZmWZcFKWZbXyTHeOeeXfWDN69/uzPP8x1mVUmiaBlLKsxACAC6cc2OPd7zYK1EUYRgGZFkG3/fPAE5fIjcCAJimCXEcGxKnAiICERkSIcQmeVoQhiHatoWUEkopJEkCAB/r+t0lHyVN023c9z201qiq6s2ZYA9jDIwx1HW9xZ4+Ihta69cK9vwLvsX6ivYf4FGIyJj/rg5uqwccd2Ar7OUdOL/kPyKY5/mhZJ53/2asgiAIHhLYMARd16EoCozj6EzwCYrrX5dC9FQIAAAAAElFTkSuQmCC) no-repeat scroll 0px 12px;
|
||||
padding:15px 0 10px 40px;
|
||||
}
|
||||
.is_dir .name {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAI0SURBVFiF7Vctb1RRED1nZu5977VQVBEQBKZ1GCDBEwy+ISgCBsMPwOH4CUXgsKQOAxq5CaKChEBqShNK222327f79n0MgpRQ2qC2twKOGjE352TO3Jl76e44S8iZsgOww+Dhi/V3nePOsQRFv679/qsnV96ehgAeWvBged3vXi+OJewMW/Q+T8YCLr18fPnNqQq4fS0/MWlQdviwVqNpp9Mvs7l8Wn50aRH4zQIAqOruxANZAG4thKmQA8D7j5OFw/iIgLXvo6mR/B36K+LNp71vVd1cTMR8BFmwTesc88/uLQ5FKO4+k4aarbuPnq98mbdo2q70hmU0VREkEeCOtqrbMprmFqM1psoYAsg0U9EBtB0YozUWzWpVZQgBxMm3YPoCiLpxRrPaYrBKRSUL5qn2AgFU0koMVlkMOo6G2SIymQCAGE/AGHRsWbCRKc8VmaBN4wBIwkZkFmxkWZDSFCwyommZSABgCmZBSsuiHahA8kA2iZYzSapAsmgHlgfdVyGLTFg3iZqQhAqZB923GGUgQhYRVElmAUXIGGVgedQ9AJJnAkqyClCEkkfdM1Pt13VHdxDpnof0jgxB+mYqO5PaCSDRIAbgDgdpKjtmwm13irsnq4ATdKeYcNvUZAt0dg5NVwEQFKrJlpn45lwh/LpbWdela4K5QsXEN61tytWr81l5YSY/n4wdQH84qjd2J6vEz+W0BOAGgLlE/AMAPQCv6e4gmWYC/QF3d/7zf8P/An4AWL/T1+B2nyIAAAAASUVORK5CYII=) no-repeat scroll 0px 10px;
|
||||
padding:15px 0 10px 40px;
|
||||
}
|
||||
.download {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB2klEQVR4nJ2ST2sTQRiHn5mdmj92t9XmUJIWJGq9NHrRgxQiCtqbl97FqxgaL34CP0FD8Qv07EHEU0Ew6EXEk6ci8Q9JtcXEkHR3k+zujIdUqMkmiANzmJdnHn7vzCuIWbe291tSkvhz1pr+q1L2bBwrRgvFrcZKKinfP9zI2EoKmm7Azstf3V7fXK2Wc3ujvIqzAhglwRJoS2ImQZMEBjgyoDS4hv8QGHA1WICvp9yelsA7ITBTIkwWhGBZ0Iv+MUF+c/cB8PTHt08snb+AGAACZDj8qIN6bSe/uWsBb2qV24/GBLn8yl0plY9AJ9NKeL5ICyEIQkkiZenF5XwBDAZzWItLIIR6LGfk26VVxzltJ2gFw2a0FmQLZ+bcbo/DPbcd+PrDyRb+GqRipbGlZtX92UvzjmUpEGC0JgpC3M9dL+qGz16XsvcmCgCK2/vPtTNzJ1x2kkZIRBSivh8Z2Q4+VkvZy6O8HHvWyGyITvA1qndNpxfguQNkc2CIzM0xNk5QLedCEZm1VKsf2XrAXMNrA2vVcq4ZJ4DhvCSAeSALXASuLBTW129U6oPrT969AK4Bq0AeWARs4BRgieMUEkgDmeO9ANipzDnH//nFB0KgAxwATaAFeID5DQNatLGdaXOWAAAAAElFTkSuQmCC) no-repeat scroll 0px 5px;
|
||||
padding:4px 0 4px 20px;
|
||||
}
|
||||
</style>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
|
||||
<script>
|
||||
(function($){
|
||||
$.fn.tablesorter = function() {
|
||||
var $table = this;
|
||||
this.find('th').click(function() {
|
||||
var idx = $(this).index();
|
||||
var direction = $(this).hasClass('sort_asc');
|
||||
$table.tablesortby(idx,direction);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
$.fn.tablesortby = function(idx,direction) {
|
||||
var $rows = this.find('tbody tr');
|
||||
function elementToVal(a) {
|
||||
var $a_elem = $(a).find('td:nth-child('+(idx+1)+')');
|
||||
var a_val = $a_elem.attr('data-sort') || $a_elem.text();
|
||||
return (a_val == parseInt(a_val) ? parseInt(a_val) : a_val);
|
||||
}
|
||||
$rows.sort(function(a,b){
|
||||
var a_val = elementToVal(a), b_val = elementToVal(b);
|
||||
return (a_val > b_val ? 1 : (a_val == b_val ? 0 : -1)) * (direction ? 1 : -1);
|
||||
})
|
||||
this.find('th').removeClass('sort_asc sort_desc');
|
||||
$(this).find('thead th:nth-child('+(idx+1)+')').addClass(direction ? 'sort_desc' : 'sort_asc');
|
||||
for(var i =0;i<$rows.length;i++)
|
||||
this.append($rows[i]);
|
||||
this.settablesortmarkers();
|
||||
return this;
|
||||
}
|
||||
$.fn.retablesort = function() {
|
||||
var $e = this.find('thead th.sort_asc, thead th.sort_desc');
|
||||
if($e.length)
|
||||
this.tablesortby($e.index(), $e.hasClass('sort_desc') );
|
||||
|
||||
return this;
|
||||
}
|
||||
$.fn.settablesortmarkers = function() {
|
||||
this.find('thead th span.indicator').remove();
|
||||
this.find('thead th.sort_asc').append('<span class="indicator">↓<span>');
|
||||
this.find('thead th.sort_desc').append('<span class="indicator">↑<span>');
|
||||
return this;
|
||||
}
|
||||
})(jQuery);
|
||||
$(function(){
|
||||
var XSRF = (document.cookie.match('(^|; )_sfm_xsrf=([^;]*)')||0)[2];
|
||||
var MAX_UPLOAD_SIZE = <?php echo $MAX_UPLOAD_SIZE ?>;
|
||||
var $tbody = $('#list');
|
||||
$(window).on('hashchange',list).trigger('hashchange');
|
||||
$('#table').tablesorter();
|
||||
|
||||
$('#table').on('click','.delete',function(data) {
|
||||
$.post("",{'do':'delete',file:$(this).attr('data-file'),xsrf:XSRF},function(response){
|
||||
list();
|
||||
},'json');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#mkdir').submit(function(e) {
|
||||
var hashval = decodeURIComponent(window.location.hash.substr(1)),
|
||||
$dir = $(this).find('[name=name]');
|
||||
e.preventDefault();
|
||||
$dir.val().length && $.post('?',{'do':'mkdir',name:$dir.val(),xsrf:XSRF,file:hashval},function(data){
|
||||
list();
|
||||
},'json');
|
||||
$dir.val('');
|
||||
return false;
|
||||
});
|
||||
<?php if($allow_upload): ?>
|
||||
// file upload stuff
|
||||
$('#file_drop_target').on('dragover',function(){
|
||||
$(this).addClass('drag_over');
|
||||
return false;
|
||||
}).on('dragend',function(){
|
||||
$(this).removeClass('drag_over');
|
||||
return false;
|
||||
}).on('drop',function(e){
|
||||
e.preventDefault();
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
$.each(files,function(k,file) {
|
||||
uploadFile(file);
|
||||
});
|
||||
$(this).removeClass('drag_over');
|
||||
});
|
||||
$('input[type=file]').change(function(e) {
|
||||
e.preventDefault();
|
||||
$.each(this.files,function(k,file) {
|
||||
uploadFile(file);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function uploadFile(file) {
|
||||
var folder = decodeURIComponent(window.location.hash.substr(1));
|
||||
|
||||
if(file.size > MAX_UPLOAD_SIZE) {
|
||||
var $error_row = renderFileSizeErrorRow(file,folder);
|
||||
$('#upload_progress').append($error_row);
|
||||
window.setTimeout(function(){$error_row.fadeOut();},5000);
|
||||
return false;
|
||||
}
|
||||
|
||||
var $row = renderFileUploadRow(file,folder);
|
||||
$('#upload_progress').append($row);
|
||||
var fd = new FormData();
|
||||
fd.append('file_data',file);
|
||||
fd.append('file',folder);
|
||||
fd.append('xsrf',XSRF);
|
||||
fd.append('do','upload');
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '?');
|
||||
xhr.onload = function() {
|
||||
$row.remove();
|
||||
list();
|
||||
};
|
||||
xhr.upload.onprogress = function(e){
|
||||
if(e.lengthComputable) {
|
||||
$row.find('.progress').css('width',(e.loaded/e.total*100 | 0)+'%' );
|
||||
}
|
||||
};
|
||||
xhr.send(fd);
|
||||
}
|
||||
function renderFileUploadRow(file,folder) {
|
||||
return $row = $('<div/>')
|
||||
.append( $('<span class="fileuploadname" />').text( (folder ? folder+'/':'')+file.name))
|
||||
.append( $('<div class="progress_track"><div class="progress"></div></div>') )
|
||||
.append( $('<span class="size" />').text(formatFileSize(file.size)) )
|
||||
};
|
||||
function renderFileSizeErrorRow(file,folder) {
|
||||
return $row = $('<div class="error" />')
|
||||
.append( $('<span class="fileuploadname" />').text( 'Error: ' + (folder ? folder+'/':'')+file.name))
|
||||
.append( $('<span/>').html(' file size - <b>' + formatFileSize(file.size) + '</b>'
|
||||
+' exceeds max upload size of <b>' + formatFileSize(MAX_UPLOAD_SIZE) + '</b>') );
|
||||
}
|
||||
<?php endif; ?>
|
||||
function list() {
|
||||
var hashval = window.location.hash.substr(1);
|
||||
$.get('?do=list&file='+ hashval,function(data) {
|
||||
$tbody.empty();
|
||||
$('#breadcrumb').empty().html(renderBreadcrumbs(hashval));
|
||||
if(data.success) {
|
||||
$.each(data.results,function(k,v){
|
||||
$tbody.append(renderFileRow(v));
|
||||
});
|
||||
!data.results.length && $tbody.append('<tr><td class="empty" colspan=5>This folder is empty</td></tr>')
|
||||
data.is_writable ? $('body').removeClass('no_write') : $('body').addClass('no_write');
|
||||
} else {
|
||||
console.warn(data.error.msg);
|
||||
}
|
||||
$('#table').retablesort();
|
||||
},'json');
|
||||
}
|
||||
function renderFileRow(data) {
|
||||
var $link = $('<a class="name" />')
|
||||
.attr('href', data.is_dir ? '#' + encodeURIComponent(data.path) : './' + data.path)
|
||||
.text(data.name);
|
||||
var allow_direct_link = <?php echo $allow_direct_link?'true':'false'; ?>;
|
||||
if (!data.is_dir && !allow_direct_link) $link.css('pointer-events','none');
|
||||
var $dl_link = $('<a/>').attr('href','?do=download&file='+ encodeURIComponent(data.path))
|
||||
.addClass('download').text('download');
|
||||
var $delete_link = $('<a href="#" />').attr('data-file',data.path).addClass('delete').text('delete');
|
||||
var perms = [];
|
||||
if(data.is_readable) perms.push('read');
|
||||
if(data.is_writable) perms.push('write');
|
||||
if(data.is_executable) perms.push('exec');
|
||||
var $html = $('<tr />')
|
||||
.addClass(data.is_dir ? 'is_dir' : '')
|
||||
.append( $('<td class="first" />').append($link) )
|
||||
.append( $('<td/>').attr('data-sort',data.is_dir ? -1 : data.size)
|
||||
.html($('<span class="size" />').text(formatFileSize(data.size))) )
|
||||
.append( $('<td/>').attr('data-sort',data.mtime).text(formatTimestamp(data.mtime)) )
|
||||
.append( $('<td/>').text(perms.join('+')) )
|
||||
.append( $('<td/>').append($dl_link).append( data.is_deleteable ? $delete_link : '') )
|
||||
return $html;
|
||||
}
|
||||
function renderBreadcrumbs(path) {
|
||||
var base = "",
|
||||
$html = $('<div/>').append( $('<a href=#>Home</a></div>') );
|
||||
$.each(path.split('%2F'),function(k,v){
|
||||
if(v) {
|
||||
var v_as_text = decodeURIComponent(v);
|
||||
$html.append( $('<span/>').text(' ▸ ') )
|
||||
.append( $('<a/>').attr('href','#'+base+v).text(v_as_text) );
|
||||
base += v + '%2F';
|
||||
}
|
||||
});
|
||||
return $html;
|
||||
}
|
||||
function formatTimestamp(unix_timestamp) {
|
||||
var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
var d = new Date(unix_timestamp*1000);
|
||||
return [m[d.getMonth()],' ',d.getDate(),', ',d.getFullYear()," ",
|
||||
(d.getHours() % 12 || 12),":",(d.getMinutes() < 10 ? '0' : '')+d.getMinutes(),
|
||||
" ",d.getHours() >= 12 ? 'PM' : 'AM'].join('');
|
||||
}
|
||||
function formatFileSize(bytes) {
|
||||
var s = ['bytes', 'KB','MB','GB','TB','PB','EB'];
|
||||
for(var pos = 0;bytes >= 1000; pos++,bytes /= 1024);
|
||||
var d = Math.round(bytes*10);
|
||||
return pos ? [parseInt(d/10),".",d%10," ",s[pos]].join('') : bytes + ' bytes';
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
</head><body>
|
||||
<script>
|
||||
document.addEventListener('contextmenu', event => event.preventDefault());
|
||||
</script>
|
||||
<div id="top">
|
||||
<?php if($allow_create_folder): ?>
|
||||
<form action="?" method="post" id="mkdir" />
|
||||
<label for=dirname>Create New Folder</label><input id=dirname type=text name=name value="" />
|
||||
<input type="submit" value="create" />
|
||||
</form>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($allow_upload): ?>
|
||||
|
||||
<div id="file_drop_target">
|
||||
Drag Files Here To Upload
|
||||
<b>or</b>
|
||||
<input type="file" multiple />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="breadcrumb"> </div>
|
||||
</div>
|
||||
|
||||
<div id="upload_progress"></div>
|
||||
<table id="table"><thead><tr>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Modified</th>
|
||||
<th>Permissions</th>
|
||||
<th>Actions</th>
|
||||
</tr></thead><tbody id="list">
|
||||
|
||||
</tbody></table>
|
||||
<footer><a onclick="lockRoot()">Index of <?php echo preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/', '', __DIR__); ?> | Press to lock root on this browser</a></footer>
|
||||
<script>
|
||||
function lockRoot() {
|
||||
document.cookie = "PHPSESSID=; expires = Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
document.cookie = "_sfm_xsrf=; expires = Thu, 01 Jan 1970 00:00:00 GMT"
|
||||
window.location.href = '/home/user/index.php';
|
||||
} // If you are like me and use the same browsing session for ages at a time, this can easily prevent usage of the root file browser.
|
||||
</script>
|
||||
</body></html>
|
|
@ -1,30 +0,0 @@
|
|||
<html>
|
||||
<style>
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: table;
|
||||
background-color: #000000;
|
||||
}
|
||||
.my-block {
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.orange {
|
||||
color: orange;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="my-block orange">
|
||||
It's now safe to turn off<br />
|
||||
your browser
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="jquery/jquery-3.3.1.min.js"></script>
|
||||
<meta http-equiv="refresh" content="7;url=shutdown.html" />
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
body {
|
||||
display: table;
|
||||
background-color: #00A9DA;
|
||||
}
|
||||
.my-block {
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.orange {
|
||||
color: orange;
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<embed src="/assets/media/music/shutdown.mp3" width="0" height="0" loop="false" autostart="true" hidden="true" />
|
||||
<div class="my-block">
|
||||
<img src="/assets/media/images/goodbye.gif">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,92 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<center><canvas id="canvas" width="255px" height="255px" style="background-color:#FFF">
|
||||
</canvas></center>
|
||||
|
||||
<script>
|
||||
var canvas = document.getElementById("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
var radius = canvas.height / 2;
|
||||
ctx.translate(radius, radius);
|
||||
radius = radius * 0.90
|
||||
setInterval(drawClock, 1000);
|
||||
|
||||
function drawClock() {
|
||||
drawFace(ctx, radius);
|
||||
drawNumbers(ctx, radius);
|
||||
drawTime(ctx, radius);
|
||||
}
|
||||
|
||||
function drawFace(ctx, radius) {
|
||||
var grad;
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, radius, 0, 2*Math.PI);
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fill();
|
||||
grad = ctx.createRadialGradient(0,0,radius*0.95, 0,0,radius*1.05);
|
||||
grad.addColorStop(0, '#333');
|
||||
grad.addColorStop(0.5, 'white');
|
||||
grad.addColorStop(1, '#333');
|
||||
ctx.strokeStyle = grad;
|
||||
ctx.lineWidth = radius*0.1;
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, radius*0.1, 0, 2*Math.PI);
|
||||
ctx.fillStyle = '#333';
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
function drawNumbers(ctx, radius) {
|
||||
var ang;
|
||||
var num;
|
||||
ctx.font = radius*0.15 + "px arial";
|
||||
ctx.textBaseline="middle";
|
||||
ctx.textAlign="center";
|
||||
for(num = 1; num < 13; num++){
|
||||
ang = num * Math.PI / 6;
|
||||
ctx.rotate(ang);
|
||||
ctx.translate(0, -radius*0.85);
|
||||
ctx.rotate(-ang);
|
||||
ctx.fillText(num.toString(), 0, 0);
|
||||
ctx.rotate(ang);
|
||||
ctx.translate(0, radius*0.85);
|
||||
ctx.rotate(-ang);
|
||||
}
|
||||
}
|
||||
|
||||
function drawTime(ctx, radius){
|
||||
var now = new Date();
|
||||
var hour = now.getHours();
|
||||
var minute = now.getMinutes();
|
||||
var second = now.getSeconds();
|
||||
//hour
|
||||
hour=hour%12;
|
||||
hour=(hour*Math.PI/6)+
|
||||
(minute*Math.PI/(6*60))+
|
||||
(second*Math.PI/(360*60));
|
||||
drawHand(ctx, hour, radius*0.5, radius*0.07);
|
||||
//minute
|
||||
minute=(minute*Math.PI/30)+(second*Math.PI/(30*60));
|
||||
drawHand(ctx, minute, radius*0.8, radius*0.07);
|
||||
// second
|
||||
second=(second*Math.PI/30);
|
||||
drawHand(ctx, second, radius*0.9, radius*0.02);
|
||||
}
|
||||
|
||||
function drawHand(ctx, pos, length, width) {
|
||||
ctx.beginPath();
|
||||
ctx.lineWidth = width;
|
||||
ctx.lineCap = "round";
|
||||
ctx.moveTo(0,0);
|
||||
ctx.rotate(pos);
|
||||
ctx.lineTo(0, -length);
|
||||
ctx.stroke();
|
||||
ctx.rotate(-pos);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1 +0,0 @@
|
|||
Clock
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
header('Refresh:10');
|
||||
function displayInfo() {
|
||||
$systemInfo = '<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
|
||||
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var content = \'<center><p>CPU Usage: '.getCpuUsage().'%</p><div id="cpuUsageBar"></div><br /><p>Memory Usage (see docs): '.memory_usage()."KB/".memory_total()."KB".'</p><div id="memoryUsageBar"></div></center>\';
|
||||
|
||||
var parent=document.getElementById("container");
|
||||
parent.insertAdjacentHTML("beforeend", content);
|
||||
|
||||
$( "#cpuUsageBar" ).progressbar({
|
||||
value: '.getCpuUsage().'
|
||||
});
|
||||
$( "#memoryUsageBar" ).progressbar({
|
||||
value: '.round((memory_usage()/memory_total())*100, 2).'
|
||||
});
|
||||
});
|
||||
function startRefresh() {
|
||||
$.get("index.php", function(data) {
|
||||
$(document.body).html(data);
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
setTimeout(startRefresh,5000);
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
body {
|
||||
font-family: Calibri;
|
||||
}
|
||||
.buttonA, .buttonB {
|
||||
display: inline-block;
|
||||
}
|
||||
.buttons {
|
||||
width: 100%;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
position: sticky;
|
||||
background-color: #D3D3D3;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!--<div class="buttons">
|
||||
<button type="button" class="buttonA" disabled>Status</button>
|
||||
<a href="TaskManager.html"><button type="button" class="buttonB">Task Manager</button></a>
|
||||
</div>-->
|
||||
<div id="container">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
echo($systemInfo);
|
||||
//ob_flush();
|
||||
//flush();
|
||||
}
|
||||
|
||||
function memory_usage() {
|
||||
return memory_total() - memory_free();
|
||||
}
|
||||
|
||||
function memory_free() {
|
||||
$fh = fopen('/proc/meminfo','r');
|
||||
$mem = 0;
|
||||
while ($line = fgets($fh)) {
|
||||
$pieces = array();
|
||||
if (preg_match('/^MemFree:\s+(\d+)\skB$/', $line, $pieces)) {
|
||||
$mem = $pieces[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
return $mem;
|
||||
}
|
||||
|
||||
function memory_total() {
|
||||
$fh = fopen('/proc/meminfo','r');
|
||||
$mem = 0;
|
||||
while ($line = fgets($fh)) {
|
||||
$pieces = array();
|
||||
if (preg_match('/^MemTotal:\s+(\d+)\skB$/', $line, $pieces)) {
|
||||
$mem = $pieces[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
return $mem;
|
||||
}
|
||||
|
||||
function getCpuUsage() {
|
||||
if(stristr(PHP_OS, 'win')) {
|
||||
$_ENV['typeperfCounter'] = '\processor(_total)\% processor time';
|
||||
exec('typeperf -sc 1 "'.$_ENV['typeperfCounter'].'"', $p);
|
||||
$line = explode(',', $p[2]);
|
||||
$load = trim($line[1], '"');
|
||||
return $load;
|
||||
} else {
|
||||
$usage = sys_getloadavg();
|
||||
return $usage[0];
|
||||
}
|
||||
}
|
||||
|
||||
displayInfo();
|
||||
?>
|
|
@ -1 +0,0 @@
|
|||
Server Status
|