'; menu('menu.txt'); echo ''; } echo ''; endtag(); function menu($name) { $handle = @fopen($name, 'r'); while(!feof($handle)) { $a = explode('@', fgets($handle, 4096)); echo ' ' . getcontent(rtrim($a[1]) . '/title.txt') . ' '; newIcon(filemtime(rtrim($a[1]))); if(!feof($handle)) echo '
'; } fclose($handle); } function create_header($paths, $type) { $nav = ''; $title = getcontent('title.txt'); $sitetitle = $title . ' : '; $description = ''; if(count($paths) == 0) { $sitetitle = ""; } else { $nav .= "" . $title . ""; $path = implode('/', $paths); if(file_exists($path . '/title.txt')) { $title = getcontent($path . '/title.txt'); } else { $title = $paths[count($paths) - 1]; } if($type != 'p' && file_exists($path . '/description.txt')) { $description = addpath(getcontent($path . '/description.txt'), $path); } if(isset($_GET['m']) && $_GET['m'] == 'p') { $description = ""; } for($i = 0; $i < count($paths) - 1; $i++) { $path2 = implode('/', array_slice($paths, 0, $i + 1)); $path3 = implode('/', array_slice($paths, 0, $i + 1)); if(file_exists($path3 . '/title.txt')) { $nav .= ' ► ' . eregi_replace("
", " | ", getcontent($path3 . '/title.txt')) . '
'; } else { $nav .= ' ► ' . $paths[$i] . ''; } } if(isset($_GET['m']) && $_GET['m'] != 'f') { $path2 = implode('/', $paths); if($_GET['m'] == 'p') { if(file_exists($paths[count($paths) - 1] . '/title.txt')) { $nav .= ' ► ' . getcontent($paths[count($paths) - 1] . '/title.txt') . ''; } else { $nav .= ' ► ' . $paths[count($paths) - 1] . ''; } $nav .= ' ► ' . $_GET['file']; $title = $_GET['file']; } else { if(file_exists($paths[count($paths) - 1] . '/title.txt')) { $nav .= ' ► ' . getcontent($paths[count($paths) - 1] . '/title.txt') . ''; } else { $nav .= ' ► ' . $paths[count($paths) - 1] . ''; } $nav .= ' ► ' . $_GET['m']; } } } headtag("0", "", "Study"); titletag($sitetitle . eregi_replace("
", " | ", $title)); echo '
'; echo '
' . $nav; echo (count($paths) > 1 ? '
':'') . ($description != "" ? '
' . $description . '
' : ''); } function photo($paths) { if(isset($_GET['m'])) { if($_GET['m'] == 'f') { photo_folder($paths); } else { photo_preview($paths, $_GET['m']); } } else { photo_display($paths); } } function photo_display($paths) { $path = implode('/', $paths); $path2 = implode('/', $paths); if(file_exists($path . '/folder.txt')) { photo_folder($paths); return; } $handle = opendir($path); $a = array(); while(false != ($file = readdir($handle))) { if(is_dir($path . '/'. $file) && $file != '.' && $file != '..') { array_push($a, $file); } } closedir($handle); if(count($a) && substr($a[0], 4, 1) != '_' && substr($a[0], 7, 1) != '_') { array_multisort($a, SORT_ASC); } else { array_multisort($a, SORT_DESC); } for($i = 0; $i < count($a); $i++) { echo '
'; if(file_exists($path . '/'. $a[$i] . '/title.txt')) { echo getcontent($path . '/'. $a[$i] . '/title.txt'); } else { echo $a[$i]; } newIcon(filemtime($path . '/' . $a[$i])); echo '
'; } } function photo_folder($paths) { $path = implode('/', $paths); $path2 = implode('/', $paths); if(file_exists($path . '/description.txt')) { echo addpath(getcontent($path . '/description.txt'), $path); echo '

'; } $handle = opendir($path . '/thumb'); $a = array(); while (false != ($file = readdir($handle))) { if ($file != 'Thumbs.db' && $file != '.' && $file != '..') { array_push($a, $file); } } closedir($handle); array_multisort($a, SORT_ASC); $_SESSION['images'] = array(); for($i = 0; $i < count($a); $i++) { echo ' '; array_push($_SESSION['images'], $a[$i]); } } function photo_preview($paths, $file) { $path = implode('/', $paths); $path2 = implode('/', $paths); $index = array_search($file, $_SESSION['images']); $next = ($index + 1) < count($_SESSION['images']); if($next) echo ''; echo ''; if(file_exists($path . '/extra')) { $n = 2; $ss = substr($file, 0, -4); $ee = substr($file, -4, 4); $efile = $ss . "-". $n . $ee; while(file_exists($path . '/extra/' . $efile)) { echo ''; $efile = $ss . "-". ++$n . $ee; } } if($next) echo ' '; echo "

"; if($index != 0 && count($_SESSION['images']) > 1 ) echo ''; if($next) echo ' '; } function files($paths) { $path = implode('/', $paths); $path2 = implode('/', $paths); $handle = opendir($path); $a = array(); $b = array(); $c = array(); while(false != ($file = readdir($handle))) { if( $file == 'Thumbs.db' || $file == '.' || $file == '..' || $file == 'stats' || strpos($file, '-private') ) ; else { $val = ($file == 'title.txt' || $file == 'description.txt' || strpos($file, '_hidden')); if(!$val) { if(is_dir($path . '/'. $file)) { array_push($a, $file); } else { if(strpos($file, '_.')) { array_push($c, $file); } if(!(strpos($file, '_.jpg') || strpos($file, '_.png') || strpos($file, '_.gif'))) { array_push($b, $file); } } } } } closedir($handle); sort($a); sort($b); sort($c); for($i = 0; $i < count($c); $i++) { if(strpos(strtolower($c[$i]), '.mp3')) { //echo '
'; } else if(strpos(strtolower($c[$i]), '.mp4')) { $tmp = explode('_', $c[$i]); $pix = $path . '/'. substr($c[$i], 0, -4) . "hidden.jpg"; $image = file_exists($pix) ? $pix:""; Video($path . '/' . $c[$i], $tmp[count($tmp) - 3], $tmp[count($tmp) - 2], $image); } else { echo '
'; } } for($i = 0; $i < count($a); $i++) { $title = ''; if(file_exists($path . '/'. $a[$i] . '/title.txt')) { $title = getcontent($path . '/'. $a[$i] . '/title.txt'); } else { $title = $a[$i]; } echo ''; if(file_exists($path . '/'. $a[$i] . '/direct.txt')) { echo ' ' . $title . ''; } else { echo ' ' . $title . ''; } newIcon(filemtime($path . '/' . $a[$i])); echo '
'; } echo '
    '; for($i = 0; $i < count($b); $i++) { $filename = $b[$i]; echo '
  • '; echo ''; echo ' ' . $filename . '' ; echo " 「" . format_file_size($path . '/' . $b[$i]) . "」 "; newIcon(filemtime($path . '/' . $b[$i])); echo '
  • '; } echo '
'; echo '
'; } function get_first_thumb($dir) { if(file_exists($dir . '.jpg')) { return $dir . '.jpg'; } $rfile = ''; $handle = opendir($dir . '/thumb/'); while (false != ($file = readdir($handle))) { if ($file != 'Thumbs.db' && $file != '.' && $file != '..') { $rfile = $file; break; } } closedir($handle); return $dir . '/thumb/' . $rfile; } function addpath($content, $path){ $s = " time()) { echo ' ' . date ( '; } } /**/ function headtag($title="", $path="", $from="") { echo ''; echo ''; echo ''; echo ''; echo ''; if($_GET['action'] == 'Audio' || $from == 'Study') { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo ''; if($title != "0") echo '' . $title . ''; } function titletag($title) { echo '' . $title . ''; } function format_file_size($file) { $arg = filesize($file); if ($arg > 0){ $j = 0; $ext = array(" bytes"," Kb"," Mb"," Gb"," Tb"); while ($arg >= pow(1024,$j)) ++$j; return round($arg / pow(1024,$j-1) * 100) / 100 . $ext[$j-1]; } else { return ""; } } function getcontent($file) { $contents = ''; $handle = fopen($file, "r"); $contents = fread($handle, filesize($file)); fclose($handle); return $contents; } function Video($f, $w, $h, $image) { echo ''; } ?>