"; if (isset($_GET['d']) ) { $ikonmappa=_ICONFOLDER; echo "
".$_GET['d']."
"; $GLOBALS['idnum'] = 0; $GLOBALS['van']=false; $tree=array(); if ($_GET['d'] == "") { $target_dir =""; } else { $target_dir = _MAINDIR."/". $_GET['d']; } $tree=getDirectory($target_dir); $type='asc'; if (is_array($tree)) { getSort($tree); listArr($tree, $target_dir); } else echo _ERROR_INVALID_DIR; } else { print "

Képnéző

"; } /** -- Függvények -- **/ function listArr($arr, $parent_dir = ".", $pd = 0) { $ignore = array( 'kepex.txt', '.', '..' ); $i=0; $padding = $pd; // + "px"; if (is_array($arr)) { foreach($arr as $a => $b) { if (array_key_exists('children', $b)) { if ($GLOBALS['van']){ $GLOBALS['van']=false; } $dir = $b['dirname']; $current_dir = $parent_dir."/".$dir; $idir = $GLOBALS['idnum']."-".$dir; echo ""; echo "".$dir."
"; echo "
"); } else { if ($b['filename'] != null) { $file = $b['filename']; if (!$GLOBALS['van']){ /** A van változó tárolja, hogy volt-e már listázás, és csak egyszer hajtja végre ezt a részt **/ $GLOBALS['van']=true; $fokonyvtar=_MAINDIR; //a teljes elérési útvonal elején lévő MAINDIR levágása, elrejtése, hogy csak a település menjen át kódolva $alkonyvtar=substr($parent_dir,strlen($fokonyvtar)); echo "
"; } } } } } else { echo("Error"); } $GLOBALS['idnum']++; } function getDirectory( $path = '.'){ $ignore = array( 'tmp', 'cgi-bin', '.', '..' ); if (is_dir($path)) { $dh = @opendir( $path ); //nem ír ki hibákat, nincs ellenőrzés $j=0; $temp=array(); while( false !== ( $file = readdir( $dh ) ) ){ if( !in_array( $file, $ignore ) ){ if( is_dir( "$path/$file" ) ){ $temp[$j]['dirname']=$file; $temp[$j]['children']=getDirectory( "$path/$file"); } else { $temp[$j]['filename']=$file; } } $j++; } return $temp; closedir( $dh ); } } function getSort(&$temp) { global $type; if (is_array($temp)) { sort($temp); foreach($temp as &$t) { if(array_key_exists('children', $t) && is_array($t['children'])) getSort($t['children']); } } } $lapozo=_ALBUM; echo "
"; ?>