Карта сайта\n";
} else {
print "
Site Map
\n";
}
flush();
function isHidden($name) {
$hidden = array(
"[#~]$",
"^\..*$"
);
$result = FALSE;
for($i=0; $i 0 ) {
return $fn;
}
}
return FALSE;
}
function NoIndexIn($dir) {
$fn = $dir."/NO-INDEX";
$fs = FileSize( $fn );
// print "\n";
if( ("$fs" != "") and ($fs >= 0) ) return TRUE;
return FALSE;
}
function NoDepthIn($dir) {
$fn = $dir."/NO-DEPTH";
$fs = FileSize( $fn );
// print "\n";
if( ("$fs" != "") and ($fs >= 0) ) return TRUE;
return FALSE;
}
function DescriptionIn($dir) {
global $Russian_OK;
$descr = $dir."/description";
if( $Russian_OK and (FileSize($descr.".ru") > 0) ) {
return $descr.".ru";
}
if( FileSize($descr) > 0 ) {
return $descr;
}
return FALSE;
}
function AbsToRel($name) {
$base = DocRoot();
return substr( $name, strlen($base) );
}
function Directory($pBase="") {
global $Russian_OK;
if( $pBase ) {
$base = $pBase;
} else {
$base = DocRoot();
}
//print "$base\n";
$d = dir( $base );
$files = array();
// print "
".($d->path)." (".($d->handle).")\n";
while( $e = $d->read() ) {
if( isHidden( $e ) ) continue;
$f = $d->path."/".$e;
$ft = FileType( $f );
if( $ft != "dir" ) continue;
if( NoIndexIn($f) ) continue;
$idx = IndexIn($f);
if( !$idx ) continue;
$files[$f] = $e;
}
$d->close();
kSort( $files );
while( list($f,$e) = each($files) ) {
// $f = $files[ $i ];
$ref = AbsToRel( $f );
$dsc = DescriptionIn($f);
if( $dsc ) $dsc = " -- ".implode("",File($dsc));
// print "- [$f] [$e]
".$e."$dsc\n";
print " - ".$e."$dsc\n";
if( NoDepthIn($f) ) continue;
print "
\n";
Directory( $f );
print "
\n";
}
}
print "\n";
Directory();
print "
\n";
Epilogue()?>