Improved locking options.

This commit is contained in:
Maxim Stewart 2019-03-28 15:26:12 -05:00
parent 0d7d799693
commit 10ff3f817f
6 changed files with 51 additions and 33 deletions

View File

@ -28,6 +28,7 @@
<input type="text" placeholder="Search..." onkeyup="searchPage(this)" name="" value=""> <input type="text" placeholder="Search..." onkeyup="searchPage(this)" name="" value="">
<button type="button" onclick="clearSearch()" title="Clears search..." >Clear Search</button> <button type="button" onclick="clearSearch()" title="Clears search..." >Clear Search</button>
<button onclick="getFavesList(); tgglElmView('favesList')">Faves List &#8597;</button> <button onclick="getFavesList(); tgglElmView('favesList')">Faves List &#8597;</button>
<button type="button" onclick="lockFolders()" title="Lock unlocked folders..." >Lock Unlocked Folders</button>
</h2> </h2>
<h2 id="fullPathHeader"> <h2 id="fullPathHeader">
@ -77,7 +78,7 @@
link.type = "text/css"; link.type = "text/css";
link.rel = "stylesheet"; link.rel = "stylesheet";
document.getElementsByTagName("head")[0].appendChild(link); document.getElementsByTagName("head")[0].appendChild(link);
}, 1500); }, 500);
} }
</script> </script>

View File

@ -224,6 +224,12 @@
border-color: rgb(255,255,255); border-color: rgb(255,255,255);
} }
.completionBar {
float:left;
clear:left;
height: 0.1em;
background-color: rgba(25, 125, 10, 1.0);
}
/* Hover events */ /* Hover events */
.dirTitle:hover, .dirTitle:hover,
@ -246,5 +252,5 @@
} }
.error { color: rgb(255, 0, 0); } .error { color: rgb(255, 0, 0); }
.warnning { color: rgb(255, 168, 0); } .warning { color: rgb(255, 168, 0); }
.success { color: rgb(136, 204, 39); } .success { color: rgb(136, 204, 39); }

View File

@ -1,6 +1,10 @@
let binary = null; let binary = null;
let pathNodes = []; let pathNodes = [];
const lockFolders = () => {
const data = "lockFolders=true";
doAjax("resources/php/lockedFolders.php", data);
}
const getDir = (query) => { const getDir = (query) => {
let formUlPth = document.getElementById("DIRPATHUL"); let formUlPth = document.getElementById("DIRPATHUL");

View File

@ -37,23 +37,18 @@ document.ondblclick = (event) => {
} else { } else {
showMedia(obj.children[1].value, "file"); showMedia(obj.children[1].value, "file");
} }
// If clicking on dir icon } else if (callingID === "dirID") { // If clicking on dir icon
} else if (callingID === "dirID") {
let node = obj.parentNode; let node = obj.parentNode;
getDir(node.children[1].value); getDir(node.children[1].value);
// If clicking on movie thumbnail } else if (callingID === "movieID") { // If clicking on movie thumbnail
} else if (callingID === "movieID") {
let node = obj.parentNode; let node = obj.parentNode;
showMedia(node.children[1].value, "video"); showMedia(node.children[1].value, "video");
// If clicking on file icon } else if (callingID === "fileID") { // If clicking on file icon
} else if (callingID === "fileID") {
let node = obj.parentNode; let node = obj.parentNode;
showMedia(node.children[1].value, "file"); showMedia(node.children[1].value, "file");
// If clicking on image } else if (callingID === "imageID") { // If clicking on image
} else if (callingID === "imageID") {
showMedia(obj.alt, "image"); showMedia(obj.alt, "image");
// If clicking on text title } else if (callingID === "titleID") { // If clicking on text title
} else if (callingID === "titleID") {
enableEdit(obj); enableEdit(obj);
} }
} }
@ -73,10 +68,7 @@ document.onkeydown = (event) => {
} }
} }
const setSelectedItem = (item) => { const setSelectedItem = (item) => { itemObj = item; }
// Get the item name
itemObj = item;
}
// Drage event for the poped out image and media container // Drage event for the poped out image and media container
const dragContainer = (elmnt) => { const dragContainer = (elmnt) => {

View File

@ -75,9 +75,9 @@ function uploadFiles($targetDir) {
if (file_exists($targetFile)) { if (file_exists($targetFile)) {
if (filetype($targetFile) == "file") { if (filetype($targetFile) == "file") {
unlink($targetFile); unlink($targetFile);
$message = "Server: [Warnning] --> This file already exists. Overwriting it."; $message = "Server: [Warning] --> This file already exists. Overwriting it.";
} else { } else {
$message = "Server: [Warnning] --> This file might be a directory. Or, no files were submitted for uploading."; $message = "Server: [Warning] --> This file might be a directory. Or, no files were submitted for uploading.";
$uploadOk = 0; $uploadOk = 0;
} }
} }
@ -85,14 +85,14 @@ function uploadFiles($targetDir) {
// Check file size // Check file size
$fileSize = $_FILES['filesToUpload']['size'][$i]; $fileSize = $_FILES['filesToUpload']['size'][$i];
if ($fileSize > 500000000000) { if ($fileSize > 500000000000) {
$message = "Server: [Warnning] --> This file is too large."; $message = "Server: [Warning] --> This file is too large.";
$uploadOk = 0; $uploadOk = 0;
} }
// Allow certain file formats // Allow certain file formats
// $ext = pathinfo($targetFile,PATHINFO_EXTENSION); // $ext = pathinfo($targetFile,PATHINFO_EXTENSION);
// if(!preg_match('/^.*\.(rar|iso|img|tar|zip|7z|7zip|jpg|jpeg|png|gif|mpeg|mov|flv|avi|mp4|webm|mpg|mkv|m4a|mp3|ogg|docx|doc|odt|txt|pdf|)$/i', strtolower($ext))) { // if(!preg_match('/^.*\.(rar|iso|img|tar|zip|7z|7zip|jpg|jpeg|png|gif|mpeg|mov|flv|avi|mp4|webm|mpg|mkv|m4a|mp3|ogg|docx|doc|odt|txt|pdf|)$/i', strtolower($ext))) {
// $message = "Server: [Warnning] --> This file type is not allowed."; // $message = "Server: [Warning] --> This file type is not allowed.";
// $uploadOk = 0; // $uploadOk = 0;
// } // }
@ -157,20 +157,14 @@ function remuxVideo($FILE) {
} }
} }
if (preg_match('(mkv)', $EXTNSN) === 1) { if (preg_match('(mkv)', $EXTNSN) === 1)
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -codec copy -strict -2 ' . $PTH . $HASHED_NAME; $COMMAND = 'ffmpeg -i "' . $FILE . '" -hide_banner -movflags +faststart -codec copy -strict -2 ' . $PTH . $HASHED_NAME;
shell_exec($COMMAND . " > /dev/null &"); if (preg_match('(avi)', $EXTNSN) === 1)
} $COMMAND = 'ffmpeg -i "' . $FILE . '" -hide_banner -movflags +faststart -c:v libx264 -crf 21 -c:a aac -b:a 192k -ac 2 ' . $PTH . $HASHED_NAME;
if (preg_match('(wmv)', $EXTNSN) === 1)
$COMMAND = 'ffmpeg -i "' . $FILE . '" -hide_banner -movflags +faststart -c:v libx264 -crf 23 -c:a aac -strict -2 -q:a 100 ' . $PTH . $HASHED_NAME;
if (preg_match('(avi)', $EXTNSN) === 1) { shell_exec($COMMAND . " 2> resources/vdata.txt");
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -c:v libx264 -crf 21 -c:a aac -b:a 192k -ac 2 ' . $PTH . $HASHED_NAME;
shell_exec($COMMAND . " > /dev/null &");
}
if (preg_match('(wmv)', $EXTNSN) === 1) {
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -c:v libx264 -crf 23 -c:a aac -strict -2 -q:a 100 ' . $PTH . $HASHED_NAME;
shell_exec($COMMAND . " > /dev/null &");
}
} }
$GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

View File

@ -22,4 +22,25 @@
} }
return false; return false;
} }
function lockFolders() {
session_start();
include 'serverMessenger.php';
if (isset($_SESSION["unlockTime"]) && $_SESSION["unlockTime"] > 0) {
$_SESSION["unlockTime"] = -1;
$message = "Server: [Success] --> Folders unlocked!";
serverMessage("success", $message);
} else {
$message = "Server: [Warning] --> Folders aren't unlocked!"
. "\n" . $_SESSION["unlockTime"];
serverMessage("warning", $message);
}
}
if (isset($_POST['lockFolders'])) {
lockFolders();
}
?> ?>