Rev 178 | Blame | Last modification | View Log | RSS feed
<?php/*vim: set expandtab tabstop=4 shiftwidth=4: */// +------------------------------------------------------------------------------------------------------+// | PHP version 4.1 |// +------------------------------------------------------------------------------------------------------+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |// +------------------------------------------------------------------------------------------------------+// | This library is free software; you can redistribute it and/or |// | modify it under the terms of the GNU General Public |// | License as published by the Free Software Foundation; either |// | version 2.1 of the License, or (at your option) any later version. |// | |// | This library is distributed in the hope that it will be useful, |// | but WITHOUT ANY WARRANTY; without even the implied warranty of |// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |// | General Public License for more details. |// | |// | You should have received a copy of the GNU General Public |// | License along with this library; if not, write to the Free Software |// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |// +------------------------------------------------------------------------------------------------------+// CVS : $Id: forums.php,v 1.10.2.2 2007-04-11 12:19:38 alexandre_tb Exp $/*** Application projet** Action forums**@package projet//Auteur original :*@author Alexandre Granier <alexandre@tela-botanica.org>//Autres auteurs :*@author Aucun*@copyright Tela-Botanica 2000-2005*@version $Revision: 1.10.2.2 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | ENTETE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;include_once (PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php') ;include_once (PROJET_CHEMIN_CLASSES.'inscription_liste.class.php') ;include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;// RAPPEL IMPORTANT// On se situe dans la méthode run() de la classe projetControleur//// création de l'objet projet courant$projet = new projet ($this->_db, $this->_id_projet) ;$liste_ext_res = '' ;$sortie_liste = '' ;$inscription_laius ='' ;$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet);if ($projet->avoirListe()) {foreach ($projet->_listes_associes as $info_liste) {ob_start() ;$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;if ($this->_auth->getAuth()) {$participant = new participe($this->_db) ;$isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;$isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;if ($isAdm) $isCoord = true ;} else {$droits = PROJET_DROIT_AUCUN;}// gestion de l'inscription désinscription à la liste// TODO : la gestion de linscription au résumé$inscription_liste = new inscription_liste($this->_db) ;$statut = $inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth ) ;if ($this->_auth->getAuth() && isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {if ($statut == 2) {$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;} else {$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;}}if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;$liste = new ezmlm_php() ;// Paramétrage de la liste$liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();$liste->listname = $info_liste->getNom() ;$liste->listdomain = $info_liste->getDomaine();if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {$liste->set_action($GLOBALS['action']) ;$liste->set_actionargs($GLOBALS['actionargs']) ;} else {$liste->set_action('list_info') ;}$liste->sendheaders = false;$liste->sendbody = false;$liste->sendfooters = false;$liste->forcehref = $this->_url->getURL() ;print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;print "</a><br />\n";$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL);if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum))print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM);$xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),$info_liste->getNom(), $GLOBALS['lang'],$this->_url->getURL()) ;$xml_parser->load();$resultat = $xml_parser->parse() ;$xml_parser->reset();//$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;// On teste si l'on vient d'une réponse à un email, si oui// on modifie $liste->action pour renvoyer le message auquelon vient de répondreif (isset($_POST['messageid'])) {$liste->action = 'show_msg' ;}switch ($liste->action) {case "show_msg":if (count($liste->actionargs) < 2) {$liste->error(EZMLM_INVALID_SYNTAX,TRUE);}// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier// On appelle la fonction qui affiche un fichier$xml_parser->setAction ('message');$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;$xml_parser->load();ob_start ();$xml_parser->parse() ;$mail = ob_get_contents() ;ob_end_clean();$mimeDecode = new Mail_mimeDecode($mail) ;$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true','include_bodies' => 'true')) ;$message = new ezmlm_msgdisplay() ;$message->listname = $info_liste->getNom();$this->_url->addQueryString ('action', 'show_msg');if ($xml_parser->getNumeroFichierPrecedent() != '') {print '[<a href="' . $this->_url->getURL(). '&actionargs[]='.$xml_parser->getNumeroRepertoirePrecedent().'&actionargs[]='.$xml_parser->getNumeroFichierPrecedent().'">'.PROJET_PRECEDENT.'</a>]';} else {print '['.PROJET_PRECEDENT.']' ;}if ($xml_parser->getNumeroFichierSuivant() != '') {print '[<a href="' .$this->_url->getURL().'&actionargs[]='.$xml_parser->getNumeroRepertoireSuivant().'&actionargs[]='.$xml_parser->getNumeroFichierSuivant().'">'.PROJET_SUIVANT. '</a>]';} else {print '['.PROJET_SUIVANT.']' ;}$this->_url->addQueryString ('action', 'repondre');print '[<a href="'.$this->_url->getURL().'&actionargs[]='.$liste->actionargs[0].'&actionargs[]='.$liste->actionargs[1].'">'.PROJET_REPONDRE.'</a>]';if ($isCoord) {$this->_url->addQueryString ('action', 'supprimer');print '[<a href="'.$this->_url->getURL().'&actionargs[]='.$liste->actionargs[0].'&actionargs[]='.$liste->actionargs[1].'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\');">'.PROJET_SUPPRIMER.'</a>]';}print '<div class="message">' ;print $message->parse_entete_mail($mailDecode) ;//var_dump($mailDecode);$message->parse_template($mailDecode, $liste->actionargs[1], $liste->actionargs[0]);print $message->message_rendu;print '</div>' ;break;case "list_info":print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;$xml_parser->reset() ;$xml_parser->setAction ('derniers_messages');$xml_parser->load();ob_start ();$xml_parser->parse() ;$derniers_messages = ob_get_contents() ;ob_end_clean();echo $derniers_messages ;break;case "show_threads":$xml_parser->reset() ;$xml_parser->setAction ('messages_thread');$xml_parser->setMois($liste->actionargs[0]);$xml_parser->load();ob_start ();$xml_parser->parse() ;$messages_thread = ob_get_contents() ;ob_end_clean();echo $messages_thread ;break;case "show_author_msgs" :$xml_parser->reset() ;$xml_parser->setAction ('messages_auteur');$xml_parser->setHashAuteur($liste->actionargs[0]);$xml_parser->load();ob_start ();$xml_parser->parse() ;$messages_auteur = ob_get_contents() ;ob_end_clean();echo $messages_auteur ;break;case 'show_month' :echo '[ '.$liste->makelink(PROJET_VARIABLE_ACTION.'=forums&action=show_threads&actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;$xml_parser->reset() ;$xml_parser->setAction ('messages_mois');$xml_parser->setMois($liste->actionargs[0]);$xml_parser->load();ob_start ();$xml_parser->parse() ;$messages_mois = ob_get_contents() ;ob_end_clean();echo $messages_mois ;break;case 'repondre' :if (count($liste->actionargs) < 2) {$liste->error(EZMLM_INVALID_SYNTAX,TRUE);}$xml_parser->setAction ('message');$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;$xml_parser->load();ob_start ();$xml_parser->parse() ;$message = ob_get_contents() ;ob_end_clean();$mimeDecode = new Mail_mimeDecode($message) ;$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;if (isset($_SESSION['formulaire_mail'])) {unset ($_SESSION['formulaire_mail']) ;}$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post',str_replace('&', '&', $this->_url->getURL()).'&action='.PROJET_ENVOYER_UN_MAIL_V.'&actionargs[]='.$liste->actionargs[0].'&actionargs[]='.$liste->actionargs[1].'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;$formulaireReponse->construitFormulaire() ;$repondre = new ezmlm_repondre();$repondre->listdir = $liste->listdir ;$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;$repondre->forcehref = $this->_url->getURL();$repondre->listname = $info_liste->getNom() ;// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier// On appelle la fonction qui affiche un fichierprint'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;$repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);$repondre->parse_template($mailDecode, $liste->actionargs[0], $liste->actionargs[1]);$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;// Ajout de > au début de chaque ligne du message$tableau = explode ("\n", $repondre->message_rendu) ;$repondre->message_rendu = "> ".implode ("\n> ", $tableau) ;$formulaireReponse->setDefaults(array('mail_corps' => $repondre->message_rendu,'mail_titre' => 'Re : '.$repondre->decode_iso ($mailDecode->headers['subject']))) ;print $formulaireReponse->toHTML() ;break;case 'supprimer' :$xml_parser->reset() ;$xml_parser->setAction ('supprimer');$xml_parser->setIdMessage($liste->actionargs[0], $liste->actionargs[1]) ;$xml_parser->load();print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;$xml_parser->reset() ;$xml_parser->setAction ('derniers_messages');$xml_parser->load();ob_start ();$xml_parser->parse() ;$derniers_messages = ob_get_contents() ;ob_end_clean();echo $derniers_messages ;break;}} else {print PROJET_MESSAGE_LISTE_PRIVEE ;}$sortie_liste = ob_get_contents() ;ob_end_clean() ;}}include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;$listes_ext = new liste_externe ($this->_db) ;$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;if (count ($tableau_liste) != 0) {//$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;for ($i = 0; $i < count ($tableau_liste); $i++) {$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;$liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;$liste_ext_res .= '<br />'."\n" ;}}$retour .= '<h1>' ;if (!isset($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) $retour .= PROJET_PROJET.' : ';$retour .= $projet->getTitre()."</h1>" ;$retour .= $inscription_laius ;$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;$retour .= $sortie_liste ;$retour .= $liste_ext_res ;?>