-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfileclass_backend.php
More file actions
32 lines (26 loc) · 1.41 KB
/
fileclass_backend.php
File metadata and controls
32 lines (26 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Cache-Control: no-cache, no-store, must-revalidate");
require_once("dbroconf.php");
foreach ($db_ro_confs as $conf) {
if ($_GET["fs"] == $conf["fs"]) {
$conn = new mysqli($conf["host"], $conf["user"], $conf["pass"], $conf["db"]);
$fileclasssql = "SELECT id FROM ENTRIES WHERE ENTRIES.fileclass LIKE BINARY '%" . $_GET["page"] . "_files%' AND ENTRIES.uid LIKE BINARY '" . $_GET["owner"] . "'";
$outp = "[";
$fileclassresult = $conn->query($fileclasssql) or trigger_error($conn->error."[$fileclasssql]");
while($fileclassrs = $fileclassresult->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$mdsql = "SELECT this_path(parent_id,name) AS path, size, uid AS owner, gid AS gr_name FROM ENTRIES LEFT JOIN NAMES ON ENTRIES.id=NAMES.id WHERE ENTRIES.id='" . $fileclassrs["id"] . "'";
$mdresult = $conn->query($mdsql) or trigger_error($conn->error."[$mdsql]");
$mdrs = $mdresult->fetch_array(MYSQLI_ASSOC);
$outp .= '{"File":"' . str_replace($conf["rootid"], $conf["fs"], $mdrs["path"]) . '",';
$outp .= '"Size":' . (is_null($mdrs["size"]) ? 0 : $mdrs["size"]) . ',';
$outp .= '"Owner":"' . $mdrs["owner"] . '",';
$outp .= '"Group":"' . $mdrs["gr_name"] . '"}';
}
$outp .= "]";
echo($outp);
}
}
?>