#CACHE{3600} Array('pretty' => 'SPIP', listeon=>'spip-on@rezo.net', responsable =>'spip-owner@rezo.net'), 'test' => Array('pretty' => 'test', listeon=>'test-on@rezo.net', responsable =>'test-owner@rezo.net'), 'disko' => Array('pretty' => 'Disko', 'listeon' =>'disko-on@other_server.org', 'responsable' =>'disko-owner@other_server.org', 'langue' => 'eo') ); // config mailman $mm_who = "~mailman/bin/list_members $liste"; $mm_ismember = "~mailman/bin/find_member -l $liste"; $mm_remove = "~mailman/bin/remove_members --nouserack $liste"; $mm_add = "~mailman/bin/add_members -w n -r - $liste"; $mm_invite = "~mailman/bin/invite_members -r - $liste"; // definitions speciales $charsets = Array('fr'=>'iso-8859-1','fa'=>'utf-8', 'zh'=>'utf-8', 'pt'=>'iso-8859-1', es=>'iso-8859-1', 'eo'=>'utf-8'); // securite if (!$liste = ereg_replace("[^a-z0-9_-]+", "", strtolower($liste))) die('x'); // chercher dans les listes de Mailman dont les archives sont publiques if (!$mailman_data[$liste]) { if (@file_exists("/var/local/mailman/archives/public/$liste")) { $mailman_data[$liste] = Array ( listeon=>"$liste-on@rezo.net", responsable=>"$liste-owner@rezo.net", pretty=>"$liste" ); } } if (!$mailman_data[$liste]) die('x'); // config liste if (!$lang AND !$lang = $mailman_data[$liste]['langue']) $lang = 'fr'; if (!$charset = $charsets[$lang]) $charset = 'iso-8859-1'; // charger le fichier de langue // (tricher sur ecrire/) /*include ('inc_version.php3'); include ('inc_lang.php3'); include ('inc_charsets.php3'); include ('inc_filtres.php3');*/ $dir_ecrire=''; $flag_ecrire=true; $meta['langues_proposees'] = $all_langs = 'fr,fa,cpf,oci_ni,bg,es,en,nl,ar,zh,pt,eo'; $meta['charset'] = $charset; changer_langue($lang); echo " "; echo _T('listes:titrefenetre'); echo " "; echo "\n \n"; // recupere la liste de tous les abonnes : // echo `$mm_who`; // si une adresse est precisee, la tester contre la liste $member = -1; $s_mail = htmlspecialchars($var_email); eregi("[-+_.'a-z0-9]+@[-.a-z0-9]+\.[a-z]+", $var_email, $regs); $var_email = $regs[0]; if ($var_email AND $var_action) $member = is_member($var_email); switch ($var_action) { case 'sub': if ($member == 1) { $retour = ""._T('listes:deja', Array('var_email'=>$var_email, 'liste'=>$liste)).""; } else if ($var_email) { // inscription // `echo "$var_email" | $mm_add`; $listeon = $mailman_data[$liste]['listeon']; @mail ($listeon, ' ', ' ', "From: $var_email\n", "-f$var_email"); $retour = ""._T('listes:ajoutee', Array('var_email'=>$var_email, 'liste'=>$liste)).""; $fin = true; } else { $retour = ""._T('listes:veuillez').""; } break; case 'unsub': if ($member == 1) { // desabonner $listeoff = ereg_replace("-on@", "-off@", $mailman_data[$liste]['listeon']); @mail($listeoff, "unsubscribe", "unsubscribe", "From: $var_email\r\n", "-f$var_email"); # OLD STYLE # `$mm_remove "$var_email"`; $retour = ""._T('listes:desabo').""; $fin = true; $responsable = $mailman_data[$liste]['responsable']; $sujet = filtrer_entites(_T('listes:subject_removed', array('liste' => $liste))); if ($charset == 'utf-8') { @mb_internal_encoding($charset); $sujet = @mb_encode_mimeheader(unicode_to_utf_8($sujet), 'utf-8', 'Q'); } @mail ($var_email, $sujet, unicode_to_utf_8(filtrer_entites(_T('listes:mail_removed', array('var_email'=>$var_email, 'liste'=>$liste, 'responsable'=>$responsable)))), "From: $responsable\n". "MIME-Version: 1.0\n". "Content-Type: text/plain; charset=$charset\n". "Content-Transfer-Encoding: 8bit\n", "-f$responsable"); } else if ($var_email) { $erreur = ""._T('listes:pasabo', array('var_email'=>$var_email, 'liste'=>$liste)).""; } else { $retour = ""._T('listes:veuillez').""; } break; case '': default: break; } // affichage echo "\n\n
\n"; if ($erreur) echo "$erreur\n"; if ($retour) echo "$retour\n"; else { echo "
\n"; echo "\n"; echo "\n"; echo "
"._T('listes:votreemail')."
\n"; //echo "      "; echo " "; echo "

'unsub' ? " checked" : "").">
\n
"; echo "\n"; echo "\n
\n"; } echo "
"; ?> "._T('listes:fermer')."\n"; echo "
"; echo "
"; // chercher un membre function is_member($email) { # global $mm_ismember; global $mm_who, $liste; $email_regexp = preg_replace('/[.+?[\]]/', '\\\\\\0', $email); $cache = _DIR_CACHE . 'popup_'.$liste.'.txt'; if (time() - @filemtime($cache) > 600) { $tous = `$mm_who`; if ($f = @fopen("$cache.tmp", "w")) { @fwrite($f, $tous); @fclose($f); @rename ("$cache.tmp", $cache); } } $result = `grep -l -E "$email_regexp" $cache`; if ($result) return true; else return false; # if (eregi("\n$email_regexp ", "\n".$result)) # return true; } // print_r($GLOBALS); ?>