-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetAppList.php
More file actions
51 lines (46 loc) · 1.75 KB
/
getAppList.php
File metadata and controls
51 lines (46 loc) · 1.75 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
header("Access-Control-Allow-Origin: *");
$dir = "./DIRECTORY"; //path
$list = array(); //main array
if(!isset($_GET['query'])){
$query="";
}
$query = $_GET['query'];
if(is_dir($dir)){
if($dh = opendir($dir)){
while(($file = readdir($dh)) != false){
if($file == "." or $file == ".." ){
//...
} else { //create object with two fields
if($query!==""){
if(strstr(strtolower($file), strtolower($query)) == TRUE){
$list3 = array(
'file' => $file,
'size' => filesize($file));
if($_GET["type"]=="all"){
array_push($list, $list3);
}else{
if(file_get_contents("./DIRECTORY/".$file."/type")==$_GET['type']){
array_push($list, $list3);
}
}
}
}else{
$list3 = array(
'file' => $file,
'size' => filesize($file));
if($_GET["type"]=="all"){
array_push($list, $list3);
}else{
if(file_get_contents("./DIRECTORY/".$file."/type")==$_GET['type']){
array_push($list, $list3);
}
}
}
}
}
}
$return_array = array('files'=> $list);
echo json_encode($return_array);
}
?>