#!/usr/bin/perl # # REF: resooconf.pl # ResooSite v.0.9.5 -(p)Resoo 2002-2003 # (c)2003 - pascal blain / GNU GPL - General Public License # http://www.resoo.org/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_img = "../img"; $dir_img2 = "../img"; $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"; $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 ######### require "resoopao.pl"; 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 { &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); } 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>/){
	    $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<\/strong>/; } &resoohtml2; if ($renew == "---"){ $renew =~ s/---\n/
/; } if ($renew =~ /\*\*/){ $renew =~ s/\*\*/$printpuce0/; # $renew =~ s/\n/
/; } $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/--\(\)<>/
$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/--\)\)<>/
$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/--\(\(<>/
$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<>--/$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>/g; $renew =~ s/\"\*/\"/g; $renew =~ s/\*\"/\"/g; $renew =~ s/>\*/\>/g; $renew =~ s/\*$&<\/a>/g; $renew =~ s/\"\*/\"http\:\/\//g; $renew =~ s/\*\"/\"/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"; } 1;