#!/usr/bin/perl ############################################################################## # Forum v 2.8 # lst mod: send mail ############################################################################## # Define Variables $basedir = "/home/stephm69/public_html/kayakdemer/wwwboard"; $homedir ="/home/stephm69/public_html/kayakdemer"; $filter_dir = "/home/stephm69/public_html/filter"; $mailprog = '|/usr/sbin/sendmail -t'; $docsdir = "/home/stephm69/public_html/kayakdemer/docs"; $homeurl = "http://www.kayakdemer.net"; $docsurl = "http://www.kayakdemer.net/docs"; $baseurl = "http://www.kayakdemer.net/wwwboard"; $photodir = "$baseurl/photos"; $cgi_url = "http://www.kayakdemer.net/cgi-bin2/wwwboard.pl"; $direct_wwboard_url = "http://www.kayakdemer.net/wwwboard/redirect.pl"; $cgis_url = "http://www.kayakdemer.net/cgi-bin2"; $cgis_dir = "/home/stephm69/public_html/kayakdemer/cgi-bin2"; $template = "message_t.html"; $addmailtp = "addmail.html"; $mesgdir = "messages"; $deleted_msg="deleted.html"; $mailingdir = "mailing"; # Pour ajout événements du calendrier page d'accueil $events_dir = "calendrier"; $eventsfile = "events.txt"; $details_dir = "details"; $delais = "7"; $stats_dir = "/home/stephm69/public_html/kayakdemer/wwwboard/stats"; $stats_url = "http://www.kayakdemer.net/wwwboard/stats"; $datafile = "data.txt"; $mesgfile_all = "wwwboard_all.php"; $mesgfile = "wwwboard.html"; $mesgfile_t = "wwwboard_t.php"; $soum_file = "soum_message.php"; $faqfile = "faq.html"; $filter_activepg = "fltpg_active.php"; # Changer le message sur la page d'accueil oui=1; non=0 $chgfrontmsg = 0; $addnouveautes = 1; $lstmsgtmfile = "lsttime.txt"; $mxtimefile = "maxtime.txt"; $maxtimejsfl = "maxtime.js"; $reg_names = "reg_names.txt"; $nmbmsgsfile = "nombrmsgsparuser.txt"; $frmail = "forum\@kayakdemer.net"; $forumtitle = "du kayak de mer dans le nouveau monde"; $forumurl = "http://www.kayakdemer.net/wwwboard"; $background_im = "http://www.kayakdemer.net/bckgrnd.gif"; $ext = "html"; $title = "Le Kayak de Mer dans le Nouveau Monde: Forum"; $site_name = "Le Kayak de Mer dans le Nouveau Monde"; $site_url = "http://www.kayakdemer.net"; $html_help = "http://www.kayakdemer.net/html.html"; $active_period = 22; $closed = ""; @passwords = ("tempo","loisi"); # Done ########################################################################### # Configure Options $show_faq = 1; # 1 - YES; 0 = NO $allow_html = 1; # 1 = YES; 0 = NO $quote_text = 0; # 1 = YES; 0 = NO $subject_line = 0; # 0 = Quote Subject Editable; 1 = Quote Subject # UnEditable; 2 = Don't Quote Subject, Editable. $use_time = 0; # 1 = YES; 0 = NO $show_poster_ip = 0; # 1 = Show the IP of every poster; 0 = Don't $enforce_max_len = 0; # 2 = YES, error; 1 = YES, truncate; 0 = NO %max_len = ('name', 50, 'email', 70, 'subject', 80, 'url', 150, 'url_title', 80, 'img', 150, 'body', 3000, 'origsubject', 80, 'origname', 50, 'origemail', 70, 'origdate', 50); # Done ########################################################################### # Get maxtime &getmaxtime; # Get the Data Number &get_number; # Get Form Information &parse_form; #$closed="09:00, 16 ocobre 06"; if($closed) { &error("Désolé, le forum est temporairement hors fonction. Il devrait être à nouveau en ligne vers $closed"); } # Put items into nice variables &get_variables; if($fct eq "register") { &enregistrer; } if($fct eq "erase_msg") { &checkpsw; &erase_msg; &error("Le message #$msgnmbr a été effaçé...$rmvlines lignes enlevés sur la page du forum"); } if($fct eq "voirdocs") { if($doc) { &show_doc; } else { &show_alldocs; } exit; } if($fct eq "voirdoc_dtls") { &showdoc_dtls; exit; } if($fct eq "showlink") { &show_link; exit; } if($addmailto) { &mk_page; exit; } if($msgnmbr) { &defmsgsandadd; &returnhtml; exit; } if($star != 1) { &check_banned; } if($newsub && $registered_only eq "oui") { if(!$reg_usr) { &error("Vous devez avoir un nom enregistré pour pouvoir cocher la case Permettre seulement aux utilisateurs enregistrés de répondre à ce message"); } else { ®istered_only; } } if($fltval && $newsub eq "oui") { &putfltval; $newsub = ""; } &write_ip; &write_name; # Write initial stats for message &write_ini_stats; # Open the new file and write information to it. &new_file; # Open the Main WWWBoard File to add link &main_page; # Now Add Thread to Individual Pages if ($num_followups >= 1) { &thread_pages; } # Return the user HTML &return_html; # Increment Number &increment_num; if($chgfrontmsg == 1) { &updt_frontmsg; } # Put calendar coming events on front page #&coming_events; &check_hidden; if($addnouveautes == 1) { if($fltval) { $typenouv = "subject"; &nouveaute; } else { &nouveaute; } } if($mail_list && !$hide) { &sendmails; } &chkmailqueue; ####################### sub chkmailqueue { $prestime = int(time/60)-19631284 ; open(MAIN,"$homedir/$mailingdir/queue_check.txt") || die $!; flock(MAIN, 2); @queued =
; close(MAIN); $mailinqueue = $queued[0]; if($mailinqueue) { $command_string = "./subvite.pl"; system( $command_string ); } } ############################ sub getmaxtime { open(NUMBER,"$basedir/$mxtimefile"); $maxtime = ; close(NUMBER); } ############################ # Get Data Number Subroutine sub get_number { open(NUMBER,"$basedir/$datafile"); $num = ; close(NUMBER); if ($num == 9999999 || $num !~ /^\d+$/) { $num = "1"; } else { $num++; } } ####################### # Parse Form Subroutine sub parse_form { local($name,$value); # Get the input if($ENV{'CONTENT_LENGTH'}) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } $change = $buffer; # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Remove any NULL characters, Server Side Includes $value =~ s/\0//g; $value =~ s///g; &place_emoticons; if ($allow_html != 1 || $value eq 'subject') { $value =~ s/<([^>]|\n)*>//g; } else { unless ($name eq 'body') { $value =~ s/<([^>]|\n)*>//g; } } $FORM{$name} = $value; } # Make sure that message fields do not exceed allowed value if ($enforce_max_len) { foreach $name (keys %max_len) { if (length($FORM{$name}) > $max_len{$name}) { if ($enforce_max_len == 2) { &error('field_size'); } else { $FORM{$name} = sprintf("%.$max_len{$name}s",$FORM{$name}); } } } } } ############### sub place_emoticons { %emot = (' X( ','angry.gif',' :f ','flirt.gif',' :x ','dead.gif',' :( ','frown.gif',' :h ','cool.gif',' :i ','idea.gif'," \:\) ",'smile.gif',' ;) ','wink.gif',' :l ','hrmpf.gif',' :o ','redface.gif',' :00 ','look.gif',' :p ','tounge.gif',' :q ','quest.gif',' :r ','shame.gif',' :D ','biggrin.gif',' :e ','supergrin.gif',' :)) ','bigsmile.gif'); foreach $es (keys %emot) { $fn = $emot{$es}; $es =~ s/\)/\&clspart\;/g; $value =~ s/\)/\&clspart\;/g; $es =~ s/\(/\&opnpart\;/g; $value =~ s/\(/\&opnpart\;/g; $value =~ s/$es/\/g; $value =~ s/\&clspart\;/\)/g; $value =~ s/\&opnpart\;/\(/g; } } ############### # Get Variables sub get_variables { if ($FORM{'fct'}) { $fct = $FORM{'fct'}; } if ($FORM{'psw'}) { $adminpass = "$FORM{'psw'}"; } if($fct eq "updtocome") { #&coming_events; &error("Les événements à venir ont été mis à jour"); } if ($FORM{'doc'}) { $doc = $FORM{'doc'}; } if ($FORM{'dir'}) { $dir = $FORM{'dir'}; } if ($FORM{'rt'}) { $rt = $FORM{'rt'}; } if($fct eq "voirdocs" || $fct eq "voirdoc_dtls") { return; } if ($FORM{'addmailto'}) { $addmailto = $FORM{'addmailto'}; $msgnmbr = $addmailto; } if ($FORM{'msgnmbr'}) { $msgnmbr = $FORM{'msgnmbr'}; } if ($FORM{'first_message'}) { $first_message = $FORM{'first_message'}; } if ($FORM{'viewnbr'}) { $viewnbr = $FORM{'viewnbr'}; &view_all; exit; } if ($FORM{'filter'}) { $filter = $FORM{'filter'}; &filter; &chkmailqueue; exit; } if ($FORM{'followup'}) { $followup = "1"; @followup_num = split(/,/,$FORM{'followup'}); $num_followups = @followups = @followup_num; @lst_msgpop=@followup_num; $last_message = pop(@lst_msgpop); $origdate = "$FORM{'origdate'}"; $origname = "$FORM{'origname'}"; $origsubject = "$FORM{'origsubject'}"; } else { $followup = "0"; } if ($FORM{'newsub'} || $followup eq "0") { $newsub = "oui"; } if ($FORM{'artgfghv'}) { $artgfghv = "$FORM{'artgfghv'}"; } if ($FORM{'artgfgev'}) { $artgfgev = "$FORM{'artgfgev'}"; } if(($newsub || $FORM{'need_code'}) && ($artgfghv ne $artgfgev || !$artgfghv) && $fct ne "erase_msg" && $fct ne "showallfrom" && $fct ne "showlink" && !$addmailto && !$FORM{'mailfct'}) { &error('
Entrez le bon code de confirmation pour valider votre message !


Le code de confirmation correspond aux quatre chiffres qui se trouvent
tout juste au dessus du champ ou vous devez insérer le code


'); exit; } if ($FORM{'answto'}) { $answrto = $FORM{'answto'}; } if($FORM{'motdepasse'} && !$FORM{'nom'}) { &error("Vous devez inscrire votre nom ou pseudonyme"); } if($FORM{'nom'} && !$FORM{'motdepasse'}) { &error("Vous devez inscrire votre mot de passe"); } if($FORM{'motdepasse'}) { $FORM{'name'} = $FORM{'nom'}."*".$FORM{'motdepasse'}; } $nameprst = $FORM{'name'}; $nameprst =~ s/\s//g; if ($FORM{'name'} && $nameprst) { if($nameprst =~/\*/) { $nametr = "$FORM{'name'}"; ($name,$psw)= split(/\*/,$nametr); $star=1; } else { $name = "$FORM{'name'}"; } $name =~ s/"//g; $name =~ s///g; $name =~ s/\&//g; $name =~ s/\s$//g; $name =~ s/^\s//g; } elsif(!($msgnmbr) && ($fct ne "register")) { &error("Vous devez inscrire votre nom ou un pseudonyme"); } if ($FORM{'registered_only'}) { $registered_only = "$FORM{'registered_only'}"; } if($fct eq "showallfrom") { &showallfrom; exit; } if ($FORM{'email'} =~ /.*\@.*\..*/) { $email = "$FORM{'email'}"; } if($FORM{'email'} && !($email)) { &error("Votre adresse de courriel n\'a pas le bon format"); } &check_registered; if ($FORM{'addmail'} eq "on") { if(!($email)) { &error("Vous devez spécifier une adresse de courriel"); } $addmail = "on"; } if ($FORM{'mail_list'}) { $mail_list = $FORM{'mail_list'}; } if ($FORM{'subject'}) { $subject = "$FORM{'subject'}"; $subject =~ s/\&/\&\;/g; $subject =~ s/"/\"\;/g; } elsif(!($msgnmbr) && ($fct ne "register")) { &error("Vous devez spécifier un sujet"); } if ($FORM{'fltval'}) { $fltval = $FORM{'fltval'}; } elsif(!($msgnmbr) && !($followup) && ($fct ne "register")) { &error("Vous devez sélectionner la catégorie de sujet"); } if ($FORM{'url'} =~ /.*\:.*\..*/ && $FORM{'url_title'}) { $message_url = "$FORM{'url'}"; $message_url_title = "$FORM{'url_title'}"; } if ($FORM{'img'} =~ /.*tp:\/\/.*\..*/) { $message_img = "$FORM{'img'}"; } if ($FORM{'body'}) { $body = "$FORM{'body'}"; $body =~ s/\cM//g; $body =~ s/\n\n/

/g; $body =~ s/\n/
/g; $body =~ s/<//g; $body =~ s/"/"/g; } elsif(!($msgnmbr) && ($fct ne "register")) { &error("Vous devez inscrire un message"); } if($FORM{'photo1'} ne "none") { $photo1 = "$FORM{'photo1'}"; } if($FORM{'photo2'} ne "none") { $photo2 = "$FORM{'photo2'}"; } if($FORM{'photo3'} ne "none") { $photo3 = "$FORM{'photo3'}"; } &insert_photos; if ($quote_text == 1) { $hidden_body = "$body"; $hidden_body =~ s//>/g; $hidden_body =~ s/"/"/g; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $month = ($mon + 1); @months = ("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"); $year += 1900; $long_date = sprintf("%02d %s %4d",$mday,$months[$mon],$year); $year %= 100; if ($use_time == 1) { $date = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$month,$mday,$year); } else { $date = sprintf("%02d/%02d/%02d",$mday,$month,$year); } $cookies=$ENV{'HTTP_COOKIE'}; @couples=split(/\; /,$cookies); foreach $couple (@couples) { ($cook_name,$cook_val)=split(/=/,$couple); $cookies{$cook_name}=$cook_val; } $ft=$cookies{"ft"}; if(!($ft)) { $ft = "nul"; } } #################### sub checkpsw { foreach $ps (@passwords) { if($adminpass eq $ps) { $pass =1; } } if(!$pass) { &error("Mauvais mot de passe"); } } ########### sub insert_photos { if($photo1) { if($body =~/\[photo1\]/) { $body =~ s/\[photo1\]/\/; } else { $body = "$body"."
"; } } if($photo2) { if($body =~/\[photo2\]/) { $body =~ s/\[photo2\]/\/; } else { $body = "$body"."
"; } } if($photo3) { if($body =~/\[photo3\]/) { $body =~ s/\[photo3\]/\/; } else { $body = "$body"."
"; } } } ################ sub check_banned { open(MAIN,"$filter_dir/banned_subject_equal.txt") || die $!; @banned_subject_equal =

; close(MAIN); open(MAIN,"$filter_dir/banned_subject_contain.txt") || die $!; @banned_subject_contain =
; close(MAIN); open(MAIN,"$filter_dir/banned_url_contain.txt") || die $!; @banned_url_contain =
; close(MAIN); open(MAIN,"$filter_dir/block_ips.txt") || die $!; @banned_ips =
; close(MAIN); open(MAIN,"$filter_dir/banned_body_contain.txt") || die $!; @banned_body_contain =
; close(MAIN); open(MAIN,"$filter_dir/banned_body_equal.txt") || die $!; @banned_body_equal =
; close(MAIN); open(MAIN,"$filter_dir/banned_followup_contain.txt") || die $!; @banned_followup_contain =
; close(MAIN); open(MAIN,"$filter_dir/needregister_followup.txt") || die $!; @needregister_followup =
; close(MAIN); $chk_followup = $FORM{'followup'}; @chk_followups = split(/\,/,$chk_followup); $host_addr=$ENV{'REMOTE_ADDR'}; $chk_body = $body; $chk_body =~ tr/A-Z/a-z/; $chk_subject = $subject; $chk_subject =~ tr/A-Z/a-z/; $chk_message_url = $message_url; $chk_message_url =~ tr/A-Z/a-z/; foreach $bv (@banned_subject_equal) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; if($chk_subject eq $bv) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_subject_contain) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; if($chk_subject =~ /$bv/) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_url_contain) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; if($chk_message_url =~ /$bv/) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_ips) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; if($host_addr =~ /$bv/) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_body_contain) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; if($chk_body =~ /$bv/) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_body_equal) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; $bv =~ s/<([^>]|\n)*>//g; if($chk_body eq $bv) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } foreach $bv (@banned_followup_contain) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; foreach $cfl (@chk_followups) { if($cfl == $bv) { $banned_key=$bv; &mail_banded; &error("Il n\'est pas possible d\'ajouter ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } } foreach $bv (@needregister_followup) { $bv =~ tr/A-Z/a-z/; $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; foreach $cfl (@chk_followups) { if($cfl == $bv && !($reg_usr) || ($cfl < 63773 && !($reg_usr))) { $banned_key=$bv; &mail_banded; &error("Vous devez avoir un nom enregistré pour soumettre une réponse à ce message. Contactez-nous si vous croyez qu\'il s\'agit d\'une erreur
No. de référence: $banned_ref"); } } } } ############## sub check_hidden { open(MAIN,"$filter_dir/hide.txt") || die $!; @hide =
; close(MAIN); $chk_followup = $FORM{'followup'}; @chk_followups = split(/\,/,$chk_followup); foreach $bv (@hide) { $bv =~ s/\n//g; $bv =~ s/\s\n$//g; $bv =~ s/\r//g; foreach $cfl (@chk_followups) { if($cfl == $bv) { $addnouveautes = 0; $hide = 1; } } } } ################ sub write_ip { $host_addr=$ENV{'REMOTE_ADDR'}; open(MAIN,">>$basedir/ips.txt") || die $!; print MAIN "$num - $host_addr\; id=$ft\n"; close(MAIN); } ################# sub write_name { open(MAIN,"$basedir/names.txt") || die $!; @allnames=
; close(MAIN); open(MAIN,">$basedir/names.txt") || die $!; foreach $nml (@allnames) { ($tx,$nms) = split(/=/,$nml); $nms =~ s/\n//g; if($tx == $ft) { if(!($nms =~ /$name/)) { $nms = $nms.";".$name; } $prntnn = 1; } print MAIN "$tx=$nms\n"; } if(!($prntnn)) { print MAIN "$ft=$name\n"; } close(MAIN); } ################# sub putfltval { open(MAIN,">>$basedir/flt_$fltval.txt") || die $!; print MAIN "$num\n"; close(MAIN); ++$tster; open(MAIN,">>$basedir/fltdebug.txt") || die $!; print MAIN "$num|$fltval|$newsub|$tster\n"; close(MAIN); } ############## sub write_ini_stats { open(MAIN,">$stats_dir/$num.js") || die $!; flock(MAIN, 2); print MAIN "//0\n"; print MAIN "document.write(\'$nmbr\')\;"; close(MAIN); } ############ sub mk_page { open(MAIN,"$basedir/$addmailtp") || die $!; @main =
; close(MAIN); print "Content-type: text/html\n\n"; foreach $tl (@main) { if($tl =~ //) { print ""; } else { print "$tl"; } } } ########### sub enregistrer { $nmtoreg = $FORM{'nom'}; $nmtoreg =~ tr/A-Z/a-z/; $nmtoreg =~ s/\s$//g; $nmtoreg =~ s/^\s//g; $motdepasse = $FORM{'motdepasse'}; if(!$nmtoreg) { &error("Vous devez entrer un nom à enregistrer !"); } if(!($motdepasse)) { &error("Vous devez entrer un mot de passe !"); } open(MAIN,"$basedir/$reg_names") || die $!; @rnms =
; close(MAIN); if($nmtoreg eq "liste" && $motdepasse eq "admin") { print "Content-type: text/html\n\n"; } foreach $rninfs (@rnms) { ($rname,$rpsw,$remail,$sh_email) = split(/\|/,$rninfs); if($rname eq $nmtoreg) { $takennm=1; } ++$nrnms; if($nmtoreg eq "liste" && $motdepasse eq "admin") { print "$rname - $rpsw - $remail - $sh_email
"; } } if($takennm && $nmtoreg ne "liste") { &error("Le nom $nmtoreg est déjà réservé !
$nrnms noms ont déjà été reservés"); } if($nmtoreg eq "liste" && $motdepasse eq "admin") { print "********
$nrnms noms enregistrés"; exit; } if($nmtoreg eq "nombre") { &error("$nrnms noms enregistrés"); } ++$nrnms; open(MAIN,">>$basedir/$reg_names") || die $!; flock(MAIN, 2); print MAIN "$nmtoreg|$FORM{'motdepasse'}|$email|$FORM{'showmail'}\n"; close(MAIN); print "Content-type: text/html\n\n"; print "

"; print "Le nom $nmtoreg a été enregistré avec succès !
"; print "Mot de passe: $FORM{'motdepasse'}
"; print "Courriel: $email
"; if($FORM{'showmail'} eq "oui") { print "Votre courriel sera lié à votre nom lors d\'ajout de messages

"; } else { print "Votre courriel ne sera pas lié à votre nom lors d\'ajout de messages

$nrnms noms ont déjà été reservés


"; } print "

Comment utiliser votre nom enregistré ?

Lorsque vous ajoutez un message, entrez (sans espaces !) votre nom suivit d\'une étoile (*) suivit de votre mot de passe

\n"; print "

Exemple:

Si votre nom enregistré est François et votre mot de passe est pagaie, vous devez entrer:

\n"; print "

Nom:

\n"; print "

Vous n\'avez pas à\; entrer votre courriel qui sera ajouté\; automatiquement si vous avez sé\;lectionné\; "\;Afficher votre courriel"\; lors de l\'enregistrement de votre nom.

\n"; print "

ATTENTION: Utilisez votre surnom*motdepasse UNIQUEMENT sur le forum puisque si vous l\'utilisiez ailleurs sur le site, l\'information n\'é\;tant pas traité\;, tous verraient apparaitre surnom*motdepasse à\; la place de votre nom et connaî\;traient alors votre pré\;cieux motdepasse !

\n"; exit; } ########### sub check_registered { use DBI; $dbh = DBI->connect("DBI:mysql:stephm69_kmnmdatas:localhost","stephm69_kmnm","access") || die "Connect failed: $DBI::errstr\n"; $chckname = $name; &removebadchar($chckname); $chckname = $string; $reg_gif="no_reg.gif"; $query = "SELECT * FROM users WHERE user='$chckname'"; $sth = $dbh->prepare($query); $result = $sth->execute; if($datas = $sth->fetchrow_hashref) { $remail = $datas->{email}; $rpsw = $datas->{motdepasse}; $sh_email = $datas->{showmail}; if($psw eq $rpsw) { if($chckname eq "stephane") { $registered = "$name"; $regiusr_email = $remail; $reg_gif="reg3.gif"; } else { $registered = "$name"; $regiusr_email = $remail; $reg_gif="reg2.gif"; } $email =$remail; $reg_usr=1; } else { &error("Le nom $name est réservé et vous n\'avez pas soumis le bon mot de passe"); } } if(!($reg_usr)) { $query = "SELECT * FROM old_users WHERE user='$chckname'"; $sth = $dbh->prepare($query); $result = $sth->execute; if($datas = $sth->fetchrow_hashref) { $remail = $datas->{email}; $rpsw = $datas->{motdepasse}; $sh_email = $datas->{showmail}; if($psw eq $rpsw) { if($sh_email eq "oui") { $registered = "$name"; $regiusr_email = $remail; } else { $registered = "$name"; } $regiusr_email = $remail; $reg_gif="reg.gif"; $email =$remail; $reg_usr=1; } else { &error("Le nom $name est réservé et vous n\'avez pas soumis le bon mot de passe"); } } } if(!($reg_usr) && $star) { &error("Le surnom $chckname et le mot de passe $psw ne sont pas enregistrés ou n\'utilisez pas le caractère * dans votre surnom"); } } ############ sub show_alldocs { $prnt = 0; $bgcolor ="eeeeee"; if($dir) { $fldocsdir = "$docsdir/$dir"; } else { $fldocsdir = "$docsdir"; } print "Content-type: text/html\n\n"; print "ADMIN: Tous les documents\n"; print "\n"; print <<"EOF"; EOF print ""; print "
\n"; print "
"; $ln_pict = 0; print "Les documents:

"; opendir DIR, "$fldocsdir" or die "Can't open directory $dir: $!\n"; while ($file = readdir DIR) { if($file ne "." && $file ne ".." && !($file =~ "docdir")) { print "\n"; $temp = $file; $temp =~ s#.*/(.*/.*/.*)$#$1#; $abslink = "$fldocsdir/$temp"; $filesize = (stat($abslink))[7]; if($filesize < 1000000) { $filesize = (int($filesize/10))/100; $in = "KB"; } else { $filesize = (int($filesize/10000))/100; $in = "MB"; } print "$file ($filesize $in)
\n"; print "\n\n"; $prnt = 1; } elsif($file =~ "docdir") { $dirname = $file; $dirname =~ s/docdir_//g; print "$dirname
\n"; } } if(!$prnt) { print "*** Aucun document ***"; } print "

\n"; # print "[ Fermer cette fenêtre ]"; print "\n"; } ############ sub show_doc { $bgcolor ="eeeeee"; if($dir) { $fldocsdir = "$docsurl/$dir"; } else { $fldocsdir = "$docsurl"; } print "Content-type: text/html\n\n"; print "Voir un document\n"; print ""; print ""; print "\n"; print "\n"; print "\n"; print "\n"; } ########### sub showdoc_dtls { $bgcolor ="eeeeee"; print "Content-type: text/html\n\n"; print "Voir un document\n"; print <<"EOF"; EOF print ""; print "\n"; print "\n"; print "insertion image: \<\;img src=\'http://www.kayakdemer.net/docs/$doc\' border=\'0\'\>\;
\n"; print "insertion lien: \<\;a href=\'http://www.kayakdemer.net/docs/$doc\' target=\'_blank\'\>\;$doc\<\;/a\>\;\n"; print "
"; print "\n"; } ##################### sub show_link { $bgcolor ="eeeeee"; print "Content-type: text/html\n\n"; print "Lien vers le message $msgnmbr\n"; print ""; print "\n"; print "Message $msgnmbr

\n"; print "\n"; print "Adresse de ce message:
http://www.kayakdemer.net/wwwboard/messages/$msgnmbr.html

\n"; print "Lien vers ce message:
\<\;a href=\'http://www.kayakdemer.net/wwwboard/messages/$msgnmbr.html\' \>\;Message $msgnmbr\<\;/a\>\;

\n"; print " ou, à l\'intérieur d\'un message du forum:
\n"; print "\<\;a href=\'$msgnmbr.html\' \>\;Message $msgnmbr\<\;/a\>\;
\n"; print "
"; print "\n"; } ##################### # New File Subroutine sub new_file { open(MAIN,"$basedir/$template") || die $!; @main =
; close(MAIN); open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!; flock(NEWFILE, 2); foreach $main_line (@main) { if($main_line =~ //) { print NEWFILE "Le Kayak de Mer dans le Nouveau Monde - Forum\: $subject\n"; } if ($main_line =~ //) { print NEWFILE "
\n"; print NEWFILE "
$subject\n"; print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE "
[ Réponses ] [ Soumettre une réponse ]
[ M\'abonner à cette discussion ]
\n"; print NEWFILE "

\n"; print NEWFILE "Soumis par "; if($registered) { print NEWFILE "$registered
\n"; } else { if ($email) { print NEWFILE "$name
\n"; } else { print NEWFILE "$name
\n"; } } if ($show_poster_ip) { print NEWFILE "($ENV{'REMOTE_ADDR'}) "; } print NEWFILE "Date: $long_date
\n"; if ($followup == 1) { print NEWFILE "En réponse à: $origsubject soumis par "; if ($origemail) { print NEWFILE "$origname Date: $origdate:
\n"; } else { print NEWFILE "$origname Date: $origdate:
\n"; } } if ($message_img) { print NEWFILE "

\n"; } print NEWFILE "\n"; print NEWFILE "\n"; print NEWFILE <<"EOF";
\n"; print NEWFILE "
\n"; if($followup && $first_message) { print NEWFILE "
\"\"
"; } print NEWFILE "
\n"; print NEWFILE "\n"; print NEWFILE "
\n"; print NEWFILE "
EOF print NEWFILE "
\n"; print NEWFILE "$subject
\n"; print NEWFILE "$long_date
\n"; print NEWFILE "$body \n"; print NEWFILE "
\n"; print NEWFILE <<"EOF";

EOF print NEWFILE "\n"; print NEWFILE "\n"; print NEWFILE "\n"; print NEWFILE "\n"; if($registered) { print NEWFILE "\n"; print NEWFILE "\n"; print NEWFILE "\n"; &get_nmbmesgs($name); print NEWFILE "\n"; } print NEWFILE "
Lu: \n"; print NEWFILE "Message no: $num
Soumis par \$name: $totalmsg
\n"; print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE "
\n"; if ($message_url) { print NEWFILE "\n"; } print NEWFILE "

\n"; print NEWFILE "Réponses:
\n"; print NEWFILE "

    \n"; print NEWFILE "
\n"; print NEWFILE "

\n"; print NEWFILE "Soumettre une réponse

\n"; print NEWFILE <<"EOF";

EOF print NEWFILE "
\n"; print NEWFILE "\n"; print NEWFILE "\n"; if ($email) { print NEWFILE "\n"; } print NEWFILE "\n"; if(!$followup) { $first_message = $num; } print NEWFILE "\n"; print NEWFILE "\n"; print NEWFILE "\n"; if($registered_only) { print NEWFILE '*** VOUS DEVEZ AVOIR UN NOM ENREGISTRÉ
POUR POUVOIR RÉPONDRE À CE MESSAGE
***
Nom : 
Mot de passe :
'; } else { print NEWFILE "Nom: \"\"
Si votre nom est enregistré\; utilisez: surnom*motdepasse\n"; } print NEWFILE "

E-Mail:
\n"; print NEWFILE " Recevoir un courriel lors de réponses

\n"; if ($subject_line == 1) { if ($subject_line =~ /^Re:/) { print NEWFILE "\n"; print NEWFILE "Sujet: $subject

\n"; } else { print NEWFILE "\n"; print NEWFILE "Sujet: Re: $subject

\n"; } } elsif ($subject_line == 2) { print NEWFILE "Sujet:

\n"; } else { if ($subject =~ /^Re:/) { print NEWFILE "Sujet:

\n"; } else { print NEWFILE "Sujet:

\n"; } } print NEWFILE <<"EOF";


Photos jointes

Commentaires: EOF print NEWFILE "
\n"; print NEWFILE <<"EOF"; EOF print NEWFILE "

\n"; print NEWFILE "URL lien optionnel :
\n"; print NEWFILE "Titre du lien:
\n"; print NEWFILE "URL image optionnel:

\n"; print NEWFILE <<"EOF";


EOF print NEWFILE " \n"; print NEWFILE <<"EOF";

EOF print NEWFILE "


\n"; print NEWFILE "
[ Réponses ] [ Soumettre une réponse ]
\n"; print NEWFILE "
\n"; } else { print NEWFILE "$main_line"; } } close(NEWFILE); } ####################### sub get_nmbmesgs { $nametocheck = $_[0]; removebadchar($nametocheck); $nametocheck = $string; $nmbrmsgs = 0; open(MAIN2,"$basedir/$nmbmsgsfile") || die $!; @allusrsnmbmsgs = ; close(MAIN2); foreach $usrnmbr (@allusrsnmbmsgs) { ($usrx,$nmbrx) = split(/\|/,$usrnmbr); $usrx =~ tr/A-Z/a-z/; $nmbrx =~ s/\n//g; $nmbrx =~ s/\s\n$//g; $nmbrx =~ s/\r//g; if($usrx eq $nametocheck) { $totalmsg = $nmbrx; } } if(!($totalmsg)) { open(MAIN3,"$basedir/$mesgfile_all") || die $!; @main3 = ; close(MAIN3); foreach $mainline (@main3) { removebadchar($mainline); $mainline_low = $string; if(($mainline_low =~ /\>$nametocheck\$basedir/$nmbmsgsfile") || die $!; flock(MAIN4, 2); foreach $usrnm (@allusrsnmbmsgs) { ($usrx,$nmbrx) = split(/\|/,$usrnm); $nmbrx =~ s/\n//g; $nmbrx =~ s/\s\n$//g; $nmbrx =~ s/\r//g; if($usrx eq $nametocheck) { print MAIN4 "$usrx|$totalmsg\n"; $nameadded = 1; } elsif($usrx) { print MAIN4 "$usrx|$nmbrx\n"; } } if(!($nameadded)) { print MAIN4 "$nametocheck|$totalmsg\n"; } close(MAIN4); } ############################### # Main WWWBoard Page Subroutine sub main_page { open(MAIN,"$basedir/$mesgfile_all") || die $!; @main =
; close(MAIN); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time-5*3600); $month = ($mon + 1); $hr = int(($hour/24)*10)/10; $tempsub=($year-101)*365+($mon+1)*30+$mday+$hr; open(MAIN,">$basedir/$mesgfile_all") || die $!; flock(MAIN, 2); if($registered_only) { $incl_reg_incon = " "; } if ($followup == 0) { foreach $main_line (@main) { if ($main_line =~ //) { print MAIN "\n"; print MAIN "
  • ".$incl_reg_incon."$subject - $name $long_date\n"; print MAIN "\n"; print MAIN "(R:0 L:)\n"; print MAIN "\n"; print MAIN "
\n"; } else { print MAIN "$main_line"; } } } else { foreach $main_line (@main) { $work = 0; if ($main_line =~ //) { print MAIN "
  • $subject - $name $long_date\n"; print MAIN "\n"; print MAIN "(R:0 L:)\n"; print MAIN "\n"; print MAIN "
\n"; print MAIN "\n"; } elsif ($main_line =~ /\(R:(.*)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print MAIN "(R:$num_responses L:)\n"; $work = 1; } } if ($work != 1) { print MAIN "$main_line"; } } elsif ($main_line =~ /\((.*)\)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print MAIN "($num_responses)\n"; $work = 1; } } if ($work != 1) { print MAIN "$main_line"; } } else { print MAIN "$main_line"; } } } close(MAIN); } ############################################ # Add Followup Threading to Individual Pages sub thread_pages { foreach $followup_num (@followup_num) { open(FOLLOWUP,"$basedir/$mesgdir/$followup_num\.$ext"); @followup_lines = ; close(FOLLOWUP); open(FOLLOWUP,">$basedir/$mesgdir/$followup_num\.$ext"); flock(FOLLOWUP, 2); foreach $followup_line (@followup_lines) { $work = 0; if ($followup_line =~ //) { print FOLLOWUP "
  • $subject $name $date\n"; print FOLLOWUP "(0)\n"; print FOLLOWUP "\n"; print FOLLOWUP "
\n"; print FOLLOWUP "\n"; } elsif ($followup_line =~ /\((.*)\)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print FOLLOWUP "($num_responses)\n"; $work = 1; } } if ($work != 1) { print FOLLOWUP "$followup_line"; } } elsif($followup_line =~ //) { print FOLLOWUP "
\"\"
\n"; } else { print FOLLOWUP "$followup_line"; } } close(FOLLOWUP); } } ############################ sub return_html { open(MAIN,"$basedir/$template"); @template =
; close(MAIN); print "Content-type: text/html\n\n"; foreach $tl (@template) { if ($tl =~ //) { print "



"; print "Le message suivant a été ajouté au forum:


\n"; print "Nom: $name
\n"; print "E-Mail: $email
\n"; if($addmail eq "on") { print "Recevoir un message lors de réponses: oui
\n"; } print "Sujet: $subject
\n"; print "Message:

\n"; print "$body

\n"; if ($message_url) { print "Lien: $message_url_title
\n"; } if ($message_img) { print "Image:
\n"; } print "Ajouté en date: $long_date

\n"; if($chgfrontmsg == 1) { print "*** Votre message pourrait ne pas être affiché imédiatement sur la page d\'accueil ***\n"; } print "


\n"; print "
[ Aller à votre message ] [ Retour au forum ]
\n"; } else { print $tl; } } } ################################# sub increment_num { open(NUM,">$basedir/$datafile") || die $!; flock(NUM, 2); print NUM "$num"; close(NUM); } ############################# sub error { $error = $_[0]; print "Content-type: text/html\n\n"; if ($error eq 'no_name') { print "$title ERROR: No Name\n"; print "

ERROR: No Name

\n"; print "You forgot to fill in the 'Name' field in your posting. Correct it below and re-submit. The necessary fields are: Name, Subject and Message.


\n"; &rest_of_form; } elsif ($error eq 'no_subject') { print "$title ERROR: No Subject\n"; print "

ERROR: No Subject

\n"; print "You forgot to fill in the 'Subject' field in your posting. Correct it below and re-submit. The necessary fields are: Name, Subject and Message.


\n"; &rest_of_form; } elsif ($error eq 'no_body') { print "$title ERROR: No Message\n"; print "

ERROR: No Message

\n"; print "You forgot to fill in the 'Message' field in your posting. Correct it below and re-submit. The necessary fields are: Name, Subject and Message.


\n"; &rest_of_form; } elsif ($error eq 'field_size') { printf "$title ERROR: Field too Long\n"; print "

ERROR: Field too Long

\n"; print "One of the form fields in the message submission was too long. The following are the limits on the size of each field (in characters):

    \n"; print "
  • Name: $max_len{'name'}\n"; print "
  • E-Mail: $max_len{'email'}\n"; print "
  • Subject: $max_len{'subject'}\n"; print "
  • Body: $max_len{'body'}\n"; print "
  • URL: $max_len{'url'}\n"; print "
  • URL Title: $max_len{'url_title'}\n"; print "
  • Image URL: $max_len{'img'}\n"; print "
Please modify the form data and resubmit.


\n"; &rest_of_form; } else { print "ERREUR\n"; print "

ERREUR:

\n"; print "
$error


\n"; print "
[ Retour au formulaire ]


\n"; print ""; } exit; } ############################### sub rest_of_form { print "\n"; if ($followup == 1) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "Name:
\n"; print "E-Mail:

\n"; if ($subject_line == 1) { print "\n"; print "Subject: $FORM{'subject'}

\n"; } else { print "Subject:

\n"; } print "Message:
\n"; print "(Vous pouvez inclure du HTML)
\n"; print "

\n"; print <<"EOF"; EOF print "

Optional Link URL:
\n"; print "Link Title:
\n"; print "Optional Image URL:

\n"; print " \n"; print "\n"; print "


\n"; if ($show_faq == 1) { print "
[ Follow Ups ] [ Post Followup ] [ $title ] [ FAQ ]
\n"; } else { print "
[ Follow Ups ] [ Post Followup ] [ $title ]
\n"; } print "\n"; } ###################################### sub updt_frontmsg { open(LSTMSGDT,"$basedir/$lstmsgtmfile"); $lstmsgdt = ; close(LSTMSGDT); open(MXTIME,">$basedir/$maxtimejsfl"); flock(MXTIME, 2); print MXTIME "var maxtime = $maxtime"; close(MXTIME); if(($tempsub - $lstmsgdt) >= $maxtime) { system ("perl", "$cgis_dir/chgforum.pl", ""); } } ################### sub showallfrom { open(MAIN,"$basedir/$template") || die $!; @template =
; close(MAIN); open(MAIN3,"$basedir/$mesgfile_all") || die $!; @mainfilelines = ; close(MAIN3); print "Content-type: text/html\n\n"; foreach $tl (@template) { if($tl =~ //) { print "
\n\n"; print "\n"; print "

Filtre: Messages soumis par $name

\n"; foreach $mainline (@mainfilelines) { &removebadchar($mainline); $mainline_nocap = $string; &removebadchar($name); $name_nocap = $string; if(($mainline_nocap =~ /\>$name_nocap\//g; $mainline =~ s/
  • //g; print "$mainline"; print "
    \n"; } } } else { print "$tl"; } } } ################## sub removebadchar { $string = $_[0]; $string =~ tr/A-Z/a-z/; $string =~ s/[À|à|Ã|ã|Â|â]/a/g; $string =~ s/[É|é|È|è|ê|Ê|ë|Ë]/e/g; $string =~ s/[Ç|ç]/c/g; $string =~ s/[Î|î|Ï|ï]/i/g; $string =~ s/[Ö|ö|Ô|ô]/o/g; $string =~ s/[Û|û|Ü|ü|ù|Ù]/u/g; } ################## sub view_all { open(MSG,"$basedir/$mesgdir/$viewnbr.html"); @msgtoshow = ; close(MSG); open(MAIN,"$basedir/$template") || die $!; @template =
    ; close(MAIN); $level = 0; print "Content-type: text/html\n\n"; foreach $tl (@template) { if($tl =~ //) { print '\n"; } if($tl =~ //) { ++$level; print "
    \n"; foreach $ml (@msgtoshow) { if($ml =~ /Soumis par/) { $auteur = $ml; $auteur =~ s/
    //g; $auteur =~ s/Date.*$//g; } if($ml =~ //) { print "
    "; print "\n"; print "\n"; } if($ml =~ //) { print ''."\n"; print "
    \n"; print "$ml\n"; print ""; } if($ml =~ //) { print "$auteur - $ml\n"; print "
    '.$ml.'
    "; # print ""; print "
    \n"; print "
    \n"; } if($ml =~ /'))-9; $msgnmbr = substr($ml, 9, $nmbrlt); $bq=1; if($level < 20) { ++$level; } &showmsg; } if($ml =~ /'))-13; $msgnmbr = substr($ml, 13, $nmbrlt); $bq=1; &showmsg; } if($ml =~ //) { print "
    "; print "\n"; print "\n"; } if($thrmsgln =~ //) { print "\n"; print "
    \n"; print "$thrmsgln\n"; print ""; } if($thrmsgln =~ //) { print "$auteur - $thrmsgln\n"; print "
    $thrmsgln
    "; # print ""; print "
    \n"; print "
    \n"; } } } ########### sub filter { &filter_stats; if($filter eq "active") { &filter_active; &chkmailqueue; exit; } if($filter eq "recents") { &filter_recents; &chkmailqueue; exit; } if($filter eq "tout") { &filter_tout; &chkmailqueue; exit; } %filters = ("equipement","Équipement", "technique","Technique/Sécurité/Cours...", "evenement","Sorties/Événement/Rencontres...", "destinations","Destinations", "construction","Construction", "autre","Autre", "milieu","Milieu, environnement, météo, faune, flore"); if($filter eq "parsujet") { &filter_parsujet; &chkmailqueue; exit; } $prnt=0; open(MSG,"$basedir/$mesgfile_all"); @board = ; close(MSG); open(MSG,"$basedir/$mesgfile_t"); @board_t = ; close(MSG); open(MSG,"$basedir/flt_$filter.txt"); @vals = ; close(MSG); $filter_pg = "fltpg_"."$filter".".php"; open(ACTIVEPG,">$basedir/$filter_pg"); flock(ACTIVEPG, 2); foreach $tl (@board_t) { if($tl =~ //) { $fltr_nm = $filters{$filter}; $close_li = 1; print ACTIVEPG "
    Filtre: $fltr_nm

    \n"; foreach $bl (@board) { if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); foreach $fv (@vals) { if($fv == $msgnmbr) { $ntr = 0; $calc_nr = 0; $nmbrlt = length ($bl)-(length ($bl)-index ($bl,'-->'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); $prnt=1; $prntnbr=$msgnmbr; $lstmsgnmbr = $msgnmbr; if(!($close_li)) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n \n"; } else { print ACTIVEPG "(R:$ntr) \n\n \n"; } } $nmbr_lect_tot = 0; $close_li =0; $max_nouveau = 0; if($offset == 9) { print ACTIVEPG "
      $bl"; } else { print ACTIVEPG "$bl"; } } } } if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); if($msgnmbr<$prntnbr) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n
    \n"; } else { print ACTIVEPG "(R:$ntr) \n\n \n"; } $prnt=0; $close_li =1; } } if($bl =~ /')+3; $nmbrltnl = (index ($bl,')') - $strt); $nmbrl = substr($bl, $strt, $nmbrltnl); $ntr = $ntr + $nmbrl; $calc_nr = 1; } } if($bl =~ // && $prnt) { $prnt=0; if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n $bl"; } else { print ACTIVEPG "(R:$ntr) \n\n $bl"; } if(!($bl =~ /
      /)) { print ACTIVEPG "
    \n"; } $close_li =1; } if($prnt) { # print ACTIVEPG "$bl"; } } } else { print ACTIVEPG "$tl"; } } close(ACTIVEPG); print "Location: $baseurl/$filter_pg\n\n"; } ################## sub filter_stats { open(STATS,"$basedir/filters_stats.txt"); @stats = ; close(STATS); open(STATS,">$basedir/filters_stats.txt"); foreach $fsl (@stats) { $fn = ""; ($fn,$stats) = split(/\|/,$fsl); $stats =~ s/\n//g; if($fn eq $filter) { ++$stats; } if($fn) { print STATS "$fn|$stats\n"; } } close(STATS); } ############################ sub filter_tout { $prnt=0; open(MSG,"$basedir/$mesgfile_all"); @board = ; close(MSG); open(MSG,"$basedir/$mesgfile_t"); @board_t = ; close(MSG); $filter_pg = "fltpg_"."$filter".".php"; open(ACTIVEPG,">$basedir/$filter_pg"); flock(ACTIVEPG, 2); foreach $tl (@board_t) { if($tl =~ //) { $fltr_nm = $filters{$filter}; $close_li = 1; print ACTIVEPG "
    Filtre: Tout

    \n"; # print ACTIVEPG ""; foreach $bl (@board) { if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); $prnt=1; $prntnbr=$msgnmbr; $lstmsgnmbr = $msgnmbr; if(!($close_li)) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n \n"; } else { print ACTIVEPG "(R:$ntr) \n\n \n"; } } $nmbr_lect_tot = 0; $close_li =0; $max_nouveau = 0; if($offset == 9) { print ACTIVEPG "
      $bl"; } else { print ACTIVEPG "$bl"; } } if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); if($msgnmbr<$prntnbr) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n
    \n"; } else { print ACTIVEPG "(R:$ntr) \n\n \n"; } $prnt=0; $close_li =1; } } if($bl =~ /')+3; $nmbrltnl = (index ($bl,')') - $strt); $nmbrl = substr($bl, $strt, $nmbrltnl); $ntr = $ntr + $nmbrl; $calc_nr = 1; } } if($bl =~ // && $prnt) { $prnt=0; if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n $bl"; } else { print ACTIVEPG "(R:$ntr) \n\n $bl"; } if(!($bl =~ /
      /)) { print ACTIVEPG "
    \n"; } $close_li =1; } if($prnt) { # print ACTIVEPG "$bl"; } } } else { print ACTIVEPG "$tl"; } } close(ACTIVEPG); print "Location: $baseurl/$filter_pg\n\n"; } ############################ sub filter_parsujet { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time-5*3600); $month = ($mon + 1); $hr = int(($hour/24)*10)/10; $tempsub=($year-101)*365+($mon+1)*30+$mday+$hr; $flpsujet=15; open(MSG,"$basedir/$mesgfile_t"); @board_t = ; close(MSG); open(MSG,"$basedir/$mesgfile_all"); @board = ; close(MSG); $filter_pg = "fltpg_"."$filter".".php"; open(ACTIVEPG,">$basedir/$filter_pg"); flock(ACTIVEPG, 2); foreach $tl (@board_t) { if($tl =~ //) { print ACTIVEPG "
    Filtre: Par sujet

  • \n"; foreach $sn (keys %filters) { print ACTIVEPG "
    \n"; $sfn = $filters{$sn}; print ACTIVEPG "$sfn\n"; print ACTIVEPG "
    "; $filter = $sn; $tot_msgshown = 0; $ep =0; &showfltmsgs; print ACTIVEPG "
    "; } } else { print ACTIVEPG "$tl"; } } close(ACTIVEPG); print "Location: $baseurl/$filter_pg\n\n"; } ############################# sub showfltmsgs { $prnt=0; open(MSG,"$basedir/flt_$filter.txt"); @vals = ; close(MSG); $fltr_nm = $filters{$filter}; $close_li = 1; foreach $bl (@board) { if(!($ep)) { if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); foreach $fv (@vals) { if($fv == $msgnmbr) { $ntr = 0; $calc_nr = 0; $nmbrlt = length ($bl)-(length ($bl)-index ($bl,'-->'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); $prnt=1; $prntnbr=$msgnmbr; $lstmsgnmbr = $msgnmbr; if(!($close_li)) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n\n"; } else { print ACTIVEPG "(R:$ntr) \n\n\n"; } } $nmbr_lect_tot = 0; $close_li =0; $max_nouveau = 0; if($offset == 9) { print ACTIVEPG "
      $bl"; } else { print ACTIVEPG "$bl"; } ++$tot_msgshown; } } } if($bl =~ /'))-$offset; $msgnmbr = substr($bl, $offset, $nmbrlt); if($msgnmbr<$prntnbr) { if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot) \n\n
    \n"; } else { print ACTIVEPG "(R:$ntr) \n\n\n"; } if($tot_msgshown == $flpsujet) { $ep =1; } $prnt=0; $close_li =1; } } if($bl =~ /')+3; $nmbrltnl = (index ($bl,')') - $strt); $nmbrl = substr($bl, $strt, $nmbrltnl); $ntr = $ntr + $nmbrl; $calc_nr = 1; } } if($bl =~ // && $prnt) { $prnt=0; if($nmbr_lect_tot) { print ACTIVEPG "(R:$ntr L:$nmbr_lect_tot)\n\n $bl"; } else { print ACTIVEPG "(R:$ntr) "; print ACTIVEPG "\n\n $bl"; } if(!($bl =~ /
      /)) { print ACTIVEPG "
    \n"; } $close_li =1; if($tot_msgshown >= $flpsujet && ($tempsub - $max_nouveau) > 22) { $ep =1; } } if($prnt) { # print ACTIVEPG "$bl"; } } } } ############################ sub filter_active { $load=0; $active=0; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time-5*3600); $month = ($mon + 1); $hr = int(($hour/24)*10)/10; $tempsub=($year-101)*365+($mon+1)*30+$mday+$hr; @loaded = @blank; open(MSG,"$basedir/$mesgfile_all"); @board = ; close(MSG); open(MSG,"$basedir/$mesgfile_t"); @board_t = ; close(MSG); open(ACTIVEPG,">$basedir/$filter_activepg"); flock(ACTIVEPG, 2); foreach $tl (@board_t) { if($tl =~ //) { print ACTIVEPG "
    Filtre: Discussions actives

    \n"; foreach $bl (@board) { if($bl =~ /'))-13; $msgnmbr = substr($bl, 13, $nmbrlt); $load=1; $loadnbr=$msgnmbr; } if($bl =~ /nouveau\(/) { $newlt = length ($bl)-(length ($bl)-index ($bl,')'))-8; $newnmbr = substr($bl, 8, $newlt); if(($tempsub - $newnmbr) < $active_period) { $active=1; $diff=($tempsub - $newnmbr); } } if($load) { push(@loaded,$bl); } if($bl =~ // && $load) { $load=0; if($active) { # print "$msgnmbr - $diff | $active_period
    "; foreach $ll (@loaded) { print ACTIVEPG "$ll"; } } $active=0; @loaded = @blank; } } } else { print ACTIVEPG $tl; } } close(ACTIVEPG); print "Location: $baseurl/$filter_activepg\n\n"; # print "
    active: $loadnbr"; } ########### sub filter_recents { if(!($msgnmbr)) { $msgnmbr = 250; } open(MSG,"$basedir/$mesgfile_t"); @board_t = ; close(MSG); open(LMN,"$basedir/$datafile"); $lastmsgnmbr = ; close(LMN); if($msgnmbr < $lastmsgnmbr) { $firstmsgnmbr = $lastmsgnmbr - $msgnmbr; } else { $firstmsgnmbr = 15; } $filter_pg = "fltpg_"."$filter".".php"; open(ACTIVEPG,">$basedir/$filter_pg"); flock(ACTIVEPG, 2); foreach $tl (@board_t) { if($tl =~ //) { print ACTIVEPG "
    Filtre: $msgnmbr derniers messages

    \n"; print ACTIVEPG "
    \n"; for($i=$lastmsgnmbr;$i>$firstmsgnmbr;--$i) { $auteur = ""; open(MSG,"$basedir/$mesgdir/$i.html"); @msglns = ; close(MSG); foreach $ml (@msglns) { if($ml =~ /Soumis par/) { $auteur = $ml; $auteur =~ s/Soumis par//g; $auteur =~ s/
    //g; $auteur =~ s/\])*>//g; $auteur =~ s/\<\/a>//g; $auteur =~ s/\n//g; $auteur = "$auteur"; } if($ml =~ //) { $ml =~ s/
    //g; $ml =~ s///g; $ml =~ s/<\/b>//g; $ml =~ s/\n//g; print ACTIVEPG "
    $ml"; } if($ml =~ //) { print ACTIVEPG " - $auteur $ml\n"; } } } print ACTIVEPG "
    \n"; } else { print ACTIVEPG "$tl"; } } close(ACTIVEPG); print "Location: $baseurl/$filter_pg\n\n"; } ########### sub erase_msg { open(MSG,"$basedir/$deleted_msg"); @thmsg = ; close(MSG); open(MAIN,">$basedir/$mesgdir/$msgnmbr.html") || die $!; flock(MAIN, 2); foreach $msg_ln (@thmsg) { print MAIN "$msg_ln"; } close(MAIN); @nouv_files = ("nouveautes_for.txt","nouveautes_for_sub.txt"); foreach $nouv_file (@nouv_files) { open(NEWS,"$homedir/$nouv_file"); @nouveautes = ; close(NEWS); open(NEWS,">$homedir/$nouv_file"); flock(NEWS, 2); foreach $new_dtls (@nouveautes) { if(!($new_dtls =~ /\/$msgnmbr\.html/)) { print NEWS "$new_dtls"; } } close(NEWS); } open(BCKNMBR,"$basedir/mainbcpnmbr.txt"); $bcknmbr = ; close(BCKNMBR); $bcknm="backupforum_"."$bcknmbr".".html"; rename("$basedir/$mesgfile_all", "$basedir/$bcknm") || die "Cannot rename file.txt: $!"; open(MAIN,"$basedir/$bcknm"); @allmainlines =
    ; close(MAIN); $prnt = "on"; open(MAIN,">$basedir/$mesgfile_all") || die $!; flock(MAIN, 2); foreach $msg_ln (@allmainlines) { if($msg_ln =~ //) { $prnt = "off"; } if($prnt eq "on") { print MAIN "$msg_ln"; } else { ++$rmvlines; } if($msg_ln =~ //) { $prnt = "on"; } } close(MAIN); ++$bcknmbr; open(BCKNMBR,">$basedir/mainbcpnmbr.txt"); flock(BCKNMBR, 2); print BCKNMBR "$bcknmbr"; close(BCKNMBR); } ########### sub sendmails { $vg = 0; $mail_listtmp = $mail_list; if($mail_listtmp =~ /$email/ && $email) { $mail_listtmp =~ s/\|$email//g ; } if($mail_listtmp =~ /$regiusr_email/ && $regiusr_email) { $mail_listtmp =~ s/\|$regiusr_email//g ; } (@all_mails) = split(/\|/,$mail_listtmp); foreach $ml (@all_mails) { $mlt = $ml; $mlt =~ s/\s//g; if($mlt) { if($vg == 1) { $all_mails .= "\,"; } $all_mails .= "$mlt"; $vg = 1; } } $all_mails =~ s/\s//g; if($registered) { $reg_sgn = "(r)"; } if($all_mails) { open (MAIL, "$mailprog"); print MAIL "To: $all_mails\n"; print MAIL "From: $frmail\n"; print MAIL "Subject: $subject\n\n"; print MAIL "Un nouveau message de $name $reg_sgn a été ajouté sur le forum $forumtitle et fait suite à un sujet à lequel vous êtes abonné(e).\n"; print MAIL "Cliquez le lien suivant pour vous y rendre:\n"; print MAIL "$forumurl/$mesgdir/$num.html"; close(MAIL); } } ########### sub mail_banded { open(MAIN,"$basedir/banned_refnbr.txt") || die $!; $banned_ref =
    ; close(MAIN); open(MSG,">>$basedir/banned.txt"); print MSG "$banned_ref => ti:$subject key:$banned_key\n"; close(MSG); $banned_refnew = $banned_ref + 1; open(MAIN,">$basedir/banned_refnbr.txt") || die $!; flock(MAIN, 2); print MAIN "$banned_refnew"; close(MAIN); # open (MAIL, "$mailprog"); # print MAIL "To: $frmail\n"; # print MAIL "From: $frmail\n"; # print MAIL "Subject: Message bloqué - $subject\n\n"; # print MAIL "Le message suivant a été bloqué\n"; # print MAIL "Soumis par: $name - $email\n"; # print MAIL "IP: $host_addr\n"; # print MAIL "Banned key=$banned_key\n"; # print MAIL "Sujet: $subject\n"; # print MAIL "Url :$message_url_title - $message_url\n"; # print MAIL "Message:\n $body\n"; # close(MAIL); } ############### sub defmsgsandadd { open(DEBUG,">$basedir/debug.txt") || die $!; flock(DEBUG, 2); if($FORM{'towhat'} eq "this") { $msgnmbr_x = $msgnmbr; &addmailtolist; } elsif($FORM{'towhat'} eq "fromthis") { $msgnmbr_x = $msgnmbr; &addmailtolist; open(MAIN,"$basedir/$mesgdir/$msgnmbr.html") || die $!; @msglines =
    ; close(MAIN); foreach $ml (@msglines) { if($ml =~ /'))-9; $msgnmbr = substr($ml, 9, $nmbrlt); $msgnmbr_x = $msgnmbr; &addmailtolist; } } } elsif($FORM{'towhat'} eq "all") { $tslvmsg = $msgnmbr; &findtopmsg; $msgnmbr_x = $topmsg; &addmailtolist; open(MAIN,"$basedir/$mesgdir/$topmsg.html") || die $!; @msglines =
    ; close(MAIN); foreach $ml (@msglines) { if($ml =~ /'))-9; $msgnmbr = substr($ml, 9, $nmbrlt); } if($ml =~ /'))-13; $msgnmbr = substr($ml, 13, $nmbrlt); } $msgnmbr_x = $msgnmbr; &addmailtolist; } } } else { $mst = 1; &addmailtolist; open(MAIN,"$basedir/$mesgfile_all") || die $!; @msglines =
    ; close(MAIN); foreach $ml (@msglines) { if($ml =~ /'))-9; $msgnmbr = substr($ml, 9, $nmbrlt); } if($ml =~ /'))-13; $msgnmbr = substr($ml, 13, $nmbrlt); } $msgnmbr_x = $msgnmbr; $msgnmbr_x =~s/\s$//g; $msgnmbr_x =~s/\n//g; print DEBUG "$msgnmbr_x | "; &addmailtolist; print DEBUG "done $msgnmbr_x \n"; } } close(DEBUG); } } ########## sub findtopmsg { open(MAIN,"$basedir/$mesgdir/$tslvmsg.html") || die $!; @msglines =
    ; close(MAIN); foreach $mxl (@msglines) { if($mxl =~ /En réponse à: ')-1); $tslvmsg = substr($mxl, $mother_st, $mother_lt); &findtopmsg; } else { $topmsg = $tslvmsg; } } } ############### sub addmailtolist { if($mst == 1) { $msgtoopen = "$soum_file"; $mst = 0; } else { $msgtoopen = "$mesgdir/$msgnmbr_x.html"; } open(MAIN,"$basedir/$msgtoopen") || die $!; @main =
    ; close(MAIN); open(MAIN,">$basedir/$msgtoopen") || die $!; flock(MAIN, 2); foreach $tl (@main) { if($tl =~ //) { $list_st = index($tl,'value="')+7; $list_lt = length ($tl)- ($list_st + 1) - (length ($tl)-index ($tl,'">')-1); $mail_list = substr($tl, $list_st, $list_lt); $mail_list =~ s/\|\|/\|/g; if($FORM{'mailfct'} eq "add") { if(!($mail_list =~ /$email/)) { ++$addfr; print MAIN "\n"; } else { ++$alrdprsnt; print MAIN "\n"; } } else { if($mail_list =~ /$email/) { ++$rmvfr; $mail_list =~ s/\|$email//g ; print MAIN "\n"; } else { print MAIN "\n"; } } } else { print MAIN "$tl"; } } close(MAIN); } ################## sub returnhtml { print "Content-type: text/html\n\n"; if($FORM{'mailfct'} eq "add") { if($addfr) { print "

    Vous êtes maintenant abonné à cette discussion
    (Ajouté à $addfr message(s)\n"; if($alrdprsnt) { print ", déjà présent sur $alrdprsnt messages"; } print ")

    \n"; } else { if($alrdprsnt) { print "

    Vous êtes déjà abonné à cette discussion
    (Présent sur $alrdprsnt message(s))

    \n"; } else { print "

    Désolé, votre courriel n\'a pu être ajouté à ce fil de discussion

    \n"; } } } else { if($rmvfr) { print "

    Votre courriel a été retiré de cette discussion
    (Retiré de $rmvfr message(s))

    \n"; } else { print "

    Votre adresse de courriel n\'est pas inscrite à cette discussion

    \n"; } } print "[ Fermer la fenêtre ]"; } ############### sub coming_events { ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = gmtime(time-4*3600); @months = ("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"); &updatecalendar; @addsoon = ("index.html","index_t.html","index_tv.html"); open(AEVENT,"$homedir/$events_dir/$eventsfile") || die $! ; @events = ; close (AEVENT); $yearl = 1900 + $year; $monthl = $month+1; $month_td = $month+1; $mdayl = $mday+$delais; $mday_td = $mday; if($mdayl>30) { $mdayl=$mdayl-30; $monthl = $monthl+1; } if($monthl>12) { $monthl = 1; $yearl = $yearl +1; } if ($monthl < 10) { $monthl = "0".$monthl; } if ($month_td < 10) { $month_td = "0".$month_td; } if ($mdayl < 10) { $mdayl = "0".$mdayl; } if ($mday_td < 10) { $mday_td = "0".$mday_td; } $today_cal = $yearl.$monthl.$mdayl; $today_d = $yearl.$month_td.$mday_td; foreach $i (sort pardate @events) { ($date_f_ev,$date_ev,$titre_ev,$lieu_ev,$no_ev,$formt) = split(/\|/,$i); $annee_f_ev=substr($date_f_ev, 0, 4); $mois_f_ev=substr($date_f_ev, 4, 2); $jour_f_ev=substr($date_f_ev, 6, 2); $evntdt = $i; chomp($i); if ($annee_f_ev.$mois_f_ev.$jour_f_ev <= $today_cal && $annee_f_ev.$mois_f_ev.$jour_f_ev>=$today_d) { push(@tocome,$evntdt); $soon = 1; } } if($soon) { foreach $ftoadd (@addsoon) { open(MAIN,"$homedir/$ftoadd") || die $!; @main =
    ; close(MAIN); open(MAIN,">$homedir/$ftoadd") || die $!; flock(MAIN, 2); foreach $mainln (@main) { if($mainln =~ //) { print MAIN ""; print MAIN ""; print MAIN ""; print MAIN "
    "; print MAIN ""; foreach $evnt_soon (@tocome) { ($date_f_ev,$date_ev,$titre_ev,$lieu_ev,$no_ev,$formt) = split(/\|/,$evnt_soon); $mois_ev=substr($date_ev, 4, 2); $mois_ev = $mois_ev -1; $jour_ev=substr($date_ev, 6, 2); print MAIN ""; } print MAIN "
    $jour_ev @months[$mois_ev] -$titre_ev - $lieu_ev
    "; print MAIN "
    \n"; } else { print MAIN "$mainln"; } } } } else { foreach $ftoadd (@addsoon) { open(MAIN,"$homedir/$ftoadd") || die $!; @main =
    ; close(MAIN); open(MAIN,">$homedir/$ftoadd") || die $!; flock(MAIN, 2); foreach $mainln (@main) { if($mainln =~ //) { print MAIN ""; print MAIN ""; print MAIN ""; print MAIN "
    "; print MAIN "

    Rien de prévu !
    Ajoutez un événement
    "; print MAIN "
    \n"; } else { print MAIN "$mainln"; } } close (MAIN); } } #&error("soon=$soon"); } ############################# sub updatecalendar { open(EVENT,"$homedir/$events_dir/$eventsfile") || die $! ; @events = ; close (EVENT); open(EVENT,">$homedir/$events_dir/$eventsfile"); flock(EVENT, 2); $yearl = 1900 + $year; $monthl = $month; if ($month < 10) { $monthl = "0".$month; } $mdayl = $mday-2; if($mdayl<0) { $mdayl=1 } if ($mdayl < 10) { $mdayl = "0".$mdayl; } $today = $yearl.$monthl.$mdayl; foreach $i (sort pardate @events) { ($date_f_ev,$date_ev,$titre_ev,$no_ev,$formt) = split(/\|/,$i); $annee_f_ev=substr($date_f_ev, 0, 4); $mois_f_ev=substr($date_f_ev, 4, 2); $jour_f_ev=substr($date_f_ev, 6, 2); chomp($i); if ($annee_f_ev.$mois_f_ev.$jour_f_ev >= $today) { print EVENT "$i\n"; } } close (EVENT); } ################################### sub pardate { @a = split(/\|/,$a); @b = split(/\|/,$b); $a[1] <=> $b[1]; } ################################# sub registered_only { $fichier = "needregister_followup"; $workdir = "/home/stephm69/public_html/filter"; $filename = $fichier.".txt"; open(MAIN,"$workdir/$filename") || die $!; @main =
    ; close(MAIN); open(MAIN,"/home/stephm69/public_html/filter/bckup/bcp_nmbr.txt") || die $!; $val =
    ; close(MAIN); $nval = $val + 1; open(MAIN,">/home/stephm69/public_html/filter/bckup/bcp_nmbr.txt") || die $!; print MAIN $nval; close(MAIN); $bck_name = $filename.".bck".$val; open(MAIN,">/home/stephm69/public_html/filter/bckup/$bck_name") || die $!; foreach $main_line (@main) { print MAIN $main_line; } close(MAIN); open(MAIN,">$workdir/$filename") || die $!; foreach $main_line (@main) { print MAIN $main_line; } print MAIN "\n".$num; close(MAIN); } ################################################################################################# # AJOUT AUX NOUVEAUTÉS SUR LA PAGE D'ACCUEIL ################################################################################################# sub nouveaute { $basedir_n = "/home/stephm69/public_html/kayakdemer"; if(!($typenouv)) { $datafilen = "nouveautes_for.txt"; $nombre_n = "nombre_n_for.txt"; $beg_txt = ""; $description_n="$subject - $name"; } else { $datafilen = "nouveautes_for_sub.txt"; $nombre_n = "nombre_n_for_sub.txt"; $beg_txt = ""; if($registered_only) { $incl_reg_incon = " "; } $description_n="".$incl_reg_incon."$subject - $name"; } ######### # Adapter pour chaque section $section_n="Forum"; $url_n="$baseurl/wwwboard.html"; ####### $mesgfile_temp = "index.html"; $mesgfile = "index.html"; #&addtoaccueil; $mesgfile_temp = "index_tv.html"; $mesgfile = "index_tv.html"; #&addtoaccueil; # Ajout à la page TEMPLATE pour ptites vites $mesgfile_temp = "index_t.html"; $mesgfile = "index_t.html"; #&addtoaccueil; $mesgfile_temp = "index_tn.html"; $mesgfile = "index_tn.html"; #&addtoaccueil; &addtolist_n; } ########################### sub addtolist_n { open(EVENT,"$basedir_n/$datafilen") || die $! ; @nouveautes = ; close (EVENT); open(NBR,"$basedir_n/$nombre_n") || die $! ; # open(NBR,"$basedir_n/nombre_n.txt") || die $! ; $nbr_n = ; close (NBR); open(EVENT,">$basedir_n/$datafilen"); flock(EVENT, 2); print EVENT "$section_n\|$url_n\|$description_n\|$long_date\n"; $nt=1; foreach $i (@nouveautes) { chomp($i); if ($nt<$nbr_n) { print EVENT "$i\n"; $nt++; } } close (EVENT); } ############################ sub addtoaccueil { open(MAIN,"$basedir_n/$mesgfile_temp") || die $!; @main =
    ; close(MAIN); open(EVENT,"$basedir_n/$datafilen") || die $! ; @nouveautes = ; close (EVENT); open(MAIN,">$basedir_n/$mesgfile") || die $!; flock(MAIN, 2); foreach $main_line (@main) { if ($main_line =~ /$beg_txt/) # if ($main_line =~ //) { print MAIN "$beg_txt"; # print MAIN "\n"; print MAIN "
  • "; # print MAIN ""; # print MAIN "$section_n "; # print MAIN " "; print MAIN "$description_n - "; print MAIN "$long_date
    "; # print MAIN "
    "; # print MAIN "
    "; foreach $event (@nouveautes) { ($section_ev,$url_ev,$description_ev,$date_ev) = split(/\|/,$event); print MAIN "
  • "; # print MAIN ""; # print MAIN "$section_ev "; # print MAIN " "; print MAIN "$description_ev - "; $date_ev =~ s/\n//g; $date_ev =~ s/\r//g; print MAIN "$date_ev"; # print MAIN ""; # print MAIN "
    "; } print MAIN "\n"; } else { print MAIN "$main_line"; } } close(MAIN); }