#!/usr/bin/perl # # REF: resooconf.pl # ResooSite v.0.9.6.6-3 -(p)Resoo 2002-2005 # (c)2005 - 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"; $police3 = "courier"; $retour_su = "resooindex.pl?$defautretour"; $space_vertical = "\"\""; $space_horizontal = "\"\""; if (!$teletitre){$teletitre = "Téléchargement";} if ($bbsretour) { $retourbbs = $bbsretour; ## lien pour un retour externe } else { $retourbbs = $retour_su; } if ($alignpara) { $alignP = $alignpara; ## alignement par defaut } else { $alignP = "justify"; } 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 = ""; $fontquote = "
"; $finfontquote = "
"; $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 "$space_vertical
"; } 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 _ $renew =~ s/�/ /g; ## 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 { ### format CODE if ($testtagcode) { if ($renew =~ /^\[\[FINCODE\]\]/) { $renew = "