commit 440077eab025b1cc0b7b3ba5dd65105369d4cef3 Author: halgatewood Date: Mon Dec 28 12:10:29 2015 -0600 Load of cold diff --git a/index.php b/index.php new file mode 100644 index 0000000..c0066aa --- /dev/null +++ b/index.php @@ -0,0 +1,214 @@ + + + + + <?php echo $title; ?> + + + + + +

+
+"; + echo ""; + echo "
 
"; + echo "
\n"; + echo "
" . basename($file) . "
\n"; + echo "
Size: " . format_size($file) . "
Last modified: " . date("D. F jS, Y - h:ia", filemtime($file)) . "
\n"; + echo "
\n"; + echo "
\n"; + echo "
"; +} + + +// RECURSIVE FUNCTION TO BUILD THE BLOCKS +function build_blocks( $items, $folder ) +{ + global $ignore_file_list, $ignore_ext_list, $sort_by, $toggle_sub_folders; + $objects = array(); + $objects['directories'] = array(); + $objects['files'] = array(); + + foreach($items as $c => $item) + { + if( $item == ".." OR $item == ".") continue; + + // IGNORE FILE + if(in_array($item, $ignore_file_list)) { continue; } + + if( $folder ) + { + $item = "$folder/$item"; + } + + $file_ext = getFileExt($item); + + // IGNORE EXT + if(in_array($file_ext, $ignore_ext_list)) { continue; } + + // DIRECTORIES + if( is_dir($item) ) + { + $objects['directories'][] = $item; + continue; + } + + // FILE DATE + $file_time = date("U", filemtime($item)); + + // FILES + $objects['files'][$file_time . "-" . $item] = $item; + } + + foreach($objects['directories'] as $c => $file) + { + display_block( $file ); + + if($toggle_sub_folders) + { + $sub_items = (array) scandir( $file ); + if( $sub_items ) + { + echo "
"; + build_blocks( $sub_items, $file ); + echo "
"; + } + } + } + + // SORT BEFORE LOOP + if( $sort_by == "date_asc" ) { ksort($objects['files']); } + elseif( $sort_by == "date_desc" ) { krsort($objects['files']); } + elseif( $sort_by == "name_asc" ) { natsort($objects['files']); } + elseif( $sort_by == "name_desc" ) { arsort($objects['files']); } + + foreach($objects['files'] as $t => $file) + { + $fileExt = getFileExt($file); + if(in_array($file, $ignore_file_list)) { continue; } + if(in_array($fileExt, $ignore_ext_list)) { continue; } + display_block( $file ); + } +} + +// GET THE BLOCKS STARTED, FALSE TO INDICATE MAIN FOLDER +$items = scandir( dirname(__FILE__) ); +build_blocks( $items, false ); +?> + + + + + + + \ No newline at end of file