Subversion Repositories Applications.projet

Compare Revisions

No changes between revisions

Ignore whitespace Rev 210 → Rev 211

/tags/Racine_livraison_narmer/classes/HTML_listeParticipants.class.php
New file
0,0 → 1,200
<?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: HTML_listeParticipants.class.php,v 1.3 2006-01-11 10:32:09 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_listeParticipants
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
 
/**
* class HTML_listeParticipants
*
*/
class HTML_listeParticipants extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Le mode, par défaut 0 => normal 1 => modification En mode modification, une
* colonne de plus pour désinscrire un utilisateur
* @access private
*/
var $_mode;
/**
* L'url vers la page affichant la liste
* @access private
*/
var $_url;
 
/**
*
*
* @return void
* @access public
*/
function HTML_listeParticipants( $utilise_pager)
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
} // end of member function HTML_listeParticipants
 
/**
*
*
* @param Array elements Tableau des éléments de l'entête. Des labels.
* @return void
* @access public
*/
function construitEntete( $elements )
{
if ($this->_mode == 1) {
array_push ($elements, PROJET_SUPPRIMER) ;
}
$this->addRow ($elements, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array elements Tableau à deux dimension contenant les éléments à afficher.
* @return void
* @access public
*/
function construitListe( $elements, $tableau_statut = '' )
{
for ($i = 0; $i < count ($elements) ; $i++) {
// L'identifiant de l'utilisateur est le premier élément du tableau
$id_utilisateur = array_shift ($elements[$i]) ;
// L'identifiant du statut est le dernier
$id_statut = (int) array_pop ($elements[$i]) ;
// En mode modif on ajoute la colonne supprimer
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$this->_url->addQueryString('statut', 4) ;
array_push ($elements[$i], '', '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'
.PROJET_SUPPRIMER.'</a>');
$this->_url->removeQueryString('statut') ;
}
$this->addRow ($elements[$i]) ;
// mise à jour du champs mail en l'entourant par la balise mailto
/// $i+1 pour sauter la ligne de titre,
if (strlen ($elements[$i][2]) > 10) {
$mail_racourci = substr($elements[$i][2], 0, 10).'...' ;
}
$this->setCellContents ($i+1, 2, '<a href="mailto:'.$elements[$i][2].'">'.$mail_racourci.'</a>') ;
// Mise à jour de la cellule contenant le statut
if ($this->_mode == 1) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 4, $select) ;
}
if ($id_statut == 1 && $this->_mode != 1) {
$this->setCellContents($i + 1, 4, PROJET_CHEF) ;
$this->updateRowAttributes ($i + 1, array('style' => 'font-weight:bold'), true) ;
}
if ($this->_mode != 1 && $id_statut != 1) {
$this->setCellContents($i + 1, 4, $tableau_statut[$id_statut]) ;
}
$this->updateCellAttributes ($i + 1, 0, array ('class' => 'nom')) ;
$this->updateCellAttributes ($i + 1, 1, array ('class' => 'prenom')) ;
}
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
* Renvoie le code HTML de la table.
*
* @return string
* @access public
*/
function toHTML( )
{
// Application de style
$this->altRowAttributes(1, array('class' =>'ligne_paire'), array('class' =>'ligne_impaire'), true) ;
// s'il n'y a qu'une seule ligne, on renvoie un message indiquant qu'il n'y a pas de participants
if ($this->getRowCount() == 1) {
return '<div>'.PROJET_PAS_D_INSCRIT.'</div>'."\n";
}
$res = HTML_Table::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Fixe la valeur de l'URL
*
* @param Net_URL url Un pointeur vers un objet Net_URL
* @return void
* @access public
*/
function setURL( &$url )
{
$this->_url = $url ;
} // end of member function setURL
 
} // end of HTML_listeParticipants
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireListe.class.php
New file
0,0 → 1,123
<?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: HTML_formulaireListe.class.php,v 1.2 2005-09-27 16:40:39 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireListe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireListe
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireListe extends HTML_QuickForm
{
 
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireListe
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire()
{
$this->addElement ('text', 'nom_liste', PROJET_NOM_DE_LA_LISTE, array('size' => '20')) ;
$this->addRule ('nom_liste', PROJET_NOM_DE_LA_LISTE_REQUIRED, 'required', '', 'client') ;
$this->applyFilter('nom_liste', 'strtolower') ;
$this->addElement ('text', 'domaine_liste', PROJET_DOMAINE_DE_LA_LISTE, array('size' => '20')) ;
$this->addRule ('domaine_liste', PROJET_DOMAINE_LISTE_REQUIRED, 'required', '', 'client') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 1, PROJET_OUI, 1) ;
$radio[] = &HTML_QuickForm::createElement('radio', 'liste_visibilite', 0, PROJET_NON, 0);
$this->addGroup($radio, null, PROJET_FORUMS_VISIBILITE, '&nbsp;');
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
 
} // end of HTML_formulaireListe
?>
/tags/Racine_livraison_narmer/classes/ezmlmAccessObject.class.php
New file
0,0 → 1,318
<?php
//vim: set expandtab tabstop=4 shiftwidth=4:
 
// Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)
//
// Ce logiciel est un programme informatique servant à gérer du contenu et des
// applications web.
// Ce logiciel est régi par la licence CeCILL soumise au droit français et
// respectant les principes de diffusion des logiciels libres. Vous pouvez
// utiliser, modifier et/ou redistribuer ce programme sous les conditions
// de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilité au code source et des droits de copie,
// de modification et de redistribution accordés par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
// seule une responsabilité restreinte pèse sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concédants successifs.
 
// A cet égard l'attention de l'utilisateur est attirée sur les risques
// associés au chargement, à l'utilisation, à la modification et/ou au
// développement et à la reproduction du logiciel par l'utilisateur étant
// donné sa spécificité de logiciel libre, qui peut le rendre complexe à
// manipuler et qui le réserve donc à des développeurs et des professionnels
// avertis possédant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invités à charger et tester l'adéquation du
// logiciel à leurs besoins dans des conditions permettant d'assurer la
// sécurité de leurs systèmes et ou de leurs données et, plus généralement,
// à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
 
// Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: ezmlmAccessObject.class.php,v 1.4 2007-04-19 15:34:35 neiluj Exp $
 
/**
* Application projet
*
* La classe ezmlmAccessObject
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** Etend XML_Parser_Simple */
require_once 'XML/Parser/Simple.php' ;
 
/**
* Les codes erreurs
*/
define ('EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE', 206) ;
/**
* classe ezmlmAccessObject parse les fichiers XML
* issue de ezmlm
*
* @category XML
* @package projet
* @author alex
*/
class ezmlmAccessObject extends XML_Parser_Simple {
/**
* Le domaine de la liste
*/
var $domaine ;
/**
* Le nom de la liste
*/
var $liste ;
/**
* Les actions valides
*/
var $actions_supportees = array ('calendrier_messages',
'message',
'derniers_messages',
'messages_auteur',
'messages_mois',
'messages_thread',
'supprimer');
/**
* l'action sélectionnée
*/
var $action ;
/**
* La langue 'fr-FR'
*/
var $langue ;
/**
* L'url de base
*/
var $url ;
/**
* L'identifiant du répertoire
*/
var $identifiant_repertoire ;
/**
* Identifiant message
*/
var $identifiant_message;
 
/**
* L'identifiant du répertoire
*/
var $_numeroRepertoireSuivant ;
/**
* L'identifiant du répertoire
*/
var $hash_auteur ;
/**
* Le mois à afficher
*/
var $mois ;
var $_numeraRepertoirePrecedent;
/**
* Identifiant message
*/
var $_numeroFichierSuivant;
var $_numeroFichierPrecedent;
var $chemin_fichier_xml;
/**
* Creation de l'objet d'accès
*
*
*/
function ezmlmAccessObject ($action, $domaine, $liste, $langue = 'fr', $url = '') {
$this->XML_Parser_Simple(null, 'func') ;
$this->action = $action ;
$this->domaine = $domaine ;
$this->liste = $liste ;
$this->langue = $langue ;
$this->url = $url ;
}
/**
* Gestion des balises
*
* Cette méthode spàcifie les balises reconnus par ezmlmAccessObject
* Elle remplace la méthode handleElement de XML_Parser_Simple
*
* @access public
* @param string nom de l'élément (Voir la doc de PHP)
* @param array attributes
* @param
* @link http://fr.php.net/manual/fr/ref.xml.php manuel
*/
function handleElement_ezmlm_message ($name, $attribs, $data) {
echo $data ;
}
function handleElement_message_suivant ($name, $attribs, $data) {
$this->_numeroRepertoireSuivant = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierSuivant = $attribs['NUMERO'] ;
}
function handleElement_message_precedent ($name, $attribs, $data) {
$this->_numeroRepertoirePrecedent = $attribs['NUMERO_REPERTOIRE'] ;
$this->_numeroFichierPrecedent = $attribs['NUMERO'] ;
}
function handleElement_ezmlm_calendrier_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_derniers_messages ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_auteur ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_mois ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_messages_thread ($name, $attribs, $data) { echo $data ; }
/**
* Choix de l'action
*
* Liste des actions :
* 'calendrier_messages'
*
* @access public
* @param string une action qui doit être supporté
*/
function setAction($action) {
// vérification de l'action
if (!in_array($action, $this->actions_supportees)) {
return raiseError(EZMLM_ACCESS_OBJECT_ACTION_NON_SUPPORTEE) ;
}
$this->action = $action ;
// Libere les ressources (XML_Parser::free)
$this->free();
// Charge la nouvelle action
$this->load() ;
}
/**
* Charge une action
*
* cad affecte un fichier xml au parser
*
* @access public
*/
function load() {
$this->chemin_fichier_xml = PROJET_SERVEUR_VPOPMAIL.'/'.$this->action.'.php?domaine='.
$this->domaine.'&liste='.$this->liste.'&langue='.
$this->langue ;
if ($this->url != '') $this->chemin_fichier_xml.= '&url='.urlencode($this->url) ;
if (isset ($this->identifiant_repertoire))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_repertoire ;
if (isset ($this->identifiant_message))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->identifiant_message ;
if (isset ($this->hash_auteur))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->hash_auteur ;
if (isset ($this->mois))
$this->chemin_fichier_xml .= '&actionargs[]='.$this->mois ;
$this->setInputFile($this->chemin_fichier_xml) ;
}
/**
* Précise un message à extraire
*
* On indique le numéro de répertoire ezmlm et le numéro du message
* @param integer le numéro du répertoire
* @param integer le numéro du message
*
*/
function setIdMessage ($identifiant_repertoire, $identifiant_message) {
$this->identifiant_repertoire = $identifiant_repertoire ;
$this->identifiant_message = $identifiant_message ;
}
/**
* Précise un auteur
*
* On indique le numéro de répertoire ezmlm et le numéro du message
* @param string le hash d'un auteur
*
*/
function setHashAuteur ($hash_auteur) {
$this->hash_auteur = $hash_auteur;
}
/**
* Précise un mois
*
* On indique le numéro de répertoire ezmlm et le numéro du message
* @param string le hash d'un auteur
*
*/
function setMois ($mois) {
$this->mois = $mois;
}
/**
* Renvoi le numero du repertoire suivant
*
*
*/
function getNumeroRepertoireSuivant() { return $this->_numeroRepertoireSuivant; }
function getNumeroFichierSuivant () { return $this->_numeroFichierSuivant ; }
function getNumeroRepertoirePrecedent() { return $this->_numeroRepertoirePrecedent; }
function getNumeroFichierPrecedent () { return $this->_numeroFichierPrecedent ; }
function parse()
{
if (substr(phpversion(), 0, 1) == '5') {
$xml = new SimpleXMLElement(file_get_contents($this->chemin_fichier_xml));
echo utf8_decode ($xml);
switch ($this->action) {
case 'calendrier_messages' : echo utf8_decode($xml->ezmlm_calendrier_messages);
break;
case 'message':
$this->_numeroRepertoirePrecedent = $xml->message_precedent['numero_repertoire'];
$this->_numeroRepertoireSuivant = $xml->message_suivant['numero_repertoire'];
$this->_numeroFichierSuivant = $xml->message_suivant['numero'];
$this->_numeroFichierPrecedent = $xml->message_precedent['numero'];
}
} else {
return parent::parse();
}
}
}
 
?>
/tags/Racine_livraison_narmer/classes/commande_serveur.class.php
New file
0,0 → 1,107
<?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: commande_serveur.class.php,v 1.2 2005-09-27 16:37:40 alexandre_tb Exp $
/**
* Application projet
*
* La classe commande_serveur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class commande_serveur
* Cette classe permet d'accéder au fichier ezmlm.sh afin de lui ajouter des
* commandes qui seront effectués périodiquement par le serveur.
*/
class commande_serveur
{
 
/*** Attributes: ***/
 
/**
* Pointeur vers le fichier des commandes
* @access private
*/
var $_fichier;
 
/**
*
*
* @return void
* @access public
*/
function commande_serveur($fichier)
{
$this->_fichier = fopen ($fichier,'a+') ;
if (!$this->_fichier) {
return 'Impossible d\'ouvrir le fichier de commande' ;
}
} // end of member function commande_serveur
 
/**
*
*
* @param string commande La commande, une chaine à ajouter à la fin du fichier ezmlm.sh
* @return bool
* @access public
*/
function ajouterCommande( $commande )
{
fwrite ($this->_fichier, "\n".$commande) ;
} // end of member function ajouterCommande
/**
* Destructeur
*
* @return void
* @access public
*/
function _commande_serveur($fichier)
{
fclose ($this->_fichier) ;
} // end of member function commande_serveur
 
/**
*
*
* @return
*/
function enleverToutesCommandes () {
ftruncate ($this->_fichier, 12) ;
}
} // end of commande_serveur
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireInscriptionProjet.class.php
New file
0,0 → 1,114
<?php
// +------------------------------------------------------------------------------------------------------+
// | 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: HTML_formulaireInscriptionProjet.class.php,v 1.2 2005-09-27 16:40:23 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireInscriptionProjet
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'HTML/QuickForm/radio.php';
 
/**
* class HTML_formulaireInscriptionProjet
*
*/
class HTML_formulaireInscriptionProjet extends HTML_QuickForm
{
/*** Attributes: ***/
 
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireInscriptionProjet( $formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireInscriptionProjet
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire(& $projet )
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
$modele_element_debut = '<li class="groupe_formulaire">'."\n".'<span class="inscription_label1">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
''."\n" ;
$modele_element_fin = "\n".'<span class="inscription_label2">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n" ;
$squelette->setElementTemplate( '<li class="liste_inscription">'."\n".'<span class="inscription_label">{label}<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required --></span>'.
"\n".'{element}'."\n".''."\n".
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
'</li>'."\n");
$squelette->setElementTemplate( '<ul><li class="groupe_bouton">{element}', 'annuler');
$squelette->setElementTemplate( '{element}</li></ul>', 'valider');
$squelette->setRequiredNoteTemplate("\n".'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'."\n");
if ($projet->avoirListe()) {
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_NORMAL, 2) ;
$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_PAS_DE_MAIL, 1) ;
// Indisponible pour le moment
//$this->addElement ('radio', 'radio_inscription_liste', '&nbsp;', PROJET_INSCRIPTION_LISTE_RESUME, 2) ;
}
$this->addElement ('hidden', 'id_projet', $projet->getId()) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ID_PROJET) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_S_INSCRIRE_AU_PROJET);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
 
} // end of HTML_formulaireInscriptionProjet
?>
/tags/Racine_livraison_narmer/classes/projetTemplate.class.php
New file
0,0 → 1,67
<?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: projetTemplate.class.php,v 1.2 2006-12-18 17:21:58 alexandre_tb Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
class projetTemplate extends PEAR {
 
 
var $_db ;
function projetTemplate(&$objetDB) {
$this->_db = $objetDB ;
}
function getTemplate ($id_template, $lang='fr-FR', $argument = 0) {
$requete = 'select pt_template from projet_template where pt_id_template='.$id_template.
' and pt_i18n like "'.$lang.'%"' ;
if ($argument != 0) $requete .= ' and pt_argument='.$argument ;
$resultat = $this->_db->query($requete) ;
if (DB::isError($resultat)) return $this->raiseError ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
if ($resultat->numRows() == 0) return $this->raiseError ('Aucun template avec l\'identifiant: '.$id_template.
', la langue: '.$lang. ' et l argument '.$argument) ;
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pt_template ;
}
}
?>
/tags/Racine_livraison_narmer/classes/HTML_Liste.class.php
New file
0,0 → 1,77
<?php
// +------------------------------------------------------------------------------------------------------+
// | 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: HTML_Liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_Liste, classe de base pour toutes les listes du module projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'HTML/Table.php' ;
 
/**
* class HTML_Liste
*
*/
class HTML_Liste extends HTML_Table
{
/*** Attributes: ***/
 
/**
*
* @access protected
*/
var $pager;
/**
*
* @access private
*/
var $_utilise_pager;
 
 
/**
*
*
* @param bool utilise_pager Si l'on souhaite que les résultats soient divisés en page, on passe true.
* @return HTML_Liste
* @access public
*/
function HTML_Liste( $utilise_pager = false, $attributes = '')
{
HTML_Table::HTML_Table($attributes) ;
$this->_utilise_pager = $utilise_pager ;
} // end of member function HTML_Liste
 
} // end of HTML_Liste
?>
/tags/Racine_livraison_narmer/classes/projet_type.class.php
New file
0,0 → 1,107
<?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: projet_type.class.php,v 1.2 2005-10-14 08:55:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe projet_type
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_type
{
 
/*** Attributes: ***/
 
/**
* Une connection vers une base de donnée
* @access private
*/
var $_db;
 
/**
* Renvoie tous types de projets (de la table projet_type) ans un tableau avec pour
* clé l'identifiant et pour valeur le label.
*
* @return Array
* @static
* @access public
*/
function getTousLesTypes(& $objetDB )
{
$requete = 'select * from projet_type' ;
return $objetDB->getAssoc ($requete) ;
} // end of member function getTousLesTypes
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_type( & $objetDB )
{
$this->_db = $objetDB ;
} // end of member function projet_type
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_type from projet_type where pt_id_type='.$id_type ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
} // end of member function projet_type
 
 
 
 
} // end of projet_type
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireCouperColler.class.php
New file
0,0 → 1,132
<?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: HTML_formulaireCouperColler.class.php,v 1.2 2005-09-27 16:39:25 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireCouperColler
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class HTML_formulaireCouperColler
*
*/
class HTML_formulaireCouperColler extends HTML_QuickForm
{
/**
*
*
* @return void
* @access public
*/
function construitFormulaire($tableau_repertoire)
{
$squelette =& $this->defaultRenderer();
$squelette->setFormTemplate("\n".'<form{attributes}><ul>'."\n".'{content}'."\n".'</ul></form>'."\n");
$squelette->setElementTemplate( '<li style="list-style-type: none;">'."\n".'{element}'."\n".'</li>'."\n");
$this->addElement('radio', 'projet_repertoire', '', PROJET_RACINE, 0) ;
if (count ($tableau_repertoire)) {
$this->addElement('html', '<ul>') ;
foreach ($tableau_repertoire as $cle => $valeur) {
if ($valeur->_id_pere ==0) {
$this->addElement ('radio', 'projet_repertoire', '', $valeur->getNomLong(), $valeur->getIdDocument()) ;
$sous_tableau = array() ;
foreach ($tableau_repertoire as $valeur_fils) {
if ($valeur_fils->_id_pere == $valeur->getIdDocument()) {
array_push ($sous_tableau, $valeur_fils) ;
}
}
if (count ($sous_tableau)) $this->construitLigneRepertoire($sous_tableau) ;
}
}
$this->addElement('html', '</ul>') ;
}
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', '',
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER
); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider_inscription_projet', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
 
/**
*
*
*
*
*/
function construitLigneRepertoire($tableau) {
$this->addElement('html', '<ul>') ;
foreach ($tableau as $valeur) {
$this->addElement('radio', 'projet_repertoire', '', $valeur->getNomLong(), $valeur->getIdDocument()) ;
}
$this->addElement('html', '</ul>') ;
}
/**
*
*
* @return void
* @access public
*/
function HTML_formulaireCouperColler($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireCouperColler
 
/**
*
*
* @return string
* @access public
*/
function toHTML($nom_de_fichier)
{
$res = '<h2>'.PROJET_CHANGER_REPERTOIRE.'</h2>'."\n" ;
$res .= PROJET_FICHIER_A_DEPLACER . $nom_de_fichier;
$res .= '<h2>'.PROJET_CHOISISSEZ_REPERTOIRE.'</h2>' ;
$res .= HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
} // end of HTML_formulaireCouperColler
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-parser.php
New file
0,0 → 1,409
<?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: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* classe ezmlm_parser pour lire les fichiers d index de ezmlm-idx
*
*@package projet
//Auteur original : ?? recupere dans ezmlm-php
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
// CLASS: ezmlm-parser
class ezmlm_parser extends ezmlm_php {
var $headers; // the full untouched headers of the message
var $body; // the full untouched (but decoded) body (this is not $this->parts[0]->body)
var $parts; // all the parts, if it is a multipart message. each part is an ezmlm_parser object...
 
// Here's the most accessed headers, everything else can be
// accessed from the $this->headers array.
var $to; // To:
var $from; // From:
var $date; // Date:
var $subject; // Subject:
var $replyto; // Reply-To:
var $contenttype; // Content-Type:
 
var $multipart; // TRUE if the message is a multipart message
 
var $msgfile; // if parsed from a file, this is the filename...
 
// functions
 
/**
* recent_msgs renvoie les derniers messages de la liste de discussion
* ezmlm
*
* (
* [0] => Array
* (
* [1] => sujet
* [2] => date en anglais
* [3] => le hash de l auteur
* [4] => l auteur
* )
* [1] => ...
* )
* @param int le nombre de message a renvoye
* @return array un tableau contenant les messages
* @access public
*/
function recent_msgs($show = 20, $month = "") {
$repertoire_archive = opendir($this->listdir . "/archive/");
 
$repertoire_message = array() ;
$dernier_repertoire = 0 ;
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item;
}
}
$tableau_message = array() ;
$compteur_message = 0 ;
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ;
while (!feof($fichier_index)) {
// Recuperation du numero de message, du hash du sujet et du sujet
$temp = fgets($fichier_index, 4096);
preg_match('/([0-9]+): ([a-z]+) (.*)/', $temp, $match) ;
// dans la seconde on recupere la date, hash auteur et auteur
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([^;]+);([^ ]*) (.*)/', $temp, $match_deuxieme_ligne) ;
if ($match[1] != '') {
$tableau_message[$match[1]] = array ($match[2], $match[3],
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3],
$match_deuxieme_ligne[5],
$match_deuxieme_ligne[6]);
}
}
fclose ($fichier_index);
// on renverse le tableau pour afficher les derniers messages en premier
$tableau_message = array_reverse($tableau_message, true);
// On compte le nombre de message, s il est inferieur $show et que l on est
// pas dans le premier index, on ouvre le fichier precedent et recupere
// le n dernier message
if (count ($tableau_message) < $show && $dernier_repertoire != '0') {
$avant_dernier_repertoire = $dernier_repertoire - 1 ;
// On utilise file_get_contents pour renverser le fichier
$fichier_index = array_reverse(
explode ("\n",
preg_replace ('/\n$/', '',
file_get_contents ($this->listdir.'/archive/'.$avant_dernier_repertoire.'/index')) ), true) ;
reset ($fichier_index);
//var_dump ($fichier_index);
for ($i = count ($tableau_message); $i <= $show; $i++) {
// Recuperation du numero de message, du hash du sujet et du sujet
// dans la seconde on recupere la date, hash auteur et auteur
 
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([^;]+);([^ ]*) (.*)/',
current ($fichier_index), $match_deuxieme_ligne) ;
preg_match('/([0-9]+): ([a-z]+) (.*)/', next($fichier_index), $match) ;
next ($fichier_index);
if ($match[1] != '') {
$tableau_message[$match[1]] = array ($match[2], $match[3],
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3],
$match_deuxieme_ligne[5],
$match_deuxieme_ligne[6]);
}
}
} else {
// Si le nombre de message est > $show on limite le tableau de retour
$tableau_message = array_slice($tableau_message, 0, $show, true);
}
return $tableau_message ;
}
 
 
// parse_file - opens a file and feeds the data to parse, file can be relative to the listdir
function parse_file($file,$simple = FALSE) {
if (!is_file($file)) {
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; }
else if (is_file($this->listdir . "/archive/" . $file)) { $file = $this->listdir . "/archive/" . $file; }
else { return FALSE; }
}
 
$this->msgfile = $file;
$data = '' ;
$fd = fopen($file, "r");
while (!feof($fd)) { $data .= fgets($fd,4096); }
fclose($fd);
return $this->parse($data,$simple);
}
 
// parse_file_headers - ouvre un fichier et analyse les entête
function parse_file_headers($file,$simple = FALSE) {
if (!is_file($file)) {
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; }
else if (is_file($this->listdir . "/archive/" . $file)) { $file = $this->listdir . "/archive/" . $file; }
else { return FALSE; }
}
 
$this->msgfile = $file;
$data = file_get_contents ($file) ;
$message = file_get_contents($file) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
return $mailDecode ;
}
 
// this does all of the work (well it calls two functions that do all the work :)
// all the decoding a part breaking follows RFC2045 (http://www.faqs.org/rfcs/rfc2045.html)
function parse($data,$simple = FALSE) {
if (($this->_get_headers($data,$simple)) && $this->_get_body($data,$simple)) { return TRUE; }
return FALSE;
}
 
// all of these are internal functions, you shouldn't call them directly...
 
// _ct_parse: parse Content-Type headers -> $ct[0] = Full header, $ct[1] = Content-Type, $ct[2] ... $ct[n] = AP's
function _ct_parse() {
$instr = $this->headers['content-type'];
preg_replace('/\(.*\)/','',$instr); // strip rfc822 comments
if (preg_match('/: /', $instr)) {
$ct = preg_split('/:/',trim($instr),2);
$ct = preg_split('/;/',trim($ct[1]));
} else {
$ct = preg_split('/;/',trim($instr));
}
if (isset($ct[1])) $attrs = preg_split('/[\s\n]/',$ct[1]);
$i = 2;
$ct[1] = $ct[0];
$ct[0] = $this->headers['content-type'];
if (isset($attrs) && is_array($attrs)) {
while (list($key, $val) = each($attrs)) {
if ($val == '') continue;
$ap = preg_split('/=/',$val,2);
if (preg_match('/^"/',$ap[1])) { $ap[1] = substr($ap[1],1,strlen($ap[1])-2); }
$ct[$i] = $ap;
$i++;
}
}
// are we a multipart message?
if (preg_match('/^multipart/i', $ct[1])) { $this->multipart = TRUE; }
 
return $ct;
}
 
// _get_headers: pulls the headers out of the data and builds the $this->headers array
function _get_headers($data,$simple = FALSE) {
$lines = preg_split('/\n/', $data);
while (list($key, $val) = each($lines)) {
$val = trim($val);
if ($val == "") break;
if (preg_match('/^From[^:].*$/', $val)) continue; /* strips out any From lines added by the MTA */
 
$hdr = preg_split('/: /', $val, 2);
if (count($hdr) == 1) {
// this is a continuation of the last header (like a recieved from line)
$this->headers[$last] .= $val;
} else {
$this->headers[strtolower($hdr[0])] = $hdr[1];
//echo htmlspecialchars($this->headers['from'])."<br />" ;
$last = strtolower($hdr[0]);
}
}
// ajout alex
// pour supprimer le problème des ISO...
// a déplacer ailleur, et appelé avant affichage
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/', $this->headers['subject'], $nombre)) {
$reg_exp = $nombre[0] ;
} else {
$reg_exp = 'ISO-8859-15?' ;
}
if (preg_match ('/UTF/i', $this->headers['subject'])) $reg_exp = 'UTF-8' ;
preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $this->headers['subject'], $match, PREG_PATTERN_ORDER) ;
for ($i = 0; $i < count ($match[0]); $i++ ) {
if ($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) ;
}
$this->headers['subject'] = str_replace ($match[0][$i], $decode, $this->headers['subject']) ;
}
// sanity anyone?
if (!$this->headers['content-type']) { $this->headers['content-type'] = "text/plain; charset=us-ascii"; }
if (!$simple) { $this->headers['content-type'] = $this->_ct_parse(); }
 
return TRUE;
}
 
// _get_body: pulls the body out of the data and fills $this->body, decoding the data if nessesary.
function _get_body($data,$simple = FALSE) {
$lines = preg_split('/\n/', $data);
$doneheaders = FALSE;
$data = "";
while (list($key,$val) = each($lines)) {
//echo htmlspecialchars($val)."<br>";
if (($val == '') and (!$doneheaders)) {
$doneheaders = TRUE;
continue;
} else if ($doneheaders) {
$data .= $val . "\n";
}
}
 
// now here comes the fun part... decoding.
switch($this->headers['content-transfer-encoding']) {
case 'binary':
$this->body = $this->_cte_8bit($this->_cte_qp($this->_cte_binary($data)),$simple);
break;
 
case 'base64':
$this->body = $this->_cte_8bit($this->_cte_qp($this->_cte_base64($data)),$simple);
break;
 
case 'quoted-printable':
$this->body = $this->_cte_8bit($this->_cte_qp($data),$simple);
break;
 
case '8bit':
$this->body = $this->_cte_8bit($data,$simple);
break;
 
case '7bit': // 7bit doesn't need to be decoded
default: // And the fall through as well...
$this->body = $data;
break;
}
//echo $this->headers['content-type'][2][1];
if (isset($this->headers['content-type'][2][1]) && $this->headers['content-type'][2][1] == 'UTF-8') {
//$this->body = utf8_decode ($this->body) ;
//echo quoted_printable_decode(utf8_decode ($this->body)) ;
}
if ($simple) { return TRUE; }
 
// if we are a multipart message then break up the parts and decode, set the appropriate variables.
// here comes the best part about making ezmlm-php OOP. since each part is just really a little message
// in itself each part becomes a new parser object and all the wheels turn again... :)
if ($this->multipart) {
$boundary = '';
for ($i = 2; $i <= count($this->headers['content-type']); $i++) {
if (preg_match('/boundary/i', $this->headers['content-type'][$i][0])) {
$boundary = $this->headers['content-type'][$i][1];
}
}
if ($boundary != '') {
$this->_get_parts($this->body,$boundary);
} else {
// whoopps... something's not right here. we were told that the message is supposed
// to be a multipart message, yet the boundary wasn't set in the content type.
// mark the message as non multipart and add a message to the top of the body.
$this->multipart = FALSE;
$this->body = "PARSER ERROR:\nWHILE PARSING THIS MESSAGE AS A MULTIPART MESSAGE AS DEFINED IN RFC2045 THE BOUNDARY IDENTIFIER WAS NOT FOUND!\nTHIS MESSAGE WILL NOT DISPLAY CORRECTLY!\n\n" . $this->body;
}
}
 
return TRUE;
}
 
// _get_parts: breaks up $data into parts based on $boundary following the rfc specs
// detailed in section 5 of RFC2046 (http://www.faqs.org/rfcs/rfc2046.html)
// After the parts are broken up they are then turned into parser objects and the
// resulting array of parts is set to $this->parts;
function _get_parts($data,$boundary) {
$inpart = -1;
$lines = preg_split('/\n/', $data);
// La première partie contient l'avertissement pour les client mail ne supportant pas
// multipart, elle est stocké dans parts[-1]
while(list($key,$val) = each($lines)) {
if ($val == "--" . $boundary) { $inpart++; continue; } // start of a part
else if ($val == "--" . $boundary . "--") { break; } // the end of the last part
else { $parts[$inpart] .= $val . "\n"; }
}
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la première partie
$part[$i] = new ezmlm_parser();
$part[$i]->parse($parts[$i]);
$this->parts[$i] = $part[$i];
//echo $this->parts[$i]."<br>" ;
}
}
 
// _cte_8bit: decode a content transfer encoding of 8bit
// NOTE: this function is a little bit special. Since the end result will be displayed in
// a web browser _cte_8bit decodes ASCII characters > 127 (the US-ASCII table) into the
// html ordinal equivilant, it also ensures that the messages content-type is changed
// to include text/html if it changes anything...
function _cte_8bit($data,$simple = FALSE) {
if ($simple) { return $data; }
$changed = FALSE;
$chars = preg_split('//',$data);
while (list($key,$val) = each($chars)) {
if (ord($val) > 127) { $out .= '&#' . ord($val) . ';'; $changed = TRUE; }
else { $out .= $val; }
}
if ($changed) { $this->headers['content-type'][1] = 'text/html'; }
return $out;
}
 
// _cte_binary: decode a content transfer encoding of binary
function _cte_binary($data) { return $data; }
 
// _cte_base64: decode a content transfer encoding of base64
function _cte_base64($data) { return base64_decode($data); }
 
// _cte_qp: decode a content transfer encoding of quoted_printable
function _cte_qp($data) {
// For the time being we'll use PHP's function, it seems to work well enough.
return quoted_printable_decode($data);
}
}
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/TODO
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/TODO
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-author.php
New file
0,0 → 1,72
<?php
// $Id: ezmlm-author.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-author.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays all messages by a given author
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_author extends ezmlm_php {
function display($authorhash) {
$file = "/archive/authors/" . substr($authorhash,0,2) . "/" . substr($authorhash,2,18);
//echo $file ;
if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; }
// Le fichier author comprend
// première ligne hash_auteur nom_auteur
// num_mess:annéemois:hash_sujet sujet
$fd = @fopen($this->listdir . $file, "r");
$i = 0 ;
$class = array ('ligne_impaire', 'ligne_paire') ;
while (!feof($fd)) {
$buf = fgets($fd,4096);
if (preg_match('/^' . $authorhash . '/', $buf)) {
// this should ALWAYS be the first line in the file
$author = preg_replace('/^' . $authorhash . ' /', '', $buf);
print '<h3>'.$author.'</h3>' ;
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$tableopened = TRUE;
} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) {
// si la ligne est valide
// on récupère le numéro du message pour en extraire le nom du fichier
$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf);
$msgdir = (int)((int)$msgfile / 100);
$msgfile = (int)$msgfile % 100;
 
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
 
if (!is_file($this->listdir . "/archive/" . $msgdir . "/" . $msgfile)) {
print "<!-- " . $this->listdir . "/archive/" . $msgdir . "/" . $msgfile . " -->\n";
$this->error(EZMLM_INCONSISTANCY);
fclose($fd);
return;
}
 
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile);
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
$subject = $mailDecode->headers['subject'];
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$date = preg_replace ('/CEST/', '', $mailDecode->headers['date']);
print '<tr class="'.$class[$i].'">'."\n";
if ($mailDecode->headers['from'] == '') $from = $mailDecode->headers['return-path'] ; else $from = $mailDecode->headers['from'];
$hash = $this->makehash($from);
print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($from,false)));
print '</td>';
print "<td><b>" . $this->makelink("action=show_msg&actionargs[]=" . $msgdir . "&actionargs[]=" . $msgfile, $this->decode_iso($subject)) . "</b></td>";
print "<td>" . $this->date_francaise($mailDecode->headers['date']) . "</td>\n";
print "</tr>\n";
$i++;
if ($i == 2) $i = 0 ;
unset ($mailDecode) ;
}
}
if ($tableopened) { print "</table>\n"; }
}
}
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm.php
New file
0,0 → 1,327
<?php
// $Id: ezmlm.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm.php - ezmlm-php v2.0
// --------------------------------------------------------------
// As the site that ezmlm-php was developed for grew, and grew
// the old system used had to be bandaid fixed more, and more
// because the site started moving to an object oriented design
// for all the backend systems and ezmlm wasn't playing nice
// with the new design. So, ezmlm was redesigned too, and here
// it is.
//
// It may look a little more confusing if you're not used to
// working with objects but it actually is much more effiecient
// and organized in it's new incarnation.
// Simply edit the variables in the ezmlm-php constructor below
// just like you would with the old ezmlm-php-config.php file,
// if you're unsure howto do this check out the file CONFIG,
// then check the USAGE file for how you should include and use
// the new classes if you are integrating ezmlm-php into your
// site.
// (SEARCH FOR: USER-CONFIG to find where to edit.)
// --------------------------------------------------------------
 
require_once("ezmlm-errors.def");
require_once("ezmlm-parser.php");
require_once("ezmlm-threads.php");
require_once("ezmlm-listinfo.php");
require_once("ezmlm-msgdisplay.php");
require_once("ezmlm-repondre.php");
require_once("ezmlm-author.php");
 
$GLOBALS['mois'] = array ('Jan', 'Fév', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Dèc') ;
 
// CLASS: ezmlm_php
// the base class, contains common functions and the config
class ezmlm_php {
var $listdir; // the root directory of the list
var $listname; // the list address upto the @
var $listdomain; // the domain for the list
 
var $tempdir; // a directory in which the webserver can write cache files
 
var $sendheaders; // send generic page headers
var $sendbody; // send generic body definitions
var $sendfooters; // send generic page footers
var $includebefore; // a file to include before the content
var $includeafter; // a file to include after the content
 
var $href; // what to add before the '?param=value' in links
 
var $prefertype; // what mime type do you prefer?
var $showheaders; // what headers should we show?
 
var $msgtemplate; // the template for displaying messages (see the file TEMPLATE)
 
var $tablecolours; // what are the colours for the table rows?
 
var $thread_subjlen; // the maximum length of subjects in the thread view (0 = no limit)
 
var $forcehref; // force the base of makelink();
 
// --------- END USER CONFIGURATION ---------
 
// Internal variables
var $action = '';
var $actionargs;
 
function ezmlm_php() {
// USER-CONFIG section
// these variables act the same way ezmlm-php-config.php did in the first release
// simply edit these variables to match your setup
$this->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 = "<pre><ezmlm-body></pre>"; // 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 "<html><head>\n";
print "<style type=\"text/css\">\n";
print "<!--\n";
print ".heading { font-family: helvetica; font-size: 16px; line-height: 18px; font-weight: bold; }\n";
print "//-->\n";
print "</style>\n";
print "</head>\n";
}
 
function sendbody() {
print "<body>\n";
}
 
function sendfooters() {
print "</body>\n";
print "</html>\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 <a href=".."> tag
function makelink($params,$text) {
if ($this->forcehref != "") {
$basehref = $this->forcehref;
} else {
$basehref = preg_replace('/^(.*)\?.*/', '\\1', $_SERVER['REQUEST_URI']);
}
$link = '<a href="'. $basehref . '&amp;' . $params . '">' . $text . '</a>';
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("/\</", '&lt;', $outstr);
$outstr = preg_replace("/\>/", '&gt;', $outstr);
} else {
$outstr = $str;
}
 
if ($short) {
$outstr = preg_replace("/&lt;.*&gt;/", '', $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 "<table width=600 border=1 cellpadding=3 cellspacing=0>\n";
print "<tr bgcolor=\"#cccccc\"><td><b>EZMLM-PHP Error: " . $ezmlm_error[$def]['title'] . "</td></tr>\n";
print "<tr bgcolor=\"#aaaaaa\"><td>" . $ezmlm_error[$def]['body'] . "</td></tr>\n";
print "</table>\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
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/makehash
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/makehash
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/MSGTEMPLATE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/MSGTEMPLATE
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php
New file
0,0 → 1,364
<?php
// $Id: ezmlm-msgdisplay.php,v 1.4 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
class ezmlm_msgdisplay extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
var $_auth ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
var $msgfile;
function display($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$this->msgfile = $msgfile ;
$message = file_get_contents($msgfile) ;
// En cours de codage
// La fonction display retourne tout simplement le source du mail
// Il n'y a plus d'analyse à ce niveau
return $message;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print $this->parse_entete_mail($mailDecode) ;
$this->parse_template($mailDecode, $a2, $a1);
print $this->message_rendu;
//print '</div>' ;
}
/**
* Renvoie les infos des messages suivants
*
*
*/
function getInfoSuivant() {
$relfile = preg_replace('!' . $this->listdir . '!', '', $this->msgfile);
$nom_repertoire = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile);
$nom_fichier = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile);
$repertoire_suivant = $nom_repertoire;
// a partir du nom du fichier
// et du nom du repertoire, on reconstitue
// le numero du message stocke dans le fichier d index
// le message 12 du repertoire 2 a le numero 112
if ($nom_repertoire == '0') {
$numero_message = $nom_fichier;
} else {
$numero_message = $nom_repertoire.$nom_fichier ;
}
// On ouvre le fichier d index
$fichier_index = fopen ($this->listdir.'/archive/'.$nom_repertoire.'/index', 'r');
$compteur_ligne = 1;
if (preg_match ('/0([1-9][0-9]*)/', $nom_fichier, $match)) {
$nom_fichier = $match[1];
$prefixe = '0' ;
} else {
$prefixe = '' ;
}
$prefixe = $this->prefixe_nom_message($nom_fichier);
//echo $numero_message;
// on cherche la ligne avec le numero du message
while (!feof($fichier_index)) {
$temp = fgets($fichier_index,4096);
list($num, $hash, $sujet) = split (':', $temp) ;
if ($num == $numero_message) {
$ligne_message_precedent = $compteur_ligne -2;
$temp = fgets($fichier_index, 4096);
$temp = fgets($fichier_index, 4096);
list ($fichier_suivant,$hash, $sujet) = split(':', $temp);
// Au cas ou est au dernier message du fichier d index
// il faut ouvrir le suivant
if (feof($fichier_index)) {
$repertoire_suivant++;
if (file_exists($this->listdir.'/archive/'.$repertoire_suivant.'/index')) {
$fichier_index_suivant = fopen($this->listdir.'/archive/'.$repertoire_suivant.'/index', 'r');
// on recupere le numero du premier message
list($fichier_suivant, $hash, $sujet) = split (':', fgets($fichier_index_suivant), 4096);
fclose ($fichier_index_suivant);
}
}
// Si le numero est > 100, il faut decouper et ne retenir
// que les dizaines et unites
if ($fichier_suivant >= 100) {
$decimal = (string) $fichier_suivant;
$numero = substr($decimal, -2) ;
$fichier_suivant = $numero ;
} else {
if ($fichier_suivant < 9)$fichier_suivant = '0'.$fichier_suivant;
}
break;
}
// On avance d une ligne, la 2e ligne contient date hash auteur
$temp2 = fgets($fichier_index, 4096);
$compteur_ligne += 2;
}
// On utilise $ligne_message_precedent pour recupere le num du message precedent
// Si $ligne_precedent est negatif soit c le premier message de la liste
// soit il faut ouvrir le repertoire precedent
if ($ligne_message_precedent > 0) {
$compteur = 1;
rewind($fichier_index);
while (!feof($fichier_index)) {
$temp = fgets($fichier_index, 4096);
if ($ligne_message_precedent == $compteur) {
list ($fichier_precedent, $hash, $sujet) = split (':', $temp) ;
}
$compteur++;
}
// Le nom du repertoire precedent est le meme que le repertoire courant
$repertoire_precedent = $nom_repertoire ;
// Si $ligne_message_precedent est negatif, alors il faut ouvrir
// le fichier index du repertoire precedent
// si le nom du repertoire est 0, alors il n y a pas de repertoire precedent
// et donc pas de message precedent
} else {
if ($nom_repertoire != '0') {
$repertoire_precedent = $nom_repertoire -1 ;
// on ouvre le fichier d index et on extraie le numero
// du dernier message
$fichier_index_precedent = fopen ($this->listdir.'/archive/'.$repertoire_precedent.'/index', 'r') ;
while (!feof($fichier_index_precedent)) {
$temp = fgets($fichier_index_precedent,4096);
$ligne = split (':', $temp) ;
if ($ligne[0] != '') $fichier_precedent = $ligne[0];
$temp = fgets($fichier_index_precedent,4096);
}
fclose ($fichier_index_precedent);
// on se situe dans le repertoire 0 donc pas de message precedent
} else {
$fichier_precedent = null;
$repertoire_precedent = null;
}
}
if ($fichier_precedent > 100) {
$decimal = (string) $fichier_precedent;
$numero = substr($decimal, -2) ;
$fichier_precedent = $numero ;
} else {
if ($fichier_precedent < 10 )$fichier_precedent = '0'.$fichier_precedent;
}
fclose ($fichier_index);
//if ($fichier_precedent != null && $fichier_precedent < 10) $fichier_precedent = '0'.$fichier_precedent;
return array ('fichier_suivant' => $fichier_suivant,
'repertoire_suivant' => $repertoire_suivant,
'fichier_precedent' => $fichier_precedent,
'repertoire_precedent' => $repertoire_precedent);
}
/**
* analyse l'entete d'un mail pour en extraire les entête
* to, from, subject, date
* met à jour la variable $this->msgtmpl
*
*/
function parse_entete_mail (&$mailDecode) {
$startpos = strpos(strtolower($this->msgtmpl_entete), '<ezmlm-headers>');
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>');
$headers = substr($this->msgtmpl_entete,$startpos + 15,($endpos - $startpos - 15));
$headers_replace = '' ;
for ($i = 0; $i < count($this->showheaders); $i++) {
$val = $this->showheaders[$i];
$headers_replace .= $headers;
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>');
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19);
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value');
$headers_replace = $this->decode_iso ($headers_replace) ;
switch ($val) {
case 'date':
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20);
break;
case 'from':
if ($mailDecode->headers[strtolower($val)] == '') $from = $mailDecode->headers['return-path'] ;
else $from = $mailDecode->headers['from'];
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($from)), $hvpos, 20);
//$headers_replace = htmlspecialchars($headers_replace);
break;
default:
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($mailDecode->headers[strtolower($val)])), $hvpos, 20);
}
}
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos));
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == '8bit') {
$corps .= $this->_cte_8bit($mailDecode->parts[$i]->body);
}
break;
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname.
'&actionargs[]='.$numero_mois.
'&actionargs[]='.$numero_mail;
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='.
$numero_mois.'&actionargs[]='.
$numero_mail.'&actionargs[]='.$i.'">'.
'<img src="'.$mimeType->getCheminIcone().'" alt="'.$mailDecode->ctype_parameters['name'].'" />&nbsp;' ;
$corps .= $mailDecode->ctype_parameters['name'].'</a><br />' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body,TRUE), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . utf8_decode($this->cleanup_body($mailDecode->body,TRUE)) . '</pre>', $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', '<pre>' . $this->cleanup_body($mailDecode->body,TRUE) . '</pre>', $this->msgtmpl);
}
}
}
}
 
function ezmlm_msgdisplay() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<pre>
<ezmlm-body>
</pre>
';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/makehash.tar.gz
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/makehash.tar.gz
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-repondre.php
New file
0,0 → 1,187
<?php
// $Id: ezmlm-repondre.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $
//
// ezmlm-msgdisplay.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Will parse a template (if specified) and display a message.
// Includes a default template.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("Mail/mimeDecode.php") ;
 
 
class ezmlm_repondre extends ezmlm_php {
// our template
var $msgtmpl;
var $message_rendu ;
// display: parses a message (using ezmlm_parser) and displays it
// using a template
function repondre($msgfile) {
if (!is_file($msgfile)) {
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; }
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; }
else { return FALSE; }
}
$message = file_get_contents($msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
// $msg->msgfile contient le chemin du fichier du mail en partant de la racine
// Le point d'exclamation est le délimiteur de l'expression régulière
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du répertoire
$a2 = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); // $a2 contient le nom du fichier
if (isset($mailDecode->headers['date'])) $msgtime = strtotime(preg_replace ('/CEST/', '', $mailDecode->headers['date']));
$threadidx = date("Ym", $msgtime);
if ($a2 <= 10) $numero_precedent = '0'.($a2 - 1) ; else $numero_precedent = ($a2 - 1) ;
if ($a2 < 9) $numero_suivant = '0'.($a2 + 1) ; else $numero_suivant = ($a2 + 1);
// On teste si le message suivant existe
$decoupe = explode ('/', $msgfile) ;
// Les nom de fichiers sont du format :
// archive/0/01
// archive/0/02 ... 0/99 archive/1/01 ...
$nom_fichier = $decoupe[count($decoupe)-1] ;
$nom_repertoire = $decoupe[count($decoupe)-2] ;
$repertoire_suivant = $nom_repertoire ; $repertoire_precedent = $nom_repertoire ;
if ($nom_fichier > 8) {
$fichier_suivant = $nom_fichier + 1 ;
if ($nom_fichier == 99) {
$fichier_suivant = '01' ;
$repertoire_suivant = $nom_repertoire + 1 ;
}
} else {
$fichier_suivant = '0'.($nom_fichier + 1) ;
}
if ($nom_fichier > 10) {
$fichier_precedent = $nom_fichier - 1 ;
} else {
if ($nom_fichier == '01') {
$fichier_precedent = '99' ;
$repertoire_precedent = $nom_repertoire - 1 ;
} else {
$fichier_precedent = '0'.($nom_fichier - 1) ;
}
}
print '<br />'."\n";
$this->parse_template($mailDecode, $a2, $a1);
$formulaireReponse = new HTML_formulaireMail('formulaire_reponse', 'post', str_replace('&amp;', '&', $this->forcehref).'&action=repondre&'.
'actionargs[]='.$a1.'&actionargs[]='.$a2.'&'.PROJET_VARIABLE_ACTION.'='.PROJET_ENVOYER_UN_MAIL_V) ;
$formulaireReponse->construitFormulaire() ;
$formulaireReponse->addElement ('hidden', 'messageid', $mailDecode->headers['message-id']) ;
// Ajout de > au début de chaque ligne du message
$tableau = explode ("\n", $this->message_rendu) ;
$this->message_rendu = "> ".implode ("\n> ", $tableau) ;
$formulaireReponse->setDefaults(array('mail_corps' => $this->message_rendu,
'mail_titre' => 'Re : '.$this->decode_iso ($mailDecode->headers['subject']))) ;
 
print $formulaireReponse->toHTML() ;
 
}
function parse_template(&$mailDecode, $numero_mail, $numero_mois, $num_part = '') {
static $profondeur = array();
array_push ($profondeur, $num_part) ;
$corps = '' ;
if ($mailDecode->ctype_primary == 'multipart') {
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
for ($i = 0; $i < count($mailDecode->parts); $i++) {
switch ($mailDecode->parts[$i]->ctype_secondary) {
case 'plain' :
case 'html' : $corps .= $mailDecode->parts[$i]->body ;
break ;
case 'mixed' :
case 'rfc822' :
case 'alternative' :
case 'appledouble' :
$this->parse_template($mailDecode->parts[$i], $numero_mail, $numero_mois, $i) ;
break ;
case 'applefile' : continue ;
break ;
default :
if ($mailDecode->parts[$i]->ctype_secondary == 'octet-stream') {
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ;
$tab = explode ('.', $nom_piece_jointe) ;
$extension = $tab[count ($tab) - 1] ;
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']);
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ;
} else {
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ?
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$corps .= '';
if (count ($profondeur) > 0) {
array_shift($profondeur) ;
//for ($j= 0; $j < count ($profondeur); $j++) $corps .= '&actionargs[]='.$profondeur[$j];
}
/*$corps .= '&actionargs[]='.$i ;
$corps .= '">'.'<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$corps .= $nom_piece_jointe;
$corps .= '</a><br />' ;*/
break ;
}
}
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,TRUE), $this->msgtmpl);
} else if ($mailDecode->ctype_primary == 'message') {
$this->message_rendu .= "\n".'<div class="message">'.$this->parse_entete_mail($mailDecode->parts[0]);
$corps .= $this->parse_template($mailDecode->parts[0], $numero_mail, $numero_mois, 0) ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl).'</div>';
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){
if ($mailDecode->ctype_secondary == 'applefile') return ;
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '' ;
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($corps,true), $this->msgtmpl);
}
} else {
if (preg_match('/html/i', $mailDecode->ctype_secondary)) {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
} else {
if (isset ($mailDecode->ctype_parameters['charset']) && $mailDecode->ctype_parameters['charset'] == 'UTF-8') {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', utf8_decode($this->cleanup_body($mailDecode->body)) , $this->msgtmpl);
} else {
$this->message_rendu .= preg_replace('/<ezmlm-body>/i', $this->cleanup_body($mailDecode->body), $this->msgtmpl);
}
}
}
}
 
function ezmlm_repondre() {
$this->ezmlm_php();
if (($this->msgtemplate != "") and (is_file($this->msgtemplate))) {
$fd = fopen($this->msgtemplate, "r");
while (!feof($fd)) { $this->msgtmpl .= fgets($fd,4096); }
fclose($fd);
} else {
$this->msgtmpl = '<ezmlm-body>';
}
$this->msgtmpl_entete = '<dl><ezmlm-headers>
<dt><ezmlm-header-name> :</dt>
<dd><ezmlm-header-value></dd>
</ezmlm-headers>
</dl>' ;
}
 
}
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-langue-fr.php
New file
0,0 → 1,5
<?php
 
define ('FIL_DE_DISCUSSION', 'Fil de discussion') ;
 
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/ajout_abonne.php
New file
0,0 → 1,6
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/creation_liste.php
New file
0,0 → 1,20
<?php
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ;
 
 
// Transformation de ma chaine $parametres ((de aBud en -a -B -u -D)
$para = '' ;
for ($i = 0; $i < count ($parametres); $i++) {
$para .= '-'.$parametres.' ' ;
}
 
 
echo exec ('ezmlm-make '.$para.' '.$repertoire.' '.$fichier_qmail.' '.$liste.' '.$domaine, $output, $ret) ;
echo "\n" ;
 
echo exec ('ezmlm-reply-to '.$domaine.' '.$liste) ;
echo "\n" ;
 
 
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/message.php
New file
0,0 → 1,38
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$message = new ezmlm_msgdisplay();
if (!$message) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$message->forcehref = $url;
$message->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$message->listname = $liste;
$message->listdomain = $domaine ;
$id_rep = $actionargs[0] ;
$num_message = $actionargs[1] ;
if ($id_rep =='' || $num_message == '') exit();
 
$html = $message->display ($id_rep.'/'.$num_message) ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_message', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= "\n".'<![CDATA[ '.$html.']]>';
$info_suivant = $message->getInfoSuivant() ;
$xml .= XML_Util::createStartElement ('message_suivant', array ('numero' => $info_suivant['fichier_suivant'],
'numero_repertoire' => $info_suivant['repertoire_suivant'])) ;
$xml .= XML_Util::createEndElement('message_suivant') ;
 
$xml .= XML_Util::createStartElement ('message_precedent', array ('numero' => $info_suivant['fichier_precedent'],
'numero_repertoire' => $info_suivant['repertoire_precedent'])) ;
$xml .= XML_Util::createEndElement('message_precedent') ;
$xml .= XML_Util::createEndElement('ezmlm_message') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/.htaccess
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/.htaccess
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/liste_abonnes.php
New file
0,0 → 1,17
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
exec ('ezmlm-list '.$repertoire, $output, $ret) ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_liste_abonnes', array('domaine' => $domaine, 'liste' => $liste)) ;
 
foreach ($output as $mail) $xml .= XML_Util::createTag('email', '', $mail) ;
 
$xml .= XML_Util::createEndElement('ezmlm_liste_abonnes') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/supprimer.php
New file
0,0 → 1,15
<?php
/**
* Supprime un message d'une liste
* Entrée domaine, liste, numero_repertoire, numero_message
*/
 
$repertoire_liste = '/home/vpopmail/domains/'.$domaine.'/'.$liste;
$message_a_supprimer = $repertoire_liste.'/archive/'.$actionargs[0].'/'.$actionargs[1] ;
 
if (file_exists ($message_a_supprimer)) {
echo $message_a_supprimer;
exec ('rm '.$message_a_supprimer) ;
exec ('ezmlm-archive -c '.$repertoire_liste);
exec ('ezmlm-idx '.$repertoire_liste);
}
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/ajout_moderateur.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste.'/mod' ;
 
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-sub '.$repertoire.' '.$mail ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/suppression_liste.php
New file
0,0 → 1,20
<?php
 
if (!isset ($domaine) || $domaine == '' || !isset($liste) || $liste == '') {
die ('manque paramètre domaine ou liste') ;
}
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ;
 
 
echo exec ('rm '.$fichier_qmail, $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-digest-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-digest-return-default', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-owner', $output2, $ret2) ;
echo exec ('rm '.$fichier_qmail.'-return-default', $output2, $ret2) ;
echo 'rm '.$fichier_qmail ;
echo exec ('rm -rf '.$repertoire, $output, $ret) ;
echo 'rm -rf '.$repertoire ;
 
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/messages_auteur.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_author();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->display($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_auteur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue )) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_auteur') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/suppression_abonne.php
New file
0,0 → 1,7
<?php
 
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
 
echo exec ('ezmlm-unsub '.$repertoire.' '.$mail, $output, $ret) ;
echo 'ezmlm-unsub '.$repertoire.' '.$mail;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->show_month($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
$info->tempdir = '/home/vpopmail/www/tmp' ;
ob_start() ;
if (!$info->load($actionargs[0])) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_messages_thread', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_messages_thread') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/calendrier_messages.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_threads();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->listmessages()) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php
New file
0,0 → 1,32
<?php
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
 
// Parametrage de la liste
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $url;
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
ob_start() ;
if (!$info->show_recentmsgs()) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
$html = ob_get_contents() ;
ob_end_clean() ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
 
$xml .= '<![CDATA[ '.$html.']]>';
 
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml ;
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-errors.def
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-errors.def
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/README
New file
0,0 → 1,131
ezmlm-php 2.0
Nov 13, 2002
http://www.unixpimps.org/software/ezmlm-php
 
ezmlm-php is a group of files written in php that allow you to fetch messages
from a ezmlm mailing list archive via a web page. It is fully customizable so
it can fit into an existing layout design very well, it is also self contained
so that you can run it with no existing site setup.
 
The new version has been rewritten from the ground up to exclude all external
dependancies (except one which comes with the source, see makehash later on)
and now implements RFC2045 MIME parsing in pure PHP.
The system is now also object based to allow greater flexibility within the
code itself, it also makes the code much more managable and readable.
 
 
INSTALLATION
~~~~~~~~~~~~
*NOTE*
The installation of ezmlm-php now requires access to a compiler to build the
included makehash program. See the MAKEHASH section at the end.
 
1. Unpack the tarball and copy the files to your webroot in the directory you
want the list to be accessed from. For example using /home/www/mailinglist
 
gzip -d ezmlm-php-2.0.tar.gz
tar xvf ezmlm-php.2.0.tar
cd /home/www/mailinglist
cp ~/ezmlm-php-2.0/*.php .
cp ~/ezmlm-php-2.0/*.def .
 
2. Build the included makehash program.
 
cd ~/ezmlm-php-2.0
gzip -d makehash.tar.gz
tar xvf makehash.tar
cd makehash
make
 
If you do not have compiler access check the binaries directory in the
makehash.tar file as there are some common binaries there. If you build
makehash on a new platform please feel free to submit the binary for
inclusion.
 
3. Move the resulting binary to your webroot.
 
4. Edit ezmlm.php and change the user configurable options. Search for
USER-CONFIG to find where to edit. See CONFIGURATION below.
 
5. Access www.yoursite.com/mailinglist to test the installation.
 
 
CONFIGURATION
~~~~~~~~~~~~~
This section will explain each variable. If you used the last version most
of these are the exact same.
 
Name Meaning
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
listdir This variable should be pointed at the root of the ezmlm
archive. For instance /usr/home/lists/ragga-jungle
 
listname The name of the list (everything before the @)
 
listdomain The domain name of the list
 
tempdir Where to store the cache files. /var/tmp should be fine
for most installations. /tmp is another choice.
 
sendheaders If set to TRUE then ezmlm will generate the nessesary
page headers. If set to FALSE your header file needs to
generate them. See 'includebefore'
 
sendbody If set to TRUE then ezmlm will generate the <body></body>
tags.
 
sendfooters If set to TRUE then ezmlm will generate the tage needed
to finish the document. If set to FALSE your footer file
needs to generate them. See 'includeafter'
 
includebefore This is a file that will be included before ezmlm-php
generates any output. You can have ezmlm-php generate
the nessesary headers (sendheaders = TRUE) and still
include a file of your own. The file is included by the
include_once function.
 
includeafter This is the exact same as includebefore except the file
is included after ezmlm-php has sent all of it's data.
 
href This is a string to prepend to the path whenever an
<a href= tag is generated. This option was added to fix
the problem of using a <base href= tag.
 
prefertype This is the mime type that you wish to send if the
current message is a multipart message. If this type isn't
found it defaults to the first part.
Some examples are: text/html, text/plain, etc...
 
showheaders This is an array of the headers to show. You can add or
remove any valid RFC822 header you wish to this array.
Some examples: X-Mailer, Message-ID
(This is case-insensitive)
 
msgtemplate This is a file to use as the message template, if blank
the internal one is used. See the file MSGTEMPLATE for
more information as it is to much to describe here.
 
tablescolours This is an array of colour hex triplets for use when a
table is generated. For each row that is generated the
next colour is used, just use a single element if you
don't want alternating colours.
(Yes there is a U in colours, the software was written
in Canada ;)
 
thread_subjlen This is an integer that tells the software how many
characters to allow the subjects when displayed in
threads or on the info page. This is useful if you
want to limit subjects to a certain length so that no
line wrapping occurs.
 
 
MAKEHASH
~~~~~~~~
So what is this little binary you need to build? Simply put it is a small
little C program to generate the nessesary ezmlm-idx hashes for cross
referencing authors. In the last version this was done by recursivley doing
a grep on the /authors directory which isn't very efficient when the list
subscriber base grows above 1000 or so. This program computes the hash by
using the same algorithim the software does and speeds things up a lot.
 
-FIN-
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/index.php
New file
0,0 → 1,19
<?php
// An even simpler version of the index page than version 1. All the actual work of
// determining what needs to be included and what needs to be run is now in the main class.
// Also, 'register_globals' doesn't need to be 'on' anymore.
 
require_once("ezmlm.php");
 
$ezmlm = new ezmlm_php();
 
$action = ($_POST['action'] ? $_POST['action'] : ($_GET['action'] ? $_GET['action'] : "list_info"));
$actionargs = ($_POST['actionargs'] ? $_POST['actionargs'] : ($_GET['actionargs'] ? $_GET['actionargs'] : ""));
 
$ezmlm->set_action($action);
$ezmlm->set_actionargs($actionargs);
$ezmlm->run();
 
unset($ezmlm);
 
?>
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-listinfo.php
New file
0,0 → 1,189
<?php
// $Id: ezmlm-listinfo.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-listinfo.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Displays general list info in the format of a welcome page.
// --------------------------------------------------------------
 
require_once("ezmlm.php");
 
class ezmlm_listinfo extends ezmlm_php {
 
function ezmlm_listinfo () {
return is_dir($this->listdir.'/archive/0') ;
}
function display() {
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le répertoire 0
echo $this->listdir.'/archive/0' ;
return false ;
}
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
//$this->show_info_file();
$threads = new ezmlm_threads();
$threads->listdir = $this->listdir ;
$threads->listname = $this->listname ;
$threads->forcehref = $this->forcehref ; /// ajout alex
$threads->listmessages() ;
$this->show_recentmsgs();
return true ;
}
 
function show_info_file() {
if (@is_file($this->listdir . "/text/info")) {
$infofile = @file($this->listdir . "/text/info");
while (list($line_num, $line) = each($infofile)) {
print nl2br($line);
}
}
}
 
 
function show_recentmsgs($title = "Messages ràcents") {
if (!is_dir($this->listdir.'/archive/0')) return false;
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$recent = $parser->recent_msgs();
// le tableau recent est de la forme
// $recent[numero_message][1] sujet
// $recent[numero_message][2] date en anglais => (22 May 2006)
// $recent[numero_message][3] le hash de l auteur
// $recent[numero_message][4] auteur
$class = array ('ligne_paire', 'ligne_impaire') ;
while (list($key,$val) = each($recent)) {
print '<tr class="'.$class[$ctc].'">'."\n";
//print '<td>'.$val->nummessage.'</td>' ;
// $key contient le numero du message tel que dans les fichiers d index par ex 216
// on retrouve le nom du repertoire et le nom du fichier
$decimal = (string) $key;
if ($key >= 100) {
$fichier_message = substr($decimal, -2) ;
$repertoire_message = substr ($decimal, 0,count ($decimal) -2) ;
} else {
if ($key < 10) {
$fichier_message = '0'.$key;
} else {
$fichier_message = $decimal;
}
$repertoire_message = '0';
}
print '<td>'.$key.'</td>' ;
print '<td>';
 
$from = $val[4];
 
print $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
print "</td>\n";
print '<td><b>';
$actionargs = preg_split("/\//", $val->msgfile);
print $this->makelink("action=show_msg&actionargs[]=" . $repertoire_message .
"&actionargs[]=" . $fichier_message ,$this->decode_iso($val[1]));
 
print "</b></td>\n";
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
print '<td>'.$val[2].'</td>'."\n";
print "</tr>\n";
 
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
print '</table>'."\n";
return true;
}
function show_month ($month) {
// Le nom du fichier est annéemois ex 200501 pour janvier 2005
// on ouvre chaque fichier en lecture
$fd = file_get_contents($this->listdir . '/archive/threads/' . $month, 'r');
$fichier = explode ("\n", $fd) ;
// on récupère la première ligne
$premiere_ligne = $fichier[0] ;
$derniere_ligne = $fichier[count($fichier)-2];
preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
$numero_premier_mail = $match[0] ;
preg_match ('/[0-9]+/', $derniere_ligne, $match1) ;
$numero_dernier_mail = $match1[0] ;
// On cherche le répertoire du premier mail
$repertoire_premier_mail = (int) ($numero_premier_mail / 100) ;
// petite verification de coherence
if ($numero_premier_mail > $numero_dernier_mail) {
$temp = $numero_premier_mail;
$numero_premier_mail = $numero_dernier_mail ;
$numero_dernier_mail = $temp;
}
print '<table class="table_cadre">'."\n";
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$ctc = 0;
$class = array ('ligne_paire', 'ligne_impaire') ;
for ($i = $numero_premier_mail, $compteur = $numero_premier_mail ; $compteur <= $numero_dernier_mail; $i++, $compteur++) {
if ($i > 99) {
$multiplicateur = (int) ($i / 100) ;
// pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100
$i = $i - $multiplicateur * 100 ;
}
if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) {
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
$mailDecode = $mimeDecode->decode() ;
if ($i == 99) {
$repertoire_premier_mail++;
$i = -1;
}
print '<tr class="'.$class[$ctc].'">'."\n";
print '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
$hash = $this->makehash($mailDecode->headers['from']);
print $this->makelink("action=show_author_msgs&actionargs[]=".
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
print "</td>\n";
print '<td><b>';
$actionargs[0] = $repertoire_premier_mail ;
$actionargs[1] = $num_message ;
if (count ($actionargs) > 1) {
print $this->makelink("action=show_msg&actionargs[]=".
$actionargs[(count($actionargs) - 2)] .
"&actionargs[]=".
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
}
print "</b></td>\n";
print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
print "</tr>\n";
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
}
print '</table>'."\n";
return true;
}
}
 
/tags/Racine_livraison_narmer/classes/ezmlm-php-2.0/ezmlm-threads.php
New file
0,0 → 1,351
<?php
// $Id: ezmlm-threads.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
// Builds, maintains & displays thread caches
// These cache files live in $ezmlm->tmpdir and are serialized
// php objects that can be unserialized and displayed easily
// --------------------------------------------------------------
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.php');
 
// CLASS: ezmlm_threads will build, maintain & display thread files (even if a thread is only 1 msg)
class ezmlm_threads extends ezmlm_php {
 
// load: this is the main function that should be called.
// it first checks to see if the cache files are stale, if they are it calls build
// other wise it loads them and calls display
function load($month) {
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum";
} else {
$checksum = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum";
}
$md5 = '' ;
if (!is_file($checksum)) {
$this->build($month);
} else {
$fd = fopen($checksum,"r");
while (!preg_match('/^md5:/', $md5)) { $md5 = fgets($fd,4096); }
fclose($fd);
$md5 = rtrim(preg_replace('/^md5:/', '', $md5), "\n");
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
$this->build($month);
}
}
$this->display($month);
}
 
// display: this loads each cache file sequentially and displays the messages in them
// there is no checking of checksum's done here so load() is the preferred method to
// view the threads
function display($month) {
$seq = 0;
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month;
} else {
$cache = $this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month;
}
// Le lien par date et par thread
echo '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
// remplacé par le tableau globals $mois dans ezmlm.php
print '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1)] .', ' . substr($month,0,4) . '</h2>'."\n";
print '<table class="table_cadre">'."\n";
print '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
print '<tr><td colspan="3"><hr /></td></tr>'."\n";
$ctc = 0;
 
if (is_file($cache)) {
include($cache);
}
print '<tr><td colspan="3"></td></tr>'."\n";
print '</table>'."\n";
}
 
 
function thread_to_html($thread) {
$html = '';
$lastdepth = -1;
$ctc = 0 ;
$thread_curr = $thread;
$class = array ('ligne_paire', 'ligne_impaire') ;
while ($thread_curr != NULL) {
preg_match ('!/archive/([0-9]*)/([0-9]*)!', $thread_curr->file, $match) ;
if (!isset($GLOBALS['fichiers_analyses'][$match[1]][$match[2]])) {
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
//$msg = new ezmlm_parser();
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
} else {
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
}
$actionargs = preg_split("/\//", $thread_curr->file);
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
$html .= $this->makelink('action=show_author_msgs&amp;actionargs[]='.
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= '</td>'."\n";
$html .= '<td><b>';
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ?
for ($i = 0; $i < $thread_curr->depth; $i++) {
$html .= "&nbsp;&nbsp;";
}
if (($this->thread_subjlen > 0) and (strlen($this->decode_iso($mailDecode->headers['subject'])) > $this->thread_subjlen)) {
$subject = substr($this->decode_iso($mailDecode->headers['subject']), 0, ($this->thread_subjlen - 3 - ($thread_curr->depth * 2)));
$subject = $subject . "...";
} else {
$subject = $this->decode_iso($mailDecode->headers['subject']);
}
 
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
$html .= $this->makelink("action=show_msg&amp;actionargs[]=" . $actionargs[2] . "&amp;actionargs[]=" . $actionargs[3], $subject);
$html .= "</b></td>\n";
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == count($this->tablecolours)) { $ctc = 0; }
 
$lastdepth = $thread_curr->depth;
$thread_curr = $thread_curr->next;
}
 
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
return $html;
}
 
// build: takes one argument in the format YYYYMM and builds the thread cache file
// for that month if the ezmlm thread file exists. The resulting cache file is then
// stored in $this->tmpdir;
function build($month) {
if (!is_file($this->listdir . "/archive/threads/" . $month)) { return FALSE; }
 
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month,"w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month,"w+");
}
fclose($fd2);
$i=0;
// ouverture du fichier thread de ezmlm
// Ils sont classés mois par mois
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
while (!feof($fd1)) {
$line = fgets($fd1,4096);
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
// valid ezmlm thread file entry
// On place dans $subjectfile le chemin vers le fichier sujet
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
 
$thread_head = NULL;
$thread_curr = NULL;
$thread_temp = NULL;
$thread_depth = 1;
 
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
// on ouvre le fichier sujet
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet
// sur les autres lignes :
// num_message:annéemois:hash_auteur nom_auteur
$fd2 = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r");
while (!feof($fd2)) {
$line2 = fgets($fd2,4096);
if (preg_match('/^[0-9]/',$line2)) {
$msgnum = preg_replace('/^([0-9]*):.*/', '\\1', $line2);
$msgfile = $msgnum % 100;
$msgdir = (int)($msgnum / 100);
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
//$msg = new ezmlm_parser();
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
$mimeDecode = new Mail_mimeDecode($message) ;
$mailDecode = $mimeDecode->decode() ;
// On stocke le fichier analysée pour réutilisation ultàrieure
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
$thread_depth = 1;
 
if ($thread_head == NULL) {
$thread_head = new ezmlm_thread(0,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
} else {
$thread_curr = new ezmlm_thread($depth,'/archive/' . $msgdir . '/' . $msgfile,$msgid);
if ($inreply != '') { $thread_curr->inreply = $inreply; }
if ($references != '') { $thread_curr->references = $references; }
$thread_head->append($thread_curr);
}
}
}
fclose($fd2);
 
// so now after all that mess $thread_head contains a full thread tree
// first build the depth of each message based on 'in-reply-to' and 'references'
unset($thread_temp);
$thread_temp = NULL;
$thread_curr =& $thread_head->next;
while (get_class($thread_curr) == 'ezmlm_thread') {
unset($thread_temp);
$thread_temp = NULL;
 
if ($thread_curr->inreply != '') { $thread_temp =& $thread_head->find_msgid($thread_curr->inreply); }
if ($thread_temp == NULL) {
if ($thread_curr->references != '') {
$refs = preg_split('/ /', $thread_curr->references);
$refs = array_pop($refs);
$thread_temp =& $thread_head->find_msgid($refs);
}
}
if ($thread_temp == NULL) {
// we couldn't find anything... set depth to 1, the default
$thread_curr->depth = 1;
} else {
// we found a reference, set it to it's depth + 1
$thread_curr->depth = $thread_temp->depth + 1;
}
$thread_curr =& $thread_curr->next;
}
 
// now write it to a temp file named MONTH-SEQ where seq is cronologic sequence order of the thread.
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
@mkdir($this->tempdir . "/ezmlm-php-" . $this->listname, 0755);
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month, "a");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month, "a");
}
fputs($fd2,$this->thread_to_html($thread_head));
fclose($fd2);
}
}
 
// finally store our checksum
if (!is_dir($this->tempdir . "/ezmlm-php-" . $this->listname)) {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "-" . $month . "-" . "checksum","w+");
} else {
$fd2 = fopen($this->tempdir . "/ezmlm-php-" . $this->listname . "/" . $month . "-" . "checksum","w+");
}
fputs($fd2,"md5:" . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . "\n");
fclose($fd2);
fclose($fd1);
 
return TRUE;
}
 
// listmessages: prints out a nice little calendar and displays the message
// totals for each month. The link jumps to the thread listing.
// On lit le répertoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// Présentés comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont rangés par leur numéro
function listmessages() {
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
 
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// on ouvre le fichier d index de chaque repertoire
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
$compteur = 0 ;
while (!feof($fichier_index)) {
// On ignore la premiere ligne
$temp = fgets($fichier_index, 4096);
// dans la seconde on recupere la date
$temp = fgets($fichier_index, 4096);
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
$threadcount[$threadyear][$threadmonth]++;
}
}
fclose ($fichier_index);
}
}
// La partie qui suit, simple, crée la table avec le nombre de message échangé chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<td>'.$valeur.'</td>' ;
$res .=" </tr>\n";
 
while (list($key,$val) = each($threadcount)) {
$res .= " <tr>\n";
$res .= " <td>$key</td>";
for ($i = 1; $i <= 12; $i++) {
if (isset($threadcount[$key][$i]) && $threadcount[$key][$i] > 0) {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\" valign=\"middle\">";
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$key.($i < 10 ? '0'.$i:$i),$threadcount[$key][$i]);
$res .= "</td>";
} else {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\"></td>";
}
}
$res .= "</tr>\n";
}
$res .= "</table>\n";
echo $res ;
}
}
 
// CLASS: ezmlm-thread is a quick little class to allow us to define
// a structure of the current thread in a single-linked list.
// it's a little messy since php doesn't support pointers like C does
// so we have to use references and a head object to append to the list.
class ezmlm_thread {
var $next;
var $depth;
var $file;
var $msgid;
var $inreply;
var $references;
function append($thread) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
$thread_curr =& $thread_curr->next;
}
$thread_curr->next = $thread;
}
function &find_msgid($msgid) {
$thread_curr =& $this;
while ($thread_curr->next != NULL) {
if (trim($thread_curr->msgid) == trim($msgid)) { return $thread_curr; }
$thread_curr =& $thread_curr->next;
}
return NULL;
}
function ezmlm_thread($depth,$file,$msgid) {
$this->depth = $depth;
$this->file = $file;
$this->msgid = $msgid;
$this->next = NULL;
}
}
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireProjet.class.php
New file
0,0 → 1,149
<?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: HTML_formulaireProjet.class.php,v 1.6 2006-07-04 09:26:46 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireProjet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireProjet
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireProjet extends HTML_QuickForm
{
 
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire(&$tableau_projet, $tableau_type = '')
{
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255)) ;
$this->addRule ('projet_titre', PROJET_ALERTE_TITRE, 'required', '', 'client') ;
if ($tableau_type != '') {
$select = new HTML_QuickForm_select ('projet_type', PROJET_TYPE, $tableau_type, array ('class' => 'projet_type')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"10")) ;
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION, array('class'=>"projet_resume", 'rows'=>"20")) ;
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet')) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = &HTML_QuickForm::createElement('radio', 'projet_moderation', '0', PROJET_NON_MODERE, '0') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'projet_moderation', '1', PROJET_MODERE, '1');
$this->addGroup($radio, null, PROJET_INSCRIPTION, '&nbsp;');
$label_projet = array() ;
$id_projet = array() ;
foreach ($tableau_projet as $projet) {
$label_projet[] = $projet->getTitre() ;
$id_projet[] = $projet->getId() ;
}
if (PROJET_UTILISE_HIERARCHIE) {
$select = new HTML_QuickForm_select ('projet_asso', PROJET_PERE, $label_projet, array ('class' => 'projet_asso')) ;
$this->addElement($select) ;
unset ($select) ;
}
$this->applyFilter(array('projet_resume', 'projet_description'), 'addslashes') ;
 
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
 
 
 
} // end of HTML_formulaireProjet
?>
/tags/Racine_livraison_narmer/classes/projetControleur.class.php
New file
0,0 → 1,1807
<?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: projetControleur.class.php,v 1.36 2007-04-19 15:34:35 neiluj Exp $
 
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.36 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if (isset ($GLOBALS['lang'])) {
/** le fichier de langue, par defaut PROJET_LANGUE_DEFAUT */
include_once 'client/projet/langues/pro_langue_'.$GLOBALS['lang'].'.inc.php' ;
} else {
include_once 'client/projet/langues/pro_langue_'.PROJET_LANGUE_DEFAUT.'.inc.php' ;
}
 
 
require_once GEN_CHEMIN_API.'html/HTML_TableFragmenteur.php' ;
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("PROJET_ACTION_COUPER", 3) ;
define ("PROJET_ACTION_MODIFIER", 4) ;
define ("PROJET_SUPPRESSION_FICHIER", 5) ;
define ("PROJET_NOUVEAU", 6) ;
define ("PROJET_NOUVEAU_V", 7) ;
define ('PROJET_MODIFIER_DESCRIPTION', 19) ;
define ('PROJET_MODIFIER_DESCRIPTION_V', 20) ;
define ("PROJET_NOUVEAU_FICHIER", 8) ;
define ("PROJET_NOUVEAU_FICHIER_V", 9) ;
define ("PROJET_NOUVEAU_REPERTOIRE", 11) ;
define ("PROJET_NOUVEAU_REPERTOIRE_V", 12) ;
define ("PROJET_SUPPRESSION_PROJET", 10) ;
define ("PROJET_ENVOYER_UN_MAIL", 13) ;
define ("PROJET_ENVOYER_UN_MAIL_V", 14) ;
define ("PROJET_ACTION_MODIFIER_V", 15) ;
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
define ('PROJET_ACTION_CREER_WIKI', 22) ;
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
define ('PROJET_ACTION_DESINSCRIPTION_PROJET', 26) ;
define ('PROJET_ACTION_INSCRIPTION_LISTE', 27) ;
define ('PROJET_ACTION_DESINSCRIPTION_LISTE', 28) ;
define ('PROJET_ACTION_REFERENCER_LISTE', 29) ;
define ('PROJET_ACTION_REFERENCER_LISTE_V', 30) ;
define ('PROJET_ACTION_COLLER', 32) ;
define ('PROJET_ACTION_ASSOCIER_WIKI', 36) ;
define ('PROJET_ACTION_ASSOCIER_WIKI_V', 37) ;
 
define ('PROJET_ACTION_VOIR_RESUME', 'resume') ;
define ('PROJET_ACTION_VOIR_DESCRIPTION', 'description') ;
define ('PROJET_ACTION_VOIR_DOCUMENT', 'documents') ;
define ('PROJET_ACTION_VOIR_FORUM', 'forums') ;
define ('PROJET_ACTION_VOIR_PARTICIPANT', 'participants') ;
define ('PROJET_ACTION_VOIR_WIKINI', 'wikini') ;
/**
* Code erreur pour l'interface projetControleur qui trouveront leur message
* correspondant via la fonction projetControleur::messageErreur()
*/
define ("PROJETCONTROLEUR_ACTION_INVALIDE", -1) ;
define ("PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE", -2) ;
define ("PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE", -3) ;
define ("PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE", -4) ;
 
/**
* Constantes pour définir les droits
*
*/
define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
define ('PROJET_DROIT_COORDINATEUR', 2) ;
define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
define ('PROJET_DROIT_AUCUN', 16) ;
define ('PROJET_DROIT_EN_ATTENTE', 32);
/**
* class projetControleur
* Cette classe sert à lancer les diverses applications du module projet, en
* fonction des paramètre de l'URL GET ou POST. La méthode principale est run()
*/
class projetControleur
{
/*** Attributes: ***/
 
/**
* Contient l'action du controleur, qui correspond à une action du module projet.
* @access private
*/
var $_action;
/**
* Une connexion à une base de donnée DB.
* @access private
*/
var $_db;
 
/**
* Un objet PEAR:Auth
* @access private
*/
var $_auth;
 
/**
*
* @access private
*/
var $_url;
 
/**
* L'identifiant du projet sur lequel on travaille. Dans l'action par défaut, cet
* attribut n'a pas de valeur.
* @access private
*/
var $_id_projet;
 
/**
* L'identifiant du répertoire que l'on est en train d'observer. Il sera passé en
* paramètre à la classe HTML_listeDocuments.
* @access private
*/
var $_id_repertoire;
 
/**
* L'identifiant du fichier que l'on est en train de modifier / supprimer.
* @access private
*/
var $_id_document;
 
/**
* La présentation de la liste des projets, par défaut vide, signifie en liste.
* Valeurs possibles: arbre
* @access private
*/
var $_presentation;
 
/**
* Le type du projets, par défaut 0, signifie en pas de type particumier.
* Valeurs possibles: 0, 1, 2, 3 ...
* @access private
*/
 
var $_type ;
/**
* Le tableau des projets à ne pas afficher, ni dans l'arbre, ni dans les listes
* @access private
*/
var $_projet_exclu = array();
 
/**
* parametre indiquant le type d'inscription possible
* @access private
*/
var $_prive = 0 ;
 
/**
* parametre pour gere l appel a un service en rapport avec ajax
* @access private
*/
var $_service ;
/**
* Méthode principale de la classe. Elle permet d'appeler les méthodes du modules
* projet en fonction de l'action.
*
* @return string
* @access public
*/
 
 
function run( )
{
// On teste en premier la presence d un appel vers un service
if ($this->_service != '') {
if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
}
}
if ($this->_action == '') {
return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
}
 
// Si il n'y a pas d'action mais un projet, on transmet par défaut l'action PROJET_VOIR
if ($this->_id_projet != "" && $this->_action == PROJET_DEFAUT) {
$this->_action = PROJET_ACTION_VOIR_RESUME ;
$this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
}
if ($this->_id_document != "") {
$this->_url->addQueryString (PROJET_VARIABLE_ID_DOCUMENT, $this->_id_document) ;
}
if ($this->_id_repertoire != '') {
$this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
}
$retour = '' ;
if (!defined('PROJET_MENU_AFFICHER_CONTENU_CORPS')) $retour = $this->menuGeneral() ;
 
switch ($this->_action) {
case PROJET_DEFAUT :
$retour .= $this->mesProjets() ;
break ;
case PROJET_VOIR :
$retour .= $this->accueilProjet();
break ;
case PROJET_NOUVEAU :
$retour .= $this->formulaireProjet(PROJET_NOUVEAU_V) ;
break ;
case PROJET_NOUVEAU_V :
$retour .= $this->nouveauProjetValidation().$this->mesProjets() ;
break ;
case PROJET_NOUVEAU_FICHIER :
$retour .= $this->formulaireFichier(PROJET_NOUVEAU_FICHIER) ;
break ;
case PROJET_ACTION_MODIFIER :
$retour .= $this->formulaireFichier (PROJET_ACTION_MODIFIER) ;
break ;
case PROJET_ACTION_MODIFIER_V :
$retour .= $this->modifierFichier () ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_NOUVEAU_FICHIER_V :
$retour .= $this->nouveauFichierValidation() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_ACTION_COUPER :
$retour .= $this->fichierCouper() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_SUPPRESSION_PROJET :
$retour .= $this->suppressionProjet().$this->mesProjets() ;
break ;
case PROJET_NOUVEAU_REPERTOIRE :
$retour .= $this->nouveauRepertoire() ;
break ;
case PROJET_NOUVEAU_REPERTOIRE_V :
$retour .= $this->nouveauRepertoireValidation() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_SUPPRESSION_FICHIER :
$retour .=$this->suppressionFichier() ;
$this->_action = PROJET_ACTION_VOIR_DOCUMENT ;
break ;
case PROJET_ENVOYER_UN_MAIL :
$retour .= $this->envoyerUnMailFormulaire() ;
break ;
case PROJET_ENVOYER_UN_MAIL_V :
$retour .= $this->envoyerUnMailValidation() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
break ;
case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
break ;
case PROJET_MODIFIER_DESCRIPTION_V : $retour .= $this->modifierProjet() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_S_INSCRIRE : $retour .= $this->inscriptionProjet() ;
 
break ;
case PROJET_ACTION_DESINSCRIPTION_PROJET : $retour .= $this->desinscriptionProjet() ;
break ;
case PROJET_ACTION_CREER_WIKI : $retour .= $this->formulaireWiki() ;
break ;
case PROJET_ACTION_CREER_WIKI_V : $retour .= $this->creationWiki() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_ASSOCIER_WIKI : $retour .= $this->associerWiki() ;
break ;
case PROJET_ACTION_ASSOCIER_WIKI_V : $retour .= $this->associationWiki() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_SUPPRIMER_WIKI : $retour .= $this->supprimerWiki();
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
case PROJET_ACTION_INSCRIPTION_LISTE : $retour .= $this->inscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_DESINSCRIPTION_LISTE : $retour .= $this->desinscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_REFERENCER_LISTE : $retour .= $this->referencerListeExterne() ;
break ;
case PROJET_ACTION_REFERENCER_LISTE_V : $retour .= $this->referencerListeExterneValidation() ;
$this->_action = PROJET_ACTION_VOIR_RESUME ;
break ;
 
}
if (!is_int($this->_action)) {
if (file_exists(PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php')) {
include_once PROJET_CHEMIN_APPLI.'actions/'.$this->_action.'.php' ;
}
}
return $retour ;
} // end of member function run
 
/**
* Permet de fixer la valeur de l'action pour l'objet projetControleur. Cette action
* provient généralement de $_POST['action'] ou $_GET['action']
*
* @param int action L'action à passer provient de l'URL.
* @return void
* @access public
*/
function setAction( $action )
{
$this->_action = $action ;
} // end of member function setAction
 
/**
* Permet de fixer la valeur de du service pour l'objet projetControleur. Ce service
* provient généralement de $_POST['service'] ou $_GET['service']
*
* @param int service Le service à appeler provient de l'URL.
* @return void
* @access public
*/
function setService( $service )
{
$this->_service = $service ;
} // end of member function setAction
 
 
/**
* Constructeur.
*
* @return void
* @access public
*/
function projetControleur(&$dbObjet, &$authObjet, $urlObjet = "")
{
$this->_db = $dbObjet ;
$this->_auth = $authObjet ;
$this->_id_repertoire = 0 ;
$this->_type = '' ;
if (is_object ($urlObjet)) {
$this->_url = $urlObjet ;
}
} // end of member function projetControleur
 
/**
* Renvoie la liste des projets auquel participe la personne loguée, avec son
* statut et un lien vers l'action pour gérer le projet.
*
* @return string
* @access public
*/
function mesProjets( )
{
$res = '' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$participant = new participe ($this->_db) ;
 
// Les entête des tableaux
$tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
 
$auth = $this->_auth->getAuth() ; // Pour raccourcir le code
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ; // --------------
return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
}
 
/**
* Renvoie le menu général de l'application projet. Avec différents liens selon le
* statut de l'utilisateur.
*
* @return string
* @access public
*/
function menuGeneral( )
{
$res = '' ;
$auth = $this->_auth->getAuth() ;
if (!$auth) return ;
$res .= '<div class="menu_projet">'."\n";
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
if ($participant->isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID))) {
$isAdm = 1; $isCoord = 1 ; $isContri = 1 ;
$label_statut = PROJET_ADMINISTRATEUR;
} else {
$isAdm = 0 ; $isCoord = 0 ; $isContri = 0 ;
}
 
// Les menus spécifiques aux projets
if ($this->_id_projet != '') {
if (!$isCoord) {
$isCoord = $participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($isCoord) {
$label_statut = PROJET_CHEF ;
$isContri = true ;
}
}
if (!$isContri && !$isAdm) {
$isContri = $participant->isContributeur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($isContri) {
$label_statut = PROJET_VOUS_PARTICIPEZ ;
} else {
$label_statut = PROJET_VOUS_N_ETES_PAS_INSCRIT ;
}
}
if ($participant->isEnAttente($this->_auth->getAuthData(PROJET_CHAMPS_ID),$this->_id_projet,$this->_db)) {
$isEnAttente = true ;
$label_statut = PROJET_EN_ATTENTE ;
} else {
$isEnAttente = false ;
}
}
 
if ($isContri || $isAdm) {
$res .= '<h2>' ;
if ($isAdm) $res .= PROJET_VOUS_ETES.' ' ;
$res .= $label_statut.'</h2>'."\n" ;
 
} else {
if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
}
if ($this->_id_projet != '') {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
// Participant
if (!$isEnAttente) {
$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
$res .= '<ul id="projet_groupe_niv2_con">' ;
}
if ($isCoord || $isContri) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
} else {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
if (!$isEnAttente) $res .= '<li class="projet_niv2"><a href="'.
$this->_url->getURL().'">'.PROJET_S_INSCRIRE_AU_PROJET."</a></li>\n" ;
}
// L'action gérer les utilisateurs
if ($isCoord || $isAdm) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
}
$res .= '</ul></li>' ;
//document
if ($isContri || $isCoord || $isAdm) {
$res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
// L'action "Mettre un fichier en ligne"
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
// L'action créer un répertoire
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
$res .= '</ul></li>' ;
// Forum
$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
$res .= '<ul id="projet_groupe_niv2_for">' ;
if ($projet->avoirListe()) {
// On vérifie si l'utilisateur est inscrit ou non à la liste et on ajoute le lien
//$projet->getListesAssociees();
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
foreach ($projet->_listes_associes as $info_liste) {
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit($info_liste->getId(), $this->_auth) == 0) {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_RECEVOIR_MESSAGES ;
} else {
// L'action envoyer un mail
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a></li>'."\n" ;
$action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
$label_inscription = PROJET_NE_PAS_RECEVOIR_MESSAGES ;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">';
$res .= $label_inscription.'</a></li> ';
}
if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
$texte_liste = PROJET_SUPPRIMER_LISTE ;
$onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
}
} else {
if ($isAdm || $isCoord) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
$texte_liste = PROJET_CREER_LISTE ;
$onclic = '' ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
}
}
if ($isAdm) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
}
$res .= '</ul></li>' ;
}
// Gestion projet
if ($isCoord || $isAdm) {
$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
$res .= '<ul id="projet_group_niv2_ges">' ;
// L'action modifier les propriétés du projet
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
// L'action supprimer le projet
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
.PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
}
$res .= '</ul></li>' ;
}
// Wikini
if ($isAdm || $isCoord) {
$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
// L'action choisir un wikini
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_ASSOCIER_WIKI) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_ASSOCIER_WIKI."</a></li>\n" ;
$res .= '</ul></li>' ;
}
} else {
if ($isAdm) {
$res .= '<li class="projet_niv1">'.PROJET_GESTION_PROJET ;
$res .= '<ul>' ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
$res .= '</ul></li>' ;
}
}
$res .= '</ul>' ;
$res .= "</div>\n" ;
$this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
return $res ;
} // end of member function menuGeneral
 
/**
* Renvoie le formulaire de création d'un projet.
*
* @return string
* @access public
*/
function formulaireProjet($action)
{
if (!$this->_auth->getAuth()) {
return PROJET_TEXTE_NON_IDENTIFIE;
}
if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
$tableau_type = '' ;
if (PROJET_UTILISE_TYPE) {
include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
$tableau_type = projet_type::getTousLesTypes($this->_db) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type) ;
if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
$projet = new projet($this->_db, $this->_id_projet) ;
$valeurs_par_defaut = array ( 'projet_titre' => $projet->getTitre(),
'projet_description' => $projet->getDescription(),
'projet_asso' => $projet->getIdPere(),
'projet_wikini' => $projet->getWikini(),
'projet_resume' => $projet->getResume(),
'projet_espace_internet' => $projet->getEspaceInternet(),
'projet_type'=> $projet->getType(),
'projet_moderation' => $projet->isModere()
) ;
$formulaire_projet->setDefaults($valeurs_par_defaut) ;
} else {
$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;
}
$res = PROJET_PROPOSER_PROJET ;
return $res . $formulaire_projet->toHTML() ;
} else {
return 'Veuillez régler les permissions en écriture sur '.PROJET_CHEMIN_FICHIER ;
}
} // end of member function nouveauProjet
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return string
* @access public
*/
function nouveauProjetValidation( )
{
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
 
$projet = new projet ($this->_db) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
return 'erreur' ;
}
// On inscrit le déposant du projet en tant que coordinateur
if (PROJET_UTILISATEURS_COORD) {
// Si le projet n'a pas de liste, on inscrit directement
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
}
} else {
return $formulaire_projet->toHTML() ;
}
} // end of member function nouveauProjetValidation
 
/**
* Valide le formulaire et appelle la fonction de mise à jour.
*
* @return void
* @access public
*/
function modifierProjet( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
$formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db)) ;
if ($formulaire_projet->validate()) {
$projet->majSQL($formulaire_projet->getSubmitValues()) ;
} else {
return $formulaire_projet->toHTML() ;
}
unset ($projet) ;
}
 
/**
* Renvoie le formulaire d'upload d'un fichier.
*
* @return void
* @access public
*/
function formulaireFichier($action)
{
$res = '<h1>'.PROJET_FICHIER_MISE_EN_LIGNE.'</h1>'."\n" ;
if (isset($_SESSION['formulaire_document'])) {
unset ($_SESSION['formulaire_document']) ;
}
$action_future = $action == PROJET_NOUVEAU_FICHIER ? PROJET_NOUVEAU_FICHIER_V : PROJET_ACTION_MODIFIER_V ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $action_future) ;
if ($this->_id_repertoire != '') $this->_url->addQueryString (PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire($action) ;
if ($action == PROJET_ACTION_MODIFIER) {
 
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
// On affecte dans un tableau les valeurs de chaque champs du formulaire avec le nom de chaque élément de formulaire
// voir HTML_formulaireDocument
$valeurs_par_defaut = array ('document_nom' => $document->getNomLong(),
'document_description' => $document->getDescription(),
'document_visibilite' => $document->getVisibilite()) ;
 
// On rajoute un champs caché avec l'identifiant du document
$formulaire_document->addElement ('hidden', 'id_document', $this->_id_document) ;
$formulaire_document->setDefaults($valeurs_par_defaut) ;
} else {
$formulaire_document->setDefaults (array ('document_visibilite'=> 'public')) ;
}
return $res.$formulaire_document->toHTML() ;
 
} // end of member function nouveauFichier
 
/**
* Présente un formulaire pour déplacer un fichier
*
*
*/
function fichierCouper() {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$res = '<h1>'.PROJET_PROJET.' : '.$projet->getTitre().'</h1>' ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas où l'on vient de déplacer un fichier
 
if (isset ($_POST['projet_repertoire'])) {
if (!$document -> deplace ($_POST['projet_repertoire'], $projet->getNomRepertoire())) {
echo 'echec du Déplacement' ;
}
return ;
}
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireCouperColler.class.php' ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_COUPER) ;
$HTML_formulaireCouperColler = new HTML_formulaireCouperColler('formulaire_couper_coller', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireCouperColler -> construitFormulaire($projet->getListeRepertoireHierarchisee()) ;
return $res.$HTML_formulaireCouperColler->toHTML('<img src="'.PROJET_CHEMIN_ICONES.$document->getCheminIcone().'" /> '.$document->getNomLong());
}
/**
* Supprime un fichier.
*
* @return void
* @access public
*/
function suppressionFichier( )
{
if ($this->_id_document == "") {
return $this->messageErreur(PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE) ;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
$document->suppression() ;
$document->suppressionSQL() ;
// On verifie s il reste des documents associes au projet et si non on met
// a jour projet.p_avoir_document
if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false);
return ;
 
} // end of member function nouveauFichier
 
/**
* Renvoie le formulaire de création d'un répertoire.
*
* @return void
* @access public
*/
function nouveauRepertoire( )
{
$res = '<h1>'.PROJET_REP_CREER.'</h1>'."\n" ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
$formulaire_repertoire->setDefaults (array ('document_visibilite'=> 'public')) ;
return $res.$formulaire_repertoire->toHTML() ;
 
}
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function nouveauFichierValidation( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
if (isset($_SESSION['formulaire_document']) && $_SESSION['formulaire_document'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/documents.php' ;
}
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire() ;
if ($formulaire_document->validate()) {
// Création d'un objet document vide
$document = new document ("", $this->_db) ;
// avant d'appeler la méthode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du propriétaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numéro de répertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
 
$chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
 
if (!$document->upload (PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload)) {
echo 'Echec de l\'upload' ;
trigger_error('echec d\'upload !', E_USER_ERROR) ;
}
 
 
$document->enregistrerSQL($formulaire_document->getSubmitValues(), $projet->getNomRepertoire().'/'.$chemin_upload) ;
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
// On ajoute une information de session
$_SESSION['formulaire_document'] = 'valide';
} else {
return $formulaire_document->toHTML() ;
}
unset ($projet) ;
} // end of member function nouveauFichierValidation
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function modifierFichier( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_document = new HTML_formulaireDocument('formulaire_document', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_document->construitFormulaire(PROJET_ACTION_MODIFIER_V) ;
if ($formulaire_document->validate()) {
// Création d'un objet document vide
$document = new document ($this->_id_document, $this->_db) ;
// On passe aussi le numéro de répertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
$document->majSQL($formulaire_document->getSubmitValues()) ;
} else {
return $formulaire_document->toHTML() ;
}
unset ($projet) ;
} // end of member function nouveauFichierValidation
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function nouveauRepertoireValidation( )
{
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireDocument.class.php' ;
$formulaire_repertoire = new HTML_formulaireDocument('formulaire_repertoire', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_repertoire->setType ('repertoire') ;
$formulaire_repertoire->construitFormulaire() ;
if ($formulaire_repertoire->validate()) {
// Création d'un objet
$document = new document ("", $this->_db) ;
// avant d'appeler la méthode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du propriétaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numéro de répertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
 
$lien = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
 
// La création du répertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
if (!mkdir (PROJET_CHEMIN_FICHIER.$lien)) {
 
$document->suppressionSQL() ;
return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.PROJET_CHEMIN_FICHIER.$lien ;
}
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
} else {
return $formulaire_repertoire->toHTML() ;
}
} // end of member function nouveauFichierValidation
 
 
/**
* Permet de spécifier au controleur sur quel projet l'on travaille.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
 
} // end of member function setIdProjet
 
/**
* Renvoie la page d'accueil d'un projet.
*
* @return string
* @access public
*/
function accueilProjet( )
{
$res = '' ;
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// récupération de la liste des documents associés
$liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
 
// création de la vue liste de document, on nettoie l'url
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
$vue_liste_document = new HTML_listeDocuments($this->_url, false, $this->_id_repertoire) ;
 
// réglage de paramètres de la vue
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
 
 
$tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
 
$vue_liste_document->setCheminNavigation ($tableau_navigation) ;
// vérification des droits de l'utilisateur
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_CREE_LE) ;
 
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
$id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
$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 ;
 
$statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
// si participant, on ajoute le champs visibilite
 
if ($statut !='' || $isAdm) {
array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
}
// si chef de projet ou si propriétaire d'au moins 1 document
$proprietaire_un_document = false ;
 
foreach ($liste_documents as $document) {
if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document) {
$proprietaire_un_document = true ;
$droits = PROJET_DROIT_PROPRIETAIRE ;
}
}
if ($statut > 0 || $proprietaire_un_document) {
array_push ($entete_liste, PROJET_ACTION) ;
}
} else {
$droits = PROJET_DROIT_AUCUN ;
}
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
 
$vue_liste_document->construitEntete($entete_liste) ;
$vue_liste_document->construitListe ($liste_documents, $droits) ;
 
$wiki_res = '' ;
// Les wikinis associés au projet
if ($projet->getWikini()) {
$wiki_res .= '<div><a href="'.PROJET_URL_WIKINI.'wakka.php?wiki=PagePrincipale&wikini='.$projet->getWikini().'">'.PROJET_URL_WIKINI.'</a>' ;
if ($this->_auth->getAuth() && $isCoord) {
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_WIKI) ;
$wiki_res .= ' <a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_WIKINI_SUPPRIMER.' ?\')">'.PROJET_WIKINI_SUPPRIMER.'</a>' ;
}
$wiki_res .= '</div>' ;
} else {
$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
}
// On charge les listes de discussion du projet
// Pour le moment seul ezmlm est supportée
 
$projet->getListesAssociees();
$sortie_liste = '' ;
 
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
foreach ($projet->_listes_associes as $info_liste) {
 
$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() ;
 
ob_start() ;
print '<span class="heading">Liste <strong>' . $info_liste->getAdresseEnvoi() ;
print "</strong></span><br />\n";
if ($this->_auth->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
$inscription_liste = new inscription_liste($this->_db) ;
if ($inscription_liste->getStatutInscrit( $info_liste->getId(), $this->_auth) == '') {
$action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
$label_inscription = PROJET_S_INSCRIRE ;
} else {
$action_inscription = PROJET_ACTION_DESINSCRIPTION_LISTE ;
$label_inscription = PROJET_SE_DESINSCRIRE ;
}
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription) ;
print '<a href="'.$this->_url->getURL().'">';
print $label_inscription.'</a><br /> ';
}
print "\n<hr noshade><br />\n";
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
switch ($liste->action) {
case "show_msg":
if (count($liste->actionargs) < 2) {
$liste->error(EZMLM_INVALID_SYNTAX,TRUE);
}
$show_msg = new ezmlm_msgdisplay();
$show_msg->listdir = $liste->listdir ;
$show_msg->forcehref = $this->_url->getURL();
// actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
// On appelle la fonction qui affiche un fichier
$show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
break;
 
case "list_info":
$info = new ezmlm_listinfo();
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
$info->forcehref = $this->_url->getURL();
$info->listdir = $liste->listdir ;
$info->listname = $info_liste->getNom();
$info->listdomain = $info_liste->getDomaine() ;
 
if (!$info->display()) {
echo 'Pas de message dans cette liste' ;
}
break;
case "show_threads":
$threads = new ezmlm_threads();
$threads->forcehref = $this->_url->getURL() ;
$threads->listdir = $liste->listdir ;
$threads->listname = $info_liste->getNom() ;
$threads->listdomain = $info_liste->getDomaine() ;
$threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
$threads->load($liste->actionargs[0]);
break;
case "show_author_msgs" :
$author = new ezmlm_author();
$author->listdir = $liste->listdir ;
$author->listname = $info_liste->getNom() ;
$author->listdomain = $info_liste->getDomaine() ;
$author->forcehref = $this->_url->getURL() ;
$author->display($liste->actionargs[0]);
break ;
}
$sortie_liste = ob_get_contents() ;
ob_end_clean() ;
}
} else {
$sortie_liste = '<div>'.PROJET_PAS_DE_LISTE.'</div>'."\n" ;
}
 
$res .= "<h1>".$projet->getTitre()."</h1>" ;
$res .= '<div>'.$projet->getDescription().'</div>'."\n" ;
$res .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
$res .= $wiki_res ;
$res .= '<h2>'.PROJET_FICHIERS_ASSOCIES.'</h2>'."\n" ;
$res .= $vue_liste_document->toHTML() ;
$res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
$res .= $sortie_liste ;
 
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) {
$res .= '<h2>'.PROJET_LISTES_EXTERNES_ASSOCIEES.'</h2>'."\n" ;
for ($i = 0; $i < count ($tableau_liste); $i++) {
$info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
$res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
$res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
$res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
$res .= '<br />'."\n" ;
}
}
return $res ;
} // end of member function accueilProjet
 
/**
* Permet de spécifier quel répertoire, dans la vue de document afficher. Il sera
* passé en paramètre à la classe HTML_listeDocuments.
*
* @param int id_repertoire L'identifiant du répertoire à afficher.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_repertoire = $id_repertoire ;
} // end of member function setIdRepertoire
 
/**
* Supprime un projet et tout ce qui va avec.
*
* @return void
* @access public
*/
function suppressionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) $projet->supprimerListe($projet->_listes_associes[0]) ;
$msg = $projet->suppressionSQL() ;
unset ($this->_id_projet) ; unset($_GET['id_projet']);
return $msg ;
}
 
/**
* Permet d'indiquer au controleur sur quel document on travaille.
*
* @param int id_document
* @return void
* @access public
*/
function setIdDocument( $id_document )
{
$this->_id_document = $id_document ;
}
 
 
/**
* Renvoie le formulaire d'envoie de mail
*
* @return void
* @access public
*/
function envoyerUnMailFormulaire( )
{
if (!$this->_auth->getAuth()) {
return PROJET_LISTE_PROJET;
}
if (isset($_SESSION['formulaire_mail'])) {
unset ($_SESSION['formulaire_mail']) ;
}
$res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
return $res.$formulaire_mail->toHTML() ;
}
 
/**
* Envoie le mail
*
* @return void
* @access public
*/
function envoyerUnMailValidation( )
{
// Vérifications
if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
}
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
$formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_mail->construitFormulaire() ;
if ($formulaire_mail->validate()) {
// création de l'objet projet courant
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$info_liste = $projet->getListesAssociees() ;
$valeurs_mail = $formulaire_mail->getSubmitValues() ;
// Pour envoyer le mail on utilise la classe Mail de PEAR
// on a besoin du mail de l'inscrit
 
$entetes['From'] = $this->_auth->getUserName();
$entetes['To'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
$entetes['Subject'] = $valeurs_mail['mail_titre'] ;
$entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
$entetes['Message-ID'] = md5(time()).'@'.$projet->_listes_associes[0]->getNom().'.'.$projet->_listes_associes[0]->getDomaine() ;
$entetes['reply-to'] = $projet->_listes_associes[0]->getAdresseEnvoi() ;
$entetes['Content-Type'] = 'text/plain' ;
// Traitement de la reference s'il s'agit d'une réponse
if (isset ($_POST['messageid'])) {
$entetes['In-Reply-To'] = $_POST['messageid'] ;
}
$objet_mail =& Mail::factory('smtp');
$objet_mail->send($entetes['To'], $entetes, $valeurs_mail['mail_corps']);
$_SESSION['formulaire_mail'] = 'valide';
return ;
} else {
return $formulaire_mail->toHTML() ;
}
} // end of member function envoyerUnMailValidation
 
/**
* Renvoie le formulaire de création d'une liste.
*
* @param int action Indique le type d'action, PROJET_ACTION_NOUVELLE_LISTE
* @return string
* @access public
*/
function formulaireListe( $action )
{
$res = '<h1>'.PROJET_CREATION_LISTE.'</h1>'."\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
$formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
$formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
return $res.$formulaire_liste->toHTML() ;
} // end of member function formulaireListe
 
/**
* Transmet au serveur la demande de création d'une nouvelle liste.
*
* @return void
* @access public
*/
function nouvelleListeValidation( )
{
// Vérifications
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE_V );
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListe.class.php' ;
$formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
$formulaire_liste->construitFormulaire() ;
if ($formulaire_liste->validate()) {
// création de l'objet liste_discussion
$liste = new liste_discussion('', $this->_db) ;
 
// On vérifie que le nom de la liste soit unique
if (liste_discussion::verifieDoubleListe($formulaire_liste->getSubmitValue('nom_liste').'@'.
$formulaire_liste->getSubmitValue('domaine_liste'), $this->_db)) {
// On rajoute la liste dans la base
$liste->enregistrerSQL($formulaire_liste->getSubmitValues()) ;
 
// On la relie au projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->ajouterListe($liste) ;
 
// Création de la liste
$resultat_creation = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/creation_liste.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&parametres=aBiud') ;
 
// Ajout du modérateur
$resultat_ajout_moderateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_moderateur.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
// Ajout du modérateur en tant qu'utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
 
} else {
return PROJET_MESSAGE_LISTE_DOUBLE.$formulaire_liste->toHTML() ;
}
return $resultat_creation.$resultat_ajout_moderateur.$resultat_ajout_utilisateur;
 
} else {
return $formulaire_liste->toHTML() ;
}
} // end of member function nouvelleListeValidation
 
/**
* Supprime la liste de discussion associée au projet
*
* @return void
* @access public
*/
function supprimerListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
 
$resultat_suppression = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/suppression_liste.php?domaine='.
$projet->_listes_associes[0]->getDomaine().'&liste='.$projet->_listes_associes[0]->getNom()) ;
$projet->supprimerListe($projet->_listes_associes[0]) ;
return $resultat_suppression;
} // end of member function supprimerListe
 
 
/**
*
*
* @param string presentation Pour affecter une présentation au projet
* @return void
* @access public
*/
function setPresentation( $presentation )
{
$this->_presentation = $presentation ;
} // end of member function setPresentation
 
/**
*
*
* @param string type Pour affecter un type au projet
* @return void
* @access public
*/
function setType( $type)
{
$this->_type = $type ;
} // end of member function setPresentation
 
 
/**
* Fonction affichant les participants à un projet
*
* @return string
* @access public
*/
function voirParticipants( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$titre = '<h1>'.$projet->getTitre().'</h1>'."\n" ;
$titre .= '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participants = new participe($this->_db) ;
 
// On teste ici s'il y a une mise à jour de statut
if (isset($_POST['statut'])) {
// $_GET['id_utilisateur'] et $_GET['statut'] proviennent du formulaire voir HTML_listeParticipants
$participants->setStatut($_POST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
}
 
// Ce qui suit doit être amàliorà pour sortir la requête sur l'annuaire
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
if (isset($_POST['mail_utilisateur'])) {
$requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$msg = PROJET_MAIL_ABSENT;
} else {
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
$participants->setStatut(3, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
}
}
 
if ($this->_auth->getAuth()) {
$statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR ;
$HTML_listeParticipants = new HTML_listeParticipants(true) ;
if ($statut < 2) $HTML_listeParticipants->setModeModification() ;
// Mise en place de l'url
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$HTML_listeParticipants->setURL($this->_url) ;
// Construction de l'entete
$entete = array (PROJET_NOM, PROJET_PRENOM) ;
 
if ($this->_auth->getAuth()) {
array_push ($entete, PROJET_MAIL) ;
} else {
$droits = PROJET_DROIT_AUCUN ;
}
$info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
array_push ($entete, PROJET_DATE_INSCRIPTION) ;
$HTML_listeParticipants->construitEntete($entete) ;
 
$HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM_COORD, $this->_db)) ;
 
$res = $HTML_listeParticipants->toHTML() ;
 
if ($statut < 2) {
$res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
$res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
if (isset ($msg) && $msg != '') {
$res .= '<div>'.$msg.'</div>' ;
}
$res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
$res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
$res .= '</form>'."\n" ;
}
} else {
$res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
}
return $titre.$res ;
 
} // end of member function voirParticipants
 
/**
* Inscrit un utilisateur à un projet avec le statut observateur
*
* @return void
* @access public
*/
function inscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireInscriptionProjet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
 
// Si le projet n'a pas de liste, on inscrit directement
if (isset ($this->_id_projet)) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
 
if (!$projet->avoirListe()) {
if ($projet->isModere()) {
$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
} else {
$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
}
return $this->mesProjets() ;
}
}
if (isset($_POST['valider_inscription_projet'])) {
if (isset($_POST['radio_inscription_liste'])) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
if (!$projet->isModere()) {
$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->inscrireUtilisateur( $utilisateur,
$projet->_listes_associes[0],
$_POST['radio_inscription_liste']) ;
} else {
$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
#include_once PROJET_CHEMIN_API.'pear/Mail.php';
$entetes['From'] = $this->_auth->getUserName();
$entetes['To'] = '';
$entetes['Subject'] = PROJET_DEMANDE_INSCRIPTION ;
$entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
$entetes['Message-ID'] = md5(time()) ;
$entetes['reply-to'] = '' ;
$entetes['Content-Type'] = 'text/plain' ;
$objet_mail =& Mail::factory('smtp');
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/HTML/Template/IT.php';
$tpl = new HTML_Template_IT() ;
// Le gabarit du mail est dans un template
// template 1
$requete = 'select pt_template from projet_template where pt_id_template=1'.
' and pt_i18n like "%'.PROJET_LANGUE_DEFAUT.'"' ;
if (!$tpl -> setTemplate($this->_db->getOne ($requete))) {
echo 'erreur' ;
}
$tpl->setVariable('nom', $utilisateur->getInfo( 'nom')) ;
$tpl->setVariable('prenom', $utilisateur->getInfo( 'prenom')) ;
$tpl->setVariable('nom_projet', $projet->getTitre()) ;
$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
foreach ($tableau_coordinateur as $coordinateur) {
$entetes['To'] .= $coordinateur[3]; // Le champs 3 est le mail
}
$objet_mail->send($entetes['To'], $entetes, $tpl->get());
}
}
 
if ($this->_presentation != 'arbre') {
return include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
return ;
}
$res = '<h1>'.PROJET_INSCRIPTION_PROJET.' : '.$projet->getTitre().'</h1>'."\n" ;
if ($projet->avoirListe()) $res .= '<h2>'.PROJET_MESSAGE_LISTE.'</h2>'."\n" ;
//$participant = new participe($this->_db) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
$HTML_formulaireInscriptionProjet = new HTML_formulaireInscriptionProjet('inscription_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireInscriptionProjet->construitFormulaire($projet) ;
$HTML_formulaireInscriptionProjet->setDefaults(array('radio_inscription_liste' => 2)) ;
return $res.$HTML_formulaireInscriptionProjet->toHTML() ;
} // end of member function inscriptionProjet
 
/**
* Inscrit l'utilisateur logué à la liste dont le paraître est en post.
*
* @return void
* @access public
*/
function inscriptionListe( )
{
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->inscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], 2) ; // 2 est la statut inscription normale
} // end of member function inscriptionListe
 
/**
* Inscrit l'utilisateur logué à la liste dont le paraître est en post.
*
* @return void
* @access public
*/
function desinscriptionListe( )
{
if (isset($_GET['inscription_liste']) || $this->_action = PROJET_ACTION_DESINSCRIPTION_LISTE) {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$projet->getListesAssociees() ;
$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
'mail' => PROJET_CHAMPS_MAIL,
'table' => PROJET_ANNUAIRE)) ;
$utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
$inscription_liste = new inscription_liste($this->_db) ;
$inscription_liste->desinscrireUtilisateur( $utilisateur, $projet->_listes_associes[0], $_GET['inscription_liste']) ;
}
} // end of member function inscriptionListe
/**
* desinscrit un utilisateur à un projet
*
* @return void
* @access public
*/
function desinscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$participant = new participe($this->_db) ;
 
// Le statut 4 désinscrit l'utilisateur, dans la méthode setStatut
$participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($this->_db) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
if ($this->_presentation != 'arbre') {
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
} // end of member function inscriptionProjet
 
/**
* Renvoie le formulaire de création d'un wiki
*
* @return void
* @access public
*/
function formulaireWiki( )
{
 
require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
 
 
$url = &$GLOBALS['_GEN_commun']['url'] ;
$url->addQueryString ('act', PROJET_ACTION_CREER_WIKI) ;
$url->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$res =admin_afficherContenuCorps();
$res .= '<br /><a href="'.$this->_url->getURL().'">'.PROJET_RETOUR_RESUME.'</a>';
return $res;
 
} // end of member function formulaireWiki
 
 
function associerWiki( )
{
$res = '<h1>'.PROJET_ASSOCIER_WIKI.'</h1>'."\n" ;
 
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$res='';
 
// Comportement par défaut
// requete sur la table gen_wikini pour affichage de la liste des Wikini
$requete = "select gewi_id_wikini, gewi_code_alpha_wikini, gewi_page from gen_wikini" ;
 
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
 
 
$liste = new HTML_TableFragmenteur () ;
$liste->construireEntete(array (PROJET_NOM_WIKINI,PROJET_PAGE_WIKINI, PROJET_SELECTIONNER_WIKINI)) ;
 
$tableau_wikini = array() ;
 
while ($ligne = $resultat->fetchRow()) {
$this->_url->addQueryString ('id_wikini', $ligne[0]) ;
array_push ($tableau_wikini, array ($ligne[1]."\n", // première colonne, le nom de l'application
$ligne[2]."\n", // Deuxieme colonne, la page par defaut
'<a href="'.$this->_url->getURL()."&amp;".PROJET_VARIABLE_ACTION."=".PROJET_ACTION_ASSOCIER_WIKI_V."".'">'.PROJET_CHOISIR_WIKINI.'</a>'."\n",
));
}
$liste->construireListe($tableau_wikini) ;
$res .= $liste->toHTML();
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
return $res ;
 
 
 
} // end of member function formulaireWiki
 
 
/**
* Associe un wiki au projet courant
*
* @return void
* @access public
*/
 
function associationWiki( ) {
 
 
if (isset($_GET['id_wikini'])) {
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$requete = "select gewi_code_alpha_wikini from gen_wikini where gewi_id_wikini = ".$_GET['id_wikini'] ;
$resultat = $db->query ($requete) ;
if (DB::isError ($resultat)) {
$GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
__FILE__, __LINE__, 'admin_wikini') ;
return ;
}
 
$ligne = $resultat->fetchRow();
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet($this->_db, $this->_id_projet) ;
$projet->majNomWikini($ligne[0]);
}
 
}
 
/**
* Supprime le wiki du projet courant
*
* @return void
* @access public
*/
function supprimerWiki( )
{
include_once PROJET_CHEMIN_CLASSES.'gestion_wikini.class.php' ;
// On crée une nouvelle connexion avec les paramètres spécifiques aux wikinis
$connexion_bd = DB::connect('mysql://'.PROJET_UTILISATEUR_WIKINI.':'.PROJET_MDP_WIKINI.'@'.PROJET_HOTE_WIKINI.'/'.PROJET_DB_WIKINI) ;
$gerantWiki = new gestion_wikini($connexion_bd) ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$gerantWiki->suppression_tables(strtolower($projet->getWikini())) ;
$projet->majNomWikini('') ;
} // end of member function supprimerWiki
 
/**
* Permet de lier une ou plusieurs listes de la table agora à un projet.
*
* @return string
* @access public
*/
function referencerListeExterne( )
{
$requete = 'show tables like \'agora\'' ;
$resultat = $this->_db->query ($requete);
if ($resultat->numRows() == 0) {
return 'Cette fonctionnalité n\'est pas active' ;
}
$res = '<h1>'.PROJET_REFERENCER_LISTE.'</h1>' ;
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$liste_externe = new liste_externe($this->_db) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE_V) ;
$HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
$liste_assoc = $liste_externe->getListesAssociees($this->_id_projet) ;
$default = array() ;
foreach ($liste_assoc as $val) $default['liste_'.$val] = 1 ;
 
$HTML_formulaireListeExterne->setDefaults($default) ;
return $res.$HTML_formulaireListeExterne->toHTML() ;
} // end of member function referencerListeExterne
 
/**
* Réalise les mises à jours dans la table projet_lien_liste_externe
*
* @return void
* @access public
*/
function referencerListeExterneValidation( )
{
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$liste_externe = new liste_externe($this->_db) ;
include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireListeExterne.class.php' ;
$HTML_formulaireListeExterne = new HTML_formulaireListeExterne('formulaire_liste_externe', 'post', str_replace('&amp;', '&', $this->_url->getURL())) ;
$HTML_formulaireListeExterne->construitFormulaire($liste_externe->getListeNom()) ;
 
$liste_externe->enregistrerSQL($HTML_formulaireListeExterne->getSubmitValues(), $this->_id_projet) ;
} // end of member function referencerListeExterneValidation
 
/**
* permet d'exclure un projet de l'affichage
*
* @return void
* @access public
*/
function exclure($id_projet)
{
array_push ($this->_projet_exclu, $id_projet) ;
} // end of member function exclure
 
/**
* permet d'exclure un projet de l'affichage
*
* @return void
* @access public
*/
function setPrive()
{
$this->_prive = 1 ;
} // end of member function exclure
 
 
 
/**
* Renvoie un message d'erreur, en fonction du code de l'erreur.
*
* @param int valeur Le code du message d'erreur.
* @return string
* @access public
*/
function messageErreur( $valeur )
{
$messageErreur = array (
PROJETCONTROLEUR_ACTION_INVALIDE => "Action non valide",
PROJETCONTROLEUR_ERREUR_SUPPRESSION_REPERTOIRE => "Impossible de supprimer le répertoire",
PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier sélectionn°',
PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de créer le répertoire'
) ;
return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
} // end of member function messageErreur
 
 
 
 
} // end of projetControleur
?>
/tags/Racine_livraison_narmer/classes/participe.class.php
New file
0,0 → 1,363
<?php
// +------------------------------------------------------------------------------------------------------+
// | 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: participe.class.php,v 1.4 2007-04-19 09:30:28 alexandre_tb Exp $
/**
* Application projet
*
* La classe partiicpe assure la jointure entre projet et Auth
* Elle se base sur la table projet_statut_utilisateur
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class participe
*
*/
class participe
{
/*** Attributes: ***/
 
/**
* Date d'inscription au projet de l'utilisateur.
* @access private
*/
var $_date_inscription;
/**
* Statut de l'utilisateur, un entier.
* @access private
*/
var $_statut;
/**
* Connexion à la base de donnée.
* @access private
*/
var $_db;
 
/**
* Constructeur. Nécessite un objet DB valide connecté à la base contenant les
* tables projets.
*
* @param DB objetDB Un objet PEAR:DB valide.
* @return void
* @access public
*/
function participe( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function participe
 
/**
* Renvoie la liste des inscrit à un projet avec leur statut.
*
* @return Array
* @access public
*/
function getInscrits($id_projet, $droits )
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$id_projet.' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInscrits
 
/**
* Renvoie un tableau contenant la liste des identifiants des projets et des statuts
* d'un inscrit. 0 => ['psu_id_utilisateur'] ['psu_id_statut'] 1 => ...
*
* @param int id_utilisateur Un identifiant d'utilisateur pour le champs
* projet_statut_utilisateurs:psu_id_utilisateur
* @return Array
* @access public
*/
function getIdProjetsStatuts( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
" where psu_id_utilisateur=".$id_utilisateur ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getIdProjetsStatuts
 
 
/**
* Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
* différents projets d'un utilisateur. 0 => ['p_titre'] Le titre du projet
* ['ps_label'] Le statut de l'utilisateur 1 => .... (autant que de
* projets)
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @return Array
* @access public
*/
function getInformationsUtilisateurs( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
" where psu_id_utilisateur=".$id_utilisateur.
" and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow()) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getInformationsUtilisateurs
 
 
/**
* Renvoie le statut du projet passé en paramètre.
*
* @param int id_utilisateur
* @param int id_projet
* @param int dbObject
* @return int
* @static
* @access public
*/
function getStatutSurProjetCourant( $id_utilisateur, $id_projet, &$dbObject )
{
$requete = 'select psu_id_statut from projet_statut_utilisateurs'.
' where psu_id_utilisateur="'.$id_utilisateur.'" and psu_id_projet ='.$id_projet ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if (!$resultat->numRows()) {
return 4 ; // Le statut ne participe pas
}
return $ligne->psu_id_statut ;
} // end of member function getStatutSurProjetCourant
 
/**
* Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
* est administrateur de l'application projet.
*
* @param int id_utilisateur L'identifiant d'un utilisateur.
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @access public
*/
function isAdministrateur( $id_utilisateur, $objetDB = "" )
{
// La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
// pour indiquer un administrateur
$requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=$id_utilisateur".
" and psu_id_projet=0" ;
if (is_object ($objetDB)) {
$resultat = $objetDB->query ($requete) ;
} else {
$resultat = $this->_db->query ($requete) ;
}
if ($resultat->numRows () != 0) {
return true;
}
return false ;
} // end of member function isAdministrateur
 
/**
* Met à jour le statut d'un utilisateur sur un projet
*
* @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
* @param int id_utilisateur Identifiant de l'utilisateur
* @param int id_projet Identifiant du projet
* @return bool
* @access public
*/
function setStatut( $id_statut, $id_utilisateur, $id_projet )
{
$requete = 'update projet_statut_utilisateurs set psu_id_statut='.$id_statut.
' where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$id_projet;
if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
$requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$id_statut.
', psu_id_utilisateur='.$id_utilisateur.',psu_id_projet='.$id_projet.
', psu_date_inscription=NOW()';
}
if ($id_statut == 4) { // Si le statut est ne participe pas, on supprime l'inscrit
$requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$id_projet ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function setStatut
 
/**
* Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
*
* @param int id_utilisateur L'identifiant d'un utilisateur
* @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
* @return bool
* @static
* @access public
*/
function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
{
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) ;
if ($statut == 1) {
return true;
}
return false ;
} // end of member function isCoordinateur
 
/**
* Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
* participe pas.
*
* @param int id_utilisateur L'identifiant de l'utilisateur.
* @return Array
* @access public
*/
function getProjetsNonParticipant( $id_utilisateur )
{
$tableau_resultat = array() ;
$requete = 'select p_id from projet'.
' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur="'.$id_utilisateur.'")' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getProjetsNonParticipant
 
/**
* Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isObservateur( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isContributeur( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false;
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
* en paramètre.
*
* @param int id_utilisateur L'identifiant de l'utilisateur
* @param int id_projet L'identifiant du projet
* @return bool
* @access public
*/
function isEnAttente( $id_utilisateur, $id_projet, &$objetDB )
{
if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
return true;
}
return false ;
} // end of member function isObservateur
 
/**
* Renvoie les infos sur les coordinateurs d'un projet
*
* @param int id_projet L'identifiant du projet
* @return array Un tableau contenant les infos concernants les coordinateurs du projet
* @access public
*/
function getCoordinateurs($id_projet)
{
$tableau_resultat = array() ;
$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
$requete .= PROJET_CHAMPS_MAIL.', ' ;
$requete .= 'psu_date_inscription, ps_id_statut '.
' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
' where psu_id_projet='.$id_projet.' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
array_push ($tableau_resultat, $ligne) ;
}
$resultat->free() ;
return $tableau_resultat ;
} // end of member function getCoordinateurs
} // end of participe
?>
/tags/Racine_livraison_narmer/classes/type_fichier_mime.class.php
New file
0,0 → 1,187
<?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: type_fichier_mime.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe type_fichier_mime
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class type_fichier_mime
*
*/
class type_fichier_mime
{
/*** Attributes: ***/
 
/**
* Le nom du type en français (ex Image jpg)
* @access private
*/
var $_nom;
/**
* L'extension du fichier (ex: png)
* @access private
*/
var $_extension;
/**
* Le nom du fichier de l'icône représentant ce fichier.
* @access private
*/
var $_icone;
/**
* Le type mime.
* @access private
*/
var $_type_mime;
/**
*
* @access private
*/
var $_description;
/**
* Le chemin UNIX ou Windows vers le dossier des icônes. Il ne commence pas par un
* slash et termine par slash.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du type dans la table gen_type_de_fichier
* @access private
*/
var $_id_type;
 
/**
* Renvoie le chemin vers les icônes.
*
* @return string
* @access public
*/
function getCheminIcone( )
{
return $this->_chemin_icone.$this->_icone ; ;
} // end of member function getCheminIcone
 
/**
*
*
* @param string chemin Le chemin vers l'icône.
* @return void
* @access public
*/
function setCheminIcone( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcone
 
/**
*
*
* @param DB objetDB un objet PEAR:DB
* @param int id_type
* @return void
* @access public
*/
function type_fichier_mime( &$objetDB, $id_type = '', $chemin_icones = "icones/" )
{
$this->_db = $objetDB ;
$requete = 'select * from gen_type_de_fichier where ' ;
if (is_numeric ($id_type)) {
$requete .= 'gtf_id_type='.$id_type ;
} else {
$requete .= 'gtf_type_mime="'.$id_type.'"' ;
}
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_chemin_icone = $chemin_icones ;
$this->_icone = $ligne->gtf_type_icone ;
$this->_id_type = $ligne->gtf_id_type ;
} // end of member function type_fichier_mime
 
/**
* Tente de renvoyer un objet type_fichier_mime à partir de l'extension passé en
* paramètre. S'il elle n'y arrive pas, elle renvoie 'inconnue'.
*
* @param string extension On passe un extension en paramètre, pour déterminer le type mime.
* @param DB objetDB un objet PEAR:DB
* @return type_fichier_mime
* @static
* @access public
*/
function factory( $extension, &$objetDB )
{
$requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return new type_fichier_mime ($objetDB, $ligne->gtf_id_type) ;
} else {
// si il n'y a pas de résultat, on renvoie inconnue
return new type_fichier_mime ($objetDB, 12) ;
}
} // end of member function factory
 
/**
* Renvoie l'identifiant du type Mime de la table gen_type_de_fichier
*
* @return int
* @access public
*/
function getIdType( )
{
return $this->_id_type;
} // end of member function getIdType
 
 
} // end of type_fichier_mime
?>
/tags/Racine_livraison_narmer/classes/gestion_wikini.class.php
New file
0,0 → 1,182
<?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: gestion_wikini.class.php,v 1.2 2005-09-27 16:38:54 alexandre_tb Exp $
/**
* Application projet
*
* La classe gestion_wikini
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class gestion_wikini
*
*/
class gestion_wikini
{
 
/*** Attributes: ***/
 
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur
*
* @param DB objetDB Une référence vers un objet PEAR:DB
* @return void
* @access public
*/
function gestion_wikini( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function gestion_wikini
 
/**
*
*
* @param string prefixe Le préfixe des tables.
* @return void
* @access public
*/
function creation_tables( $prefixe )
{
// Connection à la base de donnée de wikini
$prefixe .= '_' ;
$this->_db->query(
"CREATE TABLE ".$prefixe."pages (".
"id int(10) unsigned NOT NULL auto_increment,".
"tag varchar(50) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"body text NOT NULL,".
"body_r text NOT NULL,".
"owner varchar(50) NOT NULL default '',".
"user varchar(50) NOT NULL default '',".
"latest enum('Y','N') NOT NULL default 'N',".
"handler varchar(30) NOT NULL default 'page',".
"comment_on varchar(50) NOT NULL default '',".
"PRIMARY KEY (id),".
"FULLTEXT KEY tag (tag,body),".
"KEY idx_tag (tag),".
"KEY idx_time (time),".
"KEY idx_latest (latest),".
"KEY idx_comment_on (comment_on)".
") TYPE=MyISAM;");
$this->_db->query(
"CREATE TABLE ".$prefixe."acls (".
"page_tag varchar(50) NOT NULL default '',".
"privilege varchar(20) NOT NULL default '',".
"list text NOT NULL,".
"PRIMARY KEY (page_tag,privilege)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."links (".
"from_tag char(50) NOT NULL default '',".
"to_tag char(50) NOT NULL default '',".
"UNIQUE KEY from_tag (from_tag,to_tag),".
"KEY idx_from (from_tag),".
"KEY idx_to (to_tag)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."referrers (".
"page_tag char(50) NOT NULL default '',".
"referrer char(150) NOT NULL default '',".
"time datetime NOT NULL default '0000-00-00 00:00:00',".
"KEY idx_page_tag (page_tag),".
"KEY idx_time (time)".
") TYPE=MyISAM");
$this->_db->query(
"CREATE TABLE ".$prefixe."users (".
"name varchar(80) NOT NULL default '',".
"password varchar(32) NOT NULL default '',".
"email varchar(50) NOT NULL default '',".
"motto text NOT NULL,".
"revisioncount int(10) unsigned NOT NULL default '20',".
"changescount int(10) unsigned NOT NULL default '50',".
"doubleclickedit enum('Y','N') NOT NULL default 'Y',".
"signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
"show_comments enum('Y','N') NOT NULL default 'N',".
"PRIMARY KEY (name),".
"KEY idx_name (name),".
"KEY idx_signuptime (signuptime)".
") TYPE=MyISAM");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagePrincipale', body = '".mysql_escape_string("====== Bienvenue ! sur le Wikini de ce groupe de travail ======\nEnfin, vous pourrez cliquer sur le lien \"Editer cette page\" au bas de la page pour rédiger.\n\n----\n\n\n\n\n\n\n----\n===== Pages utiles =====\n -[[TableauDeBord Tableau de bord de ce Wikini]]\n -[[ReglesDeFormatage Règles de formatage]]\n -[[BacASable Bac à sable]]")."', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DerniersChangementsPages', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentChanges}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DernierChangementCommentaires', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n{{RecentlyCommented}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ParametresUtilisateur', body = '** Retour : ** [[PagePrincipale page principale]]\n----\n** Note : ** L\'idéal pour la création d\'un nom Wiki est d\'accoler son prénom et son nom de cette façon : \"PrenomNom\". \n----\n==== Mes paramètres ====\n\n{{UserSettingsCommon}}\n\n----\n==== Voir ma participation à ce Wikini ====\n\n [[MesPagesModifier Voir les pages que j\'ai modifiées ]]\n\n [[MesPagesCreer Voir les pages que j\'ai créées ]]', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagesACreer', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages à créer : ===\n\n{{WantedPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PagesOrphelines', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des pages orphelines ===\n\n{{OrphanedPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'RechercheTexte', body = '** Retour : ** [[PagePrincipale Page principale]] > [[TableauDeBord Tableau de bord]]\n----\n{{TextSearch}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ReglesDeFormatage', body = '** Retour : ** [[PagePrincipale Page principale]]\n----\n====== Guide des règles de formatage ======\n\nLes règles de formatage avec Wakka diffèrent légèrement des autres Wikis. (Voir par exemple [[http://c2.com/cgi/wiki?TextFormattingRules les règles de formatage de WikiWikiWeb]], le premier Wiki connu.)\nTout texte placé entre deux guillemets doubles - \" - est présenté tel que.\n\nVous pouvez effectuer vos propres tests dans le BacASable : c\'est un endroit fait pour ça.\n\n=== Règles de base : ===\n \"\"**Texte en gras !** -----\"\"> **Texte en gras !**\n \"\"//Texte en italique.// -----\"\"> //Texte en italique.//\n \"\"Texte __souligné__ ! -----\"\"> Texte __souligné__ !\n \"\"##texte à espacement fixe## -----\"\"> ##texte à espacement fixe##\n \"\"%%code%%\"\"\n \"\"%%(php) PHP code%%\"\"\n\n=== Liens forcés : ===\n \"\"[[http://www.mon-site.org]]\"\"\n \"\"[[http://www.mon-site.org Mon-site]]\"\"\n \"\"[[P2P]]\"\"\n \"\"[[P2P Page sur le P2P]]\"\"\n\n=== Liens dans Wikini ===\n Pour réaliser un lien dans wikini qui apparaisse avec un style normal utilisez cette écriture :\n \"\"[[ReglesDeFormatage Règles de Formatage]]\"\"\n Le lien apparaîtra de cette manière [[ReglesDeFormatage Règles de Formatage]].\n\n=== En-têtes : ===\n \"\"====== En-tête énorme ======\"\" ====== En-tête énorme ======\n \"\"===== En-tête très gros =====\"\" ===== En-tête très gros =====\n \"\"==== En-tête gros ====\"\" ==== En-tête gros ====\n \"\"=== En-tête normal ===\"\" === En-tête normal ===\n \"\"== Petit en-tête ==\"\" == Petit en-tête ==\n\n=== Séparateur horizontal : ===\n \"\"----\"\"\n\n=== Retour de ligne forcé : ===\n \"\"---\"\"\n=== Indentation : ===\nL\'indentation de textes se fait avec la touche \"TAB\". Vous pouvez aussi créer des listes à puces ou numérotées :\n \"\"- liste à puce\"\"\n \"\"1) liste numérotée (chiffres arabes)\"\"\n \"\"A) liste numérotée (capitales alphabétiques)\"\"\n \"\"a) liste numérotée (minuscules alphabétiques)\"\"\n \"\"i) liste numérotée (chiffres romains)\"\"\n\n=== Inclure une image ===\n\n - Pour inclure un lien sur une image (sans l\'inclure à la page):\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(ne pas indiquer de texte alternatif).\n Ce qui donne : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n\n - Pour inclure une image sans indiquer de texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\"\"(laisser 3 espaces blancs avant la fermeture des crochets).\n Ce qui donne quand l\'image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif]]\n Quand l\'image n\'est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif]]\n\n - Pour inclure une image en indiquant un texte alternatif :\n \"\"[[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\"\"\n Ce qui donne quand l\'image est trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/images/table.gif une puce ]]\n Quand l\'image n\'est pas trouvée : [[http://wiki.tela-botanica.org/eflore/bibliotheque/table.gif une puce ]]\n\n//Note :// le texte alternatif est affiché à la place de l\'image s\'il y a une erreur lors de l\'affichage de celle-ci.\n\n=== Outils avancés : ===\n\n \"\"{{Backlinks}}\"\" permet de créer un lien vers la page précédente. \n \"\"{{Listusers}}\"\" affiche la liste des utilisateurs du site wikini.\n \"\"{{OrphanedPages}}\"\" affiche les pages orphelines du site wikini.\n \"\"{{ListPages/tree}}\"\" affiche le plan du site wikini.\n \"\"{{pageindex}}\"\" affiche un index des pages du site classées par lettres alphabétiques.\n \"\"{{ListPages}}\"\" affiche un index des pages du site avec le nom de leur propriétaire.\n \"\"{{WantedPages}}\"\" affiche la liste des pages restant à créer. Elles apparaissent dans le site avec un ? à la suite de leur nom.\n \"\"{{RecentChanges}}\"\" affiche la liste des sites faisant référence au site wikini.\n \"\"{{RecentlyCommented}}\"\" affichage de la liste des derniers commentaires.\n \"\"{{TextSearch}}\"\" recherche de texte dans les pages du site.\n\n**Note :** à cause d\'un [[http://bugzilla.mozilla.org/show_bug.cgi?id=10547 bogue dans son moteur de rendu]], les listes, utilisant la touche TAB, ne fonctionnent pas (encore) sous Mozilla.\nUne astuce consiste à réaliser une tabulation dans un éditeur de texte puis de la copier. On peut ensuite coller la tabulation dans la zone de saisie de Wikini.\nVous pouvez également indenter du texte en utilisant des caractères espace au lieu de la touche \"TAB\", les exemples ci-dessus restent valables mais attention à ne pas mélanger des \"TAB\" et des espaces dans la même énumération.\n\n---', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeUtilisateurs', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du premier au dernier.\n\n{{Listuserscommon}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeUtilisateursInverse', body = '** Retour : ** [[TableauDeBord Tableau de bord]]\n----\n=== Liste des utilisateurs ===\n\n... du dernier au premier.\n\n{{Listuserscommon/last}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'PlanDuSite', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Plan du site : ===\n\n{{ListPages/tree}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'IndexDesPages', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages : ===\n\n{{ListPages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'IndexDesPagesAlphabet', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des pages par ordre alphabétique : ===\n\n{{pageindex}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'DerniersChangementsRSS', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\nCette page renvoie au fils RSS des derniers changement. Pour savoir comment l\'utiliser voir la page \"\"<a href=\"http://www.wikini.net/wakka.php?wiki=WikiniEtLesFluxRSS\" target=\"_blank\" title=\"Wikini et les flux RSS\">Wikini et les flux RSS</a>\"\".\n\n\"\"<!--\n\n{{recentchangesrss/link=\"DerniersChangements\"}}\n\n-->\"\"', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'ListeInterWiki', body = '**Retour : ** [[TableauDeBord tableau de bord]]\n----\n=== Liste des distributions wiki : ===\n\n{{interwikilist}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'BacASable', body = '** Retour : ** [[PagePrincipale Page pincipale]]\n----\nUtilisez cette page pour faire vos tests !', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'MesPagesModifier', body = '**Retour : ** [[ParametresUtilisateur mes paramètres ]]\n----\n{{mychanges}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'TableauDeBord', body = '** Retour : ** [[PagePrincipale Page Principale]]\n----\n===== Tableau de bord =====\n\n - Listes des utilisateurs : [[ListeUtilisateurs par ordre de création ]] ou [[ListeUtilisateursInverse par ordre inverse de création ]].\n\n - [[DerniersChangementsPages Dernières modifications sur les pages]]\n - [[DernierChangementCommentaires Dernières modifications sur les commentaires]]\n\n\n - [[PagesOrphelines Pages orphelines]]\n - [[PagesACreer Pages à créer]]\n\n - [[RechercheTexte Recherche texte]]\n\n - [[PlanDuSite Plan du site]]\n - [[IndexDesPages Index des pages avec noms des propriétaires]]\n - [[IndexDesPagesAlphabet Index des pages par classement alphabétique]]\n\n - [[DerniersChangementsRSS La page permettant le flux RSS]]\n\n - [[ListeInterWiki Liste des wiki existants ]]\n----\n==== 5 derniers comptes utilisateurs ====\n{{Listuserscommon last=\"5\"}}\n\n==== 5 dernières pages modifiées ====\n{{recentchanges max=\"5\"}}\n----', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'MesPagesCreer', body = '**Retour : ** [[ParametresUtilisateur mes paramètres ]]\n----\n{{mypages}}', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
$this->_db->query("insert into ".$prefixe."pages set tag = 'NomWiki', body = '** Retour : ** [[PagePrincipale Page Principale]]\n----\nUn NomWiki est un nom qui est écrit \"\"CommeCela\"\".\n\nUn NomWiki est transformé automatiquement en lien. Si la page correspondante n\'existe pas, un \'?\' est affiché à côté du mot.', owner = 'AdminTela', user = 'WikiNiInstaller', time = now(), latest = 'Y'");
} // end of member function creation_tables
 
/**
*
*
* @param string prefixe Le préfixe des tables à supprimer
* @return void
* @access public
*/
function suppression_tables( $prefixe )
{
$resultat = $this->_db->query("DROP TABLE ".$prefixe."_acls ,".$prefixe."_links ,".$prefixe."_pages ,".
$prefixe."_referrers ,".$prefixe."_users") ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
} // end of member function suppression_tables
 
 
 
 
 
} // end of gestion_wikini
?>
/tags/Racine_livraison_narmer/classes/liste_discussion.class.php
New file
0,0 → 1,291
<?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: liste_discussion.class.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* La classe liste_discussion
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once GEN_CHEMIN_API.'sql/SQL_manipulation.fonct.php' ;
/**
* class liste_discussion
*
*/
class liste_discussion
{
 
/*** Attributes: ***/
 
/**
* Le nom de la liste, sans le domaine.
* @access private
*/
var $_nom;
/**
*
* @access private
*/
var $_adresse;
/**
* Le domaine de la liste
* @access private
*/
var $_domaine;
/**
*
* @access private
*/
var $_adresse_inscription;
/**
*
* @access private
*/
var $_adresse_desinscription;
/**
*
* @access private
*/
var $_adresse_aide;
/**
* Une connexion PEAR::DB
* @access private
*/
var $_db;
/**
* L'identifiant de la liste.
* @access private
*/
var $_id;
/**
*
* @access private
*/
var $_adresse_inscription_resume;
/**
* Indique la portée, publique ou privé de la liste
* @access private
*/
var $_portee;
/**
* Le constructeur
*
* @param int id_liste L'identifiant de la liste souhaité
* @param DB objetDB Un objet PEAR:DB
* @return void
* @access public
*/
function liste_discussion( $id_liste, & $objetDB )
{
$this->_db = $objetDB ;
if ($id_liste != '') {
$this->_id = $id_liste ;
$requete_liste = 'select * from projet_liste where pl_id_liste='.$this->_id ;
$resultat_liste = $this->_db->query ($requete_liste) ;
if (DB::isError ($resultat_liste)) {
die ("Echec de la requete : $requete_liste<br />".$resultat_liste->getMessage()) ;
}
$ligne_liste = $resultat_liste->fetchRow(DB_FETCHMODE_OBJECT) ;
$this->_adresse = $ligne_liste->pl_adresse_liste ;
$this->_domaine = $ligne_liste->pl_domaine ;
$this->_nom = $ligne_liste->pl_nom_liste ;
$this->_adresse_inscription = $ligne_liste->pl_adresse_inscription ;
$this->_adresse_inscription_resume = $ligne_liste->pl_nom_liste.'-digest-subscribe@'.$this->_domaine ;
$this->_portee = $ligne_liste->pl_visibilite ;
}
} // end of member function liste_discussion
 
 
/**
* Renvoie le domaine de la liste
*
* @return string
* @access public
*/
function getDomaine( )
{
return $this->_domaine ;
} // end of member function getDomaine
 
/**
* Renvoie le nom de la liste
*
* @return string
* @access public
*/
function getNom( )
{
return $this->_nom ;
} // end of member function getNom
 
/**
* Renvoie l'identifiant de la liste
*
* @return integer
* @access public
*/
function getId( )
{
return $this->_id ;
} // end of member function getNom
 
 
 
/**
* Enregistre une ligne dans la table projet_liste
* Le tableau de valeur doit contenir les éléments suivants 'nom_liste','','domaine_liste'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur) {
$id = SQL_obtenirNouveauId($this->_db, 'projet_liste', 'pl_id_liste') ;
 
$requete = "insert into projet_liste set pl_id_liste=".$id ;
$requete .= ", pl_nom_liste=\"".$valeur['nom_liste']."\", pl_domaine=\"".$valeur['domaine_liste']."\"".
", pl_adresse_liste=\"".$valeur['nom_liste'].'@'.$valeur['domaine_liste'].'", pl_adresse_inscription="'.
$valeur['nom_liste']."-subscribe@".$valeur['domaine_liste'].'",pl_adresse_desinscription="'.
$valeur['nom_liste']."-unsubscribe@".$valeur['domaine_liste'].'", pl_adresse_aide="'.
$valeur['nom_liste']."-help@".$valeur['domaine_liste'].'", pl_visibilite="'.$valeur['liste_visibilite'].'"' ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
$this->_domaine = $valeur['domaine_liste'] ;
$this->_nom = $valeur['nom_liste'] ;
return $id;
}
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$requete = "delete from projet_liste where pl_id_liste=".$this->_id ;
$resultat = $this->_db->query ($requete) ;
 
return true ;
} // end of member function suppressionSQL
 
/**
* Vérifie si une liste existe déjà dans la table projet_liste.
*
* @param string adresse_liste L'adresse de la liste à tester
* @param DB objetDB Un objet PEAR::DB
* @return bool
* @static
* @access public
*/
function verifieDoubleListe( $adresse_liste, &$objetDB )
{
$requete = 'select pl_id_liste from projet_liste where pl_adresse_liste="'.$adresse_liste.'"' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows()) {
return false;
}
return true ;
} // end of member function verifieDoubleListe
 
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseEnvoi( )
{
return $this->_adresse ;
} // end of member function getAdresseEnvoi
 
/**
* Renvoie l'adresse de la liste
*
* @return string
* @access public
*/
function getAdresseInscription( )
{
return $this->_adresse_inscription ;
} // end of member function getAdresseEnvoi
 
/**
*
*
* @return string
* @access public
*/
function getAdresseResume( )
{
return $this->_adresse_inscription_resume ;
} // end of member function getAdresseResume
 
 
/**
*
*
* @return string
* @access public
*/
function isPublic( )
{
return $this->_portee ;
} // end of member function getAdresseResume
 
 
 
 
 
 
 
} // end of liste_discussion
?>
/tags/Racine_livraison_narmer/classes/statut_liste.class.php
New file
0,0 → 1,100
<?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: statut_liste.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
/**
* class statut_liste
*
*/
class statut_liste
{
/*** Attributes: ***/
 
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
*
* @access private
*/
var $_id_statut;
/**
*
* @access private
*/
var $_label;
 
/**
*
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function statut_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function statut_liste
 
/**
* Renvoie un tableu avec tous les status d'inscription à une liste 0 => 'Pas
* d'email' 1 => ' ...
*
* @return Array
* @access public
*/
function getTousLesStatuts( )
{
$requete = 'select * from projet_liste_statut' ;
$resultat = $this->_db->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pls_id_statut] = $ligne->pls_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
} // end of statut_liste
?>
/tags/Racine_livraison_narmer/classes/statut.class.php
New file
0,0 → 1,138
<?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: statut.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe statut
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
define ('PROJET_STATUT_TOUS', 1) ;
define ('PROJET_STATUT_SAUF_ADM', 2) ;
define ('PROJET_STATUT_SAUF_ADM_COORD', 3) ;
 
/**
* class statut
*
*/
class statut
{
 
/** Aggregations: */
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du statut
* @access private
*/
var $_id_statut;
/**
* Le label du statut, dans la table.
* @access private
*/
var $_label;
/**
* Un objet PEAR::DB
* @access private
*/
var $_db;
 
/**
* Constructeur.
*
* @param int id_statut L'identifiant du statut créé.
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function statut( $id_statut, &$objetDB )
{
$requete = "select * from projet_statut where ps_id_statut=$id_statut" ;
$resultat = $objetDB->query ($requete) ;
if (PEAR::isError ($resultat)) {
die ($resultat->getMessage()."<br />".$requete."<br />") ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_db = $objetDB ;
$this->_id_statut = $ligne->pd_id_statut ;
$this->_label = $ligne->ps_statut_nom;
} // end of member function statut
 
/**
* Renvoie le label du statut.
*
* @return string
* @access public
*/
function getLabel( )
{
return $this->_label ;
} // end of member function getLabel
/**
*
*
* @param int type_statut Indique quels statuts l'on désire voir retourner PROJET_STATUT_TOUS
* PROJET_STATUT_SAUF_ADM PROJET_STATUT_SAUF_ADM_COORD
* @return Array
* @static
* @access public
*/
function getTousLesStatuts( $type_statut = PROJET_STATUT_TOUS, &$objetDB)
{
$requete = 'select * from projet_statut' ;
if ($type_statut == PROJET_STATUT_SAUF_ADM) {
$requete .= ' where ps_id_statut <> 0' ;
}
if ($type_statut == PROJET_STATUT_SAUF_ADM_COORD) {
$requete .= ' where ps_id_statut > 1' ;
}
$resultat = $objetDB->query ($requete) ;
$tableau_resultat = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->ps_id_statut] = $ligne->ps_statut_nom ;
}
return $tableau_resultat;
} // end of member function getTousLesStatuts
 
 
 
 
 
} // end of statut
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireListeExterne.class.php
New file
0,0 → 1,116
<?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: HTML_formulaireListeExterne.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireListe
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireListeExterne extends HTML_QuickForm
{
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireListe( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireListe
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire($tableau_liste_externe)
{
foreach ($tableau_liste_externe as $cle => $valeur) {
$this->addElement ('checkbox', 'liste_'.$cle, '', $valeur) ;
}
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
 
} // end of HTML_formulaireListe
 
 
 
 
 
?>
/tags/Racine_livraison_narmer/classes/HTML_listeDocuments.class.php
New file
0,0 → 1,334
<?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: HTML_listeDocuments.class.php,v 1.8 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* La classe HTML_listeDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
/**
* class HTML_listeDocuments
*
*/
class HTML_listeDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du répertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function HTML_listeDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
} // end of member function HTML_listeDocuments
 
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
$this->HTML_listeDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array tableau_label Un tableau à deux dimensions avec les labels à afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '')
{
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
 
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// première condition : est-ce que le fichier a pour père le répertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un répertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getChemin()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$lien = $tableau_document[$i]->getChemin() ;
}
// pour éviter des effets de bords, on enlève id_repertoire de l'url
// dans le cas d'un répertoire, pour les fichiers on le laisse pour
// qu'après une opération, on reste dans le répertoire où a eu lieu l'opération
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insère le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
// Pour la taille on divise par 1000 et on écrit Ko
$taille = round($tableau_document[$i]->getTaille() / 1000).'&nbsp;Ko' ;
// Récupération de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau à donner en paramètre à HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme clé. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
} // end of member function setAction
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcones
 
/**
* Surcharge de l'opération de la classe mère. Ajoute la navigation dans les
* répertoires.
*
* @return string
* @access public
*/
function toHTML( )
{
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i+=2) {
$chemin_navig .= "&gt;&nbsp;" ;
$nom = $this->_chemin_navigation[$i+1] ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des répertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la légende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
} // end of member function affLegende
 
 
/**
* Renvoie le chemin HTML, depuis le répertoire courant jusqu'à la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
} // end of member function _getCheminHTML
 
 
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est à dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
if (!$document->isRepertoire()) $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireDocument.class.php
New file
0,0 → 1,146
<?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: HTML_formulaireDocument.class.php,v 1.4 2007-02-13 15:11:39 jp_milcent Exp $
/**
* Application projet
*
* La classe HTML_formulaireDocument
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
require_once 'HTML/QuickForm/checkbox.php' ;
require_once 'HTML/QuickForm/select.php' ;
 
/**
* class HTML_formulaireDocument
*
*/
class HTML_formulaireDocument extends HTML_QuickForm
{
/** Le type d'un document, par défaut 'fichier'
*
* @access private
*/
var $_type = 'fichier';
 
/**
* Constructeur
*
* @param string formName Le nom du formulaire
* @param string method Méthode post ou get
* @param string action L'action du formulaire.
* @param int target La cible.
* @param Array attributes Les attributs HTML en plus.
* @param bool trackSubmit ??
* @return void
* @access public
*/
function HTML_formulaireDocument( $formName, $method = "post", $action, $target = "_self", $attributes = '', $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireDocument
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire($action = PROJET_NOUVEAU_FICHIER)
{
$this->addElement ('text', 'document_nom', PROJET_FICHIER_NOM_DOCUMENT, array ('size' => 40)) ;
$this->addRule ('document_nom', PROJET_FICHIER_ALERTE, 'required', '', 'client') ;
$this->addElement ('html', '<tr><td colspan="2">'.PROJET_FICHIER_NOM_DOCUMENT_EXPLICATION.'</td></tr>') ;
$this->addElement ('textarea', 'document_description', PROJET_FICHIER_DESCRIPTION, array('cols'=>40, 'rows'=>10)) ;
// on fait un groupe avec les boutons radio pour les mettres sur la même ligne
 
$radio[] = &HTML_QuickForm::createElement('radio', 'document_visibilite', 'public', PROJET_FICHIER_PUBLIC, 'public') ;
$radio[] = &HTML_QuickForm::createElement('radio', 'document_visibilite', 'prive', PROJET_FICHIER_PRIVEE, 'prive');
$this->addGroup($radio, null, PROJET_FICHIERS_VISIBILITE, '&nbsp;');
// Le champs fichier si le type du document est un fichier
if ($this->_type == 'fichier' && $action == PROJET_NOUVEAU_FICHIER) {
$GLOBALS['fichier'] = $this->addElement ('file', 'fichier', PROJET_FICHIER_LE_FICHIER) ;
$this->setMaxFileSize(PROJET_UPLOAD_MAX_FILE_SIZE) ;
$this->addRule ('fichier', PROJET_FICHIER_ALERTE_PAS_DE_FICHIER, 'required', '', 'client') ;
}
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
$this->applyFilter('document_nom', 'addslashes') ;
$this->applyFilter('document_description', 'addslashes') ;
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
} // end of member function construitFormulaire
 
/**
* Permet de spécifier le type de formulaire à montrer
*
* @param string type Le type d'un document, 'fichier' ou 'repertoire'
* @return void
* @access public
*/
function setType( $type )
{
if ($type != 'fichier' && $type != 'repertoire') trigger_error ('type invalide', E_USER_ERROR) ;
$this->_type = $type ;
} // end of member function setType
 
/**
*
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
} // end of HTML_formulaireDocument
?>
/tags/Racine_livraison_narmer/classes/HTML_listeProjet.class.php
New file
0,0 → 1,197
<?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: HTML_listeProjet.class.php,v 1.7 2006-09-15 12:35:54 alexandre_tb Exp $
/**
* Application projet
*
* La classe controleur projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;
 
/**
* class HTML_listeProjet
*
*/
class HTML_listeProjet extends HTML_Liste
{
/*** Attributes: ***/
/**
* 0 mode normal 1 mode modification, rajoute un formulaire pour modifier le statut
* d'un utilisateur.
* @access private
*/
var $_mode;
/**
* Un objet PEAR::Net_URL
* @access private
*/
var $_url;
 
/**
*
*
* @param bool utilise_pager Indique si les résultats sont divisés en page.
* @return void
* @access public
*/
function HTML_listeProjet( $utilise_pager = false )
{
HTML_Liste::HTML_Liste($utilise_pager, array ('class' => 'table_cadre', 'summary' => PROJET_LISTE)) ;
} // end of member function HTML_listeProjet
 
/**
*
*
* @return void
* @access public
*/
function __construct($utilise_pager = false)
{
$this->HTML_listeProjet($utilise_pager);
} // end of member function __cosntruct
 
/**
*
*
* @param Array label_entete Un tableau contenant les labels pour l'entête de la liste.
* @return void
* @access public
*/
function construitEntete( $label_entete )
{
$this->addRow ($label_entete, '', 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array label_liste Un tableau à double dimension contenant les valeurs de la liste. du type
* 0 =>'label', 'label2',
* 1 => ...
* @return void
* @access public
*/
function construitListe( $label_liste, $tableau_statut = '' )
{
for ($i = 0; $i < count ($label_liste) ; $i++) {
if ($this->_mode == 1) {
$id_projet = array_shift ($label_liste[$i]) ;
$id_statut = array_pop ($label_liste[$i]) ;
}
$resume = array_shift ($label_liste[$i]) ;
$this->addRow ($label_liste[$i]) ;
if ($this->_mode == 1 && $id_statut < 3) {
$this->_url->addQueryString ('identifiant_projet', $id_projet) ;
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
$select = '<form action="'.$this->_url->getURL().'" method="post" class="magali">'."\n" ;
$select .= '<select name="statut" onchange="javascript:this.form.submit();">' ;
foreach ($tableau_statut as $cle =>$element_statut) {
$select .= '<option value="'.$cle.'"' ;
if ($cle == $id_statut) {
$select .= ' selected="selected"' ;
}
$select .= '>'.$element_statut.'</option>'."\n" ;
}
$select .= '</select>'."\n".'</form>'."\n" ;
if (is_int($id_statut)) {
//$this->setCellContents($i+1, 2, $select) ;
$this->setCellContents($this->getRowCount() - 1, 2, $select) ;
} else {
$this->setCellContents($i+1, 2, PROJET_PAS_DE_LISTE) ;
}
}
// On affiche le résumé dans la deuxième ligne
if (PROJET_LISTE_RESUME) {
$this->addRow (array ($resume), array('colspan' => $this->getColCount()));
}
}
$this->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')) ;
} // end of member function construitListe
 
/**
*
*
* @return void
* @access public
*/
function setModeModification( )
{
$this->_mode = 1 ;
} // end of member function setModeModification
 
/**
*
*
* @param Net_URL url Un objet PEAR::Net_URL
* @return void
* @access public
*/
function setURL(& $url )
{
$this->_url = $url ;
} // end of member function setURL
/**
* Alternates the row attributes starting at $start
* @param int $start Row index of row in which alternating begins
* @param mixed $attributes1 Associative array or string of table row attributes
* @param mixed $attributes2 Associative array or string of table row attributes
* @param bool $inTR false if attributes are to be applied in TD tags
* true if attributes are to be applied in TR tag
* @access public
*/
function altRowAttributes($start, $attributes1, $attributes2, $inTR = false)
{
for ($row = $start ; $row < $this->_rows ; $row++) {
$attributes = ( ($row+$start)%2 == 0 ) ? $attributes1 : $attributes2;
$this->updateRowAttributes($row, $attributes, $inTR);
if (PROJET_LISTE_RESUME) {
$row++;
$this->updateRowAttributes($row, $attributes, $inTR);
$start++;
}
}
} // end func altRowAttributes
 
} // end of HTML_listeProjet
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireCreationWikini.class.php
New file
0,0 → 1,108
<?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: HTML_formulaireCreationWikini.class.php,v 1.2 2005-09-27 16:39:47 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireCreationWikini
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireCreationWikini
*
*/
class HTML_formulaireCreationWikini extends HTML_QuickForm
{
 
/*** Attributes: ***/
 
/**
* Constructeur
*
* @return void
* @access public
*/
function HTML_formulaireCreationWikini($formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false)
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireCreationWikini
 
/**
*
*
* @return void
* @access public
*/
function construitFormulaire( )
{
$this->addElement ('html', '<p>'.PROJET_WIKINI_NOM_EXPLICATION.'</p>') ;
$this->addElement ('text', 'nom_wikini', PROJET_WIKINI_CHOISIR_NOM) ;
$this->addRule ('nom_wikini', PROJET_NOM_WIKINI_REQUIS, 'required', '', 'client') ;
$this->addRule ('nom_wikini', PROJET_WIKINI_NOM_INVALIDE, 'regex', '/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/', 'client') ;
/*
$this->addElement ('text', 'prefixe_wikini', PROJET_PREFIXE_WIKINI) ;
$this->addRule ('prefixe_wikini', PROJET_PREFIXE_WIKINI_REQUIS, 'required', '', 'client');
*/
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function construitFormulaire
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
} // end of HTML_formulaireCreationWikini
?>
/tags/Racine_livraison_narmer/classes/HTML_formulaireMail.class.php
New file
0,0 → 1,117
<?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: HTML_formulaireMail.class.php,v 1.3 2006-07-05 09:44:11 alexandre_tb Exp $
/**
* Application projet
*
* La classe HTML_formulaireMail
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once 'HTML/QuickForm.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class HTML_formulaireMail
* Cette classe représente un formulaire pour saisir un projet ou le modifier.
*/
class HTML_formulaireMail extends HTML_QuickForm
{
/**
* Constructeur
*
* @param string formName Le nom du formulaire.
* @param string method Soit get soit post, voir le protocole HTTP
* @param string action L'action du formulaire.
* @param string target La cible du formulaire.
* @param Array attributes Des attributs supplémentaires pour la balise <form>
* @param bool trackSubmit Pour repérer si la formulaire a été soumis.
* @return void
* @access public
*/
function HTML_formulaireProjet( $formName = "", $method = "post", $action = "", $target = "_self", $attributes = "", $trackSubmit = false )
{
HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
} // end of member function HTML_formulaireProjet
 
/**
* Renvoie le code HTML du formulaire.
*
* @return string
* @access public
*/
function toHTML( )
{
$res = HTML_QuickForm::toHTML() ;
return $res ;
} // end of member function toHTML
 
 
 
/**
* Ajoute les champs nécessaire au formulaire.
*
* @return void
* @access public
*/
function construitFormulaire()
{
$this->addElement ('text', 'mail_titre', PROJET_MAIL_TITRE, array ('size' => 60, 'id' => 'titre_mail')) ;
$this->addRule ('mail_titre', PROJET_MAIL_TITRE_REQUIS, 'required', '', 'client') ;
$this->addElement ('textarea', 'mail_corps', PROJET_MAIL_CORPS, array('cols'=>80, 'rows'=>30, 'id' => 'corps_mail')) ;
$url_annuler = new Net_URL($this->getAttribute('action')) ;
$url_annuler->removeQueryString(PROJET_VARIABLE_ACTION) ;
// on fait un groupe avec les boutons pour les mettres sur la même ligne
$buttons[] = &HTML_QuickForm::createElement('link', 'annuler', PROJET_FICHIER_ANNULER,
preg_replace ("/&amp;/", "&", $url_annuler->getURL()), PROJET_FICHIER_ANNULER); // Le preg_replace contourne un pb de QuickForm et Net_URL
// qui remplacent deux fois les & par des &amp;
// ce qui fait échouer le lien
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
$this->setRequiredNote('<span style="color: #ff0000">*</span>'.PROJET_CHAMPS_REQUIS) ;
} // end of member function _construitFormulaire
 
 
 
} // end of HTML_formulaireProjet
?>
/tags/Racine_livraison_narmer/classes/inscription_liste.class.php
New file
0,0 → 1,236
<?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: inscription_liste.class.php,v 1.5 2006-04-19 13:50:49 alexandre_tb Exp $
/**
* Application projet
*
* La classe inscription_liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class isncription_liste
*
*/
class inscription_liste
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste
* @access private
*/
var $_id_liste;
/**
* Identifiant de l'utilisateur
* @access private
*/
var $_id_utilisateur;
/**
* Une ressource PEAR::DB
* @access private
*/
var $_db;
/**
* Le type d'inscription indique : - 0 : pas d'email - 1 : normale - 2 : résumé
* @access private
*/
var $_type_inscription;
 
/**
* Constructeur
*
* @param DB objetDB Une ressource PEAR::DB
* @return void
* @access public
*/
function inscription_liste( &$objetDB )
{
$this->_db = $objetDB ;
} // end of member function inscription_liste
 
/**
* Renvoie un tableau avec la liste des inscrit à une liste.
*
* @param int id_liste L'identifiant de la liste
* @return Array
* @access public
*/
function getInscritsListe( $id_liste )
{
} // end of member function getInscritsListe
 
/**
*
*
* @param annire utilisateur
* @param liste_discussion id_liste
* @param int type_inscription
* @return void
* @access public
*/
function inscrireUtilisateur( &$utilisateur, &$liste, $type_inscription )
{
$requete = 'update projet_inscription_liste set '.
'pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription.' where pil_id_utilisateur='.$utilisateur->getInfo('identifiant') ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
if ($this->_db->affectedRows() == 0) {
$requete = 'insert into projet_inscription_liste set pil_id_utilisateur='.$utilisateur->getInfo('identifiant').
', pil_id_liste='.$liste->getId().', pil_id_statut='.$type_inscription ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
echo ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
// Ajout dans la liste des commandes au serveur
// On inscrit le créateur de la liste
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
} // end of member function inscrireUtilisateur
 
/**
*
*
* @param int id_utilisateur
* @param int id_liste
* @return void
* @access public
*/
function desinscrireUtilisateur( &$utilisateur, &$liste )
{
$requete = 'delete from projet_inscription_liste where pil_id_utilisateur='.$utilisateur->getInfo('identifiant').' and pil_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
} // end of member function desinscrireUtilisateur
 
/**
*
*
* @param int id_liste
* @param int id_utilisateur
* @param int type_inscription
* @return void
* @access public
*/
function modifierTypeInscription( $liste, $utilisateur, $type_inscription )
{
 
// envoie d'une demande d'inscription par email à la liste
//include_once 'Mail.php' ;
switch ($type_inscription) {
case 0 :
 
// Ajout du modérateur en tant qu'utilisateur
$resultat_suppression_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/suppression_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
 
break ;
case 1 :
break ;
case 2 :
 
// Ajout d'un utilisateur
$resultat_ajout_utilisateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_abonne.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$utilisateur->getInfo('mail')) ;
break ;
}
} // end of member function modifierTypeInscription
 
/**
* Renvoie la liste des statuts d'un utilisateur
*
* @param int id_utilisateur
* @return Array
* @access public
*/
function getStatutsInscrit( $id_utilisateur )
{
$requete = 'select pil_id_liste, pil_id_statut from projet_inscription_liste where pil_id_utilisateur='.$id_utilisateur ;
$resultat = $this->_db->query ($requete) ;echo $requete;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_resultat[$ligne->pil_id_liste] = $ligne->pil_id_statut ;
}
return $tableau_resultat ;
 
} // end of member function getStatutsInscrit
 
/**
* Renvoie le statut d'un inscrit à une liste
*
* @param int id_liste
* @param int id_utilisateur
* @return int
* @access public
*/
function getStatutInscrit( $id_liste, &$auth )
{
// Récupération de la liste des listes !!
$requete = 'select pl_nom_liste, pl_domaine from projet_liste where pl_id_liste='.$id_liste ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
$xml = file_get_contents(PROJET_SERVEUR_VPOPMAIL.'/liste_abonnes.php?domaine='.
$ligne->pl_domaine.'&liste='.$ligne->pl_nom_liste) ;
$tableau_mail = array() ;
$tableau_ligne = explode ('<email>', $xml) ;
foreach ($tableau_ligne as $ligne) array_push ($tableau_mail, strip_tags($ligne)) ;
array_shift($tableau_mail) ;
if (in_array($auth->getUsername(), $tableau_mail)) {
return 2; // Inscrit est le statut 2
}
return 0 ;
} // end of member function getStatutInscrit
} // end of isncription_liste
?>
/tags/Racine_livraison_narmer/classes/annuaire.class.php
New file
0,0 → 1,150
<?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: annuaire.class.php,v 1.5 2006-07-04 09:25:38 alexandre_tb Exp $
/**
* Application annuaire
*
* La classe annuaire
*
*@package annuaire
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
/**
* class annuaire
*
*/
class annuaire extends PEAR
{
 
/*** Attributes: ***/
 
/**
*
* @access private
*/
var $_db;
/**
*
* @access private
*/
var $_id_utilisateur;
/**
* Tableau contenant les noms des champs
* @access private
*/
var $_champs_base;
 
/**
*
*
* @param int objetDB Une ressource PEAR::DB
* @param Array param un tableau indiquant les noms des champs dans la base. 'nom' => 'CHAMPS_NOM',
'prenom' => .. 'date_inscription' => .. 'identifiant' => ... 'ville' => ...
'pays' => ...
* @return void
* @access public
*/
function annuaire( &$objetDB, $param )
{
$this->_db = $objetDB ;
$this->_champs_base = $param ;
} // end of member function annuaire
 
/**
* Spécifie l'identifiant d'un utilisateur ou plusieurs utilisateurs
*
* @param mixed id_utilisateur L'identifiant d'un utilisateur
* @return void
* @access public
*/
function setId( $id_utilisateur )
{
$this->_id_utilisateur = $id_utilisateur ;
} // end of member function setId
 
/**
* Renvoie l'info de l'utilisateur courant. Sans paramètre, renvoie un tableau avec
* tous les champs.
*
* @param string parametre Un paramètre de l'objet : - 'nom', 'prenom' ....
* @return void
* @access public
*/
function getInfo( $parametre )
{
$requete = 'select '.$this->_champs_base[$parametre].
' from '.$this->_champs_base['table'].
' where '.$this->_champs_base['identifiant'].'='.$this->_id_utilisateur ;
$resultat = $GLOBALS['projet_db']->query($requete) ;
if (DB::isError($resultat)) {
echo $requete.' erreur '.$resultat->getMessage() ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC) ;
return $ligne[$this->_champs_base[$parametre]] ;
} // end of member function getInfo
 
/**
* Renvoie la liste de tous el inscris ou celle dont le champs passé en paramètre
* ressemble à la valeur souhaité. Ex : $maliste->getListe (array('nom' => '%toto'))
* ; renvoie la liste des adhérents dont le nom commence par toto.
*
* @param Array param Un tableau du type 'nom' => 'chaine'
* @return void
* @access public
*/
function getListe( $param )
{
} // end of member function getListe
 
/**
* Renvoie la liste des inscrits dont le nom commence par lettre
*
* @param char lettre La lettre
* @return void
* @access public
*/
function getListeAlphabetique( $lettre )
{
} // end of member function getListeAlphabetique
 
 
 
 
 
} // end of annuaire
?>
/tags/Racine_livraison_narmer/classes/index.php
New file
0,0 → 1,19
<?php
// An even simpler version of the index page than version 1. All the actual work of
// determining what needs to be included and what needs to be run is now in the main class.
// Also, 'register_globals' doesn't need to be 'on' anymore.
 
require_once("ezmlm.php");
 
$ezmlm = new ezmlm_php();
 
$action = ($_POST['action'] ? $_POST['action'] : ($_GET['action'] ? $_GET['action'] : "list_info"));
$actionargs = ($_POST['actionargs'] ? $_POST['actionargs'] : ($_GET['actionargs'] ? $_GET['actionargs'] : ""));
 
$ezmlm->set_action($action);
$ezmlm->set_actionargs($actionargs);
$ezmlm->run();
 
unset($ezmlm);
 
?>
/tags/Racine_livraison_narmer/classes/projet.class.php
New file
0,0 → 1,895
<?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: projet.class.php,v 1.8 2007-04-19 15:34:35 neiluj Exp $
/**
* Application projet
*
* La classe projet
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php' ;
/* Permet la récupération d'un nouvel identifiant d'une table.*/
require_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
include_once 'Mail.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
 
 
/**
* class projet
*
*/
class projet
{
 
/** Aggregations: */
 
/**
* Le tableau d'objet document associés au projet
*
*/
var $_documents_associes = array();
 
var $_listes_associes = array();
 
/** Compositions: */
 
/*** Attributes: ***/
 
/**
* L'identifiant du projet.
* @access private
*/
var $_id_projet;
 
/**
* Le titre du projet, tel que dans la base de donnée.
* @access private
*/
var $_titre;
/**
* La description du projet, tel que dans la base.
* @access private
*/
var $_description;
/**
* L'URL d'un site sur le projet. Facultatif.
* @access private
*/
var $_espace_internet;
/**
* Le nom du wikini associé au projet, avec la syntaxe wikini. Vide par défaut.
* @access private
*/
var $_nom_wikini;
/**
* Date de création du projet. A priori ne varie pas dans le temps.
* @access private
*/
var $_date_creation;
/**
* Le chemin relatif vers le répertoire contenant les wikinis.
* @access private
*/
var $_chemin_wikini;
/**
* Une connexion vers la base de donnée.
* @access private
*/
var $_db;
 
/**
* Contient le nom du répertoire du projet tel que sur le disque.
* @access private
*/
var $_nom_repertoire;
 
/**
* Le chemin jusqu'au répertoire où seront stockés les fichiers.
* @access private
*/
var $_chemin_repertoire;
 
/**
* Vaut vrai si le projet est un projet racine et s'il est le seul.
* @access private
*/
var $_est_racine;
/**
* Le résumé du projet
* @access private
*/
var $_resume;
/**
* Contient le numéro du type du projet
* @access private
*/
var $_type;
 
/**
* Indique si l'inscription au projet est moderes
* @access private
*/
var $_isModere;
 
/**
* Indique si le projet a des documents
* @access private
*/
var $_avoirDocument;
/**
*
* PHP5
* @return projet
* @access public
*/
function __construct( &$dbObject, $id_projet = "")
{
$this->projet($dbObject, $id_projet);
 
} // end of member function __construct
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur. Cela lui permet de faire une
* première requête pour les infos de bases comme le titre, le description etc.
* @return projet
* @access public
*/
function projet( &$dbObject, $id_projet = "")
{
$this->_db = $dbObject ;
if ($id_projet != "") {
$requete = "select * from projet where p_id=$id_projet" ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
 
// Affectations dans les propriétés
$this->_id_projet = $ligne->p_id ;
$this->_titre = $ligne->p_titre ;
$this->_description = $ligne->p_description ;
$this->_espace_internet = $ligne->p_espace_internet ;
$this->_date_creation = $ligne->p_date_creation ;
$this->_nom_wikini = $ligne->p_wikini ;
$this->_resume = $ligne->p_resume;
$this->_type = $ligne->p_type ;
// On récupère le nom du répertoire
$this->_nom_repertoire = $ligne->p_nom_repertoire ;
$this->_isModere = $ligne->p_modere;
$this->_avoirDocument = $ligne->p_avoir_document;
// on regarde si on a à faire au projet racine
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'select ph_id_projet_pere, ph_id_projet_fils from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$this->_est_racine = true ;
} else {
$this->_est_racine = false ;
}
}
}
} // end of member function projet
 
/**
*
*
* @param DB dbObject Un objet PEAR:DB
* @param int id_projet On passe un identifiant de projet au constructeur.
* @return bool
* @access public
*/
function projetExiste( &$dbObject, $id_projet)
{
if ($id_projet != "") {
$requete = "select * from projet where p_id=$id_projet" ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() != 0) {
return true ;
}
}
} // end of member function projet
 
/**
*
*
* @param int id_projet
* @return string
* @access public
*/
function getTitre( $id_projet = "" )
{
return $this->_titre ;
} // end of member function getTitre
 
/**
*
*
* @return string
* @access public
*/
function getResume( )
{
return $this->_resume ;
} // end of member function getResume
 
/**
* Renvoie l'identifiant du projet courant.
*
* @return int
* @access public
*/
function getId( )
{
return $this->_id_projet ;
} // end of member function getId
 
/**
*
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description;
} // end of member function getDescription
 
/**
*
*
* @return string
* @access public
*/
function getEspaceInternet( )
{
return $this->_espace_internet;
} // end of member function getEspaceInternet
 
/**
* Charge dans l'objet projet, les listes de discussion
* ['nom_liste']
* ['domaine']
* ['adresse']
*
* @return boolean true en cas de succès
* @access public
*/
function getListesAssociees( )
{
// On rajoute un test pour éviter l'appel SQL si il a déjà été fait une fois
if (count($this->_listes_associes) > 0) return ;
$requete = "select pl_id_liste from projet_lien_liste where pl_id_projet=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
$retour = array() ;
if ($resultat->numRows()) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$this->_listes_associes[] = new liste_discussion($ligne->pl_id_liste, $this->_db) ;
 
}
} // end of member function getListesAssociees
 
/**
* Renvoie vrai si le projet a au moins une liste
*
* @return bool
* @access public
*/
function avoirListe( )
{
$this->getListesAssociees() ;
if (count($this->_listes_associes)) {
return true ;
}
return false ;
}
 
/**
* Renvoie vrai si le projet a au moins un document, fichier ou repertoire
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @return bool
* @access public
*/
function avoirDocument( )
{
return $this->_avoirDocument;
}
 
/**
* Permet de fixer la colonne p_avoir_document à 1
*
* Mis en place pour des raisons de performances avant la methode getListesDocuments etait utilisee
*
* @param bool
* @return mixed true si la requete fonctionne
* @access public
*/
function setAvoirDocument($bool)
{
$val = 0 ;
if ($bool) $val = 1;
$requete = 'update projet set p_avoir_document='.$val.' where p_id='.$this->_id_projet;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return true;
}
 
/**
* Renvoie la liste des documents associés sous forme d'un tableau, avec les
* informations afférentes. 0 => "nom (cliquable)"
"Taille"
"Date
* de création" "Proriàtaire" "Visibilità" "Action
* (cliquable)"
*
* @param visibilite visibilite Si visibilite est à prive, tous les fichiers sont renvoyés ainsi qu'une entrée
* pour indiquer la visibilité du document.
* @return Array
* @access public
*/
function getListesDocuments( $chemin, $chemin_icones = "icones/" )
{
// On réalise une requete sur projet_documents avec une jointure sur l'annuaire
// et sur gen_type_de_fichier pour envoyer un résultat complet.
// On exclue les fichiers racines cad pd_pere is null
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet.' order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
 
// Un compteur
$i = 0 ;
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, &$this->_db, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
} // end of member function getListesDocuments
 
 
/**
* Renvoie un tableau avec tous les répertoires d'un projet, imbriqué. ['rep1'],
* ['rep2'] => array (['rep21'], ['rep22']), etc .
*
* @return Array
* @access public
*/
function getListeRepertoireHierarchisee( )
{
// On ne prend que les répertoires
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_id_projet.' and pd_ce_type=0 order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_document = array() ;
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $this->_db));
}
 
return $tableau_document ;
} // end of member function getListeRepertoireHierarchisee
 
 
/**
* Renvoie un tableau comprenant tous les objets projet de la base.
*
* @return Array
* @static
* @access public
*/
function getTousLesProjets(&$objetDB, $exclu = '')
{
$sql = '';
if (count($this->_projet_exclu)) {
$sql = 'where p_id not in (';
foreach ($this->_projet_exclu as $valeur) {
$sql .= $valeur.',' ;
}
$sql[count($sql)-1] = ')';
}
$requete = 'select p_id from projet '.$sql.' order by p_titre' ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un tableau comprenant les objets projet de la base du type $type.
*
* @return Array
* @static
* @access public
*/
function getProjetDuType($type, &$objetDB)
{
$requete = "select p_id from projet where p_type=$type order by p_titre" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Renvoie un le projet racine.
*
* @return projet
* @static
* @access public
*/
function getProjetRacine(&$objetDB)
{
$requete = "select p_id from projet where p_id not in (select ph_id_projet_fils from projet_hierarchie)" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
if ($resultat->numRows() == 1) {
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return new projet($objetDB, $ligne->p_id) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, new projet ($objetDB, $ligne->p_id)) ;
}
return $tableau_resultat ;
} // end of member function getTousLesProjets
 
/**
* Desctructeur de la classe. Libère la mémoire, ferme les connexions et fichiers.
*
* @return void
* @access public
*/
function __destruct( )
{
 
} // end of member function __destruct
 
/**
* Supprime le projet courrant. Il s'ensuit une suppression en cascade de tous les
* éléments liés.
*
* @return void
* @access public
*/
function supprimer( )
{
 
} // end of member function supprimer
 
/**
* Permet d'enregistrer une ligne dans la table concernée.
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* du formulaire.
* @return int
* @access public
*/
function enregistrerSQL( $tableau_de_valeur )
{
$nom_repertoire = projet::genereNomRepertoire($tableau_de_valeur['projet_titre'], $this->_db) ;
if (!$this->_creationRepertoire ($nom_repertoire)) {
echo 'Impossible de crée un répertoire'.$nom_repertoire ;
return false ;
}
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet', 'p_id') ;
$requete = 'insert into projet set p_id='.$id ;
if (!isset($tableau_de_valeur['projet_wikini'])) {
$tableau_de_valeur['projet_wikini']='';
}
$requete .= ', p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'", p_date_creation=NOW()'.
', p_wikini="'.$tableau_de_valeur['projet_wikini'].'", p_nom_repertoire="'.$nom_repertoire.'", p_resume="'.$tableau_de_valeur['projet_resume'].
'", p_type='.$tableau_de_valeur['projet_type'].', p_modere="'.$tableau_de_valeur['projet_moderation'].'"' ;
$resultat = $this->_db->query ($requete) ;
 
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
// On affecte à l'objet projet son identifiant
$this->_id_projet = $id ;
 
//insertion dans projet_hierarchie
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
', ph_id_projet_fils='.$id ;
$resultat = $this->_db->query ($requete) ;
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Permet de mettre à jour une ligne dans la table concernée.
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* du formulaire.
* @return int
* @access public
*/
function majSQL( $tableau_de_valeur )
{
// Traitement du type
if (!PROJET_UTILISE_TYPE) {
$tableau_de_valeur['projet_type'] = 0 ;
}
$requete = 'update projet set ';
$requete .= 'p_titre="'.$tableau_de_valeur['projet_titre'].'", p_description="'.$tableau_de_valeur['projet_description'].'"'.
', p_espace_internet="'.$tableau_de_valeur['projet_espace_internet'].'"'.
', p_resume="'.$tableau_de_valeur['projet_resume'].'", p_type='.$tableau_de_valeur['projet_type'].
', p_modere='.$tableau_de_valeur['projet_moderation'].
' where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
if (PROJET_UTILISE_HIERARCHIE) {
// suppression dans projet_hierarchie
 
$requete = 'delete from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
 
//insertion dans projet_hierarchie
 
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$tableau_de_valeur['projet_asso'].
', ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Met à jour dans la base de donnée le champs p_nom_wikini
*
* @param int nom_wikini Le nouveau nom wikini
* @return bool
* @access public
*/
function majNomWikini( $nom_wikini )
{
$requete = 'update projet set p_wikini="'.$nom_wikini.'" where p_id="'.$this->_id_projet.'"' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return true ;
} // end of member function majNomWikini
 
 
/**
*
*
* @param string code_sql
* @return bool
* @access public
*/
function suppressionSQL()
{
$msg = '' ;
// Supression du répertoire du projet
if (!$this->_suppression_repertoire()) {
$msg = 'La suppression du répertoire n\'a pas fonctionn°' ;
}
// A ajouter la suppression des documents associés
 
// La suppression des évènements associés
 
// Le projet lui-même
$requete = "delete from projet where p_id=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
 
if (PROJET_UTILISE_HIERARCHIE) {
$requete = "delete from projet_hierarchie where ph_id_projet_fils=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
$requete = "delete from projet_statut_utilisateurs where psu_id_projet=".$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
return $msg ;
} // end of member function suppressionSQL
 
/**
* Supprime le répertoire associé au projet (le répertoire doit être vide).
*
* @return void
* @access private
*/
function _suppression_repertoire( )
{
return rmdir ($this->_chemin_repertoire.$this->_nom_repertoire) ;
} // end of member function _suppression_repertoire
 
/**
* Permet de créer le répertoire associé au projet.
*
* @param string nom_repertoire Le nom du répertoire à créer.
* @return boolean
* @access private
*/
function _creationRepertoire( $nom_repertoire )
{
return mkdir ($this->_chemin_repertoire.$nom_repertoire) ;
} // end of member function _creationRepertoire
 
/**
* Permet d'indiquer où seront stockés les fichiers.
*
* @param string cheminRepertoire Le chemin jusqu'au répertoire où seront stockés les fichiers.
* @return void
* @access public
*/
function setCheminRepertoire( $cheminRepertoire )
{
$this->_chemin_repertoire = $cheminRepertoire ;
} // end of member function setCheminRepertoire
 
/**
* Génère un nom de répertoire à partir de la première lettre de la chaine passé en
* paramètre et de l'identifiant du dernier projet.
*
* @param string chaine Une chaine à partir de laquelle sera générer le nom du répertoire.
* @param DB objetDB un objet PEAR::DB
* @return string
* @static
* @access public
*/
function genereNomRepertoire( $chaine, &$objetDB )
{
$requete = "select p_id from projet order by p_id desc limit 0,1" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if ($resultat->numRows() > 0) {
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= $ligne->p_id + 1 ;
}
else {
$nom = strtoupper(substr($chaine, 0, 1)) ;
$nom .= 1 ;
}
return $nom ;
 
} // end of member function genereNomRepertoire
 
/**
* Permet de récupérer le nom du répertoire d'un projet.
*
* @return string
* @access public
*/
function getNomRepertoire( )
{
return $this->_nom_repertoire ;
} // end of member function getNomRepertoire
 
/**
* Ajoute une liste à un projet
* Effectue une insertion dans projet_lien_liste
*
* @param liste_discussion liste Une instance de la classe liste_discussion
* @return void
* @access public
*/
function ajouterListe( &$liste )
{
$requete = "insert into projet_lien_liste set pl_id_liste=".$liste->getId().
', pl_id_projet='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
} // end of member function ajouterListe
 
/**
* Supprime la liste de discussion associée au projet
*
* @return void
* @access public
*/
function supprimerListe(&$liste)
{
$requete = 'delete from projet_lien_liste where pl_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$requete = 'delete from projet_liste where pl_id_liste='.$liste->getId() ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
} // end of member function supprimerListe
 
 
/**
* Renvoie vrai si le projet est racine.
*
* @return bool
* @access public
*/
function isRacine( )
{
return $this->_est_racine ;
} // end of member function isRacine
 
/**
* Renvoie le nombre d'inscrits au projet. Effectue une requete dans la table
* projet_statut_utilisateurs
*
* @return int
* @access public
*/
function getNombreInscrits( )
{
$requete = 'select count(psu_id_utilisateur) as nbre from projet_statut_utilisateurs where psu_id_projet='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->nbre ;
} // end of member function getNombreInscrits
 
 
/**
* Renvoie un tableau contenant les identifiants des fils du projet courant.
*
* @return Array
* @access public
*/
function getHierarchie( )
{
$requete = 'select ph_id_projet_fils from projet_hierarchie where ph_id_projet_pere='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->ph_id_projet_fils) ;
}
return $tableau_resultat ;
} // end of member function getHierarchie
 
/**
* Renvoie l'identifiant du pere du projet courrant.
*
* @return int
* @access public
*/
function getIdPere()
{
$requete = 'select ph_id_projet_pere from projet_hierarchie where ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
return $ligne->ph_id_projet_pere ;
} // end of member function getIdPere()
 
/**
* Renvoie le nom Wiki du wikini associé au projet.
*
* @return string
* @access public
*/
function getWikini( )
{
return $this->_nom_wikini ;
} // end of member function getWikini
 
/**
* Renvoie le type du projet, ou zéro si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getType( )
{
return $this->_type ;
} // end of member function getType
 
/**
* Renvoie 1 si les inscriptions au projet sont modérées.
*
* @return int
* @access public
*/
function isModere( )
{
return $this->_isModere ;
} // end of member function getType
 
 
 
/**
* initAttributes sets all projet attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->chemin_wikini = "projet/wikini/";
}
 
 
} // end of projet
?>
/tags/Racine_livraison_narmer/classes/fichier.class.php
New file
0,0 → 1,295
<?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: fichier.class.php,v 1.6 2007-04-19 09:25:50 alexandre_tb Exp $
/**
* Application projet
*
* La classe fichier
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'type_fichier_mime.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class fichier
* Cette classe représente un fichier au sens physique du terme. Elle fonctionne
* pour les système UNIX. A faire : adaptation selon les système. L'objectif est de
* gérer correctement l'upload de fichier.
*/
class fichier
{
/*** Attributes: ***/
/**
* Le nom du fichier, avec son extension.
* @access private
*/
var $_nom;
/**
* Le chemin UNIX ou Windows pour accéder au fichier sur le serveur (par ex;
* /var/www/fichier.txt
* @access private
*/
var $_chemin;
/**
* Cet attribut contient une valeur du type 755, indiquant les droits afférent à un
* fichier selon le système UNIX (propriétaire, groupe, autres)
* @access private
*/
var $_droits_unix;
/**
* Le type indique si le fichier est un répertoire, un lien ou un fichier.
* @access private
*/
var $_type = 'fichier';
/**
* l'identifiant du type mime.
* @access private
*/
var $_type_mime;
/**
* Le chemin vers le fichier, en partant du répertoire de travail.
* @access private
*/
var $_prefixe_chemin;
 
/**
*
*
* @return void
* @access public
*/
function fichier( $chemin, &$objetDB)
{
$this->_chemin = $chemin ;
// On analyse l'extension pour découvrir le type mime
$partie_chemin = pathinfo ($this->_chemin) ;
if (is_object($objetDB) && isset($partie_chemin['extension'])) {
$this->_type_mime = type_fichier_mime::factory ($partie_chemin['extension'], $objetDB) ;
}
// calcul du type
if (is_dir ($this->_chemin)) $this->_type = 'repertoire' ;
} // end of member function fichier
 
/**
* Le constructeur de la classe.
*
* @param string chemin Le chemin du fichier sur le serveur.
* @return fichier
* @access public
*/
function __construct( $chemin, &$objetDB)
{
$this->fichier($chemin, $objetDB);
} // end of member function __construct
 
/**
*
*
* @return void
* @access public
*/
function suppression()
{
if ($this->_type == 'repertoire') rmdir ($this->_chemin) ;
if ($this->_type == 'fichier') unlink ($this->_chemin) ;
} // end of member function suppression
 
/**
* Réalise l'upload d'un fichier vers chemin_destination.
*
* @param string chemin_destination Il s'agit du chemin UNIX de destination du fichier. Le script doit avoir les
* droits en écriture sur le répertoire.
* @global mixed une référence vers un objet HTML_QuickForm_File
* @return void
* @access public
*/
function upload( $chemin_destination )
{
if (move_uploaded_file($_FILES['fichier']['tmp_name'], $chemin_destination)) {
return true ;
} else {
return false ;
}
} // end of member function upload
 
/**
* Déplace un fichier, renvoie vrai en cas de succès.
*
* @param string origine L'emplacement de départ du fichier.
* @param string destination Le répertoire d'arrivé.
* @return bool
* @access public
*/
function deplace( $origine, $destination )
{
if (copy ($origine, $destination )) {
if (unlink($origine)) return true ;
}
return false ;
} // end of member function deplace
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime du document.
* @return type_fichier_mime
* @access public
*/
function getTypeMime( )
{
return $this->_type_mime;
} // end of member function getTypeMime
 
/**
* Renvoie vrai si le document est un répertoire.
*
* @return bool
* @access public
*/
function isRepertoire( )
{ $isRep = is_dir ($this->_chemin) ;
return $isRep ;
} // end of member function isRepertoire
 
 
/**
*
*
* @param int id_type_mime L'identifiant du type mime.
* @return void
* @access public
*/
function setTypeMime( $id_type_mime )
{
$this->_type_mime = $id_type_mime ;
} // end of member function set TypeMime
 
 
/**
* Renvoie la taille du fichier en octet. Nécessite un accès au disque.
*
* @return int
* @access public
*/
function getTaille( )
{
if ($this->isRepertoire()) {
return $this->_tailleRepertoire($this->_chemin) ;
}
return @filesize ($this->_chemin) ;
} // end of member function getTaille
 
/**
* Renovie le nom du fichier, sur le disque.
*
* @return string
* @access public
*/
function getNom( )
{
} // end of member function getNom
 
/**
* Renvoie le chemin du fichier.
*
* @return string
* @access public
*/
function getChemin( )
{
return $this->_chemin ;
} // end of member function getChemin
 
/**
* Permet de calculer la taille en octet du repertoire courrant
*
* @return int
* @access protected
*/
function _tailleRepertoire($rep)
{
$taille = 0 ;
$liste_fichier = scandir ($rep) ;
foreach ($liste_fichier as $key => $value) {
if (is_dir ($rep."/".$value) && $value != ".." && $value != ".") {
$taille += $this->_tailleRepertoire ($rep.$value."/") ;
} else {
if ($value != '..' && $value != '.') $taille += @filesize ($rep.$value) ;
}
}
return $taille ;
} // end of member function _tailleRepertoire
 
 
/**
* initAttributes sets all fichier attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_type = 'fichier';
}
 
 
} // end of fichier
 
if(!function_exists("scandir"))
{
function scandir($dirstr)
{
// php.net/scandir (PHP5)
$files = array();
$fh = opendir($dirstr);
while (false !== ($filename = readdir($fh)))
{
array_push($files, $filename);
}
closedir($fh);
return $files;
}
}
?>
/tags/Racine_livraison_narmer/classes/liste_externe.class.php
New file
0,0 → 1,162
<?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: liste_externe.class.php,v 1.2 2005-09-27 16:42:00 alexandre_tb Exp $
/**
* Application projet
*
* La classe liste_externe
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class liste_externe
*
*/
class liste_externe
{
/*** Attributes: ***/
 
/**
* Identifiant de la liste, dans la table agora et dans la table
* projet_lien_liste_externe
* @access private
*/
var $_id_liste;
/**
*
* @access private
*/
var $_db;
/**
* Constructeur
*
* @param DB objetDB Un objet PEAR::DB
* @return void
* @access public
*/
function liste_externe(&$objetDB )
{
$this->_db = $objetDB ;
} // end of member function liste_externe
 
/**
* Renvoie un tableau avec en clé l'identifiant d'une liste et en valeur le nom de
* la liste.
*
* @return Array
* @access public
*/
function getListeNom( )
{
$requete = 'select AGO_A_ID, AGO_A_NOMGRPLG from agora' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tableau_resultat[$ligne['AGO_A_ID']] = $ligne['AGO_A_NOMGRPLG'] ;
}
return $tableau_resultat ;
} // end of member function getListeNom
 
/**
* Renvoie un tableau avec les identifiants des listes associées au projet passé en
* paramètre.
*
* @param int id_projet L'identifiant du projet
* @return Array
* @access public
*/
function getListesAssociees( $id_projet )
{
$requete = 'select plle_id_liste from projet_lien_liste_externe where plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_resultat = array() ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
array_push ($tableau_resultat, $ligne->plle_id_liste) ;
}
return $tableau_resultat ;
} // end of member function getListesAssociees
 
/**
* enregistrerSQL
*
* @return
*/
function enregistrerSQL ($valeur, $id_projet) {
// on commence par supprimer
$requete = 'delete from projet_lien_liste_externe where plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
// puis on réinsère
foreach ($valeur as $cle => $val) {
if (!preg_match ('/liste_/', $cle)) continue ;
$id_liste = preg_replace ('/liste_/', '', $cle) ;
$requete = 'insert into projet_lien_liste_externe set plle_id_liste='.$id_liste.', plle_id_projet='.$id_projet ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
}
 
/**
* Renvoie un tableau avec les infos sur la liste, voir les noms des champs de la
* table agora pour une description plus détaillé.
*
* @param int id_liste L'identifiant de la liste
* @return void
* @access public
*/
function getInfoListe( $id_liste )
{
$requete = 'select * from agora where AGO_A_ID='.$id_liste ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne ;
} // end of member function getInfoListe
 
} // end of liste_externe
?>
/tags/Racine_livraison_narmer/classes/document.class.php
New file
0,0 → 1,620
<?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: document.class.php,v 1.7 2007-04-19 09:22:29 alexandre_tb Exp $
/**
* Application projet
*
* La classe document
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once PROJET_CHEMIN_CLASSES.'fichier.class.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/**
* class document
* Représente un document associé à un projet. C'est à dire un fichier
* téléchargeable disposant en plus d'une visibilité, d'un nom long, d'une
* description et d'une url.
*/
class document extends fichier
{
/*** Attributes: ***/
 
/**
* Description qui apparaitra à l'écran.
* @access private
*/
var $_description;
/**
* Date de dernière mise à jour des attributs du fichier.
* @access private
*/
var $_date_mise_a_jour;
/**
* Soit public, soit privé.
* @access private
*/
var $_visibilite;
/**
* Le nom du fichier tel qu'il apparaitra à l'écran.
* @access private
*/
var $_nom_long;
/**
* Un objet PEAR:DB
* @access private
*/
var $_db;
/**
* L'identifiant du document dans la table projet_document.
* @access private
*/
var $_id;
 
/**
*
* @access private
*/
var $_chemin_icone;
/**
* L'identifiant du père, peut être à NULL
* @access private
*/
var $_id_pere;
/**
* L'identifiant du propriétaire. Provient d'un annuaire. Peut être à NULL.
* @access private
*/
var $_id_proprietaire;
/**
* L'identifiant du projet auquel appartient le document. Peut être à NULL.
* @access private
*/
var $_id_projet;
 
/**
* Le chemin du fichier, depuis le répertoire du projet
*
*/
var $_pd_lien ;
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB un objet PEAR:DB
* @return void
* @access public
*/
function document( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '')
{
$this->_db = $objetDB ;
$this->_chemin_icone = $chemin_icones ;
if ($id_document != "") {
$requete = "select * from projet_documents where pd_id=".$id_document ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows()>0) {
fichier::fichier($chemin.$ligne->pd_lien, $this->_db) ;
$this->_id = $ligne->pd_id ;
if (is_object ($this->_type_mime)) $this->_type_mime->setCheminIcone ($chemin_icones) ;
$this->_id_proprietaire = $ligne->pd_ce_utilisateur ;
$this->_nom_long = $ligne->pd_nom ;
$this->_visibilite = $ligne->pd_visibilite ;
$this->_date_mise_a_jour = $ligne->pd_date_de_mise_a_jour ;
$this->_description = $ligne->pd_description ;
$this->_pd_lien = $ligne->pd_lien;
if ($this->_isRacine($ligne->pd_pere)) {
$this->_id_pere = 0 ;
} else {
$this->_id_pere = $ligne->pd_pere ;
}
}
}
} // end of member function document
 
/**
*
*
* @param int id_document L'identifiant du document dans la base.
* @param int objetDB Un objet PEAR:DB
* @return document
* @access public
*/
function __construct( $id_document = "", &$objetDB, $chemin = '', $chemin_icones = '' )
{
$this->document($id_document, $objetDB, $chemin, $chemin_icones);
} // end of member function __construct
 
 
/**
* Renvoie le nom long du fichier.
*
* @return string
* @access public
*/
function getNomLong( )
{
return $this->_nom_long ;
} // end of member function getNomLong
 
/**
* Renvoie la visibilité du document, soit "public" soit "prive"
*
* @return visibilite
* @access public
*/
function getVisibilite( )
{
return $this->_visibilite ;
} // end of member function getVisibilite
 
/**
* Renvoie la description du document, sous forme de chaine.
*
* @return string
* @access public
*/
function getDescription( )
{
return $this->_description ;
} // end of member function getDescription
 
/**
* Renvoie la date de création ou de mise à jour du fichier.
*
* @return date
* @access public
*/
function getDateMiseAJour( )
{
return $this->_date_mise_a_jour ;
} // end of member function getDateMiseAJour
 
/**
* Renvoie l'identifiant d'un document.
*
* @return int
* @access public
*/
function getIdDocument( )
{
return $this->_id ;
} // end of member function getIdDocument
 
/**
* Renvoie le chemin de l'icone du fichier. Fait un appel à type_fichier_mime.
*
* @return string
* @access public
*/
function getCheminIcone()
{
if ($this->isRepertoire()) {
return $this->_chemin_icone."repertoire.gif" ;
} else {
return $this->_type_mime->getCheminIcone() ;
}
} // end of member function getCheminIcone
 
/**
* Permet de récupérer le nom du répertoire racine associé à un projet.
*
* @param int id_projet L'identifiant du projet dont on veux récupérer le répertoire racine.
* @param DB objetDB Un objet PEAR:DB
* @return string
* @static
* @access public
*/
function getNomRepertoireProjet( $id_projet , &$objetDB)
{
// Dans la table projet_documents, pour les répertoires racines, pd_pere = null
$requete = "select pd_nom from projet_documents where pd_ce_projet=$id_projet and pd_pere is null" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
return $ligne->pd_nom ;
} // end of member function getNomRepertoireProjet
 
 
/**
* Renvoie true si le document passé en paramètre est le répertoire racine.
*
* @param int id_document L'identifiant du document dont on veut savoir si c'est la racine.
* @return bool
* @access public
*/
function _isRacine( $id_document )
{
if ($id_document) {
$requete = "select pd_pere from projet_documents where pd_id=".$id_document ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
if ($resultat->numRows() >0) {
if ($ligne->pd_pere == null){
return true ;
}
}
}
return false ;
} // end of member function _isRacine
 
/**
* Renvoie le chemin d'un fichier ou d'un répertoire. Contrairement à la classe
* mère, cette méthode renvoie une URL projet et non pas un fichier.
*
* @return string
* @access public
*/
function getChemin( )
{
if ($this->isRepertoire()) {
return $this->_id ;
} else {
return $this->_chemin ;
}
} // end of member function getChemin
 
 
/**
* Renvoie pour le répertoire courant, les identifiants et les noms de tous les
* répertoires père jusqu'à la racine. 0 => ['id'], ['nom'] 1 => [id'], ['nom'] etc.
* En commençant par la racine et en descendant. Pour la racine id vaut "" et nom
* vaut "".
*
* @param int id_repertoire L'identifiant d'un répertoire.
* @return Array
* @access public
*/
function getCheminIdRepertoire( $id_repertoire, &$objetDB )
{
if ($id_repertoire == "") $id_repertoire = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = "select pd_pere, pd_nom, pd_id from projet_documents where pd_id=$id_repertoire" ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
$chemin_rep_id_nom = array() ;
if ($resultat->numRows()>0) {
if ($ligne->pd_pere == 0) {
$tab = array ($ligne->pd_id, $ligne->pd_nom) ;
return $tab ;
}
else {
$requete_pere = "select pd_id, pd_nom from projet_documents where pd_id=$ligne->pd_pere" ;
$resultat_pere = $objetDB->query ($requete_pere) ;
if (DB::isError($resultat_pere)) {
die ("Echec de la requete<br />".$resultat_pere->getMessage()."<br />".$resultat_pere->getDebugInfo()) ;
}
$ligne_pere = $resultat_pere->fetchRow (DB_FETCHMODE_OBJECT) ;
array_push ($chemin_rep_id_nom, $ligne->pd_id,$ligne->pd_nom) ;
$tab = document::getCheminIdRepertoire($ligne_pere->pd_id, $objetDB) ;
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, $tab) ;
}
}
$tabl_resultat = array() ;
for ($i = 0; $i < count ($chemin_rep_id_nom); $i++) {
$val1 = array_pop ($chemin_rep_id_nom) ;
$val2 = array_pop ($chemin_rep_id_nom) ;
array_push ($tabl_resultat, $val2, $val1) ;
}
return $tabl_resultat ;
} // end of member function getCheminIdRepertoire
 
/**
* Calcule le chemin vers le fichier ou le répertoire uploadé
* renvoie un chaine de la forme dir1/dir2/fichier.ext
* En prenant comme racine le répertoire du projet, exclu.
* @return string Le chemin
*/
 
function calculeCheminUploaded ($radical) {
// On recherche le chemin vers le fichier, en fonction du répertoire
// ici on renomme le fichier à partir du dernier ID de la table gen_voiraussi
$requete_document = "select pd_id from projet_documents order by pd_id desc limit 1,1" ;
$resultat_document = $this->_db->query($requete_document) ;
$ligne_document = $resultat_document->fetchRow(DB_FETCHMODE_OBJECT) ;
$nouveau_nom = $ligne_document->pd_id + 1 ;
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
$nouveau_nom = $radical."_".$nouveau_nom.".".$extension ;
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree.$nouveau_nom ;
} else {
// Si l'on est à la racine du projet, le chemin est le nom du fichier
return $nouveau_nom ;
}
return $chemin ;
}
 
/**
* Enregistre une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function enregistrerSQL ($valeur, $chemin) {
// On teste si on a affaire à un répertoire ou un fichier
if (isset ($_FILES['fichier']['name'])) {
// On tente de déterminer le type du fichier à partir de son nom dans $valeur['$fichier']
$tableau_nom = explode (".", $_FILES['fichier']['name']) ;
// On prend le dernier élément du tableau, si c'est un tableau
if (is_array($tableau_nom)) {
$extension = array_pop($tableau_nom) ;
$type = type_fichier_mime::factory($extension, $this->_db) ;
$id_extension = $type->getIdType() ;
} else {
$id_extension = 12 ;
}
$pd_lien = $chemin ;
} else { // Le cas ou on a affaire à un répertoire
$id_extension = 0 ;
// Le nom du répertoire est son identifiant avec un slash à la fin
$pd_lien = $chemin."/" ;
if ($this->_id_pere != '') {
// On appelle la méthode getCheminIdRepertoire qui renvoie un tableau avec la liste
// des répertoires jusqu'à la racine, on enlève la racine ($i = 0) et on concatène
// toutes les entrées pour obtenir le chemin jusqu'au répertoire courant
$chemin_repertoire_entre_racine_et_repertoire_a_cree = '' ;
$tableau_navigation = $this->getCheminIdRepertoire($this->_id_pere, $this->_db) ;
for ($i = 0; $i < count ($tableau_navigation); $i+=2) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$pd_lien .= $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
}
$pd_lien .= SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id')."/" ;
}
$id = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
 
$requete = "insert into projet_documents set pd_id=".$id ;
$requete .= ", pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW(),".
"pd_ce_projet=\"".$this->_id_projet."\", pd_ce_utilisateur=\"".$this->_id_proprietaire."\"".
", pd_pere=\"$this->_id_pere\", pd_ce_type=\"$id_extension\", pd_lien=\"$pd_lien\"" ;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
return $pd_lien;
}
 
 
/**
* Met à jour une ligne dans la table projet_document
* Le tableau de valeur doit contenir les éléments suivants 'document_nom','document_description','document_visibilite','fichier'
*
* @param Array tableau_de_valeur Le tableau de valeur a insérer dans la base avec pour clé les noms des éléments
* @access public
* @return void
*/
 
function majSQL ($valeur) {
$requete = "update projet_documents set pd_nom=\"".$valeur['document_nom']."\", pd_description=\"".$valeur['document_description']."\"".
", pd_visibilite=\"".$valeur['document_visibilite']."\", pd_date_de_mise_a_jour=NOW()".
" where pd_id=".$this->_id;
 
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
return ;
}
 
/** Supprime les donnéexs du document dans la table projet_documents
*
*
* @return true en cas de succès
*/
function suppressionSQL () {
$requete = 'delete from projet_documents where pd_id='.$this->_id ;
$resultat = $this->_db->query ($requete) ;
if ($this->_db->affectedRows()) return true ;
return false ;
}
/**
* Déplace un document au sein d'un même projet
*
* @param int repertoire_destination L'identifiant du répertoire destination.
* @return bool
* @access public
*/
function deplace( $repertoire_destination, $repertoire_projet )
{
// On récupère les informations du répertoire cible
if ($repertoire_destination != 0) {
$repertoire_cible = new document ($repertoire_destination, $this->_db) ;
$rep = $repertoire_cible->_pd_lien ;
} else {
$rep = $repertoire_projet.'/' ;
}
// On récupère le nom du fichier
$decoupe = explode ('/', $this->_pd_lien) ;
$nom_fichier = $decoupe[count($decoupe)-1] ;
$requete = 'update projet_documents set pd_lien="'.$rep.$nom_fichier.'", pd_pere='.$repertoire_destination.' where pd_id='.$this->_id ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
return false ;
}
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$rep.$nom_fichier) ;
} // end of member function deplace
 
 
/**
* Pour modifier l'identifiant du projet auquel appartient un document.
*
* @param int id_projet L'identifiant du projet.
* @return void
* @access public
*/
function setIdProjet( $id_projet )
{
$this->_id_projet = $id_projet ;
} // end of member function setIdProjet
 
/**
* Permet de modifier l'identifiant du propietaire d'un projet.
*
* @param int id_proprietaire L'identifiant du proprietaire d'un document.
* @return void
* @access public
*/
function setIdProprietaire( $id_proprietaire )
{
$this->_id_proprietaire = $id_proprietaire ;
} // end of member function setIdProprietaire
 
/**
* Permet de modifier l'identifiant du répertoire d'un document.
*
* @param int id_repertoire L'identifiant du repertoire d'un document.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_pere = $id_repertoire;
} // end of member function setIdRepertoire
 
/**
* initAttributes sets all document attributes to its default value make
* sure to call this method within your class constructor
*/
function initAttributes( )
{
$this->_visibilite = "public";
}
 
/**
* Renvoie les derniers documents de l'ensemble des projets.
*
* @param int nombre Le nombre de document à renvoyer
* @return Array
* @static
* @access public
*/
function getDocumentsRecents( $nombre = 10, &$objetDB, $chemin, $chemin_icones, $id_projet = '', $visible = true)
{
// on recherche les documents, hors repertoire
$requete = 'select pd_id from projet_documents where pd_ce_type<>0 ';
if ($id_projet != '') $requete .= ' and pd_ce_projet='.$id_projet.' ';
if (!$visible) $requete .= ' and pd_visibilite="public" ';
$requete .= 'order by pd_date_de_mise_a_jour desc limit 0,'.$nombre ;
$resultat = $objetDB->query ($requete) ;
if (DB::isError ($resultat)) {
die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$tableau_document = array() ;
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau_document, new document ($ligne->pd_id, $objetDB, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
} // end of member function getDocumentsRecents
 
/**
* Renvoie les documents du projet passe en parametre sous forme d arbre d objet document
*
* @param int l identifiant du projet
* @return Array
* @static
* @access public
*/
function getArbreDocument($id_projet, $objetDB = '') {
$requete = 'select pd_id, pd_nom, pd_ce_type, pd_pere from projet_documents where pd_ce_projet='.$id_projet;
$resultat = $GLOBALS['projet_db']->getAll($requete, null, DB_FETCHMODE_OBJECT);
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
return $resultat;
}
/**
* Renvoie la taille du document formatee avec une unite adapte
*
* @return string La taille formate
* @access public
*/
function getTailleFormatee($precision = 1) {
$taille = $this->getTaille();
if ($taille > 1000000) {
$diviseur = 1000000;
$unite = 'Mo';
} else {
$diviseur = 1000 ;
$unite = 'Ko';
}
return round ($taille / $diviseur, $precision).'&nbsp;'.$unite;
}
} // end of document
 
 
?>
/tags/Racine_livraison_narmer/classes/AJAX_arbreDocuments.class.php
New file
0,0 → 1,353
<?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: AJAX_arbreDocuments.class.php,v 1.1 2007-04-19 09:20:26 alexandre_tb Exp $
/**
* Application projet
*
* La classe AJAX_arbreDocuments
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
// +------------------------------------------------------------------------------------------------------+
 
define ("FICHIER_ICONE_COUPER", "cut.gif") ;
define ("FICHIER_ICONE_COLLER", "paste.gif") ;
define ("FICHIER_ICONE_SUPPRIMER", "trash.gif") ;
define ("FICHIER_ICONE_MODIFIER", "modif.png") ;
 
// Appel de la bibliotheque dojo
 
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
 
/**
* class HTML_listeDocuments
*
*/
class AJAX_arbreDocuments extends HTML_Liste
{
/*** Attributes: ***/
 
/**
* Une url.
* @access private
*/
var $_url;
/**
* Tableau contenant les actions possibles. "couper" => 1, "modifier" => 2,
* "supprimer" => 3 Elles seront passées en paramètre aux url des icones des
* documents.
* @access private
*/
var $_actions = array ("couper" => 1, "modifier" => 2, "supprimer" => 3) ;
 
/**
* Indique le chemin des icones couper, coller, modifier, supprimer.
* @access private
*/
var $_chemin_icone = "icones/";
/**
* L'identifiant du répertoire que l'on est en train d'observer.
* @access private
*/
var $_id_repertoire;
 
/**
* Un tableau contenant les id et les noms du chemin des répertoires. 0 => ["id"],
* ["nom"] etc.
* @access private
*/
var $_chemin_navigation = array ();
 
/**
* un pointeur vers une authentificatin PEAR
* @access private
*/
var $_auth ;
/**
*
*
* @param bool utilise_pager Indique l'utilisation ou non du Pager.
* @return void
* @access public
*/
function AJAX_arbreDocuments(&$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
//HTML_Liste::HTML_Liste($utilise_pager, array('class' => 'table_cadre')) ;
$this->_url = $url ;
$this->_id_repertoire = $id_repertoire ;
if (is_object($auth)) {
$this->_auth = $auth ;
}
} // end of member function HTML_listeDocuments
 
function AJAX_construitListe($id_projet, $droits, $mode = '', $objetDB = '') {
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
// Le noeud racine
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>
<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">
<div dojoType="TreeNode" title="Racine" widgetId="eisleyRoot" objectId="root" isFolder="true"></div>';
 
 
 
return $res ;
}
/**
*
*
* @param bool utilise_pager Voir HTML_listeDocuments
* @return void
* @access public
*/
function __construct( &$url, $utilise_pager = false, $id_repertoire = 0, $auth = '' )
{
$this->AJAX_arbreDocuments($url, $utilise_pager, $id_repertoire, $auth);
} // end of member function __construct
 
/**
*
*
* @param Array tableau_label Un tableau contenant les labels à afficher dans l'entête.
* @return void
* @access public
*/
function construitEntete( $tableau_label )
{
$this->addRow ($tableau_label, NULL, 'TH') ;
} // end of member function construitEntete
 
/**
*
*
* @param Array tableau_label Un tableau à deux dimensions avec les labels à afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '')
{
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
 
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Première condition : est-ce que le fichier a pour père le répertoire courant, si oui on l'affiche
if ($tableau_document[$i]->_id_pere == $this->_id_repertoire || $mode == 'ignore_repertoire') {
// d'abord l'image
$icone = '<img src="'.$tableau_document[$i]->getCheminIcone().'" />' ;
// Si le document est un répertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getChemin()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$lien = $tableau_document[$i]->getChemin() ;
}
// pour éviter des effets de bords, on enlève id_repertoire de l'url
// dans le cas d'un répertoire, pour les fichiers on le laisse pour
// qu'après une opération, on reste dans le répertoire où a eu lieu l'opération
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insère le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
// Pour la taille on divise par 1000 et on écrit Ko
$taille = round($tableau_document[$i]->getTaille() / 1000).'&nbsp;Ko' ;
// Récupération de l'auteur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($objetDB, array('table' => PROJET_ANNUAIRE, 'identifiant' => PROJET_CHAMPS_ID,
'nom' => PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
$annuaire->setId($tableau_document[$i]->_id_proprietaire) ;
$nom_prenom = $annuaire->getInfo('nom').' '.$annuaire->getInfo('prenom') ;
// On rempli le tableau à donner en paramètre à HTML_Table avec toutes ces infos, une par colonne
$ligne_tableau = array($lien_nom, $taille, $nom_prenom, $tableau_document[$i]->getDateMiseAJour()) ;
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) array_push ($ligne_tableau, $tableau_document[$i]->getVisibilite()) ;
// On ajoute au tableau, les action couper / modifier / supprimer
if ($droits <= PROJET_DROIT_COORDINATEUR || $this->_auth->getAuthData(PROJET_CHAMPS_ID) == $tableau_document[$i]->_id_proprietaire)
array_push ($ligne_tableau, $this->_actions ($tableau_document[$i])) ;
if ($tableau_document[$i]->getVisibilite() != 'prive' || $droits < PROJET_DROIT_AUCUN) {
$this->addRow ($ligne_tableau, array('class' => $class[$compteur]), 'TD', true) ;
// enfin , s'il y a une description, on l'ajoute, mais sur une ligne entière (colspan)
if ($tableau_document[$i]->getDescription() != "") {
$this->addRow (array ($tableau_document[$i]->getDescription()),
array ('colspan' => $this->getColCount(), 'class' => $class[$compteur])) ;
$this->updateRowAttributes ($this->getRowCount()-1, array ('class' => $class[$compteur]), true) ;
}
}
$compteur++;
}
if ($compteur == 2) $compteur = 0 ;
}
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme clé. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
} // end of member function setAction
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
} // end of member function setCheminIcones
 
/**
* Surcharge de l'opération de la classe mère. Ajoute la navigation dans les
* répertoires.
*
* @return string
* @access public
*/
function toHTML( )
{
$chemin_navig = "" ;
if ($this->_id_repertoire != "") {
$this->_url->removeQueryString(PROJET_VARIABLE_ID_REPERTOIRE) ;
$chemin_navig = "<p>" ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".PROJET_RACINE."</a>\n" ;
$this->_url->addQueryString(PROJET_VARIABLE_ID_REPERTOIRE, $this->_id_repertoire) ;
for ($i = 0; $i < count ($this->_chemin_navigation); $i+=2) {
$chemin_navig .= "&gt;&nbsp;" ;
$nom = $this->_chemin_navigation[$i+1] ;
$this->_url->addQueryString ('id_repertoire', $this->_chemin_navigation[$i]) ;
$chemin_navig .= "<a href=\"".$this->_url->getURL()."\">".$nom."</a>\n" ;
}
$chemin_navig .= "</p>\n" ;
}
$res = $chemin_navig.HTML_Liste::toHTML() ;
if ($this->getRowCount() == 1 && $this->_id_repertoire == '') {
return '<div>'.PROJET_PAS_DE_DOCUMENTS.'</div>'."\n";
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des répertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la légende des actions du module "documents"
*
* @return string
* @access public
*/
function affLegende( )
{
$res = "<h2 class=\"titre2_projet\">".PROJET_LEGENDE."</h2>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/cut.gif\" title=\"couper\" alt=\"couper\">".PROJET_LEGENDE_DEPLACE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/modif.png\" title=\"modifier\" alt=\"modifier\"> ".PROJET_LEGENDE_MODIFIE."</p>\n" ;
$res .= "<p><img src=\"".$this->_chemin_icone."/trash.gif\" title=\"supprimer\" alt=\"supprimer\"> ".PROJET_LEGENDE_SUPPR."</p>\n" ;
return $res ;
} // end of member function affLegende
 
 
/**
* Renvoie le chemin HTML, depuis le répertoire courant jusqu'à la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
} // end of member function _getCheminHTML
 
 
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est à dire couper, modifier, supprimer.
*
* @return string
* @access private
*/
function _actions($document)
{
$this->_url->addQueryString ('id_document', $document->getIdDocument()) ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["couper"]) ;
$couper = ' '.PROJET_FICHIER_COUPER ;
if (!$document->isRepertoire()) $couper = '<a href="'.$this->_url->getURL().'">'.$couper.'</a>' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["modifier"]) ;
$modifier = '<a href="'.$this->_url->getURL().'">'.PROJET_FICHIER_MODIFIER.'</a> ' ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, $this->_actions["supprimer"]) ;
$supprimer= '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm (\''.PROJET_FICHIER_SUPPRIMER.' ?\');">'.PROJET_FICHIER_SUPPRIMER.'</a>' ;
$this->_url->removeQueryString ('id_document') ;
$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
return $modifier.$supprimer.$couper ;
} // end of member function _action
 
 
} // end of HTML_listeDocuments
?>