-
Notifications
You must be signed in to change notification settings - Fork 50
/
getdir.php
81 lines (68 loc) · 1.87 KB
/
getdir.php
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
if ( isset($_POST["useajax"]) && $_POST["useajax"]==="geticons" ) {
$useajax = true;
if ( isset($_POST["skin"]) ) {
$skin = $_POST["skin"];
} else {
$skin = "skin-housepanel";
}
if ( isset($_POST["path"]) ) {
$icondir = $_POST["path"];
} else {
$icondir = "icons";
}
} else {
$useajax = false;
if ( isset($_GET["skin"]) ) {
$skin = $_GET["skin"];
} else {
$skin = "skin-housepanel";
}
if ( isset($_GET["path"]) ) {
$icondir = $_GET["path"];
} else {
$icondir = "icons";
}
}
// change over to where our icons are located
$savedir = getcwd();
// chdir($skin);
$activedir = $skin . "/" . $icondir . "/";
$dirlist = scandir($activedir);
if ( $useajax ) {
// $showdir = $icondir . "/";
$showdir = $activedir;
} else {
$showdir = $activedir;
}
$allowed = array("png","jpg","jpeg","gif");
$tc = "";
foreach ($dirlist as $filename) {
if (!is_dir($filename)) {
$parts = pathinfo($filename);
$ext = $parts['extension'];
$froot = $parts['basename'];
if ( in_array($ext, $allowed) ) {
$tc.= '<div class="cat Local_Storage">';
$fullname = $showdir . rawurlencode($filename);
$tc.= "<img src=\"$fullname\" class=\"icon\" title=\"$froot\" />";
$tc.= "</div>";
}
}
}
// change back
// chdir($savedir);
// report results
if ( $useajax ) {
echo $tc;
} else {
echo '<!DOCTYPE html>';
echo "<html><head><title>HousePanel Icon List</title>";
echo "<link id=\"tileeditor\" rel=\"stylesheet\" type=\"text/css\" href=\"tileeditor.css\"/>";
echo "</head><body>";
echo "<div class='test'><h2>HousePanel Icons</h2>";
echo "<h3>skin = $skin</h3>";
echo "<h3>icondir = $icondir</h3>";
echo $tc;
echo "</div></body></html>";
}