forked from gshstexsociety/gshstexsociety.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileList.php
103 lines (83 loc) · 2.17 KB
/
fileList.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<html>
<head>
<meta charset="UTF-8">
<title>자료 목록 - 경기과학고 텍 사용자협회</title>
</head>
<body>
<p>Click to expand...</p>
<p>차례로 입문서 / 예시코드 / 양식 / 파일모음집 </p>
<?php
echo "<p class=\"project-tagline\" style=\"font-size:0.67rem\">Last Updated:";
$updateinfo = file_get_contents("updated.txt");
echo $updateinfo;
echo "</p>";
?>
<?php
/*
function scan($dir){
$files=scandir($dir);
foreach($files as &$val){
if (is_dir($val)===true){
//scan($val);
echo $val, "\n";
}
else{
echo $val, "\n";
}
}
}*/
/*
function getDirContents($dir, &$results = array()){
$files = scandir($dir);
foreach($files as $key => $value){
$path = $dir.DIRECTORY_SEPARATOR.$value;
if(!is_dir($path)) {
$results[] = $path;
} else if($value != "." && $value != "..") {
getDirContents($path, $results);
$results[] = $path;
}
}
return $results;
}
$files=getDirContents(".");
echo "<ul>";
foreach ($files as $val){
if (strpos($val, '.git') !== false) {
}else{
echo "<li><a href=\"{$val}\">{$val}</a></li>\n";
}
}
echo "</ul>";*/
function getDirContentsR($dir){
$files = scandir($dir);
foreach($files as $key => $value){
$path = $dir.DIRECTORY_SEPARATOR.$value;
if ($value[0]==".") continue;
if(!is_dir($path)) { //File
$size=number_format(filesize($path)/1024/1024,3);
echo "<li><a href=\"{$path}\" >{$value} ({$size} MB)</a></li>\n";
} else if($value != "." && $value != "..") { //Directory
echo "<li><span class=\"Collapsable\">{$value}</span><ul>\n";
getDirContentsR($path);
echo "</ul></li>\n";
}
}
}
echo "<ul id=\"root\">";
getDirContentsR("files/");
echo "</ul>";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(".Collapsable").click(function () {
$(this).parent().children().toggle();
$(this).toggle();
});
$(".Collapsable").each(function(){
$(this).parent().children().toggle();
$(this).toggle();
});
</script>
</body>
</html>