#!/usr/bin/perl # # ResooSite v.0.9.3 - Resoo 2002-2003 # resooconf.pl # 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"; ######## configuration spécifique 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"; ######## configuration mise en page ######## if ($image_fond) { $background = "$dir_fond/$image_fond"; } else { $background = ""; } $police = "$police1,$police2"; ######## configuration du script ######## $body = ""; $font = ""; $finfont = "<\/FONT>"; $fontpetite = ""; $finfontpetite = "<\/I><\/FONT>"; $fontpetite_i = ""; $finfontpetite_i = "<\/FONT>"; $fontgrande = ""; $finfontgrande = "<\/B><\/I><\/FONT>"; $fontstitre = ""; $finfontstitre = "<\/B><\/FONT>"; $fonttitre = ""; $finfonttitre = "<\/B><\/FONT>"; ######## affichage configuration du site ######## sub debug{ print "Content-type: text/html\n\n"; print "\n"; print "Configuration du site\n"; print "Configuration du site :

\n\n"; print "
\n\n"; print "couleur texte standard : exemple de couleur$finfont

\n"; print "couleur des lien : exemple de couleur$finfont

\n"; print "couleur des lien vu : exemple de couleur$finfont

\n"; print "couleur des lien actif: exemple de couleur$finfont

\n"; print "format de texte standard 1 : $font exemple de texte 1$finfont

\n"; print "
\n\n"; print "\n"; print "\n"; } ######## 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 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 "$titre\n"; print "$body\n"; print "
\n"; print "\n"; print " \n"; print " \n"; print " \n"; print "
\n"; print "
"; if ($bandeau) { print ""; } else { print "$fonttitre$title$finfonttitre"; } print "
\n"; print "
\n"; } sub creer_comp { open(COMP,">$dir_comp/$page.cmp"); print COMP "0"; close(COMP); } sub get_comp { open(NUMBER,"$dir_comp/$page.cmp"); $comp = ; close(NUMBER); } sub incr_comp { $comp++; 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(156); $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(128); $renew =~ s/$euro/\&\#128\;/g; ## Converts word euro (html) my $demi = chr(189); $renew =~ s/$demi/1\/2/g; ## Converts word 1/2 (ascii) } 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"; }