1 <?php |
|
2 if ( ! defined( 'ABSPATH' ) ) |
|
3 die(); |
|
4 if (!@include_once("auth.inc.php")) |
|
5 include_once("auth.inc.php"); |
|
6 |
|
7 if (!isset($_GET['sortby'])) $_GET['sortby'] = "filename"; |
|
8 if (!isset($_GET['order'])) $_GET['order'] = "asc"; |
|
9 if (function_exists('get_option') && get_option('wp_fileman_home') == '') |
|
10 { |
|
11 print "<div><h1><b><a href='admin.php?page=wpfileman' style='color:red;'>Please configure the Plugin</a></b></h1></div>"; |
|
12 } |
|
13 else |
|
14 { |
|
15 print "<div><h1><b>Wordpress FileManager</b></h1></div>"; |
|
16 } |
|
17 #else |
|
18 #{ |
|
19 # print get_option('wp_fileman_home'); |
|
20 # print "<br>".get_linked_path($wp_fileman_path,$base_url)."<br>".$wp_fileman_path."<br>".$base_url; |
|
21 #} |
|
22 print "<table class='menu' cellpadding=2 cellspacing=0>"; |
|
23 print "<tr>"; |
|
24 if ($AllowCreateFolder) print "<td align='center' valign='bottom'><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&action=create&type=directory'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/newfolder.gif' width=20 height=22 alt='$StrMenuCreateFolder' border=0> $StrMenuCreateFolder</a></td>"; |
|
25 if ($AllowCreateFile) print "<td align='center' valign='bottom'><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&action=create&type=file'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/newfile.gif' width=20 height=22 alt='$StrMenuCreateFile' border=0> $StrMenuCreateFile</a></td>"; |
|
26 if ($AllowUpload) print "<td align='center' valign='bottom'><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&action=upload'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/upload.gif' width=20 height=22 alt='$StrMenuUploadFiles' border=0> $StrMenuUploadFiles</a></td>"; |
|
27 if ($phpfm_auth) print "<td align='center' valign='bottom'><a href='$base_url&action=logout'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/logout.gif' width=20 height=22 alt='$StrMenuLogOut' border=0> $StrMenuLogOut</a></td>"; |
|
28 print "</tr>"; |
|
29 print "</table><br />"; |
|
30 |
|
31 print "<table class='index' cellpadding=0 cellspacing=0>"; |
|
32 print "<tr>"; |
|
33 print "<td class='iheadline' colspan=4 align='center' height=21>"; |
|
34 print "<font class='iheadline'>$StrIndexOf ".wp_fileman_get_linked_path($wp_fileman_path,$base_url)."</font>"; |
|
35 print "</td>"; |
|
36 print "</tr>"; |
|
37 print "<tr>"; |
|
38 print "<td> </td>"; |
|
39 print "<td class='fbborder' valign='top'>"; |
|
40 |
|
41 |
|
42 |
|
43 if ($open = @opendir($home_directory.$wp_fileman_path)) |
|
44 { |
|
45 for($i=0;($directory = @readdir($open)) != FALSE;$i++) |
|
46 if (is_dir($home_directory.$wp_fileman_path.$directory) && $directory != "." && $directory != ".." && !wp_fileman_is_hidden_directory($home_directory.$wp_fileman_path.$directory)) |
|
47 $directories[$i] = array($directory,$directory); |
|
48 closedir($open); |
|
49 |
|
50 if (isset($directories)) |
|
51 { |
|
52 sort($directories); |
|
53 @reset($directories); |
|
54 } |
|
55 } |
|
56 |
|
57 print "<table class='directories' width=250 cellpadding=1 cellspacing=0>"; |
|
58 print "<tr>"; |
|
59 print "<td class='bold' width=20> </td>"; |
|
60 print "<td class='bold'> $StrFolderNameShort</td>"; |
|
61 if ($AllowRename) print "<td class='bold' width=20 align='center'>$StrRenameShort</td>"; |
|
62 if ($AllowDelete) print "<td class='bold' width=20 align='center'>$StrDeleteShort</td>"; |
|
63 print "</tr>"; |
|
64 print "<tr>"; |
|
65 print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/folder.gif' width=20 height=22 alt='$StrOpenFolder' border=0></a></td>"; |
|
66 print "<td> <a href='$base_url'>.</a></td>"; |
|
67 print "<td width=20> </td>"; |
|
68 print "<td width=20> </td>"; |
|
69 print "</tr>"; |
|
70 print "<tr>"; |
|
71 print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode(dirname($wp_fileman_path)))."/'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/folder.gif' width=20 height=22 alt='$StrOpenFolder' border=0></a></td>"; |
|
72 print "<td> <a href='$base_url&path=".htmlentities(rawurlencode(dirname($wp_fileman_path)))."/'>..</a></td>"; |
|
73 print "<td width=20> </td>"; |
|
74 print "<td width=20> </td>"; |
|
75 print "</tr>"; |
|
76 if (isset($directories)) foreach($directories as $directory) |
|
77 { |
|
78 print "<tr>"; |
|
79 print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path.$directory[0]))."/'><img src='" .WP_CONTENT_URL . "/plugins/wp-filemanager/icon/folder.gif' width=20 height=22 alt='$StrOpenFolder' border=0></a></td>"; |
|
80 print "<td> <a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path.$directory[0]))."/'>".htmlentities($directory[0])."</a></td>"; |
|
81 if ($AllowRename) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&directory_name=".htmlentities(rawurlencode($directory[0]))."/&action=rename'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/rename.gif' width=20 height=22 alt='$StrRenameFolder' border=0></a></td>"; |
|
82 if ($AllowDelete) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&directory_name=".htmlentities(rawurlencode($directory[0]))."/&action=delete'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/delete.gif' width=20 height=22 alt='$StrDeleteFolder' border=0></a></td>"; |
|
83 print "</tr>"; |
|
84 } |
|
85 print "<tr><td colspan=4> </td></tr>"; |
|
86 print "</table>"; |
|
87 |
|
88 print "</td>"; |
|
89 print "<td> </td>"; |
|
90 print "<td valign='top'>"; |
|
91 |
|
92 |
|
93 |
|
94 if ($open = @opendir($home_directory.$wp_fileman_path)) |
|
95 { |
|
96 for($i=0;($file = @readdir($open)) != FALSE;$i++) |
|
97 if (is_file($home_directory.$wp_fileman_path.$file) && !wp_fileman_is_hidden_file($home_directory.$wp_fileman_path.$file)) |
|
98 { |
|
99 $icon = wp_fileman_get_icon($file); |
|
100 $filesize = filesize($home_directory.$wp_fileman_path.$file); |
|
101 $permissions = decoct(fileperms($home_directory.$wp_fileman_path.$file)%01000); |
|
102 $modified = filemtime($home_directory.$wp_fileman_path.$file); |
|
103 $extension = ""; |
|
104 $files[$i] = array( |
|
105 "icon" => $icon, |
|
106 "filename" => $file, |
|
107 "filesize" => $filesize, |
|
108 "permissions" => $permissions, |
|
109 "modified" => $modified, |
|
110 "extension" => $extension, |
|
111 ); |
|
112 } |
|
113 closedir($open); |
|
114 |
|
115 if (isset($files)) |
|
116 { |
|
117 @usort($files, "wp_fileman_compare_filedata"); |
|
118 @reset($files); |
|
119 } |
|
120 } |
|
121 |
|
122 print "<table class='files' width=500 cellpadding=1 cellspacing=0>"; |
|
123 print "<tr>"; |
|
124 print "<td class='bold' width=20> </td>"; |
|
125 print "<td class='bold'> <a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&sortby=filename&order=".wp_fileman_get_opposite_order("filename", $_GET['order'])."'>$StrFileNameShort</a></td>"; |
|
126 print "<td class='bold' width=60 align='center'><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&sortby=filesize&order=".wp_fileman_get_opposite_order("filesize", $_GET['order'])."'>$StrFileSizeShort</a></td>"; |
|
127 if ($AllowView) print "<td class='bold' width=20 align='center'>$StrViewShort</td>"; |
|
128 if ($AllowEdit) print "<td class='bold' width=20 align='center'>$StrEditShort</td>"; |
|
129 if ($AllowRename) print "<td class='bold' width=20 align='center'>$StrRenameShort</td>"; |
|
130 if ($AllowDownload) print "<td class='bold' width=20 align='center'>$StrDownloadShort</td>"; |
|
131 if ($AllowDelete) print "<td class='bold' width=20 align='center'>$StrDeleteShort</td>"; |
|
132 print "</tr>"; |
|
133 if (isset($files)) foreach($files as $file) |
|
134 { |
|
135 $file['filesize'] = wp_fileman_get_better_filesize($file['filesize']); |
|
136 $file['modified'] = date($ModifiedFormat, $file['modified']); |
|
137 |
|
138 print "<tr>"; |
|
139 print "<td width=20><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/".$file['icon']."' width=20 height=22 border=0 alt='$StrFile'></td>"; |
|
140 /* if ($ShowExtension) print "<td> ".htmlentities($file['filename'])."</td>"; |
|
141 else |
|
142 { |
|
143 $f_nm = explode('.',htmlentities($file['filename'])); |
|
144 print "<td><a title='" . $f_nm[0] . "'> " . $f_nm[0] . "</a></td>"; |
|
145 }*/ |
|
146 $f_nm = explode('.',htmlentities($file['filename'])); |
|
147 //print $f_nm[1]; |
|
148 print "<td> ".$f_nm[0]; |
|
149 if ($ShowExtension) print "." . $f_nm[1]; |
|
150 print "</td>"; |
|
151 print "<td width=60 align='right'>".$file['filesize']."</td>"; |
|
152 if ($AllowView && wp_fileman_is_viewable_file($file['filename'])) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=view&size=100'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/view.gif' width=20 height=22 alt='$StrViewFile' border=0></a></td>"; |
|
153 else if ($AllowView) print "<td width=20> </td>"; |
|
154 // echo get_option('siteurl'); /wp-admin/admin-ajax.php?action=choice&width=150&height=100" title="Choice" |
|
155 if ($AllowEdit && wp_fileman_is_editable_file($file['filename'])) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=edit'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/edit.gif' width=20 height=22 alt='$StrEditFile' border=0></a></td>"; |
|
156 // if ($AllowEdit && is_editable_file($file['filename'])) print "<td width=20><a href='" . get_option('siteurl') . "/wp-admin/admin-ajax.php?action=rename&width=150&hight=100' title='Choice'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/edit.gif' width=20 height=22 alt='$StrEditFile' border=0></a></td>"; |
|
157 else if ($AllowEdit) print "<td width=20> </td>"; |
|
158 if ($AllowRename) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=rename'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/rename.gif' width=20 height=22 alt='$StrRenameFile' border=0></a></td>"; |
|
159 // if ($AllowRename) print "<td width=20><a class='thickbox' href='" . get_option('siteurl') . "/wp-admin/admin-ajax.php?action=rename&width=355&height=120&page=" . htmlentities(rawurlencode($_GET['page'])) . "&filename=".htmlentities(rawurlencode($file['filename']))."' title='Rename File ".htmlentities(rawurlencode($file['filename']))."'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/rename.gif' width=20 height=22 alt='$StrRenameFile' border=0></a></td>"; |
|
160 // if ($AllowDownload) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=download'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/download.gif' width=20 height=22 alt='$StrDownloadFile' border=0></a></td>"; |
|
161 // if ($AllowDownload) print "<td width=20><a href='" . WP_PLUGIN_URL .'/' . str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) . "libfile.php?".SID."&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=download'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/download.gif' width=20 height=22 alt='$StrDownloadFile' border=0></a></td>"; |
|
162 if ($AllowDownload) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=download'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/download.gif' width=20 height=22 alt='$StrDownloadFile' border=0></a></td>"; |
|
163 if ($AllowDelete) print "<td width=20><a href='$base_url&path=".htmlentities(rawurlencode($wp_fileman_path))."&filename=".htmlentities(rawurlencode($file['filename']))."&action=delete'><img src='" . WP_CONTENT_URL . "/plugins/wp-filemanager/icon/delete.gif' width=20 height=22 alt='$StrDeleteFile' border=0></a></td>"; |
|
164 print "</tr>"; |
|
165 |
|
166 } |
|
167 print "<tr><td colspan=9> </td></tr>"; |
|
168 print "</table>"; |
|
169 |
|
170 |
|
171 print "</td>"; |
|
172 print "</tr>"; |
|
173 print "</table>"; |
|
174 ?> |
|