Line | |
---|
1 | <?php
|
---|
2 | //
|
---|
3 | // jQuery File Tree PHP Connector
|
---|
4 | //
|
---|
5 | // Version 1.01
|
---|
6 | //
|
---|
7 | // Cory S.N. LaViska
|
---|
8 | // A Beautiful Site (http://abeautifulsite.net/)
|
---|
9 | // 24 March 2008
|
---|
10 | //
|
---|
11 | // History:
|
---|
12 | //
|
---|
13 | // 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
|
---|
14 | // 1.00 - released (24 March 2008)
|
---|
15 | //
|
---|
16 | // Output a list of files for jQuery File Tree
|
---|
17 | //
|
---|
18 | $root = '';
|
---|
19 | $_POST['dir'] = urldecode($_POST['dir']);
|
---|
20 |
|
---|
21 | if( file_exists($root . $_POST['dir']) ) {
|
---|
22 | $files = scandir($root . $_POST['dir']);
|
---|
23 | natcasesort($files);
|
---|
24 | if( count($files) > 2 ) { /* The 2 accounts for . and .. */
|
---|
25 | echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
|
---|
26 | // All dirs
|
---|
27 | foreach( $files as $file ) {
|
---|
28 | if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && is_dir($root . $_POST['dir'] . $file) ) {
|
---|
29 | echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "/\">" . htmlentities($file) . "</a></li>";
|
---|
30 | }
|
---|
31 | }
|
---|
32 | // All files
|
---|
33 | /*foreach( $files as $file ) {
|
---|
34 | if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && !is_dir($root . $_POST['dir'] . $file) ) {
|
---|
35 | $ext = preg_replace('/^.*\./', '', $file);
|
---|
36 | echo "<li class=\"file ext_$ext\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "\">" . htmlentities($file) . "</a></li>";
|
---|
37 | }
|
---|
38 | }*/
|
---|
39 | echo "</ul>";
|
---|
40 | }
|
---|
41 | }
|
---|
42 |
|
---|
43 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.