listdir = ""; $this->listname = ""; $this->listdomain = ""; $this->tempdir = ""; $this->sendheaders = TRUE; $this->sendbody = TRUE; $this->sendfooters = TRUE; $this->includebefore = ""; $this->includeafter = ""; $this->href = ""; $this->prefertype = "text/html"; $this->showheaders = array( "to", "from", "subject", "date" ); $this->header_en_francais = array ('to' => 'A', 'from' => 'De', 'subject' => 'Sujet', 'date' => 'Date') ; $this->msgtemplate = "
"; // if blank it will use the internal one $this->tablecolours = array( // delete the next line if you don't want alternating colours "#eeeeee", "#ffffff" ); $this->thread_subjlen = 55; // --- STOP EDITING HERE --- // some sanity checking if ((!is_dir($this->listdir . "/archive")) or (!is_dir($this->listdir . "/archive/authors")) or (!is_dir($this->listdir . "/archive/threads")) or (!is_dir($this->listdir . "/archive/subjects"))) { return false ; /*$this->error(EZMLM_INVALID_DIR,TRUE);*/ } } function set_action($action) { if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); } $this->action = $action; } function set_actionargs($actionargs) { if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); } $this->actionargs = $actionargs; } function run() { if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); } if ($this->sendheaders) { $this->sendheaders(); } if ($this->sendbody) { $this->sendbody(); } if ($this->includebefore != '') { @include_once($this->includebefore); } switch ($this->action) { case "list_info": $info = new ezmlm_listinfo(); $info->display(); break; case "show_msg": if (count($this->actionargs) < 2) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); } $show_msg = new ezmlm_msgdisplay(); $show_msg->display($this->actionargs[0] . "/" . $this->actionargs[1]); break; case "show_threads": $threads = new ezmlm_threads(); $threads->load($this->actionargs[0]); break; case "show_author_msgs": $author = new ezmlm_author(); $author->display($this->actionargs[0]); break; } if ($this->includeafter != '') { @include_once($this->includeafter); } if ($this->sendfooters) { $this->sendfooters(); } } function sendheaders() { print "\n"; print "\n"; print "\n"; } function sendbody() { print "\n"; } function sendfooters() { print "\n"; print "\n"; } // begin common functions // makehash - generates an author hash using the included makehash program function makehash($str) { $str = preg_replace ('/>/', '', $str) ; $handle = popen ('/usr/local/lib/safe_mode/makehash \''.$str.'\'', 'r') ; $hash = fread ($handle, 256) ; pclose ($handle) ; return $hash; } // makelink - writes the tag function makelink($params,$text) { if ($this->forcehref != "") { $basehref = $this->forcehref; } else { $basehref = preg_replace('/^(.*)\?.*/', '\\1', $_SERVER['REQUEST_URI']); } $link = '' . $text . ''; return $link; } // md5_of_file - provides wrapper function that emulates md5_file for PHP < 4.2.0 function md5_of_file($file) { if (function_exists("md5_file")) { // php >= 4.2.0 return md5_file($file); } else { if (is_file($file)) { $fd = fopen($file, "rb"); $filecontents = fread($fd, filesize($file)); fclose ($fd); return md5($filecontents); } else { return FALSE; } } } // protect_email - protects email address turns user@domain.com into user@d... function protect_email($str,$short = FALSE) { if (preg_match("/[a-zA-Z0-9\-\.]\@[a-zA-Z0-9\-\.]*\./", $str)) { $outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str); $outstr = preg_replace("/\/", '>', $outstr); } else { $outstr = $str; } if ($short) { $outstr = preg_replace("/<.*>/", '', $outstr); $outstr = preg_replace("/[\"']/", '', $outstr); } return trim($outstr); } // cleanup_body: sortta like protect_email, just for message bodies function cleanup_body($str) { $outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str); return $outstr; } function error($def, $critical = FALSE) { global $ezmlm_error; print "\n\n"; print "\n"; print "\n"; print "\n"; print "
EZMLM-PHP Error: " . $ezmlm_error[$def]['title'] . "
" . $ezmlm_error[$def]['body'] . "
\n\n"; if ($critical) { die; } } /** * Parse une chaime et supprime les probl�me d'encodage de type ISO-4 ... * * @return string */ function decode_iso ($chaine) { if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) { $reg_exp = $nombre[0] ; $chaine = str_replace(' ', '', $chaine); } else { $reg_exp = 'ISO-8859-15?' ; } if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ; preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER) ; for ($i = 0; $i < count ($match[0]); $i++ ) { if (strtoupper($match[1][$i]) == 'Q') { $decode = quoted_printable_decode ($match[2][$i]) ; } elseif ($match[1][$i] == 'B') { $decode = base64_decode ($match[2][$i]) ; } $decode = preg_replace ("/_/", " ", $decode) ; if ($reg_exp == 'UTF-8') { $decode = utf8_decode ($decode) ; } $chaine = str_replace ($match[0][$i], $decode, $chaine) ; } return $chaine ; } /** * * * @return */ function date_francaise ($date_mail) { $date_mail = preg_replace ('/\(?CEST\)?/', '', $date_mail) ; $numero_mois = date('m ', strtotime($date_mail)) - 1 ; $date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois $date .= date(' Y ', strtotime($date_mail)) ; // l'ann�e if (date('a', strtotime($date_mail)) == 'pm') { $date .= (int) date('g', strtotime($date_mail)) + 12 ; // Les heures } else { $date .= date('g', strtotime($date_mail)) ; } $date .= date(':i', strtotime($date_mail)) ; // Les minutes return $date ; } /** * Cette fonction renvoie le prefixe, cad 0 ou rien * d un nom de message, ex : pour 09, on renvoie 0 * pour 12 on renvoie rien */ function prefixe_nom_message($nom) { if (preg_match ('/0([1-9][0-9]*)/', $nom, $match)) { $nom_fichier = $match[1]; return '0' ; } else { return '' ; } } } // // --- END OF CLASS DEFINITION --- // // FIN