forked from michalc/PDW-File-Browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_content.php
More file actions
100 lines (89 loc) · 4.55 KB
/
view_content.php
File metadata and controls
100 lines (89 loc) · 4.55 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
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
<?php
require_once('functions.php');
if(isset($_REQUEST["ajax"])){
$selectedpath = urldecode($_REQUEST["path"]);
if($selectedpath = checkpath($selectedpath, $uploadpath)){
$dirs = getDirTree(DOCUMENTROOT.$selectedpath, true, false);
} else {
die('0||'.translate("The folder path was tampered with!"));
}
} else {
$selectedpath = $uploadpath;
}
print '<ul id="content" class="files">'."\n";
$htmlFiles = '';
$htmlFolders = '';
foreach($dirs as $key => $value){
if($value != "folder"){
if(strtolower($value) == "png" || strtolower($value) == "jpg" || strtolower($value) == "jpeg" || strtolower($value) == "gif" || strtolower($value) == "bmp"){
$filename = DOCUMENTROOT.$selectedpath.$key;
$image_info = getimagesize($filename);
$file_modified = date($datetimeFormat, filemtime($filename));
$file_size = filesize($filename);
$file_size = $file_size < 1024 ? $file_size. ' '.translate('bytes') : $file_size < 1048576 ? number_format($file_size / 1024, 2, $dec_seperator, $thousands_separator) . ' '.translate('kB') : number_format($file_size / 1048576, 2, $dec_seperator, $thousands_separator) . ' '.translate('MB');
$htmlFiles .= sprintf(' <li>
<a href="%1$s" title="%2$s" class="image">
<span class="begin"></span>
<span class="filename">%2$s</span>
<span class="filetype"><span class="label">%8$s:</span> %9$s</span>
<span class="filedim"><span class="label">%5$s:</span> %6$s x %7$s</span>
<span class="filemodified"><span class="label">%12$s:</span> %13$s</span>
<span class="filesize"><span class="label">%10$s:</span> %11$s</span>
<span class="icon image"><img src="phpthumb/phpThumb.php?h=32&w=32&src=%4$s&far=1" /></span>
</a>
</li>' . "\n",
$selectedpath.$key,
$key,
$value,
urlencode($selectedpath.$key),
translate("Dimensions"),
$image_info[0],
$image_info[1],
translate("Filetype"),
$image_info['mime'],
translate("Size"),
$file_size,
translate("Modified on"),
$file_modified);
} else {
$filename = DOCUMENTROOT.$selectedpath.$key;
$file_modified = date($datetimeFormat, filemtime($filename));
$file_size = filesize($filename);
$file_type = mime_content_type($filename);
$file_size = $file_size < 1024 ? $file_size. ' '.translate('bytes') : $file_size < 1048576 ? number_format($file_size / 1024, 2, $dec_seperator, $thousands_separator) . ' '.translate('kB') : number_format($file_size / 1048576, 2, $dec_seperator, $thousands_separator) . ' '.translate('MB');
$htmlFiles .= sprintf(' <li>
<a href="%1$s" title="%2$s" class="file">
<span class="begin"></span>
<span class="filename">%2$s</span>
<span class="filetype"><span class="label">%4$s:</span> %5$s</span>
<span class="filemodified"><span class="label">%8$s:</span> %9$s</span>
<span class="filesize"><span class="label">%6$s:</span> %7$s</span>
<span class="icon %3$s"></span>
</a>
</li>' . "\n",
$selectedpath.$key,
$key,
$value,
translate("Filetype"),
$file_type,
translate("Size"),
$file_size,
translate("Modified on"),
$file_modified);
}
} else {
$htmlFolders .= sprintf(' <li>
<a href="%1$s" title="%2$s" class="folder">
<span class="begin"></span>
<span class="filename">%2$s</span>
<span class="icon folder"></span>
</a>
</li>' . "\n",
$selectedpath.$key."/",
$key);
}
}
print $htmlFolders;
print $htmlFiles;
print ' </ul>'."\n";
?>