Added a timeout for unlocked dir folders. Stays unlocked for aprox 3 minutes.

This commit is contained in:
Maxim Stewart 2018-07-28 23:35:16 -05:00
parent 2398775229
commit 76ef1b813f
4 changed files with 22 additions and 13 deletions

View File

@ -1,14 +1,12 @@
<?php
$MEDIAPLAYER = "mpv ";
$MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
$MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
$IMGVIEWER = "mirage";
$OFFICEPROG = "libreoffice";
$PDFVIEWER = "evince";
$TEXTVIEWER = "leafpad";
$FILEMANAGER = "spacefm";
$LOCKEDFOLDERS = "./dirLockCheck/";
$LOCKPASSWORD = "1234";
$MEDIAPLAYER = "mpv ";
$MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
$MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
$IMGVIEWER = "mirage";
$OFFICEPROG = "libreoffice";
$PDFVIEWER = "evince";
$TEXTVIEWER = "leafpad";
$FILEMANAGER = "spacefm";
$LOCKEDFOLDERS = "./dirLockCheck/";
$LOCKPASSWORD = "1234";
?>

View File

@ -1,5 +1,4 @@
<?php
session_start();
// Start of retrieving dir data

View File

@ -6,9 +6,14 @@
$LOCKS = explode("::::", $LOCKEDFOLDERS);
$size = sizeof($LOCKS);
if ($_SESSION["unlockTime"] > 0) {
return false;
}
for ($i = 0; $i < $size; $i++) {
if (strpos($NEWPATH, $LOCKS[$i]) !== false) {
if ($PASSWD == $LOCKPASSWORD) {
$_SESSION["unlockTime"] = 60;
return false;
} else {
return true;

View File

@ -1,6 +1,7 @@
<?php
// Start the session
session_start();
include 'config.php';
if (isset($_SESSION["refreshState"])) {
$state = $_SESSION["refreshState"];
@ -9,10 +10,16 @@
$_SESSION["refreshState"] = $state;
}
if (isset($_SESSION["unlockTime"])) {
$_SESSION["unlockTime"] += 1;
}
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
echo "data:" . $state . "\n\n";
$_SESSION["refreshState"] = "none";
$UNLOCKTIME = 0;
flush();
?>