Added a timeout for unlocked dir folders. Stays unlocked for aprox 3 minutes.
This commit is contained in:
parent
2398775229
commit
76ef1b813f
|
@ -1,14 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
$MEDIAPLAYER = "mpv ";
|
||||||
$MEDIAPLAYER = "mpv ";
|
$MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
|
||||||
$MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
|
$MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
|
||||||
$MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
|
$IMGVIEWER = "mirage";
|
||||||
$IMGVIEWER = "mirage";
|
$OFFICEPROG = "libreoffice";
|
||||||
$OFFICEPROG = "libreoffice";
|
$PDFVIEWER = "evince";
|
||||||
$PDFVIEWER = "evince";
|
$TEXTVIEWER = "leafpad";
|
||||||
$TEXTVIEWER = "leafpad";
|
$FILEMANAGER = "spacefm";
|
||||||
$FILEMANAGER = "spacefm";
|
$LOCKEDFOLDERS = "./dirLockCheck/";
|
||||||
$LOCKEDFOLDERS = "./dirLockCheck/";
|
$LOCKPASSWORD = "1234";
|
||||||
$LOCKPASSWORD = "1234";
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
// Start of retrieving dir data
|
// Start of retrieving dir data
|
||||||
|
|
|
@ -6,9 +6,14 @@
|
||||||
$LOCKS = explode("::::", $LOCKEDFOLDERS);
|
$LOCKS = explode("::::", $LOCKEDFOLDERS);
|
||||||
$size = sizeof($LOCKS);
|
$size = sizeof($LOCKS);
|
||||||
|
|
||||||
|
if ($_SESSION["unlockTime"] > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $size; $i++) {
|
for ($i = 0; $i < $size; $i++) {
|
||||||
if (strpos($NEWPATH, $LOCKS[$i]) !== false) {
|
if (strpos($NEWPATH, $LOCKS[$i]) !== false) {
|
||||||
if ($PASSWD == $LOCKPASSWORD) {
|
if ($PASSWD == $LOCKPASSWORD) {
|
||||||
|
$_SESSION["unlockTime"] = 60;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Start the session
|
// Start the session
|
||||||
session_start();
|
session_start();
|
||||||
|
include 'config.php';
|
||||||
|
|
||||||
if (isset($_SESSION["refreshState"])) {
|
if (isset($_SESSION["refreshState"])) {
|
||||||
$state = $_SESSION["refreshState"];
|
$state = $_SESSION["refreshState"];
|
||||||
|
@ -9,10 +10,16 @@
|
||||||
$_SESSION["refreshState"] = $state;
|
$_SESSION["refreshState"] = $state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_SESSION["unlockTime"])) {
|
||||||
|
$_SESSION["unlockTime"] += 1;
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-Type: text/event-stream');
|
header('Content-Type: text/event-stream');
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
echo "data:" . $state . "\n\n";
|
echo "data:" . $state . "\n\n";
|
||||||
|
|
||||||
$_SESSION["refreshState"] = "none";
|
$_SESSION["refreshState"] = "none";
|
||||||
|
$UNLOCKTIME = 0;
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue