Subversion Repositories Applications.projet

Compare Revisions

No changes between revisions

Ignore whitespace Rev 431 → Rev 433

/tags/v3.1-sardain/classes/liste_discussion.class.php
New file
0,0 → 1,288
<?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 portee, publique ou privee 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->_db->escapeSimple($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
 
 
function getVisibilite( )
{
return $this->_portee ;
} // 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=".$this->_db->escapeSimple($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->_db->escapeSimple($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/v3.1-sardain/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/v3.1-sardain/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=".$objetDB->escapeSimple($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/v3.1-sardain/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/v3.1-sardain/classes/projet_theme.class.php
New file
0,0 → 1,103
<?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$
/**
* Application projet
*
* La classe projet_theme
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision:$
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/**
* class projet_type
*
*/
class projet_theme
{
 
/*** 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 getTousLesThemes(& $objetDB )
{
$requete = 'select * from projet_theme' ;
return $objetDB->getAssoc ($requete) ;
}
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function projet_theme( & $objetDB )
{
$this->_db = $objetDB ;
}
 
 
/**
*
*
* @param DB objetDB Une instance de la classe PEAR::DB
* @return void
* @access public
*/
function getLabelType( $id_type)
{
$requete = 'select pt_label_theme from projet_theme where pt_id_theme='.$this->_db->escapeSimple($id_type) ;
$resultat = $this->_db->getOne($requete) ;
if (DB::isError($resultat)) {
echo $resultat->getMessage() ;
}
return $resultat ;
}
}
?>
/tags/v3.1-sardain/classes/HTML_listeDocuments.class.php
New file
0,0 → 1,402
<?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.9 2007-06-25 12:15:06 alexandre_tb 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.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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 repertoire 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 ;
/**
* le style d affichage
* @access private
*/
var $_mode_affichage ;
/**
*
*
* @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 ;
}
$this->_mode_affichage = 'standart';
} // 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 = '', $id_projet = '' )
{
$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') ;
}
 
/**
*
*
* @param Array tableau_label Un tableau a deux dimensions avec les labels a afficher dans le corps du
* tableau.
* @return void
* @access public
*/
function construitListe( &$tableau_document, $droits, $mode = '', $objetDB = '', $id_projet = '')
{
// mail('aurelien@tela-botanica.org','contenu de tableau documents', print_r($tableau_document,true));
if ($this->_mode_affichage == 'standart') {
$compteur = 0 ;$class[0] = 'ligne_impaire'; $class[1] = 'ligne_paire' ;
//var_dump ($tableau_document);
for ($i = 0; $i < count ($tableau_document) ; $i++) {
// Premiere condition : est-ce que le fichier a pour pere le repertoire 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 repertoire, on ajoute id_repertoire au lien.
if ($tableau_document[$i]->isRepertoire()) {
$this->_url->addQueryString ('id_repertoire', $tableau_document[$i]->getIdDocument()) ;
$lien = $this->_url->getURL() ;
} else { // Si c'est un fichier, on fait un lien direct
$this->_url->addQueryString('id_document', $tableau_document[$i]->getIdDocument());
$this->_url->addQueryString('service', 'telechargement');
$lien = $this->_url->getURL() ;
$this->_url->removeQueryString('service');
$this->_url->removeQueryString('id_document');
if($this->_url->querystring[PROJET_VARIABLE_ID_PROJET] == null) {
$identifiant_projet =$tableau_document[$i]->_id_projet ;
}
else
{
$identifiant_projet =$this->_url->querystring[PROJET_VARIABLE_ID_PROJET] ;
}
//$lien = 'http://'.$this->_url->host.'/projets/'.$this->_url->querystring[PROJET_VARIABLE_ID_PROJET].'/telechargement/'.$tableau_document[$i]->getIdDocument();
$lien = 'http://'.$this->_url->host.'/projets/'.$identifiant_projet.'/telechargement/'.$tableau_document[$i]->getIdDocument();
}
// pour eviter des effets de bords, on enleve id_repertoire de l'url
// dans le cas d'un repertoire, pour les fichiers on le laisse pour
// qu'apres une operation, on reste dans le repertoire ou a eu lieu l'operation
if ($tableau_document[$i]->isRepertoire()) $this->_url->removeQueryString('id_repertoire') ;
// on insere le lien
$lien_nom = '<a href="'.$lien.'">'.$icone.' '.$tableau_document[$i]->getNomLong()."</a>\n" ;
$taille = $tableau_document[$i]->getTailleFormatee();
// Recuperation 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 a donner en parametre a 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->_url->removeQueryString('id_document');
$this->updateColAttributes(0, array ('class' => 'col1')) ;
} else {
}
} // end of member function construitListe
 
/**
*
*
* @param Array actions Un tableau avec les valeurs d'actions comme cle. "couper", modifier",
* "supprimer".
* @return void
* @access public
*/
function setAction( $actions )
{
$this->_actions = $actions ;
}
 
/**
*
*
* @param string le mode, valeur possible standart ou ajax
* @return void
* @access public
*/
function setModeAffichage( $mode )
{
$this->_mode_affichage = $mode ;
}
 
/**
*
*
* @param string chemin Le chemin vers les icones couper, coller ...
* @return void
* @access public
*/
function setCheminIcones( $chemin )
{
$this->_chemin_icone = $chemin ;
}
 
/**
* Surcharge de l'operation de la classe mere. Ajoute la navigation dans les
* repertoires.
*
* @return string
* @access public
*/
function toHTML($id_projet = '', $droits)
{
if ($this->_mode_affichage == 'standart') {
$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++) {
$chemin_navig .= "&gt;&nbsp;" ;
$doc = new document ($this->_chemin_navigation[$i], $GLOBALS['projet_db']);
$nom = $doc->getNomLong() ;
$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";
}
} else {
GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');
GEN_stockerFichierScript('dojoScriptProjet', 'client/projet/js/arbreDocument.js');
$res = '' ;
$RCPUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php?id_projet='.$id_projet;
$this->_url->addQueryString(PROJET_VARIABLE_SERVICE, 'ecouteArbreFichier');
$RCPUrl = $this->_url->getURL();
// Le noeud racine
if ($droits <= PROJET_DROIT_CONTRIBUTEUR) {
$tree = '<div dojoType="Tree" DNDMode="between" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController" eventNames="moveTo:nodeRemoved">';
} else {
$tree = '<div dojoType="Tree" selector="treeSelector" DNDAcceptTypes="bandTree" widgetId="bandTree" controller="treeController">';
}
$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RCPUrl.'" widgetId="treeController" DNDController="create"></div>
<div dojoType="TreeSelector" widgetId="treeSelector"></div>'.$tree.
'<div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true"></div></div>';
}
return $res ;
} // end of member function toHTML
 
/**
*
*
* @param Array tableau_navigation Un tableau contenant les identifiants et les noms des repertoires. 0 => ["id"],
* ["nom"] etc.
* @return void
* @access public
*/
function setCheminNavigation( $tableau_navigation )
{
$this->_chemin_navigation = $tableau_navigation ;
} // end of member function setCheminNavigation
 
/**
* Affiche la legende 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 ;
}
 
 
/**
* Renvoie le chemin HTML, depuis le repertoire courant jusqu'a la racine.
*
* @return string
* @access private
*/
function _getCheminHTML( )
{
$path = "" ;
 
return $path ;
}
 
/**
* Renvoie une chaine contenant le code html des icones des actions possibles sur un
* fichier, c'est a 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 ;
$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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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='.$this->_db->escapeSimple($type_inscription).' where pil_id_utilisateur='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).
', pil_id_liste='.$this->_db->escapeSimple($liste->getId()).', pil_id_statut='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($utilisateur->getInfo('identifiant')).' and pil_id_liste='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/classes/projet.class.php
New file
0,0 → 1,986
<?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.12 2008-05-21 14:35:26 alexandre_tb 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.12 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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;
/**
* tableau contenant les themes associes au projet
*/
var $_themes = array();
/**
*
* 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
* premiere requete 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=".$this->_db->escapeSimple($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 proprietes
$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 recupere le nom du repertoire
$this->_nom_repertoire = $ligne->p_nom_repertoire ;
$this->_isModere = $ligne->p_modere;
$this->_avoirDocument = $ligne->p_avoir_document;
// on regarde si on a 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->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
if (!$resultat->numRows()) {
$this->_est_racine = true ;
} else {
$this->_est_racine = false ;
}
}
/** Recuperation des themes */
$requete_theme = 'select pat_id_theme, pt_label_theme from projet_avoir_theme, projet_theme'.
' where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).' and pat_id_theme=pt_id_theme';
$resultat_theme = $GLOBALS['projet_db']->query ($requete_theme);
if (DB::isError($resultat_theme)) {
return ("Echec de la requete : $requete_theme<br />".$resultat_theme->getMessage()) ;
}
if ($resultat_theme->numRows() != 0) {
while ($ligne_theme = $resultat_theme->fetchRow(DB_FETCHMODE_OBJECT)) {
$this->_themes[$ligne_theme->pat_id_theme] = $ligne_theme->pt_label_theme;
}
}
}
} // 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=".$dbObject->escapeSimple($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 eviter l'appel SQL si il a deja ete fait une fois
if (count($this->_listes_associes) > 0) return ;
$requete = "select pl_id_liste from projet_lien_liste where pl_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("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 a 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='.$this->_db->escapeSimple($val).' where p_id='.$this->_db->escapeSimple($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 associes sous forme d'un tableau, avec les
* informations afferentes. 0 => "nom (cliquable)"
"Taille"
"Date
* de creation" "Prorietaire" "Visibilite" "Action
* (cliquable)"
*
* @param visibilite visibilite Si visibilite est prive, tous les fichiers sont renvoyes ainsi qu'une entree
* pour indiquer la visibilite du document.
* @return Array
* @access public
*/
function getListesDocuments( $chemin, $chemin_icones = "icones/", $id_repertoire = '', $date = '' )
{
// On realise une requete sur projet_documents avec une jointure sur l'annuaire
// et sur gen_type_de_fichier pour envoyer un resultat complet.
// On exclue les fichiers racines cad pd_pere is null
$requete = "select pd_id from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet) ;
if ($id_repertoire != '') $requete .= ' and pd_pere='.$this->_db->escapeSimple($id_repertoire);
if ($id_repertoire != '' && $id_repertoire == 0) $requete .= ' and pd_pere=0';
if ($date != '') $requete .= ' and pd_date_de_mise_a_jour > date_sub (NOW(), interval 1 week)';
$requete .= ' order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("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, $i, $chemin, $chemin_icones)) ;
}
return $tableau_document ;
}
 
 
/**
* Renvoie un tableau avec tous les repertoires d'un projet, imbrique. ['rep1'],
* ['rep2'] => array (['rep21'], ['rep22']), etc .
*
* @return Array
* @access public
*/
function getListeRepertoireHierarchisee( )
{
// On ne prend que les repertoires
$requete = "select pd_id, pd_pere, pd_nom from projet_documents where pd_ce_projet=".$this->_db->escapeSimple($this->_id_projet).' and pd_ce_type=0 order by pd_nom' ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError($resultat)) {
return ("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));
}
*/
$tableau = array();
$tab = array();
 
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT)) {
array_push ($tableau, array ('id' => $ligne->pd_id,
'id_pere' => $ligne->pd_pere,
'fils' => array(),
'label' => $ligne->pd_nom));
 
}
// la $tableau reste un tableau de valeur a plat
$i = 0;
foreach ($tableau as $noeud) {
// On teste si le noeud est racine si oui on l ajoute a l arbre sinon on ne l ajoute pas
if ($noeud['id_pere'] == 0) {
$tab[$i] = $noeud;
$this->construireArbre($tab[$i], $tableau) ;
}
$i++;
}
return $tab;
} // end of member function getListeRepertoireHierarchisee
 
function construireArbre(&$noeud, $tableau) {
$j = 0;
foreach ($tableau as $element) {
// pour chaque element on teste
if ($element['id_pere'] == $noeud['id']) {
$noeud['fils'][$j]= $element ;
$this->construireArbre($noeud['fils'][$j],$tableau);
}
$j++;
}
}
 
/**
* Renvoie un tableau comprenant tous les objets projet de la base.
*
* @return Array
* @static
* @access public
*/
function getTousLesProjets(&$objetDB, $exclu = '')
{
$sql = '';
if (is_object($this) && isset ($this->_projet_exclu) && count($this->_projet_exclu)) {
$sql = 'where p_id not in (';
foreach ($this->_projet_exclu as $valeur) {
$sql .= $objetDB->escapeSimple($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= ".$objetDB->escapeSimple($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. Libere la memoire, 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
* elements lies.
*
* @return void
* @access public
*/
function supprimer( )
{
 
} // end of member function supprimer
 
/**
* Permet d'enregistrer une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* 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&eacute;e un r&eacute;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='.$this->_db->escapeSimple($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)) {
return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
 
// On affecte a l'objet projet son identifiant
$this->_id_projet = $id ;
 
//insertion dans projet_herarchie
if (PROJET_UTILISE_HIERARCHIE) {
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$id ;
$resultat = $this->_db->query ($requete) ;
}
/** enregistrement dans projet_avoir_theme */
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($id).', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
}
 
/**
* Permet de mettre a jour une ligne dans la table concernee.
*
* @param Array tableau_de_valeur Le tableau de valeur a inserer dans la base avec pour cle les noms des elements
* 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)) {
return ("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->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
//insertion dans projet_hierarchie
 
$requete = 'insert into projet_hierarchie set ph_id_projet_pere='.$this->_db->escapeSimple($tableau_de_valeur['projet_asso']).
', ph_id_projet_fils='.$this->_id_projet ;
$resultat = $this->_db->query ($requete) ;
}
/** enregistrement dans projet_avoir_theme */
$requete_suppression_theme = 'delete from projet_avoir_theme where pat_id_projet='.$this->_db->escapeSimple($this->_id_projet);
$resultat_suppression_theme = $GLOBALS['projet_db']->query($requete_suppression_theme);
$requete_theme = '';
foreach ($tableau_de_valeur['projet_theme'] as $cle => $valeur) {
$requete_theme = 'insert into projet_avoir_theme set pat_id_projet='.$this->_db->escapeSimple($this->_id_projet).', pat_id_theme='.$this->_db->escapeSimple($cle);
$resultat_theme = $GLOBALS['projet_db']->query($requete_theme);
if (DB::isError($resultat_theme)) {
return $resultat_theme->getMessage();
}
}
return true ;
} // end of member function enregistrerSQL
 
/**
* Met a jour dans la base de donnee 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)) {
return ('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 repertoire du projet
if (!$this->_suppression_repertoire()) {
$msg = 'La suppression du repertoire n\'a pas fonctionne' ;
}
// A ajouter la suppression des documents associes
 
// La suppression des evenements associ�s
 
// Le projet lui-meme
$requete = "delete from projet where p_id=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
 
if (PROJET_UTILISE_HIERARCHIE) {
$requete = "delete from projet_hierarchie where ph_id_projet_fils=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
}
$requete = "delete from projet_statut_utilisateurs where psu_id_projet=".$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
return $msg ;
} // end of member function suppressionSQL
 
/**
* Supprime le repertoire associe au projet (le repertoire doit etre vide).
*
* @return void
* @access private
*/
function _suppression_repertoire( )
{
return rmdir ($this->_chemin_repertoire.$this->_nom_repertoire) ;
} // end of member function _suppression_repertoire
 
/**
* Permet de creer le repertoire associe 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 ou seront stockes les fichiers.
*
* @param string cheminRepertoire Le chemin jusqu'au repertoire ou seront stockes les fichiers.
* @return void
* @access public
*/
function setCheminRepertoire( $cheminRepertoire )
{
$this->_chemin_repertoire = $cheminRepertoire ;
} // end of member function setCheminRepertoire
 
/**
* Genere un nom de repertoire a partir de la premiere lettre de la chaine passe en
* parametre et de l'identifiant du dernier projet.
*
* @param string chaine Une chaine a partir de laquelle sera generer le nom du repertoire.
* @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)) {
return ("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 recuperer le nom du repertoire d'un projet.
*
* @return string
* @access public
*/
function getNomRepertoire( )
{
return $this->_nom_repertoire ;
} // end of member function getNomRepertoire
 
/**
* Ajoute une liste a 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=".$this->_db->escapeSimple($liste->getId()).
', pl_id_projet='.$this->_db->escapeSimple($this->_id_projet) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
}
}
 
/**
* Supprime la liste de discussion associee au projet
*
* @return void
* @access public
*/
function supprimerListe(&$liste)
{
$requete = 'delete from projet_lien_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
$requete = 'delete from projet_liste where pl_id_liste='.$this->_db->escapeSimple($liste->getId()) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
}
}
 
 
/**
* 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->_db->escapeSimple($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->_db->escapeSimple($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->_db->escapeSimple($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 associe au projet.
*
* @return string
* @access public
*/
function getWikini( )
{
return $this->_nom_wikini ;
} // end of member function getWikini
 
/**
* Renvoie le type du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getType( )
{
return $this->_type ;
} // end of member function getType
 
/**
* Renvoie les themes du projet, ou zero si le projet n'a pas de type.
*
* @return int
* @access public
*/
function getThemes( )
{
return $this->_themes ;
} // end of member function getType
 
/**
* Renvoie 1 si les inscriptions au projet sont moderees.
*
* @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/v3.1-sardain/classes/enteteColonneTriable.class.php
New file
0,0 → 1,259
<?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$
/**
* Application projet
*
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
// +------------------------------------------------------------------------------------------------------+
*/
 
 
 
/**
* class enteteColonneTriable
*/
class enteteColonneTriable
{
 
 
/*** Attributes: ***/
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $colonne;
 
/**
* Nom de la colonne dont on veut afficher le lien
* @access private
*/
private $var_colonneDeTri;
 
/**
* Nom de la colonne clique par l utilisateur
* @access private
*/
private $colonneCliquee;
 
/**
* @access private
*/
private $ordre = 'asc';
 
/**
* @access private
*/
private $var_ordre ;
/**
* @access private
*/
private $icone_asc;
 
/**
* @access private
*/
private $icone_desc;
 
/**
* icone par defaut lorsqu aucun tri n est demande
* @access private
*/
private $icone_base;
 
 
/**
*
* @param string nom_colonne Le nom de la colonne sur laquelle va s'effectuer les tris
 
* @return
* @access public
*/
public function enteteColonneTriable( $nom_colonne ) {
$this->colonne = $nom_colonne;
} // end of member function enteteColonneTriable
 
/**
*
* @param string colonneDeTri
* @return bool
* @access public
*/
public function setColonneCliquee( $colonneDeTri, $var_colonneDeTri ) {
$this->colonneCliquee = $colonneDeTri;
$this->var_colonneDeTri = $var_colonneDeTri;
} // end of member function setColonneCliquee
 
/**
* Precise l ordre ascendant ou descendant
* Ne peut prendre que 2 valeurs asc ou desc
*
* @param string ordre
* @return
* @access public
*/
public function setOrdre( $ordre, $var_ordre ) {
if ($ordre != 'asc' && $ordre != 'desc') return false;
//if ($this->colonne == $this->colonneCliquee) $this->ordre = $ordre;
// C subtil, il faut inverser l ordre de tri pour la colonne dont le tri est
// actif, afin de pouvoir inverser le tri
$this->ordre = $ordre;
if ($this->colonne == $this->colonneCliquee) {
if ($ordre == 'asc') $this->ordre = 'desc'; else $this->ordre = 'asc';
}
$this->var_ordre = $var_ordre;
} // end of member function setOrdre
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Le chemin vers l icone
 
* @return
* @access public
*/
public function setIconeAsc( $chemin_icone ) {
$this->icone_asc = $chemin_icone;
} // end of member function setIconeAsc
 
/**
* Pour indiquer le chemin vers l icone de fleche vers le bas
* Renvoie false si le chemin vers l icone n existe pas
*
* @param string chemin_icone Chemin vers l icone indiquant un classement descendant, en general une fleche
vers le haut
 
* @return bool
* @access public
*/
public function setIconeDesc( $chemin_icone ) {
$this->icone_desc = $chemin_icone;
} // end of member function setIconeDesc
 
/**
*
* @param string chemin_icone chemin vers un fichier
 
* @return bool
* @access public
*/
public function setIconeSansTri( $chemin_icone ) {
$this->icone_base = $chemin_icone;
} // end of member function setIconeSansTri
 
/**
* Permet d attribuer un template d affichage
*
* @param string template Permet d attribuer un template d affichage
 
* @return
* @access public
*/
public function setTemplate( $template ) {
} // end of member function setTemplate
 
/**
* Renvoie l icone approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getIcone( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return $this->icone_asc;
} else {
return $this->icone_desc;
}
} else {
return $this->icone_base;
}
} // end of member function getIcone
 
/**
* Renvoie la classe approprie pour l entete de la colonne
*
* @return string
* @access public
*/
public function getClasse( ) {
if ($this->colonne == $this->colonneCliquee) {
if ($this->ordre == 'asc') {
return 'tri_bas';
} else {
return 'tri_haut';
}
} else {
return 'tri_sans';
}
} // end of member function getIcone
/**
* Renvoie le lien de la colonne
*
* @return string
* @access public
*/
public function getLien($url) {
$url->addQueryString('projet_tri', $this->colonne);
$url->addQueryString('projet_ordre_tri', $this->ordre);
return $url->getURL();
} // end of member function getLien
 
/**
* Renvoie l entete
*
* @return string
* @access public
*/
public function getEntete( ) {
} // end of member function getEntete
 
/**
* similaire a getEntete()
*
* @return string
* @access public
*/
public function toHTML( ) {
return getEntete();
} // end of member function toHTML
 
 
 
 
 
} // end of enteteColonneTriable
?>
/tags/v3.1-sardain/classes/fichier.class.php
New file
0,0 → 1,293
<?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.7 2007-06-25 12:15:06 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.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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']) ;
}
// 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 (rename ($origine, $destination )) 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/v3.1-sardain/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='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($id_liste).', plle_id_projet='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($id_liste) ;
$resultat = $this->_db->query ($requete) ;
if (DB::isError ($resultat)) {
return ('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/v3.1-sardain/classes/document.class.php
New file
0,0 → 1,675
<?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.9 2008-08-25 15:18:10 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.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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 ;
var $nom_fichier ;
/**
*
*
* @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 = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$this->_chemin_icone = $chemin_icones ;
if ($id_document != "") {
$requete = "select * from projet_documents where pd_id=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_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) {
$this->nom_fichier = $ligne->pd_lien;
$this->_id_projet = $ligne->pd_ce_projet;
$this->_id = $ligne->pd_id ;
fichier::fichier($chemin.$this->getChemin(), $GLOBALS['projet_db']) ;
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 {
if (is_object ($this->_type_mime)) 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=".$GLOBALS['projet_db']->escapeSimple($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=".$GLOBALS['projet_db']->escapeSimple($id_document) ;
$resultat = $GLOBALS['projet_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($prefixe = '')
{
$chemin_repertoire_entre_racine_et_fichier = '';
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
// l arborescence des repertoires
$tableau_navigation = $this->getPath($this->_id) ;
if (is_array ($tableau_navigation))$tableau_navigation = array_reverse($tableau_navigation);
for ($i = 0; $i < count ($tableau_navigation); $i++) {
$chemin_repertoire_entre_racine_et_fichier.= $tableau_navigation[$i]."/";
}
return $projet->getNomRepertoire().'/'.$chemin_repertoire_entre_racine_et_fichier.$this->nom_fichier ;
}
 
 
/**
* Renvoie pour le repertoire ou le fichier 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_doc, &$objetDB )
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$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) {
return array ($ligne->pd_id);
}
array_push ($chemin_rep_id_nom, $ligne->pd_id) ;
$tab = document::getCheminIdRepertoire($ligne->pd_pere, $objetDB) ;
$chemin_rep_id_nom = array_merge ($tab, $chemin_rep_id_nom) ;
}
return ($chemin_rep_id_nom);
}
function getPath( $id_doc)
{
if ($id_doc == "") $id_doc = 0;
// on commence par rechercher le répertoire père, dans la base de donnée
$requete = 'select pd_pere, pd_nom, pd_id, pd_ce_type from projet_documents where pd_id='.$GLOBALS['projet_db']->escapeSimple($id_doc) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
return ("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 && $ligne->pd_pere != 0 && $ligne->pd_pere != $ligne->pd_id) {
array_push ($chemin_rep_id_nom, $ligne->pd_pere) ;
// Récursion sur le répertoires ou fichiers fils
$chemin_rep_id_nom = array_merge ($chemin_rep_id_nom, document::getPath($ligne->pd_pere) );
}
return $chemin_rep_id_nom;
}
/**
* 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) {
 
if (isset($_FILES['fichier']['name'])) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $_FILES['fichier']['name']) ;
}
 
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 = '' ;
$doc_pere = new document ($this->_id_pere, $GLOBALS['projet_db']);
return $doc_pere->getChemin();
$tableau_navigation = $this->getPath($this->_id_pere) ;
for ($i = 0; $i < count ($tableau_navigation); $i++) $chemin_repertoire_entre_racine_et_repertoire_a_cree.= $tableau_navigation[$i]."/";
$chemin = $chemin_repertoire_entre_racine_et_repertoire_a_cree ;
} else {
// Si l'on est à la racine du projet, le chemin vide
return $radical ;
}
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) ;
$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, $GLOBALS['projet_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($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
$pd_lien = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id')."/" ;
}
$id = SQL_obtenirNouveauId($GLOBALS['projet_db'], 'projet_documents', 'pd_id') ;
 
$requete = "insert into projet_documents set pd_id=".$GLOBALS['projet_db']->escapeSimple($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 = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
}
$this->_id = $id ;
return $pd_lien;
}
 
function genereNouveauNom ($radical, $ancien_nom, $id) {
$extension = preg_replace("/^([^\.]+)\.(\w+$)/", "\\2", $ancien_nom) ;
$nouveau_nom = $radical."_".$id.".".$extension ;
return $nouveau_nom;
}
 
/**
* 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=".$GLOBALS['projet_db']->escapeSimple($this->_id);
 
$resultat = $GLOBALS['projet_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='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if ($GLOBALS['projet_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, $GLOBALS['projet_db']) ;
$chemin_rep_cible = $repertoire_cible->getChemin();
} else {
// Si le repertoire destination est la racine cad id =0
// on cree un document qui aura pour chemin le repertoire du projet
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
$projet = new projet ($GLOBALS['projet_db'], $this->_id_projet);
$chemin_rep_cible = $projet->getNomRepertoire().'/';
}
$nom_fichier = $this->_pd_lien ;
$requete = 'update projet_documents set pd_pere='.$GLOBALS['projet_db']->escapeSimple($repertoire_destination).' where pd_id='.$GLOBALS['projet_db']->escapeSimple($this->_id) ;
$resultat = $GLOBALS['projet_db']->query ($requete) ;
if (DB::isError($resultat)) {
echo ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
return false ;
}
//echo $this->_chemin.'<br>'.PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$nom_fichier;
return fichier::deplace ($this->_chemin, PROJET_CHEMIN_FICHIER.$chemin_rep_cible.$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
*/
static 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='.$GLOBALS['projet_db']->escapeSimple($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='.$GLOBALS['projet_db']->escapeSimple($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;
}
/**
* Renvoie une liste de document, enfant du document courant
* qui doit etre un repertoire bien sur
*
* @return mixed un tableau de document
* @access public
*/
function getDocumentsEnfant() {
}
} // end of document
 
 
?>
/tags/v3.1-sardain/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
include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php';
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
?>
/tags/v3.1-sardain/classes/HTML_listeParticipants.class.php
New file
0,0 → 1,216
<?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.4 2007-06-25 12:15:06 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.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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 = '', &$projet )
{
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
if (count ($elements)>5) $inscrit_liste = (int) array_pop ($elements[$i]);
$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) ;
$supprimer = '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER.' ?\')">'.PROJET_SUPPRIMER.'</a>';
if (count ($elements) > 5) array_push ($elements[$i], '');
array_push ($elements[$i], '', $supprimer);
$this->_url->removeQueryString('statut') ;
}
// La colonne avec l inscription a la liste de discussion
$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) ;
// Colonne avec l inscription a la liste de discussion
if (count ($elements)>5) {
$this->_url->addQueryString ('id_utilisateur', $id_utilisateur) ;
$select = '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
$select .= '<select name="inscription_liste" onchange="javascript:this.form.submit();">' ;
$select .= '<option value="0">Non inscrit</option>';
$select .= '<option value="1"'.($inscrit_liste ? ' selected="selected"': '').'>Inscrit</option>';
$select .= '</select>'."\n".'</form>'."\n" ;
$this->setCellContents($i+1, 5, $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/v3.1-sardain/classes/gestion_wikini05.class.php
New file
0,0 → 1,207
<?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 )
{
 
$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(
'CREATE TABLE `' .$prefixe. 'triples` (' .
' `id` int(10) unsigned NOT NULL auto_increment,' .
' `resource` varchar(255) NOT NULL default \'\',' .
' `property` varchar(255) NOT NULL default \'\',' .
' `value` text NOT NULL default \'\',' .
' PRIMARY KEY (`id`),' .
' KEY `resource` (`resource`),' .
' KEY `property` (`property`)' .
') TYPE=MyISAM');
 
// que fait on pour le compte admin ?
// c'est moche alors on l'externalisera dans une variable de conf
$this->_db->query(
"insert into ".$prefixe."users set ".
"signuptime = now(), ".
"name = '".mysql_escape_string('AdminWiki')."', ".
"email = '".mysql_escape_string('accueil@tela-botanica.org')."', ".
"password = md5('".mysql_escape_string('wqa&WQA1')."')");
 
$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/v3.1-sardain/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/v3.1-sardain/classes/ezmlmAccessObject.class.php
New file
0,0 → 1,355
<?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 regi par la licence CeCILL soumise au droit francais 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 diffusee par le CEA, le CNRS et l'INRIA
// sur le site "http://www.cecill.info".
 
// En contrepartie de l'accessibilite au code source et des droits de copie,
// de modification et de redistribution accordes par cette licence, il n'est
// offert aux utilisateurs qu'une garantie limitee. Pour les memes raisons,
// seule une responsabilite restreinte pese sur l'auteur du programme, le
// titulaire des droits patrimoniaux et les concedants successifs.
 
// A cet egard l'attention de l'utilisateur est attiree sur les risques
// associes au chargement, a l'utilisation, a la modification et/ou au
// developpement et a la reproduction du logiciel par l'utilisateur etant
// donne sa specificite de logiciel libre, qui peut le rendre complexe a
// manipuler et qui le reserve donc a des developpeurs et des professionnels
// avertis possedant des connaissances informatiques approfondies. Les
// utilisateurs sont donc invites a charger et tester l'adequation du
// logiciel a leurs besoins dans des conditions permettant d'assurer la
// securite de leurs systemes et ou de leurs donnees et, plus generalement,
// a l'utiliser et l'exploiter dans les memes conditions de securite.
 
// Le fait que vous puissiez acceder a cet en-tete signifie que vous avez
// pris connaissance de la licence CeCILL, et que vous en avez accepte les
// termes.
// ----
// CVS : $Id: ezmlmAccessObject.class.php,v 1.5 2007-06-25 12:15:06 alexandre_tb 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.5 $
// +------------------------------------------------------------------------------------------------------+
*/
 
/** 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',
'liste_abonnes',
'nombre_messages');
/**
* l'action selectionnee
*/
var $action ;
/**
* La langue 'fr-FR'
*/
var $langue ;
/**
* L'url de base
*/
var $url ;
/**
* L'identifiant du repertoire
*/
var $identifiant_repertoire ;
/**
* Identifiant message
*/
var $identifiant_message;
 
/**
* L'identifiant du repertoire
*/
var $_numeroRepertoireSuivant ;
/**
* L'identifiant du repertoire
*/
var $hash_auteur ;
/**
* Le mois a afficher
*/
var $mois ;
var $_numeraRepertoirePrecedent;
/**
* Identifiant message
*/
var $_numeroFichierSuivant;
var $_numeroFichierPrecedent;
var $chemin_fichier_xml;
/**
* Creation de l'objet d'acces
*
*/
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 methode specifie les balises reconnus par ezmlmAccessObject
* Elle remplace la methode handleElement de XML_Parser_Simple
*
* @access public
* @param string nom de l'element (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 ; }
function handleElement_ezmlm_liste_abonnes ($name, $attribs, $data) { echo $data ; }
function handleElement_ezmlm_nombre_messages ($name, $attribs, $data) { echo $data ; }
/**
* Choix de l'action
*
* Liste des actions :
* 'calendrier_messages'
*
* @access public
* @param string une action qui doit etre support�
*/
function setAction($action) {
// verification 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();
// On vide l url
//$this->url = '';
$this->chemin_fichier_xml = '';
// 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) ;
}
/**
* Precise un message a extraire
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param integer le numero du repertoire
* @param integer le numero du message
*
*/
function setIdMessage ($identifiant_repertoire, $identifiant_message) {
$this->identifiant_repertoire = $identifiant_repertoire ;
$this->identifiant_message = $identifiant_message ;
}
/**
* Precise un auteur
*
* On indique le numero de repertoire ezmlm et le numero du message
* @param string le hash d'un auteur
*
*/
function setHashAuteur ($hash_auteur) {
$this->hash_auteur = $hash_auteur;
}
/**
* Precise un mois
*
* On indique le numero de repertoire 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 getNumeroMessage () { return $this->_numeroMessage ; }
function getNombreTotalMessage () { return $this->_nombreTotalMessage ; }
function parse()
{
if (substr(phpversion(), 0, 1) == '5') {
try {
$xml = new SimpleXMLElement($this->chemin_fichier_xml, null, true);
switch ($this->action) {
case 'calendrier_messages' :echo utf8_decode($xml);
trigger_error ($this->chemin_fichier_xml);
echo utf8_decode($xml->ezmlm_calendrier_messages);
break;
case 'message':
echo utf8_decode ($xml);
$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'];
$this->_numeroMessage = $xml->numero;
$this->_nombreTotalMessage = $xml->numero['total_message'];
break;
case 'nombre_messages':
echo $xml[0];
break;
case 'liste_abonnes':
return $xml;
break;
default :
echo utf8_decode($xml);
}
$error = 'Erreur dans l\'acc&egrave;s au fichier:<br />'.$this->chemin_fichier_xml.'<br />';
$error = '';
throw new Exception($error);
}
catch (Exception $e) {
echo $e->getMessage().'<br />';
//echo $this->chemin_fichier_xml;
}
} else {
return parent::parse();
}
}
}
 
?>
/tags/v3.1-sardain/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/v3.1-sardain/classes/projetTemplate.class.php
New file
0,0 → 1,89
<?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.3 2008-08-25 15:04:38 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.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'PEAR.php' ;
 
/** Constante des templates */
// Pour le coordinateur dans la cas de projets moderes
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET', 1);
define ('PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS', 2);
 
// Pour le coordinateur lors d une nouvelle inscription (projets non moderes)
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_SUJET', 3);
define ('PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_CORPS', 4);
 
// pour le coodinateur lors des desinscription
define ('PROJET_TEMPLATE_DESINSCRIPTION_SUJET', 5);
define ('PROJET_TEMPLATE_DESINSCRIPTION_CORPS', 6);
 
// Pour le coordinateur lors du depot d un nouveau document
define ('PROJET_TEMPLATE_NOUVEAU_DOC_SUJET', 7);
define ('PROJET_TEMPLATE_NOUVEAU_DOC_CORPS', 8);
 
// Pour les administrateur lorsque le dernier coordinateur
// d un projet se desinscrit
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET', 9);
define ('PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS', 10);
 
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='.$this->_db->escapeSimple($id_template).
' and pt_i18n like "'.$lang.'%"' ;
if ($argument != 0) $requete .= ' and pt_argument='.$this->_db->escapeSimple($argument) ;
$resultat = $GLOBALS['projet_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/v3.1-sardain/classes/HTML_formulaireInscriptionProjet.class.php
New file
0,0 → 1,115
<?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.3 2007-11-21 09:42:50 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.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/radio.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.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/v3.1-sardain/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/v3.1-sardain/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='.$this->_db->escapeSimple($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/v3.1-sardain/classes/HTML_formulaireCouperColler.class.php
New file
0,0 → 1,134
<?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 |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'HTML/QuickForm.php' ;
 
/**
* 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 $valeur) {
if ($valeur['id_pere'] ==0) {
$this->addElement ('radio', 'projet_repertoire', '', $valeur['label'], $valeur['id']) ;
if (count ($valeur['fils'])) $this->construireArbreRadio ($valeur['fils']);
}
}
$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 construireArbreRadio(&$noeud) {
foreach ($noeud as $val) {
$this->addElement('html', '<ul>') ;
$this->construitLigneRepertoire($val) ;
if (count($val['fils'])) $this->construireArbreRadio ($val['fils']) ;
$this->addElement('html', '</ul>') ;
}
}
/**
*
*
*
*
*/
function construitLigneRepertoire($noeud) {
$this->addElement('html', '<ul>') ;
$this->addElement('radio', 'projet_repertoire', '', $noeud['label'], $noeud['id']) ;
$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 ;
}
}
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php
New file
0,0 → 1,400
<?php
// $Id: ezmlm-msgdisplay.php,v 1.9 2008-05-23 10:18:37 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_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 a 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 delimiteur de l'expression reguliere
$relfile = preg_replace('!' . $this->listdir . '!', '', $msgfile);
$a1 = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); // $a1 contient le nom du repertoire
$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;
// On recupere le numero du dernier message
if (file_exists($this->listdir.'/archnum')) {
$numero_dernier_message = file_get_contents($this->listdir.'/archnum');
}
// 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 212
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�tes
* 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();
if ($num_part != '') 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);
} else if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == 'quoted-printable') {
if ($mailDecode->parts[$i]->ctype_parameters['charset'] == 'UTF-8') {
$corps .= utf8_decode($mailDecode->parts[$i]->body);
}
}
break;
case 'html' : $corps .= trim(strip_tags ($mailDecode->parts[$i]->body, '<br><p><a><style>'));
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);
$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( $mailDecode->parts[$i]->ctype_primary.'/'.
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ;
}
$lien = PROJET_CHEMIN_APPLI.'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++) $lien .= '&actionargs[]='.$profondeur[$j];
}
$lien .= '&actionargs[]='.$i ;
$corps .= '<a href="'.$lien.'">';
$tableau_type_image = array ('jpg', 'jpeg', 'pjpeg');
if (in_array ($mailDecode->parts[$i]->ctype_secondary, $tableau_type_image)) {
$corps .= '<img src="'.$lien.'&amp;min=1" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$texte_lien = '';
} else {
$corps .= '<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" />&nbsp;' ;
$texte_lien = $nom_piece_jointe;
}
$corps .= $texte_lien;
$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( $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ;
if ($mimeType->getIdType() != 12) {
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'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);
}
}
}
array_pop ($profondeur);
}
 
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>' ;
}
// _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;
$out = '';
$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;
}
 
}
/tags/v3.1-sardain/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�tes
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/v3.1-sardain/classes/ezmlm-php-2.0/TODO
New file
0,0 → 1,5
Things left TODO...
 
- Implement unique titles for each page
- Better default header/footer
- Fix bugs as they appear
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v3.1-sardain/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);
$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( $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( $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/v3.1-sardain/classes/ezmlm-php-2.0/ezmlm-langue-fr.php
New file
0,0 → 1,5
<?php
 
define ('FIL_DE_DISCUSSION', 'Fil de discussion') ;
 
?>
/tags/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php
New file
0,0 → 1,101
<?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: messages_mois.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
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 ;
 
 
 
/** Calcul du cache */
 
require_once('Cache/Lite.php');
 
// Set a id for this cache
$id = 'cachemonth_'.$domaine.'_'.$liste.'_'.$actionargs[0];
 
// Set a few options
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 360000
);
 
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
 
if ($xml = $Cache_Lite->get($id)) {
} else {
include_once 'XML/Util.php' ;
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
$html = $info->show_month($actionargs[0]);
if (!$html) {
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ \'Les fichiers de la liste ne sont pas visibles sur le serveur\']]>';
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
} else {
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[ '.$html.']]>';
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ;
$Cache_Lite->save($xml);
}
}
header ('Content-type: text/xml');
echo $xml ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: messages_mois.php,v $
* Revision 1.4 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.3 2008-08-25 15:24:09 alexandre_tb
* ajout de la gestion du cache
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php
New file
0,0 → 1,74
<?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: messages_thread.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $
/**
* Application projet
*
* Renvoie les messages d un thread
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
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' ;
$html = $info->load($actionargs[0]) ;
if (!$html) {
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
}
 
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 ;
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: messages_thread.php,v $
* Revision 1.4 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.3 2008-08-26 09:26:41 alexandre_tb
* ajout commentaire
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/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/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php
New file
0,0 → 1,90
<?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 $
/**
* Application projet
*
* Action forums
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/
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 ;
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
if (!file_exists($info->listdir.'/num')) {
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
 
$html = $info->show_recentmsgs() ;
 
if (!$html) {
if (!$info) {
echo 'Les fichiers de la liste ne sont pas visibles sur le serveur' ;
exit();
}
}
 
$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 ;
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: derniers_messages.php,v $
* Revision 1.5 2008-11-04 17:11:10 aperonnet
* correction de bugs dans la liste des derniers messages
*
* Revision 1.4 2008-08-25 15:25:09 alexandre_tb
* optimisation et gestion des erreurs
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/est_abonne.php
New file
0,0 → 1,65
<?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: est_abonne.php,v 1.1 2008-10-27 16:45:25 aperonnet Exp $
/**
* Application projet
*
* Renvoie une balise xml contenant 1 si l'utilisateur est abonné à une liste de discussion donnée, 0 sinon
*
*@package projet
//Auteur original :
*@author Aurelien Peronnet <aurelien@tela-botanica.org>
*@copyright Tela-Botanica 2000-2008
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
 
// Les 2 parametres doivent etres present
 
if (!isset($_GET['domaine']) || !isset($_GET['liste'])) {
$xml .= XML_Util::createTag('erreur', 'Vous devez sp&eacute;cifier un domaine et une liste');
} else {
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
exec ('ezmlm-list '.$repertoire, $output, $ret) ;
$xml .= XML_Util::createStartElement ('ezmlm_est_abonne') ;
if(in_array($mail,$output) >= 1) {
$xml .= '1' ;
}
else {
$xml .= '0' ;
}
$xml .= XML_Util::createEndElement('ezmlm_est_abonne') ;
header ('Content-type: text/xml');
echo $xml ;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
 
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/forumRSS.php
New file
0,0 → 1,54
<?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 Lesser 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser 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: forumRSS.php,v 1.2 2008-08-26 09:23:33 alexandre_tb Exp $
/**
* Générateur de flux RSS à partir d'une liste
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
*
*@copyright Tela-Botanica 2000-2004
*@version $$
// +------------------------------------------------------------------------------------------------------+
*/
 
include_once 'ezmlm-php-2.0/ezmlm-xml.php' ;
 
// test des variables
 
if (!isset($domaine) || !isset($liste)) {
exit() ;
}
 
$list = new ezmlm_xml() ;
$list->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
header('Content-type: text/xml') ;
$list->show_rss() ;
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/message.php
New file
0,0 → 1,50
<?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') ;
 
if (!$html) {
$xml .= XML_Util::createStartElement ('ezmlm_erreur') ;
$xml .= 'Le message n\'existe pas';
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
header ('Content-type: text/xml');
echo $xml;
exit();
}
 
 
 
$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/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/.htaccess
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/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/v3.1-sardain/classes/ezmlm-php-2.0/services_vpopmail/clical.php
New file
0,0 → 1,68
<?php
/**
* @author Raphaël Droz <raphael@tela-botanica.org>
* @copyright 2013, Tela-Botanica
* @license GPL v3
* @license CECILL v2
*/
 
// eg: php clical.php amorphophallus_et_araceae|html2text
if (PHP_SAPI !== 'cli') die;
 
// for standalone use
// WARNING: this uses cache !
// php-cli user could have != permission than a webserver
// then cache file created could become inaccessible to webserver
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE ^ E_DEPRECATED);
date_default_timezone_set('Europe/Paris');
 
$path = '/home/vpopmail/domains';
$domaine = 'tela-botanica.org';
 
/*
List (ezmlm_threads::listmessages()), /calendrier_messages.php,
Recent (ezmlm_listinfo::show_recentmsgs()), /derniers_messages.php?domaine=&liste=
Month (ezmlm_listinfo::show_month(X)), /messages_mois.php?domaine=&liste=&actionargs[]=201306
month/Thread (ezmlm_listinfo::show_month(X)), /messages_thread.php?domaine=&liste=&actionargs[]=201306
XXX: Show (ezmlm_msgdisplay::display(X)), /message.php?domaine=&liste=&action=show_msg&actionargs[]=18&actionargs[]=09
 
-p: path
-d: domaine
*/
$options = getopt("LRMTp:d:");
if(isset($options['p'])) $path = $options['p'];
if(isset($options['d'])) $domaine = $options['d'];
$liste = array_slice($argv, -1)[0];
 
if(!$liste || !$domaine || !$path) die;
 
include_once 'ezmlm-php-2.0/ezmlm.php' ;
 
// Parametrage de la liste
if(array_key_exists('R', $options) || array_key_exists('M', $options)) {
$info = new ezmlm_listinfo();
} else { // cal & show threads
$info = new ezmlm_threads();
}
 
 
if (!$info) die('Les fichiers de la liste ne sont pas visible sur le serveur');
 
$info->forcehref = $url;
$info->listdir = $path . '/' . $domaine . '/' . $liste ;
$info->listname = $liste;
$info->listdomain = $domaine ;
 
if(array_key_exists('R', $options)) {
echo $info->show_recentmsgs();
}
elseif(array_key_exists('M', $options)) {
echo $info->show_month("201307");
}
elseif(array_key_exists('T', $options)) {
$info->tempdir = '/tmp' ; echo $info->load("201306");
}
else {
echo $info->listmessages(); // ezmlm_threads
}
/tags/v3.1-sardain/classes/ezmlm-php-2.0/ezmlm-errors.def
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/v3.1-sardain/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/v3.1-sardain/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-
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/tags/v3.1-sardain/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/v3.1-sardain/classes/ezmlm-php-2.0/ezmlm-listinfo.php
New file
0,0 → 1,197
<?php
// $Id: ezmlm-listinfo.php,v 1.5 2008-11-04 17:11:10 aperonnet 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;
$html = '' ;
$parser = new ezmlm_parser();
$parser->listdir = $this->listdir ;
$html .= '<table class="table_cadre">'."\n";
$html .= '<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)) {
$html .= '<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, -2) ;
} else {
if ($key < 10) {
$fichier_message = '0'.$key;
} else {
$fichier_message = $decimal;
}
$repertoire_message = '0';
}
$html .= '<td>'.$key.'</td>' ;
$html .= '<td>';
 
$from = $val[4];
 
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs = preg_split("/\//", $val->msgfile);
$html .= $this->makelink("action=show_msg&actionargs[]=".$repertoire_message.
"&actionargs[]=".$fichier_message ,$this->decode_iso($val[1]));
 
$html .= "</b></td>\n";
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
$html .= '<td>'.$val[2].'</td>'."\n";
$html .= "</tr>\n";
 
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
$html .= '</table>'."\n";
return $html;
}
function show_month ($month) {
// Le nom du fichier est ann�emoi ex 200501 pour janvier 2005
// le html est vide au début
$html = '' ;
// on ouvre chaque fichier en lecture
if(!file_exists($this->listdir . '/archive/threads/' . $month)) {
return false ;
}
$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;
}
$html .= '<table class="table_cadre">'."\n";
$html .= '<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;
}
$html .= '<tr class="'.$class[$ctc].'">'."\n";
$html .= '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
$hash = $this->makehash($mailDecode->headers['from']);
$html .= $this->makelink("action=show_author_msgs&actionargs[]=".
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
$html .= "</td>\n";
$html .= '<td><b>';
$actionargs[0] = $repertoire_premier_mail ;
$actionargs[1] = $num_message ;
if (count ($actionargs) > 1) {
$html .= $this->makelink("action=show_msg&actionargs[]=".
$actionargs[(count($actionargs) - 2)] .
"&actionargs[]=".
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
}
$html .= "</b></td>\n";
$html .= '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
$html .= "</tr>\n";
$ctc++;
if ($ctc == 2) { $ctc = 0; }
}
}
$html .= '</table>'."\n";
return $html;
}
}
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0/makehash
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/v3.1-sardain/classes/ezmlm-php-2.0/makehash
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/v3.1-sardain/classes/ezmlm-php-2.0/MSGTEMPLATE
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/v3.1-sardain/classes/ezmlm-php-2.0/MSGTEMPLATE
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/v3.1-sardain/classes/ezmlm-php-2.0/ezmlm-threads.php
New file
0,0 → 1,464
<?php
// $Id: ezmlm-threads.php,v 1.6 2008-08-25 15:19:15 alexandre_tb 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);
}
}
$html = $this->display($month);
return $html ;
}
 
// 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) {
$html = '' ;
$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
$html .= '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
// remplac� par le tableau globals $mois dans ezmlm.php
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n";
$html .= '<table class="table_cadre">'."\n";
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n";
$ctc .= 0;
 
if (is_file($cache)) {
include($cache);
}
$html .= '<tr><td colspan="3"></td></tr>'."\n";
$html .= '</table>'."\n";
return $html ;
}
 
 
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 repetoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// Presentes comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont ranges par leur numero
function listmessages() {
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
$res .= $this->calendrierMessage();
$res .= "</table>\n";
return $res;
/*
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
$tableau_annee = array();
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]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
fclose ($fichier_index);
}
}
if (count($threadcount) == 0) return 'Il n\y a pas de messages dans les archives';
// La partie qui suit, simple, cree la table avec le nombre de message echange chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
$res .= " <td></td>" ;
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
$res .=" </tr>\n";
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
$res .= "</table>\n";
return $res ;
*/
}
/*
* Cree un fichier liste.calendrierPermanent qui contient
* le nombre de message par mois pour toutes les annees
* depuis le debut de la liste sauf la derniere
*
*/
function calculeCalendrierPermanent($Annnee = '') {
$numArchive = $this->getNumArchive();
$dernierRepertoire = floor($numArchive / 100);
$threadcount = array();
$tableau_annee = array();
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
 
// On parcours le fichier a l envers
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $fichier_index[$j], $match) ;
if ($match[0] != '') {
$threadmonth = date('n', strtotime($match[0])) ;
$threadyear = date('Y', strtotime($match[0])) ;
if ($Annnee != '') {
if ($threadyear < date('Y')) {
$sortir = true;
break;
}
} else {
if ($threadyear == date('Y')) continue;
}
$threadcount[$threadyear][$threadmonth]++;
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
}
}
if ($sortir) break;
}
$res = '';
arsort($tableau_annee);
foreach ($tableau_annee as $annee) {
$res .= " <tr>\n";
$res .= ' <td class="col_annee">'.$annee.'</td>';
for ($i = 1; $i <= 12; $i++) {
$res .= '<td class="mois">';
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
}
$res .= '</td>';
}
$res .= '</tr>'."\n";
}
return $res;
}
function ecrireFichierCalendrier() {
$html = $this->calculeCalendrierPermanent();
$f = fopen ('tmp/'.$this->listname.'.calendrier', 'w') ;
fwrite ($f, $html);
fclose($f);
return $html;
}
function calendrierMessage() {
$html = '';
// On ajoute la derniere annee
$html .= $this->calculeCalendrierPermanent(date ('Y'));
if ($this->isFichierCalendrierExiste()) {
// S il existe mais qu il est trop vieux, il faut le recalculer
if ($this->isDoitRecalculerCalendrier()) {
$annees = $this->getAnneesARecalculer();
$html .= $this->calculeCalendrierPermanent($annees);
}
$html .= file_get_contents('tmp/'.$this->listname.'.calendrier');
} else {
$html .= $this->ecrireFichierCalendrier();
}
return $html;
}
function isFichierCalendrierExiste() {
if (file_exists('tmp/'.$this->listname.'.calendrier')) {
return true;
}
return false;
}
function isDoitRecalculerCalendrier() {
 
if (date ('Y', fileatime('tmp/'.$this->listname.'.calendrier')) != date('Y')) return true;
return false;
}
function getAnneesARecalculer() {
// On suppose que l index de ezmlm est correct
$anneeFichierCalendrier = date ('Y', fileatime('tmp/'.$this->listname.'.calendrier'));
return $anneeFichierCalendrier + 1;
}
}
 
// 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/v3.1-sardain/classes/HTML_formulaireProjet.class.php
New file
0,0 → 1,175
<?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.7 2007-11-21 09:42:50 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.7 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
 
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
 
/**
* 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 = '', $tableau_theme = '')
{
$this->addElement ('text', 'projet_titre', PROJET_TITRE, array ('class' => 'projet_titre', 'maxlength' => 255, 'size' => '80')) ;
$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) ;
}
/* impossible de faire fonctionner dojo Editor !!!
*
GEN_stockerStyleExterne('tundra', 'api/js/dojo1.0/dijit/themes/tundra/tundra.css');
GEN_stockerStyleExterne('dojo', 'api/js/dojo1.0/dojo/resources/dojo.css');
GEN_AttributsBody('class', 'tundra');
GEN_stockerFichierScript('dojo', 'api/js/dojo1.0/dojo/dojo.js',
'text/javascript',
array ('djConfig' => 'parseOnLoad: true, isDebug: true'));
GEN_stockerFichierScript('dojo.editor', 'api/js/dojo1.0/dijit/Editor.js', 'text/javascript');
GEN_stockerCodeScript('dojo.config.allowXdRichTextSave = true;');
*/
$this->addElement ('textarea', 'projet_resume', PROJET_RESUME, array('class'=>'projet_resume', 'rows'=>"5", 'cols'=>'80',
'width'=>"200", /*'dojoType' => 'dijit.Editor',*/ 'id' => 'resume_editeur')) ;
 
$this->addElement ('textarea', 'projet_description', PROJET_DESCRIPTION,
array('class'=>"projet_resume", 'rows'=>"20", 'cols'=>'80'/*, 'dojoType' => 'dijit.Editor'*/)) ;
 
$this->addElement ('text', 'projet_espace_internet', PROJET_ESPACE_INTERNET, array ('class' => 'projet_espace_internet', 'size' => '80')) ;
// 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;');
/** Theme du projet ajout 05/2008 */
//var_dump ($tableau_theme);
if ($tableau_theme != '') {
foreach ($tableau_theme as $cle => $theme) {
$checkbox[$cle] = new HTML_QuickForm_checkbox('projet_theme['.$cle.']', '', $theme);
$this->addElement($checkbox[$cle]);
}
}
$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);
$buttons[] = &HTML_QuickForm::createElement('submit', 'valider', PROJET_FICHIER_VALIDER);
$this->addGroup($buttons, null, null, '&nbsp;');
} // end of member function _construitFormulaire
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/classes/projetControleur.class.php
New file
0,0 → 1,1759
<?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.50 2008-10-22 08:21:58 aperonnet 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.50 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | 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.'sql/SQL_manipulation.fonct.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 definir 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);
 
/** Constante pour les notifications
* Messages envoyes par la systeme pour prevenir
* les utilisateurs de certaines action
*/
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD', 6);
 
/**
* class projetControleur
* Cette classe sert a lancer les diverses applications du module projet, en
* fonction des parametre de l'URL GET ou POST. La methode principale est run()
*/
class projetControleur
{
/*** Attributes: ***/
 
/**
* Contient l'action du controleur, qui correspond a une action du module projet.
* @access private
*/
var $_action;
/**
* Une connexion a une base de donnee 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 defaut, cet
* attribut n'a pas de valeur.
* @access private
*/
var $_id_projet;
 
/**
* L'identifiant du repertoire que l'on est en train d'observer. Il sera passé en
* parametre a 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 presentation de la liste des projets, par defaut en liste.
* Valeurs possibles: arbre
* @access private
*/
var $_presentation = 'liste' ;
 
/**
* Le type du projets, par defaut 0, signifie en pas de type particumier.
* Valeurs possibles: 0, 1, 2, 3 ...
* @access private
*/
 
var $_type ;
/**
* Le tableau des projets a 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 ;
/**
* Methode principale de la classe. Elle permet d'appeler les methodes 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')) {
return 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 defaut l'action PROJET_VOIR_RESUME
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_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 : $message_retour = $this->inscriptionListe() ;
$this->_action = PROJET_ACTION_VOIR_FORUM ;
break ;
case PROJET_ACTION_DESINSCRIPTION_LISTE : $message_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 generalement 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 ;
}
 
/**
* 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 ;
}
 
 
/**
* 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 logguee, avec son
* statut et un lien vers l'action pour gerer 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 entetes 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 general de l'application projet. Avec differents 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 specifiques 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 gerer 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) {
// On ajoute l id d un repertoire s il existe
if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
$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 creer un repertoire
$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>' ;
$this->_url->removeQueryString('id_repertoire');
// Forum
$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
$res .= '<ul id="projet_groupe_niv2_for">' ;
if ($projet->avoirListe()) {
// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
//$projet->getListesAssociees();
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
foreach ($projet->_listes_associes as $info_liste) {
$listes_ext = new liste_externe ($this->_db) ;
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
if (count ($tableau_liste) == 0) {
$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 proprietes 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) {
$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) ;
$vues = array (PROJET_ACTION_VOIR_RESUME, PROJET_ACTION_VOIR_DESCRIPTION, PROJET_ACTION_VOIR_WIKINI, PROJET_ACTION_VOIR_FORUM, PROJET_ACTION_VOIR_PARTICIPANT);
if (isset($_REQUEST[PROJET_VARIABLE_ACTION]) && in_array ($_REQUEST[PROJET_VARIABLE_ACTION], $vues)) $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $_REQUEST[PROJET_VARIABLE_ACTION]);
return $res ;
} // end of member function menuGeneral
 
/**
* Renvoie le formulaire de cretion 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) ;
}
/** recuperation des themes */
include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
$tableau_theme = projet_theme::getTousLesThemes($this->_db);
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
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) ;
$themes = $projet->getThemes();
foreach ($themes as $cle => $valeur) {
$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
$element->setChecked(true);
}
} else {
$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;
}
$res = PROJET_PROPOSER_PROJET ;
return $res . $formulaire_projet->toHTML() ;
} else {
return 'Veuillez r&eacute;gler les permissions en &eacute;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 deposant 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() ;
}
}
 
/**
* Valide le formulaire et appelle la fonction de mise à jour.
*
* @return void
* @access public
*/
function modifierProjet( )
{
// creation 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) {
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
$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 element 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 cache avec l'identifiant du document
$formulaire_document->addElement ('hidden', 'id_document', $this->_id_document) ;
$formulaire_document->setDefaults($valeurs_par_defaut) ;
} else {
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
$visibilite = $projet->isModere() ? "prive" : "public";
$formulaire_document->setDefaults (array ('document_visibilite'=> $visibilite)) ;
}
return $res.$formulaire_document->toHTML() ;
 
} // end of member function nouveauFichier
 
/**
* Presente un formulaire pour deplacer 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>' ;
include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;
$document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
// On traite le cas ou l'on vient de deplacer un fichier
 
if (isset ($_POST['projet_repertoire'])) {
if (!$document -> deplace ($_POST['projet_repertoire'], $projet->getNomRepertoire())) {
return 'echec du d&eacute;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()) ;
$tab = $projet->getListeRepertoireHierarchisee();
//$res .= '<pre>'.print_r ($tab, true).'</pre>';
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);
$this->_url->removeQueryString(PROJET_VARIABLE_ID_DOCUMENT);
return ;
 
} // end of member function nouveauFichier
 
/**
* Renvoie le formulaire de creation d'un repertoire.
*
* @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( )
{
// creation 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()) {
// Creation d'un objet document vide
$document = new document ("", $this->_db) ;
// avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numero de repertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
//$GLOBALS['log'] .= '<br>this->_id_repertoire: '.$this->_id_repertoire.'<br>';
$chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
return 'Echec de l\'upload<br />'.
'Fichier source : '. $_FILES['fichier']['name'];
'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
}
 
$document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
// 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';
// Pour notification coordinateur
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)) ;
$this->notifierCoordinateurs(PROJET_NOTIFICATION_NOUVEAU_DOC,
$utilisateur,
 
'http://'.$this->_url->host.'/projets/'.$this->_id_projet.'/telechargement/'.$id_document.
' (' . $formulaire_document->getSubmitValue("document_nom") . ')');
} else {
return $formulaire_document->toHTML() ;
}
return $retour;
}
 
/**
* Valide le formulaire et appelle la fonction d'insertion.
*
* @return void
* @access public
*/
function modifierFichier( )
{
// creation 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()) {
// Creation d'un objet document vide
$document = new document ($this->_id_document, $this->_db) ;
// On passe aussi le numero de repertoire 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( )
{
// creation 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()) {
// Creation d'un objet
$document = new document ("", $this->_db) ;
// avant d'appeler la methode enregistrerSQL, il faut indiquer l'identifiant du projet et l'identifiant du proprietaire
$document->setIdProjet ($this->_id_projet) ;
$document->setIdProprietaire ($this->_auth->getAuthData (PROJET_CHAMPS_ID)) ;
 
// On passe aussi le numero de repertoire s'il existe
if ($this->_id_repertoire != '') $document->setIdRepertoire($this->_id_repertoire) ;
if ($this->_id_repertoire == 0) $document->setIdRepertoire(0) ;
$chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
$nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
 
// La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
$GLOBALS['log'] = '<br />chemin_upload:'.$chemin_upload.'<br />';
$GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.rtrim ($nom_repertoire, '/'))) {
 
$document->suppressionSQL() ;
return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire;
}
// On place a 1 la colonne p_avoir_document
if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
} else {
return $formulaire_repertoire->toHTML() ;
}
}
 
 
/**
* Permet de specifier 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 ;
}
 
/**
* Permet de specifier quel repertoire, dans la vue de document afficher. Il sera
* passe en parametre a la classe HTML_listeDocuments.
*
* @param int id_repertoire L'identifiant du repertoire a afficher.
* @return void
* @access public
*/
function setIdRepertoire( $id_repertoire )
{
$this->_id_repertoire = $id_repertoire ;
}
 
/**
* 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( )
{
// Verifications
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()) {
// creation 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 reponse
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 creation 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() ;
}
 
/**
* Transmet au serveur la demande de creation d'une nouvelle liste.
*
* @return void
* @access public
*/
function nouvelleListeValidation( )
{
// Verifications
$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()) {
// creation de l'objet liste_discussion
include_once PROJET_CHEMIN_CLASSES.'liste_discussion.class.php';
$liste = new liste_discussion('', $this->_db) ;
 
// On verifie 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) ;
 
// Creation de la liste
$resultat_creation = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/creation_liste.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&parametres=aBiud') ;
 
// Ajout du moderateur
$resultat_ajout_moderateur = file_get_contents (PROJET_SERVEUR_VPOPMAIL.'/ajout_moderateur.php?domaine='.
$liste->getDomaine().'&liste='.$liste->getNom().'&mail='.$this->_auth->getUserName()) ;
// Ajout du moderateur 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 associee 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 presentation 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
 
/**
* Inscrit un utilisateur a 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) ;
// On controle si la liste est externe (yahoo) auquel cas on ne presente pas l inscription
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
$liste_ext = new liste_externe($this->_db);
$listes = $liste_ext->getListesAssociees($this->_id_projet);
if (count ($listes))$info_liste = $liste_ext->getInfoListe($listes[0]);
if (count ($listes) != 0) {
$avoir_liste_externe = true;
$msg = '';
$msg = 'Pour vous inscrire &agrave; la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes, <a href="mailto:';
$msg .= $info_liste->AGO_A_MAILABO.'">cliquez ici</a>';
} else {
$avoir_liste_externe = false;
}
if (!$projet->avoirListe() || $avoir_liste_externe) {
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) ;
$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
}
$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour;
}
}
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 ($_POST['radio_inscription_liste'] == 2) {
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']) ;
}
if (!$projet->isModere()) {
$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
$this->notifierCoordinateurs(PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE, $utilisateur);
} else {
$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
$this->notifierCoordinateurs(PROJET_NOTIFICATION_DEMANDE_INSCRIPTION, $utilisateur);
}
}
 
if ($this->_presentation != 'arbre') {
if ($projet->isModere()) return '<h1>'.$projet->getTitre().'</h1>'.
str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
else {
$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour;
}
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
return PROJET_LAIUS_INSCRIPTION_MODERE;
}
$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 loggue a la liste dont le parametre 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
return '<p class="information">Vous &ecirc;tes inscrit &agrave; la liste</p>';
} // end of member function inscriptionListe
 
/**
* Inscrit l'utilisateur loggue a la liste dont le parametre 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']) ;
return '<p class="information">Vous avez &eacute;t&eacute; d&eacute;sinscrit de la liste</p>';
}
} // end of member function inscriptionListe
/**
* desinscrit un utilisateur d un projet
*
* @return void
* @access public
*/
function desinscriptionProjet( )
{
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$participant = new participe($this->_db) ;
$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)) ;
// Le statut 4 desinscrit l'utilisateur, dans la methode 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]) ;
}
$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
// On verifie si l utilisateur est le dernier coordinateur
// auquel cas on previent les administrateurs
if ($participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db)) {
$coord = $participant->getCoordinateurs($this->_id_projet);
if (count($coord) == 0) {
$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $utilisateur);
}
}
//
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
$liste_ext = new liste_externe($this->_db);
$listes = $liste_ext->getListesAssociees($this->_id_projet);
$msg = '';
if (count ($listes) != 0) {
$info_liste = $liste_ext->getInfoListe($listes[0]);
$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
$msg .= ' Vous pouvez le faire en <a href="mailto:';
$msg .= $info_liste->AGO_A_MAILDESA.'">cliquez ici</a>';
}
if ($this->_presentation != 'arbre') {
$message_retour = '<p class="information">Votre d&eacute;sinscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
return $retour ;
} else {
$this->_action = PROJET_ACTION_VOIR_RESUME;
}
}
 
/**
* Renvoie le formulaire de creation d'un wiki
*
* @return void
* @access public
*/
function formulaireWiki( )
{
$GLOBALS['url']->addQueryString ('act', PROJET_ACTION_CREER_WIKI) ;
$GLOBALS['url']->addQueryString (PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
$res =admin_afficherContenuCorps();
$res .= '<br /><a href="'.$this->_url->getURL().'">'.PROJET_RETOUR_RESUME.'</a>';
return $res;
 
}
 
 
function associerWiki( )
{
$res = '<h1>'.PROJET_ASSOCIER_WIKI.'</h1>'."\n" ;
 
$db = &$GLOBALS['_GEN_commun']['pear_db'] ;
$res='';
 
// Comportement par defaut
// 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 ;
}
 
include_once 'api/html/HTML_TableFragmenteur.php';
$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", // Premiere 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
 
/**
* Realise les mises a 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
 
/**
* retourne une variable locale si la variable $_GET existe
*
*/
function traiterVariableGet($var, $valeur_par_defaut ='') {
if (isset($_GET[$var]) && $_GET[$var] != '') {
return $_GET[$var];
} else {
return $valeur_par_defaut;
}
}
 
/**
* 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&eacute;pertoire",
PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
) ;
return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
} // end of member function messageErreur
/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
* Lorsqu un projet n a plus de coordinateur, la notification est
* envoyee aux administrateurs
*
*/
 
function notifierCoordinateurs ($notification, $utilisateur, $lien = false) {
include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php';
switch ($notification) {
case PROJET_NOTIFICATION_DEMANDE_INSCRIPTION :
$sujet = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET;
$corps = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS;
break;
case PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE :
$sujet = PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_SUJET;
$corps = PROJET_TEMPLATE_INSCRIPTION_NOUVELLE_CORPS;
break;
case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET :
$sujet = PROJET_TEMPLATE_DESINSCRIPTION_SUJET;
$corps = PROJET_TEMPLATE_DESINSCRIPTION_CORPS;
break;
case PROJET_NOTIFICATION_NOUVEAU_DOC:
$sujet = PROJET_TEMPLATE_NOUVEAU_DOC_SUJET;
$corps = PROJET_TEMPLATE_NOUVEAU_DOC_CORPS;
break;
case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD:
$sujet = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET;
$corps = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS;
break;
}
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
$projet = new projet ($this->_db, $this->_id_projet) ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
$participant = new participe($this->_db) ;
$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
$objet_mail =& Mail::factory('smtp');
$modele = new projetTemplate($GLOBALS['projet_db']);
 
$sujet_mail = $modele->getTemplate($sujet, PROJET_LANGUE_DEFAUT);
$corps_mail = $modele->getTemplate($corps, PROJET_LANGUE_DEFAUT);
if (PEAR::isError($sujet_mail)) $sujet_mail->raiseError ($sujet_mail->getMessage().'<br />'.$sujet_mail->getDebugInfo());
$corps_mail = str_replace ('{nom}', $utilisateur->getInfo( 'nom'), $corps_mail);
$corps_mail = str_replace ('{prenom}', $utilisateur->getInfo( 'prenom'), $corps_mail);
$corps_mail = str_replace ('{nom_projet}', $projet->getTitre(), $corps_mail);
if($notification == PROJET_NOTIFICATION_NOUVEAU_DOC && $lien) {
$corps_mail = str_replace ('{lien}', $lien, $corps_mail);
}
else {
$corps_mail = str_replace ('{lien}', str_replace ('&amp;', '&', $this->_url->getURL()), $corps_mail);
}
$entetes['From'] = PROJET_MAIL_ADMINISTRATEUR;
$entetes['To'] = '';
$entetes['Subject'] = trim ($sujet_mail) ; // le trim est necessaire pour enlever d eventuels retour-chariot qui foutent el l air le message
$entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
$entetes['Message-ID'] = md5(time()) ;
$entetes['reply-to'] = $this->_auth->getUserName();
$entetes['Content-Type'] = 'text/plain' ;
// 2 cas : 1. il reste des coordinateurs ou notification pour administrateur
// 2. plus de coordinateur ou notification pour administrateur
if (count ($tableau_coordinateur) != 0 && $notification != PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD) {
foreach ($tableau_coordinateur as $coordinateur) {
$entetes['To'] .= $coordinateur[3].','; // Le champs 3 est le mail
}
// On enleve la virgule finale
$entetes['To'] = substr ($entetes['To'], 0, -1);
// on envoie le mail
$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
} else { // Pour le cas ou il n y a plus de coordinateur, on envoie un message aux administrateurs
$tableau_administrateur = $participant->getAdministrateurs();
trigger_error(print_r($tableau_administrateur, true));
foreach ($tableau_administrateur as $administrateur) {
$entetes['To'] .= $administrateur[3].','; // Le champs 3 est le mail
}
// On enleve la virgule finale
$entetes['To'] = substr ($entetes['To'], 0, -1);
// on envoie le mail
$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
}
}
 
 
} // end of projetControleur
 
class bouton {
static function toHTML($lien, $label, $id, $class='projet_bouton_action') {
if ($lien != '#') {
$balise_a_debut = '<a href="'.$lien.'"'.($id == 'cross'? ' onclick="javascript:return confirm(\''.$label.' ?\');"':'').'>';
$balise_a_fin = '</a>';
} else {
$balise_a_debut = '';
$balise_a_fin = '';
}
return '<div id="bouton_'.$id.'" class="'.$class.'">' .
$balise_a_debut.'<img src="'.PROJET_CHEMIN_ICONES.$id.'.png" alt="'.$label.'" />'.$label.$balise_a_fin.'</div>';
}
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.49 2008-09-16 14:10:20 alexandre_tb
* verification du statut de l utilisateur lors d une desinscription.
* Si coordinateur, message aux admins
*
* Revision 1.48 2008-09-15 07:41:16 alexandre_tb
* ajout de HTML_TableFragmenteur
*
* Revision 1.47 2008-09-01 14:38:00 alexandre_tb
* correction de bug inscription projet
*
* Revision 1.46 2008-08-28 14:48:54 alexandre_tb
* encodage et suppression d une methode inutile
*
* Revision 1.45 2008-08-26 12:42:10 alexandre_tb
* nettoyage url apres suppression d un fichier
*
* Revision 1.44 2008-08-26 08:52:28 alexandre_tb
* suppression de la methode accueilProjet desormais remplacee par resume.php
*
* Revision 1.43 2008-08-25 15:06:59 alexandre_tb
* ajout:
* - des notifications
* - des messages en retour
* - correction inscription a un projet avec liste externe
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/tags/v3.1-sardain/classes/participe.class.php
New file
0,0 → 1,425
<?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.6 2008-08-25 15:11:56 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.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
 
// +------------------------------------------------------------------------------------------------------+
// | 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='.$this->_db->escapeSimple($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) ;
$id = $ligne[0];
$inscrits[$id]['nom'] = $ligne[1];
$inscrits[$id]['prenom'] = $ligne[2];
$inscrits[$id]['mail'] = $ligne[3];
$inscrits[$id]['date'] = $ligne[4];
$inscrits[$id]['id_statut'] = $ligne[5];
}
$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=".$this->_db->escapeSimple($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=".$this->_db->escapeSimple($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 )
{
if (participe::isAdministrateur($id_utilisateur, $dbObject)) return PROJET_DROIT_ADMINISTRATEUR;
$requete = 'select psu_id_statut from projet_statut_utilisateurs'.
' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet ='.$this->_db->escapeSimple($id_projet) ;
$resultat = $dbObject->query ($requete) ;
if (DB::isError ($resultat)) {
return DB::raiseError('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=".$this->_db->escapeSimple($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='.$this->_db->escapeSimple($id_statut).
' where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$this->_db->escapeSimple($id_projet);
if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
$requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
', psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).',psu_id_projet='.$this->_db->escapeSimple($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='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet='.$this->_db->escapeSimple($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 )
{
if (!is_object($objetDB)) $objetDB = $this->_db;
$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='.$this->_db->escapeSimple($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 (!is_object($objetDB)) $objetDB = $this->_db;
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 (!is_object($objetDB)) $objetDB = $this->_db;
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='.$this->_db->escapeSimple($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)) {
return ("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
function getAdministrateurs () {
$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_utilisateur='.PROJET_CHAMPS_ID.
' and psu_id_statut=ps_id_statut and psu_id_statut=0 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 ;
}
/**
* Renvoie la constante de statut d un utilisateur
*
* 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);
*
* @access public
* @return int La constante de statut
*/
function getStatut($id_utilisateur, $id_projet)
{
$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db);
switch ($statut)
{
case 0 : return PROJET_DROIT_ADMINISTRATEUR;
break;
case 1 : return PROJET_DROIT_COORDINATEUR;
break;
case 2 : return PROJET_DROIT_CONTRIBUTEUR;
break;
case 3 : return PROJET_DROIT_EN_ATTENTE;
break;
default : return PROJET_DROIT_AUCUN;
}
}
} // end of participe
?>
/tags/v3.1-sardain/classes/ezmlm-php-2.0.tar.gz
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tags/v3.1-sardain/classes/ezmlm-php-2.0.tar.gz
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/v3.1-sardain/classes/type_fichier_mime.class.php
New file
0,0 → 1,190
<?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( $id_type = '', $chemin_icones = "icones/" )
{
$requete = 'select * from gen_type_de_fichier where ' ;
if (is_numeric ($id_type)) {
$requete .= 'gtf_id_type='.$GLOBALS['projet_db']->escapeSimple($id_type) ;
} else {
$requete .= 'gtf_type_mime="'.$id_type.'"' ;
}
$resultat = $GLOBALS['projet_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 = '')
{
if (is_object($objetDB)) {
$GLOBALS['projet_db'] = $objetDB;
}
$requete = "select * from gen_type_de_fichier where gtf_extension=\"$extension\" or gtf_type_mime=\"$extension\"" ;
$resultat = $GLOBALS['projet_db']->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 ( $ligne->gtf_id_type) ;
} else {
// si il n'y a pas de résultat, on renvoie inconnue
return new type_fichier_mime (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/v3.1-sardain/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
?>