Browse Source

Add files via upload

yeungalan 6 years ago
parent
commit
fd1cbc6e4e
20 changed files with 1228 additions and 0 deletions
  1. BIN
      7za
  2. BIN
      7za.dll
  3. BIN
      7za.exe
  4. BIN
      7za_x86
  5. BIN
      7zxa.dll
  6. 168 0
      CopyNMoveUI.php
  7. 332 0
      MainUI.php
  8. 288 0
      ProgressUI.php
  9. 12 0
      README.txt
  10. 33 0
      deltmp.php
  11. 1 0
      description.txt
  12. 8 0
      embedded.php
  13. 11 0
      getMessage.php
  14. BIN
      img/function_icon.png
  15. BIN
      img/small_icon.png
  16. 146 0
      index.php
  17. 47 0
      infoUI.php
  18. BIN
      install/template/background.png
  19. 63 0
      install/template/template.php
  20. 119 0
      opr.php

BIN
7za


BIN
7za.dll


BIN
7za.exe


BIN
7za_x86


BIN
7zxa.dll


+ 168 - 0
CopyNMoveUI.php

@@ -0,0 +1,168 @@
+<?php
+include '../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+	<script src="../script/jquery.min.js"></script>
+	<!-- <script src="../script/jquery-ui.min.js"></script> -->
+    <link rel="stylesheet" href="../script/tocas/tocas.css">
+	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
+	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<title>7z File Manager</title>
+	<style>
+	body{
+		background-color:white
+	}
+	.ts.form .inline.field label {
+		min-width: 50%;
+	}
+	.ts.basic.dropdown, .ts.form select {
+		max-width: 50%;
+	}
+	</style>
+</head>
+<body>
+	<div class="ts container">
+		<div class="ts grid">
+			<div class="sixteen wide column">
+			<br>
+				<div class="ts form">
+
+					<div class="field">
+						<label>Extract to:</label>
+						<div class="ts labeled input" style="width:100%">
+							<div class="ts label">
+								/AOR/
+							</div>
+							<input type="text" id="path" placeholder="Select a path for unzip.">
+							<button class="ts icon button" onClick="selectFolder();">
+								<i class="folder open icon"></i>
+							</button>
+						</div>
+					</div>
+				</div>
+				<br>
+				<div class="ts checkbox">
+					<input type="checkbox" id="ZipFolderCreate">
+					<label for="ZipFolderCreate">Don't create new folder</label>
+				</div>
+				<p id="filesshow">Target: </p>
+			</div>
+			
+
+			<div class="eight wide column"></div>
+			<div class="eight wide column">
+				<button class="ts basic small button" style="width:45%" onclick="f_ok()">OK</button>
+				<button class="ts basic small button" style="width:45%" onclick="f_close()">Cancel</button>
+			</div>
+		</div>
+	</div>
+</body>
+<script>
+var f_method = "<?php echo $_GET["method"] ?>";
+var f_rand = "<?php echo $_GET["rand"] ?>";
+var f_file = "<?php echo $_GET["file"] ?>";
+var f_dir = "<?php echo $_GET["dir"] ?>";
+var f_extractTo = "";
+
+ao_module_setFixedWindowSize();
+ao_module_setWindowSize(650,240);
+
+$( "#ZipFolderCreate" ).change(function() {
+	updatePath();
+}).change();
+
+function f_close(){
+	if(ao_module_virtualDesktop){
+		ao_module_close();
+	}else{
+		ts('#modal').modal('hide');
+	}		
+}
+
+function f_ok(){
+	var href = "ProgressUI.php?method=" + f_method + "&rand=" + f_rand + "&file=" + f_file + "&dir=" + f_dir + "&destdir=" + f_extractTo + "&CreateNewFoler=" + $("#ZipFolderCreate").is( ":checked" );
+
+	if(ao_module_virtualDesktop){
+		ao_module_newfw('7-Zip File Manager/' + href,'7-Zip','file outline','7-ZipProgressUI' + Math.floor(Math.random()*100),720,250);
+		ao_module_close();
+	}else{
+		$.get( href, function( data ) {
+			$( "#modaldata" ).html( data );
+			ts('#modal').modal("show");
+		});
+	}
+}
+
+$( "#path" ).keyup(function() {
+	updatePath();
+});
+
+function updatePath(){
+	var SelectedPath = $("#path").val();
+	var ZipPath = "";
+	console.log(f_file);
+	var ZipNameAsPath = ao_module_codec.decodeUmFilename(f_file.replace(/^.*[\\\/]/, '')).split(".")[0] + "/";
+	var RootDir = "/AOR/";
+	
+	if(f_dir == ""){
+		ZipPath = "...";
+	}else{
+	    if(f_method == "e"){
+		    ZipPath = f_dir.replace(/^.*[\\\/]/, '');
+	    }else{
+	        ZipPath = f_dir;
+	    }
+	}
+	if(SelectedPath.slice(-1) !== "/"){
+		SelectedPath = SelectedPath + "/";
+	}
+	
+	if(SelectedPath.includes("/media/") || (!SelectedPath.includes("C:\\") && SelectedPath.includes("/media/"))){
+		RootDir = "";
+	}
+	
+	if($("#ZipFolderCreate").is( ":checked" )){
+		ZipNameAsPath = "";
+	}
+	
+	console.log(SelectedPath);
+	console.log(ZipNameAsPath);
+	console.log(ZipPath);
+	$("#filesshow").text("Target: " + RootDir + SelectedPath + ZipNameAsPath + ZipPath);
+	f_extractTo = "../" + SelectedPath;
+}
+
+function selectFolder(){
+	if (ao_module_virtualDesktop){
+		ao_module_openFileSelector(getUUID(),"setPathBySelector",undefined,undefined,false,"folder");
+	}else{
+		ao_module_openFileSelectorTab(getUUID(),"../",false,"folder","setPathBySelector");
+	}
+}
+
+function setPathBySelector(object){
+	var files = JSON.parse(object);
+	console.log(files);
+	$("#path").val(files[0].filepath);
+	updatePath();
+}
+
+function getUUID(){
+	return new Date().getTime();
+}
+
+/* depreacted
+$( "#path" ).keypress(function() {
+	$.get( "opr.php?method=ListAORDir&dir=" + $( "#path" ).val(), function( data ) {
+	   $( "#path" ).autocomplete({
+		source: JSON.parse(data)
+		});
+	});
+});
+*/
+
+</script>
+</html>

+ 332 - 0
MainUI.php

@@ -0,0 +1,332 @@
+<?php
+include '../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+	<script src="../script/jquery.min.js"></script>
+    <link rel="stylesheet" href="../script/tocas/tocas.css">
+	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
+	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<title>7z File Manager</title>
+	<style>
+	body{
+		background-color:white;
+		-webkit-user-select: none; /* Safari */        
+		-moz-user-select: none; /* Firefox */
+		-ms-user-select: none; /* IE10+/Edge */
+		user-select: none; /* Standard */
+	}
+	tr{
+	    cursor:pointer;
+	}
+	tr:hover { 
+		background-color: #fafafa;
+	}
+	@media (max-width: 767px){
+		.ts.bottom.right.snackbar.active{
+			width: 100% !important;
+			bottom: 0px !important;
+			right: 0px !important;
+		}
+		.ts.snackbar:not(.inline) .content {
+		    margin-bottom: 7px;
+		}
+	}
+	</style>
+</head>
+<body>
+<div class="ts labeled icon menu" style="box-shadow: 0px 0px 0px 0 #000000 !important;">
+    <a class="item disabled" onclick="msgbox('Error: Operation is not supported','red','white')">
+        <i class="plus icon"></i> Add
+    </a>
+    <a class="item" onclick="functionbar_extract();">
+        <i class="minus icon"></i> Extract
+    </a>
+    <a class="item" onclick="msgbox('Warning: Not implemented','yellow','Black')">
+        <i class="chevron down icon"></i> Test
+    </a>
+    <a class="item disabled" onclick="functionbar_extract();">
+        <i class="copy icon"></i> Copy
+    </a>
+	<a class="item disabled" onclick="functionbar_extract();">
+        <i class="move icon"></i> Move
+    </a>
+	<a class="item"  onclick="msgbox('Error: Operation is not supported','red','white')">
+        <i class="remove icon"></i> Clear Cache
+    </a>
+	<a class="item" onclick="functionbar_info();">
+        <i class="notice icon"></i> Info
+    </a>
+</div>
+<div class="ts breadcrumb" style="left: 20px;padding-bottom:10px;" id="breadcrumb">
+	<button class="ts icon mini basic button" path="" attr="Dir" id="returnBtn" onclick="load(this)">
+		<i class="reply icon"></i>
+	</button>
+		<p href="#!" class="section"><?php echo $_GET["file"] ?></p>
+</div>
+<div class="ts fitted divider"></div>
+<table class="ts borderless table">
+    <thead>
+        <tr id="thead">
+        </tr>
+    </thead>
+    <tbody id="tbody">
+    </tbody>
+</table>
+
+<!-- use for displaying dialog , for VDI user , use VDI module instead -->
+<div class="ts modals dimmer">
+    <dialog id="modal" class="ts basic modal" style="background-color: white;color: black!important" open>
+        <div class="content" id="modaldata">
+        </div>
+    </dialog>
+</div>
+<div class="ts bottom right snackbar">
+    <div class="content"></div>
+</div>
+<div class="ts contextmenu">
+    <div class="item" onclick="contextmenu_extract()">
+        Open
+		<span class="description">Enter</span>
+    </div>
+    <div class="item" onclick="functionbar_extract()">
+        Extract
+    </div>
+    <div class="item"  onclick="functionbar_info()">
+        Properties
+    </div>
+</div>
+
+</body>
+<script>
+/*
+Reminder: the x and y for new windows no longer has any function;
+please change it on another page directly.
+*/
+//Global variable
+var random = Math.floor((Math.random() * 10000) + 1000);
+var file = "<?php echo $_GET["file"] ?>";
+
+//Init floatWindow events
+ao_module_setWindowIcon("file archive outline");
+ao_module_setGlassEffectMode();
+ao_module_setWindowTitle(ao_module_codec.decodeUmFilename(basename(file)) + " 7-Zip File Manager");
+if (ao_module_virtualDesktop){
+    //Push up the body section a bit to compensate for the floatWindow offsets
+    $("body").css("padding-bottom","20px");
+}
+ao_module_setWindowSize(950,530);
+
+function basename(path){
+    path = path.split("\\").join("/");
+    return path.split("/").pop();
+}
+
+load($("#returnBtn"));
+$.get("deltmp.php", function(data) {
+});
+
+
+ts('.borderless.table').contextmenu({
+    menu: '.ts.contextmenu'
+});
+
+$('body').on('click', function(e) {
+  if (e.target !== this)
+    return;
+  $("tr").removeAttr("style");
+});
+document.onkeydown = function(e) {
+    if($("[style='background-color: #e9e9e9;']").length > 0){
+        var htmlelement = $("[style='background-color: #e9e9e9;']");
+    }else{
+        var htmlelement = $("#tbody tr:first");
+    }
+    switch (e.keyCode) {
+        case 9:
+            if(htmlelement.prev().length > 0){
+                var next = htmlelement.prev();
+    	    	$("tr").removeAttr("style");
+    		    $(next).attr("style","background-color: #e9e9e9;");
+            }
+        case 13:
+            var htmlelement = $("[style='background-color: #e9e9e9;']");
+            load(htmlelement);
+            break;
+        case 38:
+            if(htmlelement.prev().length > 0){
+                var next = htmlelement.prev();
+    	    	$("tr").removeAttr("style");
+    		    $(next).attr("style","background-color: #e9e9e9;");
+            }else{
+            	$("tr").removeAttr("style");
+                $(htmlelement).attr("style","background-color: #e9e9e9;");
+            }
+            break;
+        case 40:
+            if(htmlelement.next().length > 0){
+    	    	var next = htmlelement.next();
+    	    	$("tr").removeAttr("style");
+    		    $(next).attr("style","background-color: #e9e9e9;");
+            }else{
+            	$("tr").removeAttr("style");
+                $(htmlelement).attr("style","background-color: #e9e9e9;");
+            }
+            break;
+    }
+};
+
+
+//for load data into table
+//load($(returnBtn));
+
+function onsingleclick(htmlelement){
+	$("tr").removeAttr("style");
+	$(htmlelement).attr("style","background-color: #e9e9e9;");
+}
+
+function load(htmlelement){
+	if($(htmlelement).attr("attr") == "Dir"){
+		$("#breadcrumb").html('<button class="ts icon mini basic button" disabled><i class="level up icon"></i></button> <p class="section"><i class="loading circle notched icon"></i>Fetching..</p>');
+		//for load data into table
+		$.get("opr.php?method=l&rand=" + random + "&file=" + file + "&dir=" + $(htmlelement).attr("path"), function( raw ) {
+			//clear table for pepare load data into table
+			$("#thead").html("");
+			$("#tbody").html("");
+			var data = JSON.parse(raw); //parse it
+			var header = data["Header"]; 
+			//create thead
+			$(data["Header"]).each(function( key, value ) {
+			  $("#thead").append("<th>" + value + "</th>");//create header (thead) first
+			});
+			//create tbody
+			$(data["Information"]).each(function( a, value ) {
+				//to check if attr not exists. if not exists, assume it is an file.
+				if(typeof value["Attributes"] === 'undefined'){
+					var attr = "File";
+				}else{
+					if(value["Attributes"].includes("D")){
+						var attr = "Dir";
+					}else{
+						var attr = "File";
+					}
+				}
+				//create HTML structure
+				var tmp = "";
+				tmp = tmp + '<tr path="' + value["Path"] + '" attr="' + attr + '" ondblclick="load(this)" onclick="onsingleclick(this)" oncontextmenu="onsingleclick(this)">'
+				$.each(data["Header"], function( a, key ) {
+					if(typeof value[key] !== 'undefined'){
+					    if(key == "Path"){
+					        //create fanastic icon to user
+					        if(attr == "Dir"){
+					            var tdicon = '<i class="folder outline icon"></i>';
+					        }else{
+					            var filepath = value["Path"].trim();
+					            if (filepath != ""){
+					                var ext = filepath.split(".").pop();
+					                var icon = ao_module_utils.getIconFromExt(ext);
+					                var tdicon = '<i class="' + icon + ' icon"></i>';
+					            }else{
+					                var tdicon = '<i class="file outline icon"></i>';
+					            }
+					            
+					        }
+					        var tdpath = value[key].replace(new RegExp($(htmlelement).attr("path") + "/"),"");
+							if(tdpath.includes("?")){
+					            var tdicon = '<i class="exclamation triangle icon"></i>';
+					        }
+							tmp = tmp + "<td>" + tdicon + ao_module_codec.decodeUmFilename(tdpath) + "</td>";					        
+					    }else{
+					        tmp = tmp + "<td>" + value[key] + "</td>";
+					    }
+					}else{
+						tmp = tmp + "<td></td>";
+					}
+				});
+				$("#tbody").append(tmp + "</tr>");
+			});
+			
+			/*
+			//Little patch for HEX file name (PATCH)
+			$( "tr td:first-child" ).each( function( index, element ){
+				var tpath = $(this);
+				if(/^inith[0-9a-fA-F]*\..*$|^[0-9a-fA-F]*$/.test($(tpath).text())){
+					
+					$.get( '../SystemAOB/functions/file_system/um_filename_decoder.php?filename=' + $(tpath).text(), function( decodedfilename ) {
+						$(tpath).text(decodedfilename);
+					});
+					
+				}
+			});
+			*/
+			
+			//process for Prev button 
+			var path = $(htmlelement).attr("path").split("/");
+			var previousPath = $(htmlelement).attr("path").replace(/([^\/]+)$/, '').slice(0, -1);
+			if(previousPath == $(htmlelement).attr("path")){
+				previousPath = "";
+			}
+			//console.log(previousPath);
+			$("#breadcrumb").html('<button class="ts icon mini basic button" currPath="' + $(htmlelement).attr("path") + '" path="' + previousPath + '" attr="Dir" id="returnBtn" onclick="load(this)"><i class="level up icon"></i></button> <p href="#!" class="section">' + ao_module_codec.decodeUmFilename(file.replace(/^.*[\\\/]/, '')) +'</p><div class="divider">/</div>');
+			if($(htmlelement).attr("path").length > 1){
+				$.each(path, function( a, key ) {
+					$("#breadcrumb").append('<p href="#!" class="section"><i class="folder icon"></i>' + key + '</p><div class="divider">/</div>');
+				});
+			}
+		});
+	}else{
+		//if it was file, show it.
+		showDialog("ProgressUI.php?method=e&rand=" + random + "&file=" + file + "&dir=" + $(htmlelement).attr("path"),720,250);
+		random = Math.floor((Math.random() * 10000) + 1000);
+	}
+}
+
+function contextmenu_extract(){
+	showDialog("ProgressUI.php?method=e&rand=" + random + "&file=" + file + "&dir=" + $("[style='background-color: #e9e9e9;']").attr("path"),720,250);
+	random = Math.floor((Math.random() * 10000) + 1000);
+}
+
+function functionbar_extract(){
+	//extract files or dir , if file then pass method=e , if dir then pass method=x
+	if($("[style='background-color: #e9e9e9;']").attr("attr") == "Dir"){
+		showDialog("CopyNMoveUI.php?method=x&rand=" + random + "&file=" + file + "&dir=" + $($("[style='background-color: #e9e9e9;']")).attr("path"),720,280);
+	}else if($("[style='background-color: #e9e9e9;']").attr("attr") == "File"){
+		showDialog("CopyNMoveUI.php?method=e&rand=" + random + "&file=" + file + "&dir=" + $("[style='background-color: #e9e9e9;']").attr("path"),720,280);
+	}else{
+		showDialog("CopyNMoveUI.php?method=x&rand=" + random + "&file=" + file + "&dir=" + $("#returnBtn").attr("currPath"),720,250);
+	}
+	//generate new number for next extraction
+	random = Math.floor((Math.random() * 10000) + 1000);
+}
+
+function functionbar_info(){
+	//showDialog("infoUI.php?file=" + file,365,475);
+	var displayname = ao_module_codec.decodeUmFilename(basename(file));
+	var icon = ao_module_utils.getIconFromExt(displayname.split(".").pop().trim());
+	ao_module_newfw('7-Zip File Manager/' + "infoUI.php?file=" + file,displayname + ' - Properties',icon,'7-ZipProgressUI' + Math.floor(Math.random()*100),365,475,undefined,undefined,true,true);
+}
+
+function showDialog(href,x,y){
+	if(ao_module_virtualDesktop){
+		ao_module_newfw('7-Zip File Manager/' + href,'Extract Files - 7zip File Manager','external','7-ZipProgressUI' + Math.floor(Math.random()*100),x,y,undefined,undefined,true,true);
+	}else{
+		$.get( href, function( data ) {
+			$( "#modaldata" ).html( data );
+			ts('#modal').modal("show");
+		});
+	}
+}
+
+function msgbox(content,bgcolor,fontcolor){
+	$(".snackbar").attr("style",'background-color: ' + bgcolor + ';color:' + fontcolor);
+	ts('.snackbar').snackbar({
+		content: content,
+		onAction: () => {
+			$(".snackbar").removeAttr("style");
+		}
+	});
+}
+</script>
+</html>

+ 288 - 0
ProgressUI.php

@@ -0,0 +1,288 @@
+<?php
+include '../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+	<script src="../script/jquery.min.js"></script>
+    <link rel="stylesheet" href="../script/tocas/tocas.css">
+	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
+	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<title>7z File Manager</title>
+	<style>
+	body{
+		background-color:white
+	}
+	.ts.form .inline.field label {
+		min-width: 50%;
+	}
+	.ts.basic.dropdown, .ts.form select {
+		max-width: 50%;
+	}
+	</style>
+</head>
+<body>
+<br>
+	<div class="ts container">
+		<div class="ts grid">
+			
+			<div class="eight wide column">
+				<span style="text-align:left">Elasped time:</span>
+				<span style="text-align:right" id="time">00:00:00</span>
+			</div>
+			<div class="eight wide column">
+				<span style="text-align:left">Total size:</span>
+				<span style="text-align:right" id="totalsize">0 b</span>
+			</div>
+			
+			<div class="eight wide column">
+				<span style="text-align:left">Remaining time:</span>
+				<span style="text-align:right" id="remaining">00:00:00</span>
+			</div>
+			<div class="eight wide column">
+				<span style="text-align:left">Speed:</span>
+				<span style="text-align:right" id="speed">0 b/s</span>
+			</div>
+			
+			<div class="sixteen wide column">
+				<span style="text-align:left">Loading...</span>
+				<div class="ts progress">
+					<div class="bar" id="bar" style="width: 0%"></div>
+				</div>
+			</div>	
+			
+			<div class="eight wide column"></div>
+			<div class="eight wide column">
+				<button class="ts basic button" style="width:100%" onclick="f_close();f_cancel = true;">Cancel</button>
+			</div>
+		</div>
+	</div>
+	<div class="ts bottom right snackbar">
+		<div class="content"></div>
+	</div>
+</body>
+<script>
+var f_method = "<?php echo $_GET["method"] ?>";
+var f_rand = "<?php echo $_GET["rand"] ?>";
+var f_file = "<?php echo $_GET["file"] ?>";
+var f_dir = "<?php echo $_GET["dir"] ?>";
+var f_CreateNewFoler = "<?php echo $_GET["CreateNewFoler"] ?>";
+var f_size = "<?php echo filesize($_GET["file"]); ?>";
+var f_destdir = "<?php echo isset($_GET["destdir"]) ? $_GET["destdir"] : ""; ?>";
+var f_time = 1;
+var f_totaltime = 1;
+var f_cancel = false;
+
+//Initiate floatWindow events
+ao_module_setWindowTitle("Inflating from compressed file...");
+ao_module_setWindowIcon("loading spinner");
+
+var f_load = setInterval(function(){ 
+
+	$.ajax({
+		url: "./tmp/" + f_rand + "messages",
+		contentType: "text/plain"
+	}).done(function(data) { 
+		var progress = data.match(/ ([0-9]{0,2}%)/gim);
+		console.log(progress[progress.length - 1]);
+		f_totaltime = Math.floor(f_time / (parseInt(progress[progress.length - 1])/100));
+		$("#bar").attr("style","width: " + progress[progress.length - 1]);
+		$("#time").text(f_convert(f_time));
+		$("#remaining").text(f_convert(f_totaltime - f_time));
+		$("#speed").text(f_filesize(Math.floor(f_size / f_totaltime)) + "/s");
+		$("#totalsize").text(f_filesize(f_size));
+		f_time += 1;
+	});
+	
+	/*
+	$.get("./tmp/" + f_rand + "messages", function( data ) {
+		var progress = data.match(/ ([0-9]{0,2}%)/gim);
+		console.log(progress[progress.length - 1]);
+		f_totaltime = Math.floor(f_time / (parseInt(progress[progress.length - 1])/100));
+		$("#bar").attr("style","width: " + progress[progress.length - 1]);
+		$("#time").text(f_convert(f_time));
+		$("#remaining").text(f_convert(f_totaltime - f_time));
+		$("#speed").text(f_filesize(Math.floor(f_size / f_totaltime)) + "/s");
+		$("#totalsize").text(f_filesize(f_size));
+		f_time += 1;
+	});
+	*/
+}, 1000);
+
+f_load;
+
+$.get("opr.php?method=" + f_method + "&rand=" + f_rand + "&file=" + f_file + "&dir=" + f_dir , function( raw ) {
+		clearInterval(f_load);
+		if(!f_cancel){
+			if(f_destdir.length >0){
+				//console.log('../SystemAOB/functions/file_system/move.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'&to=../../' + f_destdir + f_filenameToFoldername(f_file));
+				console.log(f_destdir);
+				console.log(f_filenameToFoldername(f_file));
+				$.get( '../SystemAOB/functions/file_system/move.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'&to=../../' + f_destdir + f_filenameToFoldername(f_file), function(data) {
+					if(data !== "DONE"){
+						if(ao_module_virtualDesktop){
+							parent.msgbox(data,'<i class="caution sign icon"></i> 7-Zip File Manager',"");
+							ao_module_close();
+						}else{
+							msgbox(data,"","");
+							setTimeout(function(){ts('#modal').modal('hide')},1500);
+						}
+					}else{
+						f_openFile(true);
+					}
+				});
+				/*
+				console.log('../SystemAOB/functions/file_system/copy_folder.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'/&target=../../' + f_destdir + f_rand + "/");
+				
+				console.log('../SystemAOB/functions/file_system/rename.php?file=../../' + f_destdir + f_rand + '&newFileName=../../' + f_destdir + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"") + '/&hex=false');
+				
+				$.get( '../SystemAOB/functions/file_system/copy_folder.php?from=../../../7-Zip%20File%20Manager/tmp/' + f_rand +'/&target=../../' + f_destdir + f_rand + "/", function(data) {
+					if(data !== "DONE"){
+						msgbox(data,"","");
+						if(ao_module_virtualDesktop){
+							parent.msgbox(data,"","");
+							ao_module_close();
+						}else{
+							msgbox(data,"","");
+							setTimeout(function(){ts('#modal').modal('hide')},1500);
+						}
+					}
+					
+					$.get( '../SystemAOB/functions/file_system/rename.php?file=../../' + f_destdir + f_rand + '&newFileName=../../' + f_destdir + f_file.replace(/^.*[\\\/]/, '').replace(/\./,"") + '/&hex=false', function(data) {
+						if(data !== "DONE"){
+							$.get( '../SystemAOB/functions/file_system/delete.php?filename=../../' + f_destdir + f_rand, function(data) {
+							});
+							if(ao_module_virtualDesktop){
+								parent.msgbox(data,"","");
+								ao_module_close();
+							}else{
+								msgbox(data,"","");
+								setTimeout(function(){ts('#modal').modal('hide')},1500);
+							}
+						}else{
+							f_openFile(true);
+						}
+					});
+				});
+				*/
+			}else{
+				f_openFile(false);
+			}
+		}
+});
+
+function f_filenameToFoldername(path){
+		var filename = path.split("\\").join("/").split("/").pop();
+		var filename = filename.split(".");
+		if (filename.length > 1){
+			filename.pop();
+		}
+		filename = filename.join(".");
+		if (filename.substring(0,5) == "inith"){
+			filename = filename.replace("inith","");
+		}
+		return filename;
+}
+
+function f_openFile(bool){
+	var Folder = "";
+	// bool = true then it have destdir
+	// bool = false then it dont have destdir
+	if(bool == true){
+		//f_method = e then it is only single file
+		//f_method = x then it is a folder
+		if(f_method == "e"){
+			Folder = f_destdir.replace("../","") + f_filenameToFoldername(f_file) + "/" + f_dir.replace(/^.*[\\\/]/, '');
+		}else if(f_method == "x"){
+			Folder = f_destdir.replace("../","") + f_filenameToFoldername(f_file);
+		}
+	}else{
+		//f_method = e then it is only single file
+		//f_method = x then it is a folder
+		if(f_method == "e"){
+			Folder = "7-Zip File Manager/tmp/" + f_rand + "/" + f_dir.replace(/^.*[\\\/]/, '');
+		}else if(f_method == "x"){
+			Folder = "7-Zip File Manager/tmp/" + f_rand + "/";
+		}
+	}
+	//console.log(f_rand + Folder);
+	if(ao_module_virtualDesktop){
+		if(f_method == "e"){
+			ao_module_openFile(Folder,"7-Zip Preview");
+		}else if(f_method == "x"){
+			ao_module_openPath(Folder);
+		}
+		ao_module_close();
+	}else{
+		if(f_method == "e"){
+			window.open("../" + Folder);
+		}else if(f_method == "x"){
+			window.open("../SystemAOB/functions/file_system/index.php?controlLv=2#../../../" + Folder);
+		}
+		setTimeout(function(){ts('#modal').modal('hide')},1500);
+	}
+}
+
+function f_convert(time){
+	var hours   = Math.floor(time / 3600);
+	var minutes = Math.floor((time - (hours * 3600)) / 60);
+	var seconds = time - (hours * 3600) - (minutes * 60);
+	
+	if(hours < 10){
+		var dhour  = "0" + hours;
+	}else{
+		var dhour  = hours;
+	}
+	
+	if(minutes < 10){
+		var dminutes  = "0" + minutes;
+	}else{
+		var dminutes  = minutes;
+	}
+
+	if(seconds < 10){
+		var dseconds  = "0" + seconds;
+	}else{
+		var dseconds  = seconds;
+	}
+	
+	if(!isNaN(hours) && !isNaN(minutes) && !isNaN(seconds)){
+		var formatted = dhour + ":" + dminutes + ":" + dseconds;
+	}else{
+		var formatted = "00:00:00";
+	}
+	return formatted;
+}
+
+function f_filesize(size){
+	if(size >= 1073741824){
+		return Math.floor(size/1073741824*100)/100 + "GB";
+	}else if(size >= 1048576){
+		return Math.floor(size/1048576*100)/100 + "MB";
+	}else if(size >= 1024){
+		return Math.floor(size/1024*100)/100 + "KB";
+	}else if(size > 0){
+		return size + "Bytes";
+	}
+}
+
+function msgbox(content,bgcolor,fontcolor){
+	$(".snackbar").attr("style",'background-color: ' + bgcolor + ';color:' + fontcolor);
+	ts('.snackbar').snackbar({
+		content: content,
+		onAction: () => {
+			$(".snackbar").removeAttr("style");
+		}
+	});
+}
+
+function f_close(){
+	if(ao_module_virtualDesktop){
+		ao_module_close();
+	}else{
+		setTimeout(function(){ts('#modal').modal('hide')},1500);
+	}
+}
+</script>
+</html>

+ 12 - 0
README.txt

@@ -0,0 +1,12 @@
+Extract 7z and others zip
+
+7za.exe (a = alone) is a standalone version of 7-Zip. 7za.exe supports only 7z, lzma, cab, zip, gzip, bzip2, Z and tar formats. 7za.exe doesn't use external modules.
+
+Troubleshoot:
+File can't unzipped
+> Try fix the permission
+sudo chmod 0777 7za_x86
+sudo chmod 0777 7za
+sudo chmod -R 0777 tmp
+sudo chown www-data:www-data 7za_x86
+sudo chown www-data:www-data 7za

+ 33 - 0
deltmp.php

@@ -0,0 +1,33 @@
+<?php
+include '../auth.php';
+?>
+<?php
+    $dirs = scandir("./tmp/");
+    foreach ($dirs as $dir){
+       $time = filectime("./tmp/".$dir) ;
+        if($time + 3600*3 <= time() && $dir !== ".." && $dir !== "."){
+            //echo "$dir Deleted.\r\n";
+            if(is_dir("./tmp/".$dir)){
+                rrmdir("./tmp/".$dir);
+            }else{
+                unlink("./tmp/".$dir);
+            }
+        }
+    }
+    echo "Completed.";
+
+//https://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
+ function rrmdir($dir) { 
+   if (is_dir($dir)) { 
+     $objects = scandir($dir); 
+     foreach ($objects as $object) { 
+       if ($object != "." && $object != "..") { 
+         if (is_dir($dir."/".$object))
+           rrmdir($dir."/".$object);
+         else
+           unlink($dir."/".$object); 
+       } 
+     }
+     rmdir($dir); 
+   } 
+ }

+ 1 - 0
description.txt

@@ -0,0 +1 @@
+7-Zip File Manager for ArOZ Online System

+ 8 - 0
embedded.php

@@ -0,0 +1,8 @@
+<?php
+include '../auth.php';
+if(isset($_GET["filepath"])){
+    header('Location: MainUI.php?file='.$_GET["filepath"]);
+}else{
+    header('Location: index.php');
+}
+?>

+ 11 - 0
getMessage.php

@@ -0,0 +1,11 @@
+<?php
+include_once("../auth.php");
+if (isset($_GET['id'])){
+	if (file_exists("tmp/" . $_GET['id'])){
+		echo file_get_contents("tmp/" . $_GET['id']);
+		exit(0);
+	}
+}else{
+	die("ERROR. unset id value for lookup.");
+}
+?>

BIN
img/function_icon.png


BIN
img/small_icon.png


+ 146 - 0
index.php

@@ -0,0 +1,146 @@
+<!--
+2019 AroZ 7-Zip
+-->
+<?php
+include '../auth.php';
+?>
+<?php
+if(isset($_GET["filepath"])){
+    header('Location: MainUI.php?file='.$_GET["filepath"]);
+}
+?>
+<html>
+<head>
+<title>ArOZ 7z</title>
+<meta charset="UTF-8">
+<link rel="stylesheet" href="../script/tocas/tocas.css">
+<script src="../script/tocas/tocas.js"></script>
+<script src="../script/jquery.min.js"></script>
+</head>
+<body>
+<br><br><br><br><br>
+<div class="ts text container">
+<div id="maindiv" class="ts segment">
+	<div id="first" class="ts top attached tabbed menu">
+		<a class="active item" data-tab="Premission">Premission</a>
+		<a class="item" data-tab="License">License</a>
+	</div>
+	<div data-tab="Premission" class="ts active bottom attached tab segment">
+		<h4><i class="caution sign icon"></i>ArOZ Module Warning</h4>
+		<h6>Module Directory: 7-Zip File Manager</h6>
+		<p>This function might need Serval permission.
+		<br>If you proceed to the module, it means you have agreed to give the module the following permissions:</p>
+		<div class="ts secondary segment">
+			<p><i class="checkmark icon"></i>Read data into ArOZ Directory</p>
+			<p><i class="checkmark icon"></i>Write data into ArOZ Directory</p>
+			<p><i class="checkmark icon"></i>Create File Assoications</p>
+			<p><i class="checkmark icon"></i>Execute shell script on server</p>
+		</div>
+		<p>ArOZ Online BETA System cannot ensure your data is secured during the connection.
+		<br>Please use this module with your own risk.
+		</p>
+	</div>
+	<div data-tab="License" class="ts bottom attached tab segment">
+		<h4>Module License</h4>
+		<div class="ts horizontal form">
+			<div class="field" style="padding-left: 0 !important">
+				<textarea rows="19">  7-Zip
+  ~~~~~
+  License for use and distribution
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+  7-Zip Copyright (C) 1999-2018 Igor Pavlov.
+
+  The licenses for files are:
+
+    1) 7z.dll:
+         - The "GNU LGPL" as main license for most of the code
+         - The "GNU LGPL" with "unRAR license restriction" for some code
+         - The "BSD 3-clause License" for some code
+    2) All other files: the "GNU LGPL".
+
+  Redistributions in binary form must reproduce related license information from this file.
+
+  Note:
+    You can use 7-Zip on any computer, including a computer in a commercial
+    organization. You don't need to register or pay for 7-Zip.
+
+
+  GNU LGPL information
+  --------------------
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You can receive a copy of the GNU Lesser General Public License from
+    http://www.gnu.org/
+
+
+
+
+  BSD 3-clause License
+  --------------------
+
+    The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
+    That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
+    that also uses the "BSD 3-clause License":
+
+    ----
+    Copyright (c) 2015-2016, Apple Inc. All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    1.  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+    2.  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
+        in the documentation and/or other materials provided with the distribution.
+
+    3.  Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+    ----
+
+
+
+
+  unRAR license restriction
+  -------------------------
+
+    The decompression engine for RAR archives was developed using source
+    code of unRAR program.
+    All copyrights to original unRAR code are owned by Alexander Roshal.
+
+    The license for original unRAR code has the following restriction:
+
+      The unRAR sources cannot be used to re-create the RAR compression algorithm,
+      which is proprietary. Distribution of modified unRAR sources in separate form
+      or as a part of other software is permitted, provided that it is clearly
+      stated in the documentation and source comments that the code may
+      not be used to develop a RAR (WinRAR) compatible archiver.
+
+
+  --
+  Igor Pavlov</textarea>
+			</div>
+		</div>
+	</div>
+</div>
+</div>
+</body>
+<script>
+ts('.tabbed.menu .item').tab();
+</script>
+</html>

+ 47 - 0
infoUI.php

@@ -0,0 +1,47 @@
+<?php
+include '../auth.php';
+$useSystemProperties = file_exists("../SystemAOB/functions/file_system/properties.php");
+if ($useSystemProperties){
+    header("Location: " . "../SystemAOB/functions/file_system/properties.php?filename=" . realpath($_GET["file"]));
+}
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+	<script src="../script/jquery.min.js"></script>
+    <link rel="stylesheet" href="../script/tocas/tocas.css">
+	<script type='text/javascript' src="../script/tocas/tocas.js"></script>
+	<script type='text/javascript' src="../script/ao_module.js"></script>
+	<title>7z File Manager</title>
+	<style>
+	body{
+		background-color:white
+	}
+	.ts.form .inline.field label {
+		min-width: 50%;
+	}
+	.ts.basic.dropdown, .ts.form select {
+		max-width: 50%;
+	}
+	</style>
+</head>
+<body>
+<br>
+	<div class="ts container">
+		<h3>File information</h3>
+		<br>File name: <?php echo $_GET["file"];?>
+		<br>File size: <?php echo filesize($_GET["file"]);?>b
+		<br><button class="ts basic button" style="width:45%" onclick="f_close()">Cancel</button>
+	</div>
+</body>
+<script>
+function f_close(){
+	if(ao_module_virtualDesktop){
+		ao_module_close();
+	}else{
+		ts('#modal').modal('hide');
+	}		
+}
+</script>
+</html>

BIN
install/template/background.png


+ 63 - 0
install/template/template.php

@@ -0,0 +1,63 @@
+<html>
+<head>
+	<link rel="stylesheet" href="../../../script/tocas/tocas.css">
+	<script src="../../../script/tocas/tocas.js"></script>
+	<script src="../../../script/jquery.min.js"></script>
+	<script src="../../../script/ao_module.js"></script>
+	<style>
+	body {
+		overflow-y:hidden;
+	}
+	.header{
+		position: absolute;
+		font-size: 20px;
+		top: 30%;
+		left: 5%;
+	}
+	.subheader{
+		position: absolute;
+		top: 50%;
+		left: 5%;
+	}
+	</style>
+</head>
+<body>
+	<div class="ts grid">
+		<div class="sixteen wide column" style="height:16%;overflow:hidden">
+			<img src="background.png" style="height:auto;width:100%">
+			<div class="header">7-Zip File Manager</div>
+			<div class="subheader">Powered by ArOZ</div>
+		</div>
+		<div class="sixteen wide column" style="height:60%;overflow:hidden">
+			<div style="width:90%;left:5%">
+				<table class="ts sortable large table">
+					<thead>
+						<tr>
+							<th>Item</th>
+							<th>Value</th>
+						</tr>
+					</thead>
+					<tbody>
+						<tr>
+							<td>Package name</td>
+							<td>7-Zip File Manager</td>
+						</tr>
+					</tbody>
+				</table>
+			</div>
+		</div>
+		</div>
+		<div id="menubar" style="overflow:hidden;position: absolute;bottom: 3%;width:100%">
+			<div class="ts section divider"></div>
+			<div class="ts separated buttons" style="float: right;right:5%">
+				<button class="ts positive basic button">Next</button>
+				<button class="ts negative basic button">Cancel</button>
+			</div>
+		</div>
+</body>
+<script>
+if(ao_module_virtualDesktop){
+	$("#menubar").css("bottom","8%");
+}
+</script>
+</html>

+ 119 - 0
opr.php

@@ -0,0 +1,119 @@
+<?php
+include '../auth.php';
+?>
+<?php
+/*
+|-----------------------------|
+| 77777     ZZZZZ IIIII PPPPP |
+|     7         Z   I   P   P |
+|    7    -    Z    I   PPPP  |
+|   7         Z     I   P     |
+|  7        ZZZZZ IIIII P     |
+|-----------------------------|
+Yes ! This is an 7Zip logo
+*/
+$rand = $_GET["rand"];
+
+if(!isset($_GET["method"])){
+	die('["Method Error"]');
+}
+/*
+if(!isset($_GET["rand"])){
+	die('["Rand Error"]');
+}
+if(!isset($_GET["file"])){
+	die('["File Error"]');
+}
+*/
+if(strcasecmp(substr(PHP_OS, 0, 3), 'WIN') == 0){
+    $executions = "7za";
+	foreach ($_GET as $key => $value) {
+		$_GET[$key] = preg_replace('/\//', '\\', $value);
+	}
+}else{
+	if(strpos(exec('uname -m'), 'arm') !== false){
+		$executions = "LANG=\"en_HK.UTF-8\" && "."./7za";
+	}else{
+		$executions = "LANG=\"en_HK.UTF-8\" && "."./7za_x86";
+	}
+}
+
+if($_GET["method"] == "ListAORDir"){
+	$result = [];
+	$dir = $_GET["dir"] !== "" ?  "../".$_GET["dir"]."/" : "../";
+	$data = scandir($dir,1);
+	array_pop($data); // this two use for remove .. and .
+	array_pop($data);
+	foreach($data as $value){
+		if(is_dir($dir.$value)){
+			array_push($result,$value);
+		}
+	}
+	echo json_encode($result);
+	
+}else if($_GET["method"] == "l"){
+	$filesnumber = -1;
+	$FileInformation = [];
+	$SevenZHeader = [];
+	exec($executions.' l "'.$_GET["file"].'" -ba -slt',$output);
+	//   echo $_GET["dir"];
+	if($_GET["dir"] !== ""){
+		$dir = $_GET["dir"];
+	}else{
+		$dir = ".";
+	}
+	
+		//* Special designed handler for ZIP (use for show folder)
+		if(pathinfo($_GET["file"])['extension'] == "zip"){
+			for($i = 0;$i < sizeOf($output);$i++){
+				preg_match_all('/(.*[^=]) = (.*)/', $output[$i], $tmp);
+				if(isset($tmp[1][0])){
+					if($tmp[1][0] == "Path" && pathinfo($tmp[2][0])["dirname"] !== "."){
+						if(!in_array("Path = ".pathinfo($tmp[2][0])["dirname"],$output)){
+							array_push($output,"Path = ".pathinfo($tmp[2][0])["dirname"]);
+							array_push($output,"Attributes = D");
+							array_push($output,"");
+						}
+					}
+				}
+			}
+		}
+
+	//print_r($output);
+	for($i = 0;$i < sizeOf($output);$i++){
+		preg_match_all('/(.*[^=]) = (.*)/', $output[$i], $tmp);
+		if(isset($tmp[1][0])){
+			if($tmp[1][0] == "Path"){
+				$currDir = pathinfo($tmp[2][0])["dirname"];
+				if($currDir == $dir){
+					$filesnumber += 1;
+				}
+			}
+			if($tmp[1][0] !== NULL && $currDir == $dir){
+				$FileInformation[$filesnumber][$tmp[1][0]] = $tmp[2][0];
+				if(!in_array($tmp[1][0],$SevenZHeader)){
+					array_push($SevenZHeader,$tmp[1][0]);
+				}
+			}
+		}
+	}
+	
+	if(strcasecmp(substr(PHP_OS, 0, 3), 'WIN') == 0){
+		for($i = 0;$i < sizeOf($FileInformation);$i++){
+			$FileInformation[$i] = preg_replace('/\\\\/', '/', $FileInformation[$i]);
+		}
+	}
+	echo json_encode(array("Header" => $SevenZHeader,"Information" => $FileInformation));
+
+}else if($_GET["method"] == "e"){
+	$rand = $_GET["rand"];
+	mkdir('tmp/'.$rand,0777);
+	system($executions.' e -bsp1 -bso0 "'.$_GET["file"].'" "'.$_GET["dir"].'" -o"tmp/'.$rand.'/" > tmp/'.$rand.'messages',$output);
+	//echo './'.$executions.' e -bsp1 -bso0 "'.$_GET["file"].'" "'.$_GET["dir"].'" -o"tmp/'.$rand.'/" > tmp/'.$rand.'messages';
+	echo json_encode(array("Extract finished. e"));
+}else if($_GET["method"] == "x"){
+	$rand = $_GET["rand"];
+	mkdir('tmp/'.$rand,0777);
+	system($executions.' x -bsp1 -bso0 "'.$_GET["file"].'" "'.$_GET["dir"].'" -o"tmp/'.$rand.'/" > tmp/'.$rand.'messages',$output);
+	echo json_encode(array("Extract finished. x"));
+}