|
|||||||||||||||||||
<?php
$type = $_GET['type']; // Dirs: 1 --- Books: 2
$dir = $_GET['dir'];
$books_path = '/home/church/public_html/Bible';
$folder_gif = '/main/images/books/folder.gif';
$book_gif = '/main/images/books/book.gif';
$dir = iconv('utf-8','windows-1256',$dir);
if($type==2)
$books_path = $books_path.'/'.$dir;
if ($handle = opendir($books_path)) {
$i = 0;
while (false !== ($file = readdir($handle))) {
$book = "$books_path/$file";
if ($file != "." && $file != "..") {
$ext = substr($file, strrpos($file, "."));
$filename = $file;
if(is_file($book))
$filename = substr($file , 0 , strrpos($file, ".") );
$filename = iconv("windows-1256", "UTF-8", $filename);
$tmp['name'] = $filename;
$tmp['book'] = $filename.$ext;
$tmp['stats'] = lstat($book);
$tmp['extension'] = $ext;
$files[$i++] = $tmp;
unset($tmp);
}
}
}
if($files){
ksort($files, SORT_STRING);
sort($files);
closedir($handle);
?>
|
||||||||||||
| <?php echo $files[$i++]['name'] ?> |