#!/usr/bin/perl # # REF: resooconf.pl # ResooSite v.0.9.6 -(p)Resoo 2002-2004 # (c)2004 - pascal blain / GNU GPL - General Public License # http://www.resoo.com/resoosite # pascal@resoo.org # require "resoocnf.pl"; require "resoourl.pl"; ######## configuration du site ######## $domain = "$server/$dir"; $domainreal = "/$dir"; $domaincgi = "$domain/cgi-bin"; $domaincgireal = "$domainreal/cgi-bin"; $private = "private"; $dir_i = "img"; $dir_img = "../img"; $dir_img2 = "../img"; $dir_image = "$dir_img/images"; $dir_cadre = "$dir_img/cadre"; $dir_fond = "$dir_img2/fond"; $dir_lettr = "$dir_img2/lettr/$lettr"; $ext_lettr = ".gif"; $dir_dujour = "$dir_img/jour"; $dir_txt = "../txt"; $dir_template = "templates"; $defaut_template1 = "resoopao.pl"; $defaut_template2 = "resoopaoindex.pl"; $defautcadre = "cadre.gif"; # dans rep cadre $defaut_cadre = "$dir_img/resoo/cadre.gif"; $defautimage = "image.jpg"; # dans rep dujour $defaut_image = "$dir_img/resoo/image.jpg"; $dir_comp = "../cmp"; $dir_bbs = "../bbs"; $dir_rep = "doc"; $dir_opt1 = ""; $dir_opt2 = ""; $dir_opt3 = ""; $defautretour = "1"; $retour_su = "resooindex.pl?$defautretour"; if (!$teletitre){$teletitre = "Téléchargement";} if ($bbsretour) { $retourbbs = $bbsretour; ## lien pour un retour externe } else { $retourbbs = $retour_su; } if ($sign){ $signature = $sign; } else{ open(SIGN,"$dir_img/resoo/signature"); $signature = ; close(SIGN); } ######## configuration mise en page ######## if ($image_fond) { $background = "$dir_fond/$image_fond"; } else { $background = ""; } $police = "$police1,$police2"; if (!$coul_ban) {$coul_ban = $couleur_fond;} if (!$coul_cad) {$coul_cad = $couleur;} if (!$coul_cel) {$coul_cel = $couleur_fond;} if (!$coul_col) {$coul_col = $couleur;} if (!$couleurb) {$couleurb = $couleur;} if (!$couleurc) {$couleurc = $couleur;} if (!$couleurd) {$couleurd = $couleur;} if (!$coul_bbslien) {$coul_bbslien = $coul_lien;} if (!$coul_bbslien_vu) {$coul_bbslien_vu = $coul_lien_vu;} if (!$coul_bbslien_actif) {$coul_bbslien_actif = $coul_lien_actif;} if (!$puce0){$printpuce0 = " \;o \;<\/strong>";} ## resoo html (défaut) if (!$puce1){$printpuce1 = " \;o \;<\/strong>";} ## page index (1) if (!$puce2){$printpuce2 = " \;ø\; \;<\/strong>";} ## page index (2) if (!$puce3){$printpuce3 = " \;ø\; \;<\/small><\/strong>";} ## rep if (!$puce4){$printpuce4 = " \;Ø\; \;<\/strong>";} ## breves if (!$puce5){$printpuce5 = " \;o \;<\/strong>";} ## page link ######## usine à tag ######## $body2 = ""; $body = ""; $font = ""; $fontlien = ""; $font_ban = ""; $font_cad = ""; $font_cel = ""; $font_col = ""; $finfont = ""; $fontpetite = ""; $fontpetite_ban = ""; $fontpetite_cad = ""; $fontpetite_cel = ""; $fontpetite_col = ""; $finfontpetite = ""; $fontgrande = ""; $fontgrande_ban = ""; $fontgrande_cad = ""; $fontgrande_cel = ""; $fontgrande_col = ""; $finfontgrande = ""; $fontstitre = ""; $fontstitre_ban = ""; $fontstitre_cad = ""; $fontstitre_cel = ""; $fontstitre_col = ""; $finfontstitre = ""; $fonttitre = ""; $fonttitre_ban = ""; $fonttitre_cad = ""; $fonttitre_cel = ""; $fonttitre_col = ""; $finfonttitre = ""; $fontcouleurb = ""; $fontcouleurc = ""; $fontcouleurd = ""; $finfontcouleur = ""; ## tag body spécifique forum: $body_bbs2 = ""; $body_bbs = ""; ######## mise en page spécifique affichage ######### if ($template) { $usetemplate1=$dir_template."/resoopao".$template.".pl"; $usetemplate2=$dir_template."/resooindex".$template.".pl"; } else { $usetemplate1=$defaut_template1; $usetemplate2=$defaut_template2; } require "$usetemplate1"; require "$usetemplate2"; sub foot { print "\n"; print " \n"; print " \n"; print " \n"; print "
\n"; print "
\n"; print " $font\n"; print "$signature\n"; print " $finfont\n"; print "
\n"; print "\n"; print "\n"; print "\n"; } sub head { print "\n"; print "\n"; print "$titre\n"; print "$body\n"; if ($marge_haut) { print "\"\"
"; } print "
\n"; print "\n"; print " \n"; print " \n"; print " \n"; print "
\n"; print "
"; if ($bandeau) { print "\"\""; } else { print "$fonttitre_ban$title$finfonttitre"; } print "
\n"; print "
\n"; } ######## configuration spécifique forum ######## if (!$forumtitre){$forumtitre = "Forum";} $bbslink = "resoobbs.pl"; $bbsadminlink = "resooboardadmin.pl"; $mesgdir = "../bbs/message"; $mesgdirtmp = "../bbs/mess"; $ext1 = "txt"; $ext2 = "top"; $datafile = "data.txt"; $datafiletmp = "data2.txt"; $faqfile = "faq"; ######## routines communes ######## sub resoocrypt { $input = $_[0]; my $sel = "PX"; my $chaine_cryptee = crypt($input,$sel); return($chaine_cryptee); } sub hidden { print "\n"; print "\n"; print "\n"; } sub creer_comp { open(COMP,">$dir_comp/$page.cmp"); print COMP "1"; close(COMP); } sub get_comp { open(NUMBER,"$dir_comp/$page.cmp"); $comp = ; close(NUMBER); } sub incr_comp { $comp++; $PAGENUMB = "$dir_comp/$page.cmp"; if ((($comp == 1) and (!(-e $PAGENUMB))) or ($comp > 1)) { open(NUM,">$dir_comp/$page.cmp") || die $!; print NUM "$comp"; close(NUM); } } sub get_numb { $PAGENUMB = "$dir_comp/page.cmp"; if (!(-e $PAGENUMB)){open(NEW,"> $PAGENUMB");print NEW "1";close(NEW); } open(PAGE,"$PAGENUMB"); $numb = ; close(PAGE); $numb++; open(NUMPAGE,">$PAGENUMB") || die $!; print NUMPAGE "$numb"; close(NUMPAGE); } #sub maj_date_old { # &get_date; # open(INDEX,"$dir_txt/$retour.idx"); # @index = ; # close(INDEX); # open(INDEX,">$dir_txt/$retour.idx") || die $!; # foreach $line (@index) { # if ($line =~ /(\d{2})\/(\d{2})\/(\d{4})/) { # $_=$line; # s/(\d{2})\/(\d{2})\/(\d{4})/$date/; # print INDEX "$_"; # } # else { # print INDEX "$line"; # } # } # close(INDEX); #} ### revision 0.9.5.2-2 sub maj_date { &get_date; open(INDEX,"$dir_txt/$retour.idx"); @index = ; close(INDEX); open(INDEX,">$dir_txt/$retour.idx") || die $!; if (@index[9]>0){ ## ce n'est pas une page index @index[3]="$date\n"; } else{ ## page index @index[1]="$date\n"; } foreach $line (@index) { print INDEX "$line"; } close(INDEX); } sub get_date { # calcule l'heure locale à partir de l'heure locale du serveur $time2 = time() + ( 60 * 60 * 0 ); # changer 0 en 7 pour 7 heures de plus @days = ('dimanche','lundi','mardi','mercredi','jeudi','vendredi','samedi'); @months = ('janvier','fevrier','mars','avril','mai','juin','juillet', 'aout','septembre','octobre','novembre','decembre'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime($time2))[0,1,2,3,4,5,6]; if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour < 10) { $hour = "0$hour"; } $month = ($mon + 1); if ($month < 10) { $month = "0$month"; } if ($mday < 10) { $mday = "0$mday"; } if ($year > 0) { $year += 1900; } $date = "$mday/$month/$year"; $date_mois = "$mday $months[$mon] $year"; $date_heure = "$mday/$months/$year à $hour\:$min"; $heure = "$hour\:$min"; $date_long = "$days[$wday] $mday $months[$mon] $year"; $date_tres_long = "$mday $months[$mon], $year à $hour\:$min\:$sec"; } sub renomme { $renew =~ s/\n//; ## Removes \n $renew = lc($renew); ## lowercase it $renew =~ s/\%20/ /g; ## Converts netscape screwup to a _ $renew =~ s/\(//g; ## Removes ( $renew =~ s/\)//g; ## Removes ) $renew =~ s/\[//g; ## Removes [ $renew =~ s/\]//g; ## Removes ] $renew =~ s/\{//g; ## Removes { $renew =~ s/\}//g; ## Removes } $renew =~ s/\#//g; ## Removes # $renew =~ s/\!//g; ## Removes ! $renew =~ s/\~//g; ## Removes ~ $renew =~ s/\"//g; ## Removes " $renew =~ s/\'/ /g; ## Converts ' to space $renew =~ s/^-//g; ## Remove - at beginning $renew =~ s/^_//g; ## Remove _ at beginning $renew =~ s/^\.//g; ## Remove . at beginning $renew =~ s/-*-/-/g; ## Shorten 2 or more -- to 1 - $renew =~ s/_*_/_/g; ## Shorten 2 or more __ to 1 _ $renew =~ s/_/ /g; ## Converts _ to space $renew =~ s/-/ /g; ## Converts - to space $renew =~ s/\&/\+/g; ## Clean up & for easier use in unix $renew =~ s/\ *\ /\ /g; ## Shorten 2 or more space to 1 space } sub unword { $renew =~ s/\r//g; ## Removes \r (retour charriot) $renew =~ s/\%20/ /g; ## Converts netscape screwup to a _ my $aposinv = chr(145); $renew =~ s/$aposinv/\'/g; ## Converts word ' (ascii) my $apos = chr(146); $renew =~ s/$apos/\'/g; ## Converts word ' (ascii) my $guill = chr(148); $renew =~ s/$guill/\"/g; ## Converts word " (ascii) my $guillinv = chr(147); $renew =~ s/$guillinv/\"/g; ## Converts word " (ascii) my $edanslo = chr(189); $renew =~ s/$edanslo/oe/g; ## Converts word oe (ascii) my $pointsusp = chr(133); $renew =~ s/$pointsusp/\.\.\./g; ## Converts word ... (ascii) my $pourcent = chr(37); $renew =~ s/$pourcent/\%/g; ## Converts word % (ascii) my $euro = chr(164); $renew =~ s/$euro/EUR/g; ## Converts word euro (html) my $demi = "½"; $renew =~ s/$demi/1\/2/g; ## Converts word 1/2 (ascii) my $dbllt = "<<"; $renew =~ s/$dbllt/<\;<\;/g; ## Converts << (html) } sub ctrlline { chomp($renew); $renew =~ s/\r//g; $renew =~ s/\n/ /g; ##### a voir: controle du nombre de caractères } sub resoohtml { if ($renew =~ /^\(>[\S+\s\S+]+/) { $renew =~ s/\>/>\;/g; $renew =~ s/\--/g; $renew =~ s/--\(>\;/
/g;
	$renew =~ s/<>--/<\/pre>/g;
    }
    else {
        if (($renew =~ /^\[\]\S/) or ($renew =~ /^\[\] \S/)){
	    $renew =~ s/\[\] /\[\]/;
	    $car2 = substr($renew, 0, 3);
	    $car2=~s/\[\]//;
	    $car2=~tr/A-Z/a-z/;
	    if (-e "$dir_lettr/$car2$ext_lettr") {
		$car2= "
"; } else { $car2=~tr/a-z/A-Z/; } $renew =~ s/^\[\]\S/\+\+\+\+$car2\+\+\+\+/; } &resoohtml2; if ($renew == "---"){ $renew =~ s/---\n/
/; } if ($renew =~ /\*\*/){ $renew =~ s/\*\*/$printpuce0/g; # $renew =~ s/\n/
/; } $renew =~ s/^<>\+[\S+\s\S+]+/--$&<>\+--/; $renew =~ s/--<>\+/
/; $renew =~ s/<>\+--/<\/strong><\/big><\/div>/g; $renew =~ s/^<>[\S+\s\S+]+/--$&<>--/; $renew =~ s/--<>/
/; $renew =~ s/^>>[\S+\s\S+]+/--$&<>--/; $renew =~ s/-->>/
/; $renew =~ s/<>--/<\/div>/g; $renew =~ s/^\(\)\+[\S+\s\S+]+/--$&\(\)\+--/g; $renew =~ s/--\(\)\+/
$fontgrande_cad/; $renew =~ s/^\(\)<>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\)<>/
$font_cad/; $renew =~ s/^\(\)>>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\)>>/
$font_cad/; $renew =~ s/^\(\)[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\)/
$font_cad/; $renew =~ s/^\)\)\+[\S+\s\S+]+/--$&\(\)\+--/g; $renew =~ s/--\)\)\+/
$fontgrande_cel/; $renew =~ s/^\)\)<>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\)\)<>/
$font_cel/; $renew =~ s/^\)\)>>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\)\)>>/
$font_cel/; $renew =~ s/^\)\)[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\)\)/
$font_cel/; $renew =~ s/^\(\(\+[\S+\s\S+]+/--$&\(\)\+--/g; $renew =~ s/--\(\(\+/
$fontgrande_col/; $renew =~ s/^\(\(<>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\(<>/
$font_col/; $renew =~ s/^\(\(>>[\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\(>>/
$font_col/; $renew =~ s/^\(\([\S+\s\S+]+/--$&<>--/g; $renew =~ s/--\(\(/
$font_col/; $renew =~ s/\n\(\)\+--/<\/big>$finfontgrande<\/td><\/tr><\/table>/g; $renew =~ s/\n<>--/$finfont<\/td><\/tr><\/table>/g; $renew =~ s/\n/
/; } } sub resoohtml2 { if ($renew =~ /\+\+[\S+\s\S+]+\+\+/){ ### $testtag = 1; while ($renew =~ /\+\+\+\+/){ if ($testtag%2){$renew =~ s/\+\+\+\+//;} else {$renew =~ s/\+\+\+\+/<\/big><\/big><\/big>/;} $testtag++; } $renew =~ s/\+\+\+\+//; ### $testtag = 1; while ($renew =~ /\+\+\+/){ if ($testtag%2){$renew =~ s/\+\+\+//;} else {$renew =~ s/\+\+\+/<\/big><\/big>/;} $testtag++; } $renew =~ s/\+\+\+//; ### $testtag = 1; while ($renew =~ /\+\+/){ if ($testtag%2){$renew =~ s/\+\+//;} else {$renew =~ s/\+\+/<\/big>/;} $testtag++; } $renew =~ s/\+\+//; } if ($renew =~ /\-\-[\S+\s\S+]+\-\-/){ ### $testtag = 1; while ($renew =~ /\-\-\-\-/){ if ($testtag%2){$renew =~ s/\-\-\-\-//;} else {$renew =~ s/\-\-\-\-/<\/small><\/small><\/small>/;} $testtag++; } $renew =~ s/\-\-\-\-//; ### $testtag = 1; while ($renew =~ /\-\-\-/){ if ($testtag%2){$renew =~ s/\-\-\-//;} else {$renew =~ s/\-\-\-/<\/small><\/small>/;} $testtag++; } $renew =~ s/\-\-\-//; ### $testtag = 1; while ($renew =~ /\-\-/){ if ($testtag%2){$renew =~ s/\-\-//;} else {$renew =~ s/\-\-/<\/small>/;} $testtag++; } $renew =~ s/\-\-//; } if ($renew =~ /\*\S+\@\S+\*/){ $renew =~ s/\*\S+\@\S+\*/$&<\/a>/g; $renew =~ s/\:\*/\:/g; $renew =~ s/\*\"/\"/g; $renew =~ s/>\*/\>/g; $renew =~ s/\*$&<\/a>/gi; $renew =~ s/\*ftp:\S+\*/$&<\/a>/gi; $renew =~ s/\"\*/\"/g; $renew =~ s/\*\"/\"/g; $renew =~ s/>\*/\>/g; $renew =~ s/\*/g; $renew =~ s/\*\[http://g; $renew =~ s/\|/\">/g; } if ($renew =~ /\*\S+\*/){ $renew =~ s/\*\S+\*/$&<\/a>/g; $renew =~ s/\"\*\./\"\./g; $renew =~ s/\"\*\//\"\//g; $renew =~ s/\"\*/\"http\:\/\//g; $renew =~ s/\*\"/\"/g; $renew =~ s/>\*/\>/g; $renew =~ s/\*$&<\/a>\ \;\]/g; $renew =~ s/\[\[\[//g; $renew =~ s/\]\]\]//g; if ($renew =~ /\[\[\/\S+\]\]/){ $renew =~ s/\[\[\S+\]\]//g; $renew =~ s/\[\[\//\//g; } else { $renew =~ s/\[\[\S+\]\]//g; $renew =~ s/\/\[\[/\//g; } $renew =~ s/\|>\]\]\"/\" align=\"right\" border=0 alt=\"image\"/g; $renew =~ s/\|<\]\]\"/\" align=\"left\" border=0 alt=\"image\"/g; $renew =~ s/\|\.\]\]\"/\" align=\"middle\" border=0 alt=\"image\"/g; $renew =~ s/\|\^\]\]\"/\" align=\"top\" border=0 alt=\"image\"/g; $renew =~ s/\]\]\"/\" border=0 alt=\"image\"/g; # $renew =~ s/>\*/\>/g; # $renew =~ s/\*/;} else {$renew =~ s/\'\'\'\'/<\/u>/;} $testtag++; } } $renew =~ s/\'\'\'\'//; ### if ($renew =~ /\'\'\'[\S+\s+]+\'\'\'/){ my $testtag = 1; while ($renew =~ /\'\'\'/){ if ($testtag%2){$renew =~ s/\'\'\'//;} else {$renew =~ s/\'\'\'/<\/i>/;} $testtag++; } } $renew =~ s/\'\'\'//; ### if ($renew =~ /\'\'[\S+\s+]+\'\'/){ my $testtag = 1; while ($renew =~ /\'\'/){ if ($testtag%2){$renew =~ s/\'\'//;} else {$renew =~ s/\'\'/<\/strong>/;} $testtag++; } } $renew =~ s/\'\'//; } sub logutil { my $log = $_[0]; open(LOGUTIL,">>$private/util.log") || die $!; print LOGUTIL "$log\n"; close(LOGUTIL); chmod 0600, "$private/util.log"; } sub delogutil { my $log = $_[0]; open(LOGUTIL,"$private/util.log") || die $!; @logutil = ; close(LOGUTIL); open(LOGUTIL,">$private/util.log") || die $!; foreach $line(@logutil) { unless ($line =~ /^$log$/) { print LOGUTIL $line; } } close(LOGUTIL); chmod 0600, "$private/util.log"; } #$gui_su=0; #$gui_control=1; sub linkutil { open(MAINLINK,"$dir_txt/$page.txt") || die $!; @mainlink = ; close(MAINLINK); # $GUI=1; # $link_space=0; # $linkRsort=0; # $linkSsort=$linkRsort; # $linkLsort=2; @Tsort=(); @Ssort=(); @Lsort=(); @TRsort=(); @TSsort=(); @TLsort=(); $linkRlast=0; $linkSlast=0; $debuglink=0; foreach $line (@mainlink) { @line=split(/\|/,$line); # au premier passage je récupère les liens sans parent, # et par commodité: les sous rubriques sans parent, et toutes les rubriques ###>>> les liens SANS sous-rubrique & SANS rubrique (0|0) if ((!@line[0]) and (!@line[1])){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; chomp($newline); push(@Lsort,$newline); ## table lien temp push(@TLsort,$newline); ## table lien total } ### les sous rubriques SANS rubrique (0|X|..) if ((!@line[0]) and (@line[2] eq "..")){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; chomp($newline); push(@Ssort,$newline); ## table sous-rubrique temp push(@TSsort,$newline); ## table sous-rubrique total if (@line[1]>$linkSlast){$linkSlast=@line[1];} } ### toutes les rubriques (X|0|.) if ((!@line[1]) and (@line[2] eq ".")){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; push(@TRsort,$newline); ## table rubrique total --- complète if (@line[0]>$linkRlast){$linkRlast=@line[0];} } } if (!$linkLsort){@Lsort = sort(@Lsort);} if ($linkLsort==2){@Lsort = reverse(@Lsort);} foreach $Lline(@Lsort) { push(@Tsort,$Lline); ## intégration définitive (après tri) } if (!$linkSsort){@Ssort = sort(@Ssort);} if ($linkSsort==2){@Ssort = reverse(@Ssort);} ###>>> les sous-rubriques sans parent et les liens rattachés foreach $Sline(@Ssort) { push(@Tsort,$Sline); ## intégration définitive (après tri) @Lsort=(); @Sline=split(/\|/,$Sline); foreach $line (@mainlink) { @line=split(/\|/,$line); ### pour intégration les liens rattachés SANS rubrique (0|X|non..) if ((!@line[0]) and (@line[1]==@Sline[2]) and (@line[2] ne (".."))){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; chomp($newline); push(@Lsort,$newline); ## table lien temp push(@TLsort,$newline); ## table lien total } } if (!$linkLsort){@Lsort = sort(@Lsort);} if ($linkLsort==2){@Lsort = reverse(@Lsort);} foreach $Lline(@Lsort) { push(@Tsort,$Lline); ## intégration définitive (après tri) } } if (!$linkRsort){@TRsort = sort(@TRsort);} if ($linkRsort==2){@TRsort = reverse(@TRsort);} ###>>> les rubriques foreach $Rline (@TRsort) { push(@Tsort,$Rline); ## intégration définitive (après tri) ## print " R ".$Rline."\n"; @Lsort=(); @Ssort=(); @Rline=split(/\|/,$Rline); foreach $line (@mainlink) { @line=split(/\|/,$line); ### par commodité les sous-rubriques rattachées (X|X|..) if ((@line[0]==@Rline[1]) and (@line[1]) and (@line[2] eq "..")){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; push(@Ssort,$newline); ## table sous-rubrique temp push(@TSsort,$newline); ## table sous-rubrique total --- complète if (@line[1]>$linkSlast){$linkSlast=@line[1];} } ### pour intégration les liens rattachés SANS sous-rubrique (X|0|non..) if ((@line[0]==@Rline[1]) and (!@line[1]) and (@line[2] ne ("."))){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; chomp($newline); push(@Lsort,$newline); ## table lien temp push(@TLsort,$newline); ## table lien total } } if (!$linkLsort){@Lsort = sort(@Lsort);} if ($linkLsort==2){@Lsort = reverse(@Lsort);} foreach $Lline(@Lsort) { push(@Tsort,$Lline); ## intégration définitive (après tri) } if (!$linkSsort){@Ssort = sort(@Ssort);} if ($linkSsort==2){@Ssort = reverse(@Ssort);} ### pour intégration les sous-rubriques rattachées foreach $Sline(@Ssort) { push(@Tsort,$Sline); ## intégration définitive (après tri) @Lsort=(); @Sline=split(/\|/,$Sline); foreach $line (@mainlink) { @line=split(/\|/,$line); ## pour intégration les liens rattachés AVEC sous-rubrique (X|X|non..) if ((@line[0]==@Sline[1]) and (@line[1]==@Sline[2]) and (@line[2] ne (".."))){ $newline = @line[3]."\|".@line[0]."\|".@line[1]."\|".@line[2]."\|".@line[4]; chomp($newline); push(@Lsort,$newline); ## table lien temp push(@TLsort,$newline); ## table lien total --- complète } } if (!$linkLsort){@Lsort = sort(@Lsort);} if ($linkLsort==2){@Lsort = reverse(@Lsort);} foreach $Lline(@Lsort) { push(@Tsort,$Lline); ## intégration définitive (après tri) } } } ###>>> tri des tables totales if (!$linkLsort){@TLsort = sort(@TLsort);} if (!$linkSsort){@TSsort = sort(@TSsort);} if ($linkLsort==2){@TLsort = reverse(@TLsort);} if ($linkSsort==2){@TSsort = reverse(@TSsort);} ###>>> nb d'élément des tables $TRsort=@TRsort; $TSsort=@TSsort; $TLsort=@TLsort; $Tsort=@Tsort; if ($debuglink){ print "\n\n\n"; print "Les rubriques: ($TRsort) (last=$linkRlast)
\n"; foreach $line(@TRsort) { print " . ".$line."
\n"; } print "Les sous-rubriques: ($TSsort) (last=$linkSlast)
\n"; foreach $line(@TSsort) { print " . ".$line."
\n"; } print "Les liens: ($TLsort)
\n"; foreach $line(@TLsort) { print " . ".$line."
\n"; } print "La liste: ($Tsort)
\n"; foreach $line(@Tsort) { print " . ".$line."
\n"; } } } sub listage_rep { @listage_rep=(); my @unlistage_rep=("resoo","lettr","admin"); $fdir = "$dir_rep"; $adir = "../$dir_rep"; if ($_[0] ne '') { $adir = $_[0]; } if ($_[1] ne '') { $fdir = $_[1]; } push(@listage_rep,"$fdir"); &find_rep($adir,$fdir,@listage_rep); sub find_rep { my $dir = $_[0]; opendir(DIRREP, "$dir"); ###|| print "Can't opendir $dir: $!"; my @DIRREP=grep(!/^\.\.?$/, readdir DIRREP); closedir (DIRREP); foreach $line (@DIRREP) { $infofile = "$dir/$line"; ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($infofile); if ($mode < 20000) { $pdir = $dir; $pdir =~ s/$adir/$fdir/; if (!grep(/$line/, @unlistage_rep)) { push(@listage_rep,"$pdir/$line"); &find_rep("$dir/$line"); } } } } return(@listage_rep); } sub search_console3{ ## les console 1 et 2 font partie du script resoosearch my $search_mode = "-x"; return("
\n
\n \n \n \n
\n
\n "); } 1;