Trimming PHPSESSID from query as temp solution.

This commit is contained in:
Maxim Stewart 2018-04-22 02:11:11 -05:00
parent 84fcd61e9c
commit 7cc572b78d
2 changed files with 25 additions and 8 deletions

View File

@ -1,10 +1,17 @@
var pathNodes = []; // Path parts Could store a cookie to keep sessions var pathNodes = [];
function getDirSSE() { function getDirSSE() {
var path = ""; var path = "";
// Create path from array of items // Create path from array of items
for (pathNode of pathNodes) { path += pathNode; } for (pathNode of pathNodes) { path += pathNode; }
// For some reason, PHPSESSID= gets inserted when in sub dir.
// temp work arround is to trim it.
if (path.includes("PHPSESSID=")) {
path = path.split("; ").pop();
}
path = "dirQuery=" + path; path = "dirQuery=" + path;
process(path); process(path);
} }
@ -35,10 +42,20 @@ function getDir(query) {
} else { pathNodes.push(query); } // Add path } else { pathNodes.push(query); } // Add path
// Create path from array of items // Create path from array of items
for (pathNode of pathNodes) { path += pathNode; } // for (pathNode of pathNodes) { path += pathNode; console.log(pathNode); }
for (var i = 0; i < pathNodes.length; i++) {
path += pathNodes[i];
}
// For some reason, PHPSESSID= gets inserted when in sub dir.
// temp work arround is to trim it.
if (path.includes("PHPSESSID=")) {
path = path.split("; ").pop();
}
formULPTH.value = path; // Used when uploading a file formULPTH.value = path; // Used when uploading a file
path = "dirQuery=" + path; path = "dirQuery=" + path;
console.log("Path : " + path);
process(path); process(path);
} }

View File

@ -3,16 +3,16 @@
session_start(); session_start();
// Retrieve data // Retrieve data
function dirListing($PATH) { function dirListing($NEWPATH) {
if (is_dir($PATH)) { if (is_dir($NEWPATH)) {
$GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DIR_LIST>" $GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DIR_LIST>"
. "<PATH_HEAD>" . $PATH . "</PATH_HEAD>"; . "<PATH_HEAD>" . $NEWPATH . "</PATH_HEAD>";
$dirContents = scandir($PATH); $dirContents = scandir($NEWPATH);
foreach ($dirContents as $fileName) { foreach ($dirContents as $fileName) {
$fullPath = $PATH . $fileName; $fullPath = $NEWPATH . $fileName;
if (is_dir($PATH . $fileName)) { if (is_dir($NEWPATH . $fileName)) {
$GeneratedXML .= "<DIR>" . $fileName . "/</DIR>"; $GeneratedXML .= "<DIR>" . $fileName . "/</DIR>";
} elseif (preg_match('/^.*\.(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg|mp4|webm)$/i', strtolower($fileName))) { } elseif (preg_match('/^.*\.(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg|mp4|webm)$/i', strtolower($fileName))) {
$NAMEHASH = hash('sha256', $fileName); $NAMEHASH = hash('sha256', $fileName);