[Назад] [Главная] Карта сайта [Карта сайта] [Контакты]


#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser); use locale; use Fcntl; use Perlfect::Template; use File::Basename; use SDBM_File; { # block is for $1 not mantaining its value $0 =~ /(.*)\//; push @INC, $1 if $1; } require 'conf.pl'; my $query = new CGI; my (%docs_db, %titles_db, %url_db); tie (%docs_db, SDBM_File, $DOCS_DB_FILE, O_RDONLY, 0640) or die "Cannot open $DOCS_DB_FILE: $!"; tie (%titles_db, SDBM_File, $TITLES_DB_FILE, O_RDONLY, 0640) or die "Cannot open $TITLES_DB_FILE: $!"; %url_db = reverse %docs_db; print $query->header; print '

    '; print "
  • FERHRI home page
  • "; my %t; $oldlevel = 1; $olddir = '/'; for (sort { $a <=> $b } keys %docs_db) { ($fname, $dir, $ext) = fileparse($docs_db{$_}, '\.\w+'); $level=0; $show=1; foreach $l (split(/\//, $docs_db{$_})) { next if (!$l); $level=$level+1; if ($l eq $fname) {$show=0;} } if ($oldlevel<$level) {for($i=$oldlevel;$i<$level;$i++) {print "
      ";}} if ($oldlevel>$level) {for($i=$oldlevel;$i>$level;$i--) {print "
    ";}} if ($dir ne $olddir) { $t=$dir; $t =~ s/.*\/(.*)\/$/$1/i; print "
"; if ($level eq 2) {print $query->br;} print $query->li($query->a({href => $dir.$t.$ext}, $titles_db{$url_db{$dir.$t.$ext}})), "
    "; } if ($show ne 0) { print $query->li($query->a({href => $docs_db{$_}}, $titles_db{$_})); } $oldlevel=$level; $olddir=$dir; } print '
';


[Назад] [Главная]