Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 831 → Rev 832

/trunk/client/integrateur_wikini/bibliotheque/adwi_wikini.fonct.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adwi_wikini.fonct.php,v 1.5 2005-09-28 16:29:39 ddelon Exp $
// CVS : $Id: adwi_wikini.fonct.php,v 1.6 2006-04-28 12:41:26 florian Exp $
/**
* Contient les fonctions de l'application gestion des Wikini
*
35,7 → 35,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
314,7 → 314,7
if (PEAR::isError($resultat)) {
$message = '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
'Fichier origine : '. $chemin_wikini_config .'<br />'.
'Fichier origine : '. $chemin_wikini_bibliotheque .'<br />'.
'Fichier copié : '. $chemin_wikini .'<br />'.
'Erreur origine : '. $resultat->getMessage() .'<br />'.
'Ligne n° : '. __LINE__ .'<br />'.
418,6 → 418,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/09/28 16:29:39 ddelon
* Merge modification projet
*
* Revision 1.4 2005/09/09 09:37:17 ddelon
* Integrateur Wikini et administration des Wikini
*
/trunk/client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php
19,7 → 19,7
// | 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: iw_admin_wikini.fonct.php,v 1.1 2005-11-14 10:14:30 ddelon Exp $
// CVS : $Id: iw_admin_wikini.fonct.php,v 1.2 2006-04-28 12:41:26 florian Exp $
/**
* Application gérant les Wikini associe à Papyrus
*
36,7 → 36,7
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.1 $
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
45,7 → 45,7
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/** Inclusion du fichier de configuration de cette application.*/
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
require_once '../configuration/adwi_configuration.inc.php';
 
//Utilisation de la bibliothèque PEAR NET_URL
 
188,6 → 188,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.7 2005/10/21 20:55:06 ddelon
* todo wikini
*
/trunk/client/integrateur_wikini/bibliotheque/adwi_HTML_formulaireWikini.class.php
19,7 → 19,7
// | 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: adwi_HTML_formulaireWikini.class.php,v 1.5 2005-11-14 13:07:11 ddelon Exp $
// CVS : $Id: adwi_HTML_formulaireWikini.class.php,v 1.6 2006-04-28 12:41:26 florian Exp $
/**
*
* Admin Wikini
32,7 → 32,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $
*@version $Revision: 1.6 $
// +------------------------------------------------------------------------------------------------------+
*/
 
43,9 → 43,9
 
/** 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' ;
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' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
/trunk/client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: iw_integrateur.fonct.php,v 1.14 2006-01-09 21:58:16 ddelon Exp $
// CVS : $Id: iw_integrateur.fonct.php,v 1.15 2006-04-28 12:41:26 florian Exp $
/**
* Fonctions de l'integrateur de page Wikini
*
33,7 → 33,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.14 $ $Date: 2006-01-09 21:58:16 $
*@version $Revision: 1.15 $ $Date: 2006-04-28 12:41:26 $
*
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
46,11 → 46,11
 
$GLOBALS['_PAPYRUS_']['erreur']->setActive(0);
 
require_once 'Net/URL.php';
require_once PAP_CHEMIN_API_PEAR.'Net/URL.php';
 
// TODO : un seul fichier de configuration ?
/** Inclusion du fichier de configuration de cette application.*/
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
require_once '../configuration/adwi_configuration.inc.php';
 
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
 
252,7 → 252,7
}
else
{
 
$ACbuttonsBar='';
require_once(IW_CHEMIN_BIBLIO_ACEDITOR."ACeditor.buttonsBar.php");
 
$result .=
363,6 → 363,7
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
 
// split into page/method
$matches='';
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page, $method) = $matches;
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
433,6 → 434,7
$_REQUEST['wiki'] = preg_replace("/^\//", '', $_REQUEST['wiki']);
 
// split into page/method
$matches='';
if ( preg_match( "#^(.+?)/(.*)$#", $_REQUEST['wiki'], $matches ) ) {
list(, $page, $method) = $matches;
} else if ( preg_match( "#^(.*)$#", $_REQUEST['wiki'], $matches ) ) {
/trunk/client/integrateur_wikini/integrateur_wikini.admin.php
19,7 → 19,7
// | 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: integrateur_wikini.admin.php,v 1.4 2005-09-30 07:48:35 ddelon Exp $
// CVS : $Id: integrateur_wikini.admin.php,v 1.5 2006-04-28 12:41:26 florian Exp $
/**
* Gestion des Wikini associé à un menu pour papyrus : lit et stocke les informations dans la
* champs gm_application_arguments de la table gen_menu
53,7 → 53,7
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $ $Date: 2005-09-30 07:48:35 $
*@version $Revision: 1.5 $ $Date: 2006-04-28 12:41:26 $
// +------------------------------------------------------------------------------------------------------+
*/
 
68,7 → 68,7
// +------------------------------------------------------------------------------------------------------+
 
/** Inclusion du fichier de configuration de cette application.*/
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
require_once 'configuration/adwi_configuration.inc.php';
 
 
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
120,7 → 120,7
$resultat_menu = $db->query($requete_menu);
(DB::isError($resultat_menu))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete_menu))
: '';
$info_menu = $resultat_menu->fetchRow(DB_FETCHMODE_OBJECT);
276,6 → 276,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2005/09/30 07:48:35 ddelon
* Projet Wikini
*
* Revision 1.3 2005/09/14 09:12:15 ddelon
* Integrateur Wikini et administration des Wikini
*
/trunk/client/integrateur_wikini/admin_wikini.php
19,7 → 19,7
// | 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: admin_wikini.php,v 1.8 2005-11-14 10:14:30 ddelon Exp $
// CVS : $Id: admin_wikini.php,v 1.9 2006-04-28 12:41:26 florian Exp $
/**
* Application gérant les Wikini associe à Papyrus
*
27,7 → 27,7
//Auteur original :
*@author David Delon <david.delon@clapas.net>
*@copyright Tela-Botanica 2000-2005
*@version $Revision: 1.8 $
*@version $Revision: 1.9 $
// +------------------------------------------------------------------------------------------------------+
*/
 
37,7 → 37,7
// +------------------------------------------------------------------------------------------------------+
 
/** Inclusion des fonctions de cette application.*/
require_once 'client/integrateur_wikini/bibliotheque/iw_admin_wikini.fonct.php';
require_once 'bibliotheque/iw_admin_wikini.fonct.php';
 
 
function afficherContenuCorpsHTML() {
58,6 → 58,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2005/11/14 10:14:30 ddelon
* Projets Wikini
*
* Revision 1.7 2005/10/21 20:55:06 ddelon
* todo wikini
*
/trunk/client/integrateur_wikini/integrateur_wikini.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: integrateur_wikini.php,v 1.12 2005-10-31 17:12:00 ddelon Exp $
// CVS : $Id: integrateur_wikini.php,v 1.13 2006-04-28 12:41:26 florian Exp $
/**
* Integrateur de page Wikini
*
33,7 → 33,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.12 $ $Date: 2005-10-31 17:12:00 $
*@version $Revision: 1.13 $ $Date: 2006-04-28 12:41:26 $
*
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
48,7 → 48,7
* @access public
*/
require_once 'client/integrateur_wikini/bibliotheque/iw_integrateur.fonct.php';
require_once 'bibliotheque/iw_integrateur.fonct.php';
 
 
function afficherContenuMenu()
/trunk/client/projet/projet.php
19,7 → 19,7
// | 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.php,v 1.10 2005-12-01 16:38:32 alexandre_tb Exp $
// CVS : $Id: projet.php,v 1.11 2006-04-28 12:41:28 florian Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.10 $
*@version $Revision: 1.11 $
// +------------------------------------------------------------------------------------------------------+
*/
 
72,17 → 72,17
||($GLOBALS['_GEN_commun']['info_application']->presentation == 'tela')))) {
$res .= '<ul class="onglets">';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_RESUME);
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
$res .= '<li id="projet_resume" class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DESCRIPTION);
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
$res .= '<li id="projet_description" class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_WIKINI);
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
$res .= '<li id="projet_wikini" class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
$res .= '<li id="projet_documents" class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
$res .= '<li id="projet_forum" class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
$GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
$res .= '<li class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
$res .= '<li id="projet_participants" class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
$res .= '</ul>';
$GLOBALS['url']->removeQueryString (PROJET_VARIABLE_ACTION) ;
}
228,6 → 228,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.10 2005/12/01 16:38:32 alexandre_tb
* ajout de l'action telechargement
*
* Revision 1.9 2005/11/25 14:48:44 alexandre_tb
* ajout de la gestion de la présentation tela
*
/trunk/papyrus/applettes/moteur_recherche/moteur_recherche.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: moteur_recherche.php,v 1.8 2006-03-02 10:49:49 ddelon Exp $
// CVS : $Id: moteur_recherche.php,v 1.9 2006-04-28 12:41:49 florian Exp $
/**
* Applette : moteur de recherche
*
38,7 → 38,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $ $Date: 2006-03-02 10:49:49 $
*@version $Revision: 1.9 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
56,7 → 56,7
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
require_once MORE_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
/** Inclusion de la bibliothèque PEAR de modification des squelettes des formulaires QuickForm.*/
require_once 'HTML/QuickForm/Renderer/Default.php';
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/Renderer/Default.php';
 
// Inclusion des fichiers de traduction de l'appli ADME dePapyrus
if (file_exists(MORE_CHEMIN_LANGUE.'more_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
238,6 → 238,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2006/03/02 10:49:49 ddelon
* Fusion branche multilinguisme dans branche principale
*
* Revision 1.7.2.2 2005/12/27 15:56:00 ddelon
* Fusion Head vers multilinguisme (wikini double clic)
*
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_papyrus_menu.class.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: more_recherche_papyrus_menu.class.php,v 1.4 2005-05-25 13:49:22 jpm Exp $
// CVS : $Id: more_recherche_papyrus_menu.class.php,v 1.5 2006-04-28 12:41:49 florian Exp $
/**
* Classe permettant d'effectuer des recherches sur les informations des menus de Papyrus.
*
38,7 → 38,7
//Autres auteurs :
*@author aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $ $Date: 2005-05-25 13:49:22 $
*@version $Revision: 1.5 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
129,6 → 129,7
}
// Analyse du poids de cette page vis à vis du contenu
$tab_morceaux='';
$nbre_correspondance = preg_match_all('/'.$motif.'/i', $aso_menu_contenu['gmc_contenu'], $tab_morceaux);
$aso_resultat['poids'] = $aso_resultat['poids'] + $nbre_correspondance;
143,6 → 144,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4 2005/05/25 13:49:22 jpm
* Corection erreur pour la recherche dans le contenu.
*
* Revision 1.3 2005/05/19 12:46:12 jpm
* Correction bogue accesskey.
* Ajout d'un id à la liste.
/trunk/papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: more_recherche.class.php,v 1.5 2005-09-20 17:01:22 ddelon Exp $
// CVS : $Id: more_recherche.class.php,v 1.6 2006-04-28 12:41:49 florian Exp $
/**
* Classe permettant d'effectuer des recherches sur les métas informations des menus.
*
34,7 → 34,7
//Autres auteurs :
*@author aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2005-09-20 17:01:22 $
*@version $Revision: 1.6 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
132,44 → 132,31
{
switch ($mois_numerique) {
case '01' :
return 'janvier';
break;
return 'janvier';
case '02' :
return 'février';
break;
return 'février';
case '03' :
return 'mars';
break;
case '04' :
return 'avril';
break;
case '05' :
return 'mai';
break;
case '06' :
return 'juin';
break;
case '07' :
return 'juillet';
break;
case '08' :
return 'août';
break;
case '09' :
return 'septembre';
break;
case '10' :
return 'octobre';
break;
case '11' :
return 'novembre';
break;
case '12' :
return 'décembre';
break;
default:
return '';
break;
}
}
}
177,6 → 164,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/09/20 17:01:22 ddelon
* php5 et bugs divers
*
* Revision 1.4 2005/05/25 13:49:22 jpm
* Corection erreur pour la recherche dans le contenu.
*
/trunk/papyrus/applettes/vous_etes_ici/vous_etes_ici.php
19,7 → 19,7
// | 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: vous_etes_ici.php,v 1.9 2006-03-02 10:49:49 ddelon Exp $
// CVS : $Id: vous_etes_ici.php,v 1.10 2006-04-28 12:41:49 florian Exp $
/**
* Applette : Vous Etes Ici
*
39,7 → 39,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $ $Date: 2006-03-02 10:49:49 $
*@version $Revision: 1.10 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
164,7 → 164,8
$retour = '';
for ($i = (count($tab_vei) - 1); $i >= 0 ;$i--) {
if ($i == 0) {
// Supprime le lien pour le nom du menu courant
// Supprime le lien pour le nom du menu courant
$tab_txt_capture='';
preg_match("/>(.*)<\/a>/", $tab_vei[$i], $tab_txt_capture);
$retour .= $tab_txt_capture[1];
} else {
189,6 → 190,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.9 2006/03/02 10:49:49 ddelon
* Fusion branche multilinguisme dans branche principale
*
* Revision 1.8.2.1 2006/02/28 14:02:10 ddelon
* Finition multilinguisme
*
/trunk/papyrus/applettes/selecteur_sites/selecteur_sites.php
19,7 → 19,7
// | 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: selecteur_sites.php,v 1.8 2006-03-02 10:49:49 ddelon Exp $
// CVS : $Id: selecteur_sites.php,v 1.9 2006-04-28 12:41:49 florian Exp $
/**
* Applette : selecteur sites
*
40,7 → 40,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.8 $ $Date: 2006-03-02 10:49:49 $
*@version $Revision: 1.9 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
103,7 → 103,8
$bln_xhtml_strict = 1;
}
// Nous vérifions s'il y a des sites que nous ne voulons pas afficher:
$morceau_requete_id_suppr = '';
$morceau_requete_id_suppr = '';
$tab_id_suppr_groupe='';
if (isset($tab_applette_arguments[3]) && ereg('SANS_(.+)', $tab_applette_arguments[3], $tab_id_suppr_groupe)) {
if (preg_match('/^\d+$/', $tab_id_suppr_groupe[1])) {
$liste_id_suppr = $tab_id_suppr_groupe[1];
298,6 → 299,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.8 2006/03/02 10:49:49 ddelon
* Fusion branche multilinguisme dans branche principale
*
* Revision 1.7.2.4 2006/02/28 14:02:07 ddelon
* Finition multilinguisme
*
/trunk/papyrus/pap_cache.inc.php
19,7 → 19,7
// | 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: pap_cache.inc.php,v 1.2 2005-02-28 11:20:42 jpm Exp $
// CVS : $Id: pap_cache.inc.php,v 1.3 2006-04-28 12:41:49 florian Exp $
/**
* Gestion de la suppression et de la recherche dans le cache.
*
36,7 → 36,7
//Autres auteurs :
*@author Laurent COUDOUNEAU <lc@gsite.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $ $Date: 2005-02-28 11:20:42 $
*@version $Revision: 1.3 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
45,10 → 45,10
// +------------------------------------------------------------------------------------------------------+
 
/** <BR> Inclusion de la bibliothèque de fonctions de gestion du cache.*/
include_once './bibliotheque/fonctions/GEN_cache.fonct.php';
include_once './bibliotheque/fonctions/pap_cache.fonct.php';
 
/** <BR> Inclusion de la bibliothèque de fonctions de compression des données à envoyer.*/
include_once './bibliotheque/fonctions/GEN_compression.fonct.php';
include_once './bibliotheque/fonctions/pap_compression.fonct.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
105,6 → 105,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/02/28 11:20:42 jpm
* Modification des auteurs.
*
* Revision 1.1 2004/06/16 08:11:01 jpm
* Changement de nom de Génésia en Papyrus.
* Changement de l'arborescence.
/trunk/papyrus/pap_connecte_bdd.inc.php
19,7 → 19,7
// | 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: pap_connecte_bdd.inc.php,v 1.2 2004-10-15 18:29:19 jpm Exp $
// CVS : $Id: pap_connecte_bdd.inc.php,v 1.3 2006-04-28 12:41:49 florian Exp $
/**
* Connection à la base de données et inclusions des classes générées par DataObject de Pear.
*
32,7 → 32,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $ $Date: 2004-10-15 18:29:19 $
*@version $Revision: 1.3 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
41,7 → 41,7
// +------------------------------------------------------------------------------------------------------+
 
/** <br> Inclusion de la classe PEAR d'abstraction de base de donnée. */
require_once 'DB.php';
require_once PAP_CHEMIN_API_PEAR.'DB.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
61,6 → 61,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2004/10/15 18:29:19 jpm
* Modif pour gérer l'appli installateur de Papyrus.
*
* Revision 1.1 2004/06/16 08:11:22 jpm
* Changement de nom de Génésia en Papyrus.
* Changement de l'arborescence.
/trunk/papyrus/applications/installateur/bibliotheque/instal_installation.fonct.php
19,7 → 19,7
// | 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: instal_installation.fonct.php,v 1.5 2005-09-23 14:20:23 florian Exp $
// CVS : $Id: instal_installation.fonct.php,v 1.6 2006-04-28 12:41:49 florian Exp $
/**
* Bibliothèque des fonctions de l'application Installateur de Papyrus.
*
33,7 → 33,7
//Autres auteurs :
*@author aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2005-09-23 14:20:23 $
*@version $Revision: 1.6 $ $Date: 2006-04-28 12:41:49 $
*/
 
// +------------------------------------------------------------------------------------------------------+
231,6 → 231,7
function retournerInfoRequete($sql)
{
$requete = array();
$resultat='';
if (preg_match('/(?i:CREATE TABLE) +(.+) +\(/', $sql, $resultat)) {
if (isset($resultat[1])) {
$requete['table_nom'] = $resultat[1];
330,7 → 331,10
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/09/23 14:20:23 florian
* nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.4 2004/10/25 16:26:56 jpm
* Ajout de la gestion des requêtes de type alter et update.
*
/trunk/papyrus/applications/admin_auth/bibliotheque/HTML_formulaireAuth.class.php
19,7 → 19,7
// | 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_formulaireAuth.class.php,v 1.3 2005-04-14 13:54:51 jpm Exp $
// CVS : $Id: HTML_formulaireAuth.class.php,v 1.4 2006-04-28 12:41:49 florian Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
42,9 → 42,9
 
/** 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' ;
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' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
/trunk/papyrus/applications/admin_application/bibliotheque/HTML_formulaireAppli.class.php
19,7 → 19,7
// | 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_formulaireAppli.class.php,v 1.2 2005-03-09 10:40:33 alex Exp $
// CVS : $Id: HTML_formulaireAppli.class.php,v 1.3 2006-04-28 12:41:49 florian Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $
*@version $Revision: 1.3 $
// +------------------------------------------------------------------------------------------------------+
*/
 
42,9 → 42,9
 
/** 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' ;
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' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE des constantes |
/trunk/papyrus/applications/admin_menu/bibliotheque/adme_general.fonct.php
32,7 → 32,7
// pris connaissance de la licence CeCILL, et que vous en avez accepté les
// termes.
// ----
// CVS : $Id: adme_general.fonct.php,v 1.15 2006-03-24 13:03:24 ddelon Exp $
// CVS : $Id: adme_general.fonct.php,v 1.16 2006-04-28 12:41:49 florian Exp $
/**
* Contient l'affichage par défaut de l'appli quand aucune actin
*
46,7 → 46,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.15 $ $Date: 2006-03-24 13:03:24 $
*@version $Revision: 1.16 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
395,7 → 395,7
$objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
$objet_pear_url_copie->addQueryString('adme_menu_id', 0);
$url_ajout_menu_classique_n1 = $objet_pear_url_copie->getURL();
unset($url_ajout_menu_n1);
//unset($url_ajout_menu_n1);
$retour .= '<a href="'.$url_ajout_menu_classique_n1.'" >'.
ADME_LG_MENU_CLASSIQUE_RACINE.'&nbsp;'.
'<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
411,7 → 411,7
$objet_pear_url_copie->addQueryString('adme_site_id', $adme_site_id);
$objet_pear_url_copie->addQueryString('adme_menu_id', 0);
$url_ajout_menu_commun_n1 = $objet_pear_url_copie->getURL();
unset($url_ajout_menu_n1);
//unset($url_ajout_menu_n1);
$retour .= '<a href="'.$url_ajout_menu_commun_n1.'">'.
ADME_LG_MENU_COMMUN_RACINE.'&nbsp;'.
'<img class="'.ADME_CLASS_IMG_ICONE.'" src="'.ADME_IMAGE_NOUVEAU.'" alt="+" />'.
429,6 → 429,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.15 2006/03/24 13:03:24 ddelon
* bug afficheur multilinguisme
*
* Revision 1.14 2006/03/23 20:24:59 ddelon
* *** empty log message ***
*
/trunk/papyrus/applications/afficheur/configuration/affi_configuration.inc.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: affi_configuration.inc.php,v 1.12 2005-08-25 08:59:12 ddelon Exp $
// CVS : $Id: affi_configuration.inc.php,v 1.13 2006-04-28 12:41:49 florian Exp $
/**
* Application réalisant l'affichage du contenu stocké dans Papyrus.
*
34,7 → 34,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.12 $ $Date: 2005-08-25 08:59:12 $
*@version $Revision: 1.13 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
50,7 → 50,7
/** Chemin vers la bibliothèque PEAR.*/
define('AFFI_CHEMIN_BIBLIOTHEQUE_PEAR', '');
/** Chemin vers la bibliothèque API.*/
define('AFFI_CHEMIN_BIBLIOTHEQUE_API', GEN_CHEMIN_API);
define('AFFI_CHEMIN_BIBLIOTHEQUE_API', 'api'.GEN_SEP);
/** Chemin vers la bibliothèque API : fckeditor.*/
define('AFFI_CHEMIN_FCKEDITOR', AFFI_CHEMIN_BIBLIOTHEQUE_API.'fckeditor'.GEN_SEP);
/** Chemin vers l'application Admin de l'afficheur de Papyrus.*/
106,6 → 106,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.12 2005/08/25 08:59:12 ddelon
* Integrateur Wikini et administration des Wikini
*
* Revision 1.11 2005/08/18 10:20:04 ddelon
* Integrateur Wikini et Acces PEAR
*
/trunk/papyrus/applications/afficheur/afficheur.admin.php
19,7 → 19,7
// | 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: afficheur.admin.php,v 1.17 2006-03-27 13:42:32 ddelon Exp $
// CVS : $Id: afficheur.admin.php,v 1.18 2006-04-28 12:41:49 florian Exp $
/**
* Gestion de la rédaction du contenu pour Papyrus.
*
32,7 → 32,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.17 $ $Date: 2006-03-27 13:42:32 $
*@version $Revision: 1.18 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
345,8 → 345,7
$fckeditor->ToolbarSet = $GLOBALS['_AFFI_']['fckeditor']['barre'];
$fckeditor->Config['CustomConfigurationsPath']=$GLOBALS['_AFFI_']['fckeditor']['CustomConfigurationsPath'];
$fckeditor->Config['AutoDetectLanguage'] = false;
$fckeditor->Config['DefaultLanguage'] = $GLOBALS['_AFFI_']['fckeditor']['langue'];
$fckeditor->Config['DefaultLanguage'] = $GLOBALS['_AFFI_']['fckeditor']['langue'];
$fckeditor->BasePath = AFFI_CHEMIN_FCKEDITOR;
if ($fckeditor->IsCompatible()) {
$form->addElement('html', '<li>'.$fckeditor->CreateHtml().'</li>');
468,6 → 467,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.17 2006/03/27 13:42:32 ddelon
* the last but not the least
*
* Revision 1.16 2006/03/27 11:21:49 ddelon
* Still some pb
*
/trunk/papyrus/configuration/pap_config.inc.php
1,5 → 1,5
<?php
// pap_config.inc.php construit le Tue Mar 14 10:25:18 2006
// pap_config.inc.php construit le Thu Mar 16 16:20:56 2006
// ne changez pas la version de Papyrus manuellement!
 
define('PAP_VERSION','0.21');
10,7 → 10,7
 
define('PAP_BDD_UTILISATEUR','root');
 
define('PAP_BDD_MOT_DE_PASSE','');
define('PAP_BDD_MOT_DE_PASSE','fs1980');
 
define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);
 
20,7 → 20,7
 
define('PAP_FTP_UTILISATEUR','florian');
 
define('PAP_FTP_MOT_DE_PASSE','');
define('PAP_FTP_MOT_DE_PASSE','fs1980');
 
define('PAP_FTP_RACINE','/papyrus/');
 
31,4 → 31,4
define('PAP_URL_REECRITURE','');
 
 
?>
?>
/trunk/papyrus/configuration/pap_config_avancee.inc.php
22,7 → 22,7
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// | |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: pap_config_avancee.inc.php,v 1.19 2006-03-13 21:00:20 ddelon Exp $
// CVS : $Id: pap_config_avancee.inc.php,v 1.20 2006-04-28 12:41:49 florian Exp $
/**
* Page de configuration avancée de Papyrus
*
36,7 → 36,7
*@author Alexandre GRANIER <alex@tela-botanica.org>
*@author Laurent COUDOUNEAU <laurent.coudouneau@ema.fr>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.19 $ $Date: 2006-03-13 21:00:20 $
*@version $Revision: 1.20 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
44,6 → 44,7
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once 'pap_config.inc.php';
// +------------------------------------------------------------------------------------------------------+
// Paramétrage du mode d'écriture des fichiers sur le serveur
/** Booléen permetant de savoir si on utilise ou pas le ftp. */
118,7 → 119,7
/** Séparateur dans les chemins d'accès aux fichiers.*/
define('GEN_SEP', '/');
/** Chemin relatif par rapport au fichier papyrus.php vers le dossier contenant les fichiers des api.*/
define('GEN_CHEMIN_API', 'api'.GEN_SEP);
define('GEN_CHEMIN_API', PAP_CHEMIN_RACINE.'api'.GEN_SEP);
/** Chemin relatif par rapport au fichier papyrus.php vers le dossier contenant les fichiers des api.*/
define('PAP_CHEMIN_API_PEAR', GEN_CHEMIN_API.'pear'.GEN_SEP);
/** Chemin relatif par rapport au fichier papyrus.php vers le dossier contenant le reste de l'application Papyrus.*/
199,6 → 200,9
);
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.19 2006/03/13 21:00:20 ddelon
* Suppression messages d'erreur multilinguisme
*
* Revision 1.18 2006/03/02 10:49:49 ddelon
* Fusion branche multilinguisme dans branche principale
*
/trunk/papyrus/pap_initialise_auth.inc.php
21,7 → 21,7
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// | |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: pap_initialise_auth.inc.php,v 1.20 2006-03-15 09:30:50 florian Exp $
// CVS : $Id: pap_initialise_auth.inc.php,v 1.21 2006-04-28 12:41:49 florian Exp $
/**
* Initialisation de l'authentification.
*
37,7 → 37,7
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.20 $ $Date: 2006-03-15 09:30:50 $
*@version $Revision: 1.21 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
46,7 → 46,7
// +------------------------------------------------------------------------------------------------------+
 
/** <br> Inclusion de l'authentification de PEAR.*/
include_once 'Auth/Auth.php';
include_once PAP_CHEMIN_API_PEAR.'Auth/Auth.php';
 
/** Inclusion de la bibliothèque de fonctions d'identification.
* Contient entre autre la fonction founissant le formulaire d'identification pour Auth de Pear.
277,10 → 277,10
setcookie('spip_session', $id_session, time() + 3600 * 24 * 30, "/$chemin_cookie_spip/") ;
}
set_include_path(get_include_path().':'.$chemin_spip);
//set_include_path(get_include_path().':'.$chemin_spip);
include_once 'ecrire/inc_db_mysql.php3';
include_once 'ecrire/inc_version.php3';
include_once $chemin_spip.'ecrire/inc_db_mysql.php3';
include_once $chemin_spip.'ecrire/inc_version.php3';
ob_flush();// Nécessaire car spip utilise un ob_start() et cela cause un plantage
include_ecrire ('inc_meta.php3');
310,6 → 310,9
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.20 2006/03/15 09:30:50 florian
* suppression des echos, qui entrainaient des problemes d'affichages
*
* Revision 1.19 2005/09/20 17:01:22 ddelon
* php5 et bugs divers
*
/trunk/papyrus/bibliotheque/fonctions/pap_application.fonct.php
21,7 → 21,7
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: pap_application.fonct.php,v 1.2 2005-02-28 11:12:03 jpm Exp $
// CVS : $Id: pap_application.fonct.php,v 1.3 2006-04-28 12:41:49 florian Exp $
/**
* Biblibothèque de fonction sur les applications.
*
34,7 → 34,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $ $Date: 2005-02-28 11:12:03 $
*@version $Revision: 1.3 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
122,6 → 122,7
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
$chemin_appli = $ligne_appli->gap_chemin;
$morceaux='';
preg_match('/([\w_]+).php$/', $chemin_appli, $morceaux);
$nom_interface_admin = ucfirst($morceaux[1]).'_Admin';
return $nom_interface_admin;
145,6 → 146,7
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
$chemin_appli = $ligne_appli->gap_chemin;
$morceaux='';
preg_match('/([\w_]+).php$/', $chemin_appli, $morceaux);
preg_replace('/_(\w)/', '_'.ucfirst(${1}),$morceaux[1]);
$nom_classe_appli = $morceaux[1];
203,6 → 205,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2005/02/28 11:12:03 jpm
* Modification des auteurs.
*
* Revision 1.1 2004/11/09 17:54:50 jpm
* Ajout de fonction permettant de manipuler les informations liées aux applications.
*
/trunk/papyrus/bibliotheque/fonctions/pap_meta.fonct.php
19,7 → 19,7
// | 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: pap_meta.fonct.php,v 1.3 2004-12-06 19:45:45 jpm Exp $
// CVS : $Id: pap_meta.fonct.php,v 1.4 2006-04-28 12:41:49 florian Exp $
/**
* Bibliothèque de fonctions permettant d'inclure des balises META.
*
34,7 → 34,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.3 $ $Date: 2004-12-06 19:45:45 $
*@version $Revision: 1.4 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
269,7 → 269,7
}
} else {
die('ERREUR Papyrus : le type de balise est incorrect. <br />'.
'Contenu : '. $content .'<br />'.
'Contenu : <br />'.
'Ligne n° : '. __LINE__ .'<br />'.
'Fichier : '. __FILE__);
}
278,6 → 278,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2004/12/06 19:45:45 jpm
* Ajout d'une fonction permettant de vider les tableaux des meta.
*
* Revision 1.2 2004/12/06 17:58:02 jpm
* Ajout de fonctions permettant de modifier le contenu des balises meta : http-equiv, name et name DC.
*
/trunk/papyrus/pap_verification.inc.php
19,7 → 19,7
// | 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: pap_verification.inc.php,v 1.7 2006-03-15 09:30:50 florian Exp $
// CVS : $Id: pap_verification.inc.php,v 1.8 2006-04-28 12:41:49 florian Exp $
/**
* Réalisation de la vérification des besoins de Papyrus.
*
31,7 → 31,7
//Autres auteurs :
*@author Laurent COUDOUNEAU <lc@gsite.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $ $Date: 2006-03-15 09:30:50 $
*@version $Revision: 1.8 $ $Date: 2006-04-28 12:41:49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
54,7 → 54,7
 
/** Inclusion du fichier de configuration avancée
** Ajout du fichier de configuration avancée de de Papyrus contenant les chemins des fichiers.*/
include_once 'papyrus/configuration/pap_config_avancee.inc.php';
include_once 'configuration/pap_config_avancee.inc.php';
 
// Gestion du fichier de config par défaut permettant de savoir si l'installation a été faite ou pas
if (file_exists($chemin_fichier_config_defaut)) {
85,6 → 85,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.7 2006/03/15 09:30:50 florian
* suppression des echos, qui entrainaient des problemes d'affichages
*
* Revision 1.6 2005/09/20 17:01:22 ddelon
* php5 et bugs divers
*
/trunk/api/html/HTML_TableFragmenteur.php
19,7 → 19,7
// | 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_TableFragmenteur.php,v 1.1 2004-12-07 11:54:22 alex Exp $
// CVS : $Id: HTML_TableFragmenteur.php,v 1.2 2006-04-28 12:41:26 florian Exp $
/**
* Classe qui permet de créer des tables de résultat divisé en page
*
30,7 → 30,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
*@version $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
40,7 → 40,7
// +------------------------------------------------------------------------------------------------------+
 
 
include_once 'HTML/Table.php' ;
include_once PAP_CHEMIN_API_PEAR.'HTML/Table.php' ;
 
/**
* class HTML_Liste
/trunk/api/text/wiki_papyrus/Render/Xhtml/Inclure.php
53,7 → 53,9
$output = '';
$contenu = file_get_contents($href);
$tab_matches='';
preg_match($this->conf['sites'][$site]['preg'], $contenu, $tab_matches);
$tab_encodage='';
preg_match('/<meta +http-equiv="Content-Type" +content="text\/html; *charset=(.+)"\/>/Ui', $contenu, $tab_encodage);
if (preg_match('/^(?:iso-8859-1|iso-8859-15)$/i', $this->conf['encodage']) && preg_match('/utf-8/i', $tab_encodage[1])) {
$output = utf8_decode($tab_matches[1]);
/trunk/api/text/wiki_papyrus/Render/Xhtml/Categorie.php
86,43 → 86,30
switch ($mois_numerique) {
case '01' :
return 'janvier';
break;
case '02' :
return 'février';
break;
case '03' :
return 'mars';
break;
case '04' :
return 'avril';
break;
case '05' :
return 'mai';
break;
case '06' :
return 'juin';
break;
case '07' :
return 'juillet';
break;
case '08' :
return 'août';
break;
case '09' :
return 'septembre';
break;
case '10' :
return 'octobre';
break;
case '11' :
return 'novembre';
break;
case '12' :
return 'décembre';
break;
default:
return '';
break;
}
}
}
/trunk/api/text/wiki_papyrus/Render/Xhtml/Syndication.php
28,7 → 28,7
$tab_url = array_map('trim', explode(',', $urls));
foreach ($tab_url as $cle => $url) {
$url = str_replace('&amp;', '&', $url) ;
$sortie .= voir_rss($titre, $url, $nblimite, $nouvellefenetre, $formatdate);
$sortie .= voir_rss($titre, $url, $nblimite, $nouvellefenetre, $formatdate);
}
return $sortie;
}
/trunk/api/text/wiki_papyrus/Render/Xhtml/Motcles.php
108,43 → 108,30
switch ($mois_numerique) {
case '01' :
return 'janvier';
break;
case '02' :
return 'février';
break;
case '03' :
return 'mars';
break;
case '04' :
return 'avril';
break;
case '05' :
return 'mai';
break;
case '06' :
return 'juin';
break;
case '07' :
return 'juillet';
break;
case '08' :
return 'août';
break;
case '09' :
return 'septembre';
break;
case '10' :
return 'octobre';
break;
case '11' :
return 'novembre';
break;
case '12' :
return 'décembre';
break;
default:
return '';
break;
}
}
}
/trunk/api/text/wiki_papyrus/Render/Xhtml/Nouveaute.php
134,43 → 134,30
switch ($mois_numerique) {
case '01' :
return 'janvier';
break;
case '02' :
return 'février';
break;
case '03' :
return 'mars';
break;
case '04' :
return 'avril';
break;
case '05' :
return 'mai';
break;
case '06' :
return 'juin';
break;
case '07' :
return 'juillet';
break;
case '08' :
return 'août';
break;
case '09' :
return 'septembre';
break;
case '10' :
return 'octobre';
break;
case '11' :
return 'novembre';
break;
case '12' :
return 'décembre';
break;
default:
return '';
break;
}
}
}
/trunk/api/text/wiki_wikini/Parse/Table.php
1,5 → 1,5
<?php
// $Id: Table.php,v 1.2 2004-11-25 15:36:19 jpm Exp $
// $Id: Table.php,v 1.3 2006-04-28 12:41:27 florian Exp $
 
 
/**
100,6 → 100,7
}
// Les attributs de la ligne
$morceaux='';
if (preg_match('/^!(.*)!$/U', $cell[0], $morceaux)) {
$attr = $morceaux[1];
} else {
/trunk/api/text/wiki_wikini/Render/Xhtml/Table.php
27,7 → 27,10
{
// make nice variable names (type, attr, span)
extract($options);
if (!isset($span)) $span=1;
if (!isset($type)) $type='';
if (!isset($attr)) $attr='';
 
$pad = ' ';
switch ($type) {
35,20 → 38,15
case 'table_start':
$css = $this->formatConf(' class="%s"', 'css_table');
return "\n\n".'<table'.$css.' '.trim($attr).'>'."\n";
break;
case 'table_end':
return "</table>\n\n";
break;
case 'row_start':
$css = $this->formatConf(' class="%s"', 'css_tr');
return "$pad<tr$css $attr>\n";
break;
case 'row_end':
return "$pad</tr>\n";
break;
case 'cell_start':
79,7 → 77,6
// done!
$html .= '>';
return $html;
break;
case 'cell_end':
if ($attr == 'header') {
87,7 → 84,6
} else {
return "</td>\n";
}
break;
default:
return '';
/trunk/api/pear/HTML/QuickForm.php
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/api/pear/HTML/Template/ITX.php
New file
0,0 → 1,809
<?php
//
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 Ulf Wendel, Pierre-Alain Joye |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled |
// | with this package in the file LICENSE, and is available through |
// | the world-wide-web at |
// | http://www.opensource.org/licenses/bsd-license.php |
// | If you did not receive a copy of the new BSD license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | pajoye@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Ulf Wendel <ulf.wendel@phpdoc.de> |
// | Pierre-Alain Joye <pajoye@php.net> |
// +----------------------------------------------------------------------+
//
// $Id$
//
 
require_once 'HTML/Template/IT.php';
require_once 'HTML/Template/IT_Error.php';
 
/**
* Integrated Template Extension - ITX
*
* With this class you get the full power of the phplib template class.
* You may have one file with blocks in it but you have as well one main file
* and multiple files one for each block. This is quite usefull when you have
* user configurable websites. Using blocks not in the main template allows
* you to modify some parts of your layout easily.
*
* Note that you can replace an existing block and add new blocks at runtime.
* Adding new blocks means changing a variable placeholder to a block.
*
* @author Ulf Wendel <uw@netuse.de>
* @access public
* @version $Id$
* @package IT[X]
*/
class HTML_Template_ITX extends HTML_Template_IT
{
/**
* Array with all warnings.
* @var array
* @access public
* @see $printWarning, $haltOnWarning, warning()
*/
var $warn = array();
 
/**
* Print warnings?
* @var array
* @access public
* @see $haltOnWarning, $warn, warning()
*/
var $printWarning = false;
 
/**
* Call die() on warning?
* @var boolean
* @access public
* @see $warn, $printWarning, warning()
*/
var $haltOnWarning = false;
 
/**
* RegExp used to test for a valid blockname.
* @var string
*/
var $checkblocknameRegExp = '';
 
/**
* Functionnameprefix used when searching function calls in the template.
* @var string
*/
var $functionPrefix = 'func_';
 
/**
* Functionname RegExp.
* @var string
*/
var $functionnameRegExp = '[_a-zA-Z]+[A-Za-z_0-9]*';
 
/**
* RegExp used to grep function calls in the template.
*
* The variable gets set by the constructor.
*
* @var string
* @see HTML_Template_IT()
*/
var $functionRegExp = '';
 
/**
* List of functions found in the template.
*
* @var array
*/
var $functions = array();
 
/**
* List of callback functions specified by the user.
*
* @var array
*/
var $callback = array();
 
/**
* Builds some complex regexps and calls the constructor
* of the parent class.
*
* Make sure that you call this constructor if you derive your own
* template class from this one.
*
* @see HTML_Template_IT()
*/
function HTML_Template_ITX($root = '')
{
 
$this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@';
$this->functionRegExp = '@' . $this->functionPrefix . '(' .
$this->functionnameRegExp . ')\s*\(@sm';
 
$this->HTML_Template_IT($root);
} // end func constructor
 
function init()
{
$this->free();
$this->buildFunctionlist();
$this->findBlocks($this->template);
// we don't need it any more
$this->template = '';
$this->buildBlockvariablelist();
 
} // end func init
 
/**
* Replaces an existing block with new content.
*
* This function will replace a block of the template and all blocks
* contained in the replaced block and add a new block insted, means
* you can dynamically change your template.
*
* Note that changing the template structure violates one of the IT[X]
* development goals. I've tried to write a simple to use template engine
* supporting blocks. In contrast to other systems IT[X] analyses the way
* you've nested blocks and knows which block belongs into another block.
* The nesting information helps to make the API short and simple. Replacing
* blocks does not only mean that IT[X] has to update the nesting
* information (relatively time consumpting task) but you have to make sure
* that you do not get confused due to the template change itself.
*
* @param string Blockname
* @param string Blockcontent
* @param boolean true if the new block inherits the content
* of the old block
* @return boolean
* @throws IT_Error
* @see replaceBlockfile(), addBlock(), addBlockfile()
* @access public
*/
function replaceBlock($block, $template, $keep_content = false)
{
if (!isset($this->blocklist[$block])) {
return new IT_Error(
"The block "."'$block'".
" does not exist in the template and thus it can't be replaced.",
__FILE__, __LINE__
);
}
 
if ($template == '') {
return new IT_Error('No block content given.', __FILE__, __LINE__);
}
 
if ($keep_content) {
$blockdata = $this->blockdata[$block];
}
 
// remove all kinds of links to the block / data of the block
$this->removeBlockData($block);
 
$template = "<!-- BEGIN $block -->" . $template . "<!-- END $block -->";
$parents = $this->blockparents[$block];
$this->findBlocks($template);
$this->blockparents[$block] = $parents;
 
// KLUDGE: rebuild the list for all block - could be done faster
$this->buildBlockvariablelist();
 
if ($keep_content) {
$this->blockdata[$block] = $blockdata;
}
 
// old TODO - I'm not sure if we need this
// update caches
 
return true;
} // end func replaceBlock
 
/**
* Replaces an existing block with new content from a file.
*
* @brother replaceBlock()
* @param string Blockname
* @param string Name of the file that contains the blockcontent
* @param boolean true if the new block inherits the content of the old block
*/
function replaceBlockfile($block, $filename, $keep_content = false)
{
return $this->replaceBlock($block, $this->getFile($filename), $keep_content);
} // end func replaceBlockfile
 
/**
* Adds a block to the template changing a variable placeholder
* to a block placeholder.
*
* Add means "replace a variable placeholder by a new block".
* This is different to PHPLibs templates. The function loads a
* block, creates a handle for it and assigns it to a certain
* variable placeholder. To to the same with PHPLibs templates you would
* call set_file() to create the handle and parse() to assign the
* parsed block to a variable. By this PHPLibs templates assume
* that you tend to assign a block to more than one one placeholder.
* To assign a parsed block to more than only the placeholder you specify
* in this function you have to use a combination of getBlock()
* and setVariable().
*
* As no updates to cached data is necessary addBlock() and addBlockfile()
* are rather "cheap" meaning quick operations.
*
* The block content must not start with <!-- BEGIN blockname -->
* and end with <!-- END blockname --> this would cause overhead and
* produce an error.
*
* @param string Name of the variable placeholder, the name must be unique
* within the template.
* @param string Name of the block to be added
* @param string Content of the block
* @return boolean
* @throws IT_Error
* @see addBlockfile()
* @access public
*/
function addBlock($placeholder, $blockname, $template)
{
// Don't trust any user even if it's a programmer or yourself...
if ($placeholder == '') {
return new IT_Error('No variable placeholder given.',
__FILE__, __LINE__
);
} elseif ($blockname == '' ||
!preg_match($this->checkblocknameRegExp, $blockname)
) {
return new IT_Error("No or invalid blockname '$blockname' given.",
__FILE__, __LINE__
);
} elseif ($template == '') {
return new IT_Error('No block content given.', __FILE__, __LINE__);
} elseif (isset($this->blocklist[$blockname])) {
return new IT_Error('The block already exists.',
__FILE__, __LINE__
);
}
 
// find out where to insert the new block
$parents = $this->findPlaceholderBlocks($placeholder);
if (count($parents) == 0) {
 
return new IT_Error(
"The variable placeholder".
" '$placeholder' was not found in the template.",
__FILE__, __LINE__
);
 
} elseif (count($parents) > 1) {
 
reset($parents);
while (list($k, $parent) = each($parents)) {
$msg .= "$parent, ";
}
$msg = substr($parent, -2);
 
return new IT_Error("The variable placeholder "."'$placeholder'".
" must be unique, found in multiple blocks '$msg'.",
__FILE__, __LINE__
);
}
 
$template = "<!-- BEGIN $blockname -->" . $template . "<!-- END $blockname -->";
$this->findBlocks($template);
if ($this->flagBlocktrouble) {
return false; // findBlocks() already throws an exception
}
$this->blockinner[$parents[0]][] = $blockname;
$this->blocklist[$parents[0]] = preg_replace(
'@' . $this->openingDelimiter . $placeholder .
$this->closingDelimiter . '@',
 
$this->openingDelimiter . '__' . $blockname . '__' .
$this->closingDelimiter,
 
$this->blocklist[$parents[0]]
);
 
$this->deleteFromBlockvariablelist($parents[0], $placeholder);
$this->updateBlockvariablelist($blockname);
/*
// check if any inner blocks were found
if(is_array($this->blockinner[$blockname]) and count($this->blockinner[$blockname]) > 0) {
// loop through inner blocks, registering the variable placeholders in each
foreach($this->blockinner[$blockname] as $childBlock) {
$this->updateBlockvariablelist($childBlock);
}
}
*/
return true;
} // end func addBlock
 
/**
* Adds a block taken from a file to the template changing a variable
* placeholder to a block placeholder.
*
* @param string Name of the variable placeholder to be converted
* @param string Name of the block to be added
* @param string File that contains the block
* @brother addBlock()
*/
function addBlockfile($placeholder, $blockname, $filename)
{
return $this->addBlock($placeholder, $blockname, $this->getFile($filename));
} // end func addBlockfile
 
/**
* Returns the name of the (first) block that contains
* the specified placeholder.
*
* @param string Name of the placeholder you're searching
* @param string Name of the block to scan. If left out (default)
* all blocks are scanned.
* @return string Name of the (first) block that contains
* the specified placeholder.
* If the placeholder was not found or an error occured
* an empty string is returned.
* @throws IT_Error
* @access public
*/
function placeholderExists($placeholder, $block = '')
{
if ($placeholder == '') {
new IT_Error('No placeholder name given.', __FILE__, __LINE__);
return '';
}
 
if ($block != '' && !isset($this->blocklist[$block])) {
new IT_Error("Unknown block '$block'.", __FILE__, __LINE__);
return '';
}
 
// name of the block where the given placeholder was found
$found = '';
 
if ($block != '') {
if (is_array($variables = $this->blockvariables[$block])) {
// search the value in the list of blockvariables
reset($variables);
while (list($k, $variable) = each($variables)) {
if ($k == $placeholder) {
$found = $block;
break;
}
}
}
} else {
 
// search all blocks and return the name of the first block that
// contains the placeholder
reset($this->blockvariables);
while (list($blockname, $variables) = each($this->blockvariables)){
if (is_array($variables) && isset($variables[$placeholder])) {
$found = $blockname;
break;
}
}
}
 
return $found;
} // end func placeholderExists
 
/**
* Checks the list of function calls in the template and
* calls their callback function.
*
* @access public
*/
function performCallback()
{
reset($this->functions);
while (list($func_id, $function) = each($this->functions)) {
if (isset($this->callback[$function['name']])) {
if ($this->callback[$function['name']]['object'] != '') {
$this->variableCache['__function' . $func_id . '__'] =
call_user_func(
array(
&$GLOBALS[$this->callback[$function['name']]['object']],
$this->callback[$function['name']]['function']),
$function['args']
);
} else {
$this->variableCache['__function' . $func_id . '__'] =
call_user_func(
$this->callback[$function['name']]['function'],
$function['args']
);
}
}
}
 
} // end func performCallback
 
/**
* Returns a list of all function calls in the current template.
*
* @return array
* @access public
*/
function getFunctioncalls()
{
return $this->functions;
} // end func getFunctioncalls
 
/**
* Replaces a function call with the given replacement.
*
* @param int Function ID
* @param string Replacement
* @deprec
*/
function setFunctioncontent($functionID, $replacement)
{
$this->variableCache['__function' . $functionID . '__'] = $replacement;
} // end func setFunctioncontent
 
/**
* Sets a callback function.
*
* IT[X] templates (note the X) can contain simple function calls.
* "function call" means that the editor of the template can add
* special placeholder to the template like 'func_h1("embedded in h1")'.
* IT[X] will grab this function calls and allow you to define a callback
* function for them.
*
* This is an absolutely evil feature. If your application makes heavy
* use of such callbacks and you're even implementing if-then etc. on
* the level of a template engine you're reiventing the wheel... - that's
* actually how PHP came into life. Anyway, sometimes it's handy.
*
* Consider also using XML/XSLT or native PHP. And please do not push
* IT[X] any further into this direction of adding logics to the template
* engine.
*
* For those of you ready for the X in IT[X]:
*
* <?php
* ...
* function h_one($args) {
* return sprintf('<h1>%s</h1>', $args[0]);
* }
*
* ...
* $itx = new HTML_Template_ITX( ... );
* ...
* $itx->setCallbackFunction('h1', 'h_one');
* $itx->performCallback();
* ?>
*
* template:
* func_h1('H1 Headline');
*
* @param string Function name in the template
* @param string Name of the callback function
* @param string Name of the callback object
* @return boolean False on failure.
* @throws IT_Error
* @access public
*/
function
setCallbackFunction($tplfunction, $callbackfunction, $callbackobject = '')
{
if ($tplfunction == '' || $callbackfunction == '') {
return new IT_Error(
"No template function "."('$tplfunction')".
" and/or no callback function ('$callback') given.",
__FILE__, __LINE__
);
}
$this->callback[$tplfunction] = array(
'function' => $callbackfunction,
'object' => $callbackobject
);
 
return true;
} // end func setCallbackFunction
 
/**
* Sets the Callback function lookup table
*
* @param array function table
* array[templatefunction] =
* array(
* "function" => userfunction,
* "object" => userobject
* )
* @access public
*/
function setCallbackFuntiontable($functions)
{
$this->callback = $functions;
} // end func setCallbackFunctiontable
 
/**
* Recursively removes all data assiciated with a block, including all inner blocks
*
* @param string block to be removed
*/
function removeBlockData($block)
{
if (isset($this->blockinner[$block])) {
foreach ($this->blockinner[$block] as $k => $inner) {
$this->removeBlockData($inner);
}
 
unset($this->blockinner[$block]);
}
 
unset($this->blocklist[$block]);
unset($this->blockdata[$block]);
unset($this->blockvariables[$block]);
unset($this->touchedBlocks[$block]);
 
} // end func removeBlockinner
 
/**
* Returns a list of blocknames in the template.
*
* @return array [blockname => blockname]
* @access public
* @see blockExists()
*/
function getBlocklist()
{
$blocklist = array();
foreach ($this->blocklist as $block => $content) {
$blocklist[$block] = $block;
}
 
return $blocklist;
} // end func getBlocklist
 
/**
* Checks wheter a block exists.
*
* @param string
* @return boolean
* @access public
* @see getBlocklist()
*/
function blockExists($blockname)
{
return isset($this->blocklist[$blockname]);
} // end func blockExists
 
/**
* Returns a list of variables of a block.
*
* @param string Blockname
* @return array [varname => varname]
* @access public
* @see BlockvariableExists()
*/
function getBlockvariables($block)
{
if (!isset($this->blockvariables[$block])) {
return array();
}
 
$variables = array();
foreach ($this->blockvariables[$block] as $variable => $v) {
$variables[$variable] = $variable;
}
 
return $variables;
} // end func getBlockvariables
 
/**
* Checks wheter a block variable exists.
*
* @param string Blockname
* @param string Variablename
* @return boolean
* @access public
* @see getBlockvariables()
*/
function BlockvariableExists($block, $variable)
{
return isset($this->blockvariables[$block][$variable]);
} // end func BlockvariableExists
 
/**
* Builds a functionlist from the template.
*/
function buildFunctionlist()
{
$this->functions = array();
 
$template = $this->template;
$num = 0;
 
while (preg_match($this->functionRegExp, $template, $regs)) {
 
$pos = strpos($template, $regs[0]);
$template = substr($template, $pos + strlen($regs[0]));
 
$head = $this->getValue($template, ')');
$args = array();
 
$search = $regs[0] . $head . ')';
 
$replace = $this->openingDelimiter .
'__function' . $num . '__' .
$this->closingDelimiter;
 
$this->template = str_replace($search, $replace, $this->template);
$template = str_replace($search, $replace, $template);
 
while ($head != '' && $args2 = $this->getValue($head, ',')) {
$arg2 = trim($args2);
$args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ?
substr($arg2, 1, -1) : $arg2;
if ($arg2 == $head) {
break;
}
$head = substr($head, strlen($arg2) + 1);
}
 
$this->functions[$num++] = array(
'name' => $regs[1],
'args' => $args
);
}
 
} // end func buildFunctionlist
 
function getValue($code, $delimiter) {
if ($code == '') {
return '';
}
 
if (!is_array($delimiter)) {
$delimiter = array( $delimiter => true );
}
 
$len = strlen($code);
$enclosed = false;
$enclosed_by = '';
 
if (isset($delimiter[$code[0]])) {
$i = 1;
} else {
for ($i = 0; $i < $len; ++$i) {
$char = $code[$i];
 
if (
($char == '"' || $char = "'") &&
($char == $enclosed_by || '' == $enclosed_by) &&
(0 == $i || ($i > 0 && '\\' != $code[$i - 1]))
) {
 
if (!$enclosed) {
$enclosed_by = $char;
} else {
$enclosed_by = "";
}
$enclosed = !$enclosed;
 
}
 
if (!$enclosed && isset($delimiter[$char])) {
break;
}
}
}
 
return substr($code, 0, $i);
} // end func getValue
 
/**
* Deletes one or many variables from the block variable list.
*
* @param string Blockname
* @param mixed Name of one variable or array of variables
* ( array ( name => true ) ) to be stripped.
*/
function deleteFromBlockvariablelist($block, $variables)
{
if (!is_array($variables)) {
$variables = array($variables => true);
}
 
reset($this->blockvariables[$block]);
while (list($varname, $val) = each($this->blockvariables[$block])) {
if (isset($variables[$varname])) {
unset($this->blockvariables[$block][$varname]);
}
}
} // end deleteFromBlockvariablelist
 
/**
* Updates the variable list of a block.
*
* @param string Blockname
*/
function updateBlockvariablelist($block)
{
preg_match_all( $this->variablesRegExp,
$this->blocklist[$block], $regs
);
 
if (count($regs[1]) != 0) {
foreach ($regs[1] as $k => $var) {
$this->blockvariables[$block][$var] = true;
}
} else {
$this->blockvariables[$block] = array();
}
 
// check if any inner blocks were found
if (isset($this->blockinner[$block]) &&
is_array($this->blockinner[$block]) &&
count($this->blockinner[$block]) > 0
) {
/*
* loop through inner blocks, registering the variable
* placeholders in each
*/
foreach ($this->blockinner[$block] as $childBlock) {
$this->updateBlockvariablelist($childBlock);
}
}
} // end func updateBlockvariablelist
 
/**
* Returns an array of blocknames where the given variable
* placeholder is used.
*
* @param string Variable placeholder
* @return array $parents parents[0..n] = blockname
*/
function findPlaceholderBlocks($variable)
{
$parents = array();
reset($this->blocklist);
while (list($blockname, $content) = each($this->blocklist)) {
reset($this->blockvariables[$blockname]);
while (
list($varname, $val) = each($this->blockvariables[$blockname]))
{
if ($variable == $varname) {
$parents[] = $blockname;
}
}
}
 
return $parents;
} // end func findPlaceholderBlocks
 
/**
* Handles warnings, saves them to $warn and prints them or
* calls die() depending on the flags
*
* @param string Warning
* @param string File where the warning occured
* @param int Linenumber where the warning occured
* @see $warn, $printWarning, $haltOnWarning
*/
function warning($message, $file = '', $line = 0)
{
$message = sprintf(
'HTML_Template_ITX Warning: %s [File: %s, Line: %d]',
$message,
$file,
$line
);
 
$this->warn[] = $message;
 
if ($this->printWarning) {
print $message;
}
 
if ($this->haltOnWarning) {
die($message);
}
} // end func warning
 
} // end class HTML_Template_ITX
?>
/trunk/api/pear/HTML/Template/IT_Error.php
New file
0,0 → 1,51
<?php
//
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 Ulf Wendel, Pierre-Alain Joye |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled |
// | with this package in the file LICENSE, and is available through |
// | the world-wide-web at |
// | http://www.opensource.org/licenses/bsd-license.php |
// | If you did not receive a copy of the new BSD license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | pajoye@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Ulf Wendel <ulf.wendel@phpdoc.de> |
// | Pierre-Alain Joye <pajoye@php.net> |
// +----------------------------------------------------------------------+
//
// $Id$
 
require_once "PEAR.php";
 
/**
* IT[X] Error class
*
* @package IT[X]
*/
class IT_Error extends PEAR_Error {
 
 
/**
* Prefix of all error messages.
*
* @var string
*/
var $error_message_prefix = "IntegratedTemplate Error: ";
/**
* Creates an cache error object.
*
* @param string error message
* @param string file where the error occured
* @param string linenumber where the error occured
*/
function IT_Error($msg, $file = __FILE__, $line = __LINE__) {
$this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line));
} // end func IT_Error
} // end class IT_Error
?>
/trunk/api/pear/HTML/Template/IT.php
New file
0,0 → 1,990
<?php
//
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 Ulf Wendel, Pierre-Alain Joye |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled |
// | with this package in the file LICENSE, and is available through |
// | the world-wide-web at |
// | http://www.opensource.org/licenses/bsd-license.php |
// | If you did not receive a copy of the new BSDlicense and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | pajoye@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Ulf Wendel <ulf.wendel@phpdoc.de> |
// | Pierre-Alain Joye <pajoye@php.net> |
// +----------------------------------------------------------------------+
//
// $Id$
//
 
require_once 'PEAR.php';
 
define('IT_OK', 1);
define('IT_ERROR', -1);
define('IT_TPL_NOT_FOUND', -2);
define('IT_BLOCK_NOT_FOUND', -3);
define('IT_BLOCK_DUPLICATE', -4);
define('IT_UNKNOWN_OPTION', -6);
/**
* Integrated Template - IT
*
* Well there's not much to say about it. I needed a template class that
* supports a single template file with multiple (nested) blocks inside and
* a simple block API.
*
* The Isotemplate API is somewhat tricky for a beginner although it is the best
* one you can build. template::parse() [phplib template = Isotemplate] requests
* you to name a source and a target where the current block gets parsed into.
* Source and target can be block names or even handler names. This API gives you
* a maximum of fexibility but you always have to know what you do which is
* quite unusual for php skripter like me.
*
* I noticed that I do not any control on which block gets parsed into which one.
* If all blocks are within one file, the script knows how they are nested and in
* which way you have to parse them. IT knows that inner1 is a child of block2, there's
* no need to tell him about this.
*
* <table border>
* <tr>
* <td colspan=2>
* __global__
* <p>
* (hidden and automatically added)
* </td>
* </tr>
* <tr>
* <td>block1</td>
* <td>
* <table border>
* <tr>
* <td colspan=2>block2</td>
* </tr>
* <tr>
* <td>inner1</td>
* <td>inner2</td>
* </tr>
* </table>
* </td>
* </tr>
* </table>
*
* To add content to block1 you simply type:
* <code>$tpl->setCurrentBlock("block1");</code>
* and repeat this as often as needed:
* <code>
* $tpl->setVariable(...);
* $tpl->parseCurrentBlock();
* </code>
*
* To add content to block2 you would type something like:
* <code>
* $tpl->setCurrentBlock("inner1");
* $tpl->setVariable(...);
* $tpl->parseCurrentBlock();
*
* $tpl->setVariable(...);
* $tpl->parseCurrentBlock();
*
* $tpl->parse("block1");
* </code>
*
* This will result in one repition of block1 which contains two repitions
* of inner1. inner2 will be removed if $removeEmptyBlock is set to true which is the default.
*
* Usage:
* <code>
* $tpl = new HTML_Template_IT( [string filerootdir] );
*
* // load a template or set it with setTemplate()
* $tpl->loadTemplatefile( string filename [, boolean removeUnknownVariables, boolean removeEmptyBlocks] )
*
* // set "global" Variables meaning variables not beeing within a (inner) block
* $tpl->setVariable( string variablename, mixed value );
*
* // like with the Isotemplates there's a second way to use setVariable()
* $tpl->setVariable( array ( string varname => mixed value ) );
*
* // Let's use any block, even a deeply nested one
* $tpl->setCurrentBlock( string blockname );
*
* // repeat this as often as you need it.
* $tpl->setVariable( array ( string varname => mixed value ) );
* $tpl->parseCurrentBlock();
*
* // get the parsed template or print it: $tpl->show()
* $tpl->get();
* </code>
*
* @author Ulf Wendel <uw@netuse.de>
* @version $Id$
* @access public
* @package HTML_Template_IT
*/
class HTML_Template_IT
{
/**
* Contains the error objects
* @var array
* @access public
* @see halt(), $printError, $haltOnError
*/
var $err = array();
 
/**
* Clear cache on get()?
* @var boolean
*/
var $clearCache = false;
 
/**
* First character of a variable placeholder ( _{_VARIABLE} ).
* @var string
* @access public
* @see $closingDelimiter, $blocknameRegExp, $variablenameRegExp
*/
var $openingDelimiter = '{';
 
/**
* Last character of a variable placeholder ( {VARIABLE_}_ ).
* @var string
* @access public
* @see $openingDelimiter, $blocknameRegExp, $variablenameRegExp
*/
var $closingDelimiter = '}';
 
/**
* RegExp matching a block in the template.
* Per default "sm" is used as the regexp modifier, "i" is missing.
* That means a case sensitive search is done.
* @var string
* @access public
* @see $variablenameRegExp, $openingDelimiter, $closingDelimiter
*/
var $blocknameRegExp = '[0-9A-Za-z_-]+';
 
/**
* RegExp matching a variable placeholder in the template.
* Per default "sm" is used as the regexp modifier, "i" is missing.
* That means a case sensitive search is done.
* @var string
* @access public
* @see $blocknameRegExp, $openingDelimiter, $closingDelimiter
*/
var $variablenameRegExp = '[0-9A-Za-z_-]+';
 
/**
* RegExp used to find variable placeholder, filled by the constructor.
* @var string Looks somewhat like @(delimiter varname delimiter)@
* @access public
* @see IntegratedTemplate()
*/
var $variablesRegExp = '';
 
/**
* RegExp used to strip unused variable placeholder.
* @brother $variablesRegExp
*/
var $removeVariablesRegExp = '';
 
/**
* Controls the handling of unknown variables, default is remove.
* @var boolean
* @access public
*/
var $removeUnknownVariables = true;
 
/**
* Controls the handling of empty blocks, default is remove.
* @var boolean
* @access public
*/
var $removeEmptyBlocks = true;
 
/**
* RegExp used to find blocks an their content, filled by the constructor.
* @var string
* @see IntegratedTemplate()
*/
var $blockRegExp = '';
 
/**
* Name of the current block.
* @var string
*/
var $currentBlock = '__global__';
 
/**
* Content of the template.
* @var string
*/
var $template = '';
 
/**
* Array of all blocks and their content.
*
* @var array
* @see findBlocks()
*/
var $blocklist = array();
 
/**
* Array with the parsed content of a block.
*
* @var array
*/
var $blockdata = array();
 
/**
* Array of variables in a block.
* @var array
*/
var $blockvariables = array();
 
/**
* Array of inner blocks of a block.
* @var array
*/
var $blockinner = array();
 
/**
* List of blocks to preverse even if they are "empty".
*
* This is something special. Sometimes you have blocks that
* should be preserved although they are empty (no placeholder replaced).
* Think of a shopping basket. If it's empty you have to drop a message to
* the user. If it's filled you have to show the contents of
* the shopping baseket. Now where do you place the message that the basket
* is empty? It's no good idea to place it in you applications as customers
* tend to like unecessary minor text changes. Having another template file
* for an empty basket means that it's very likely that one fine day
* the filled and empty basket templates have different layout. I decided
* to introduce blocks that to not contain any placeholder but only
* text such as the message "Your shopping basked is empty".
*
* Now if there is no replacement done in such a block the block will
* be recognized as "empty" and by default ($removeEmptyBlocks = true) be
* stripped off. To avoid thisyou can now call touchBlock() to avoid this.
*
* The array $touchedBlocks stores a list of touched block which must not
* be removed even if they are empty.
*
* @var array $touchedBlocks
* @see touchBlock(), $removeEmptyBlocks
*/
var $touchedBlocks = array();
 
/**
* List of blocks which should not be shown even if not "empty"
* @var array $_hiddenBlocks
* @see hideBlock(), $removeEmptyBlocks
*/
var $_hiddenBlocks = array();
 
/**
* Variable cache.
*
* Variables get cached before any replacement is done.
* Advantage: empty blocks can be removed automatically.
* Disadvantage: might take some more memory
*
* @var array
* @see setVariable(), $clearCacheOnParse
*/
var $variableCache = array();
 
/**
* Clear the variable cache on parse?
*
* If you're not an expert just leave the default false.
* True reduces memory consumption somewhat if you tend to
* add lots of values for unknown placeholder.
*
* @var boolean
*/
var $clearCacheOnParse = false;
 
/**
* Root directory for all file operations.
* The string gets prefixed to all filenames given.
* @var string
* @see HTML_Template_IT(), setRoot()
*/
var $fileRoot = '';
 
/**
* Internal flag indicating that a blockname was used multiple times.
* @var boolean
*/
var $flagBlocktrouble = false;
 
/**
* Flag indicating that the global block was parsed.
* @var boolean
*/
var $flagGlobalParsed = false;
 
/**
* EXPERIMENTAL! FIXME!
* Flag indication that a template gets cached.
*
* Complex templates require some times to be preparsed
* before the replacement can take place. Often I use
* one template file over and over again but I don't know
* before that I will use the same template file again.
* Now IT could notice this and skip the preparse.
*
* @var boolean
*/
var $flagCacheTemplatefile = true;
 
/**
* EXPERIMENTAL! FIXME!
*/
var $lastTemplatefile = '';
 
/**
* $_options['preserve_data'] Whether to substitute variables and remove
* empty placeholders in data passed through setVariable
* (see also bugs #20199, #21951).
* $_options['use_preg'] Whether to use preg_replace instead of
* str_replace in parse()
* (this is a backwards compatibility feature, see also bugs #21951, #20392)
*/
var $_options = array(
'preserve_data' => false,
'use_preg' => true
);
 
/**
* Builds some complex regular expressions and optinally sets the
* file root directory.
*
* Make sure that you call this constructor if you derive your template
* class from this one.
*
* @param string File root directory, prefix for all filenames
* given to the object.
* @see setRoot()
*/
function HTML_Template_IT($root = '', $options = null)
{
if (!is_null($options)) {
$this->setOptions($options);
}
$this->variablesRegExp = '@' . $this->openingDelimiter .
'(' . $this->variablenameRegExp . ')' .
$this->closingDelimiter . '@sm';
$this->removeVariablesRegExp = '@' . $this->openingDelimiter .
"\s*(" . $this->variablenameRegExp .
")\s*" . $this->closingDelimiter .'@sm';
 
$this->blockRegExp = '@<!--\s+BEGIN\s+(' . $this->blocknameRegExp .
')\s+-->(.*)<!--\s+END\s+\1\s+-->@sm';
 
$this->setRoot($root);
} // end constructor
 
 
/**
* Sets the option for the template class
*
* @access public
* @param string option name
* @param mixed option value
* @return mixed IT_OK on success, error object on failure
*/
function setOption($option, $value)
{
if (array_key_exists($option, $this->_options)) {
$this->_options[$option] = $value;
return IT_OK;
}
 
return PEAR::raiseError(
$this->errorMessage(IT_UNKNOWN_OPTION) . ": '{$option}'",
IT_UNKNOWN_OPTION
);
}
 
/**
* Sets the options for the template class
*
* @access public
* @param string options array of options
* default value:
* 'preserve_data' => false,
* 'use_preg' => true
* @param mixed option value
* @return mixed IT_OK on success, error object on failure
* @see $options
*/
function setOptions($options)
{
if (is_array($options)) {
foreach ($options as $option => $value) {
$error = $this->setOption($option, $value);
if (PEAR::isError($error)) {
return $error;
}
}
}
 
return IT_OK;
}
 
/**
* Print a certain block with all replacements done.
* @brother get()
*/
function show($block = '__global__')
{
print $this->get($block);
} // end func show
 
/**
* Returns a block with all replacements done.
*
* @param string name of the block
* @return string
* @throws PEAR_Error
* @access public
* @see show()
*/
function get($block = '__global__')
{
if ($block == '__global__' && !$this->flagGlobalParsed) {
$this->parse('__global__');
}
 
if (!isset($this->blocklist[$block])) {
$this->err[] = PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND) .
'"' . $block . "'",
IT_BLOCK_NOT_FOUND
);
return '';
}
 
if (isset($this->blockdata[$block])) {
$ret = $this->blockdata[$block];
if ($this->clearCache) {
unset($this->blockdata[$block]);
}
if ($this->_options['preserve_data']) {
$ret = str_replace(
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$this->openingDelimiter,
$ret
);
}
return $ret;
}
 
return '';
} // end func get()
 
/**
* Parses the given block.
*
* @param string name of the block to be parsed
* @access public
* @see parseCurrentBlock()
* @throws PEAR_Error
*/
function parse($block = '__global__', $flag_recursion = false)
{
static $regs, $values;
 
if (!isset($this->blocklist[$block])) {
return PEAR::raiseError(
$this->errorMessage( IT_BLOCK_NOT_FOUND ) . '"' . $block . "'",
IT_BLOCK_NOT_FOUND
);
}
 
if ($block == '__global__') {
$this->flagGlobalParsed = true;
}
 
if (!$flag_recursion) {
$regs = array();
$values = array();
}
$outer = $this->blocklist[$block];
$empty = true;
 
if ($this->clearCacheOnParse) {
foreach ($this->variableCache as $name => $value) {
$regs[] = $this->openingDelimiter .
$name . $this->closingDelimiter;
$values[] = $value;
$empty = false;
}
$this->variableCache = array();
} else {
foreach ($this->blockvariables[$block] as $allowedvar => $v) {
 
if (isset($this->variableCache[$allowedvar])) {
$regs[] = $this->openingDelimiter .
$allowedvar . $this->closingDelimiter;
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
$empty = false;
}
}
}
 
if (isset($this->blockinner[$block])) {
foreach ($this->blockinner[$block] as $k => $innerblock) {
 
$this->parse($innerblock, true);
if ($this->blockdata[$innerblock] != '') {
$empty = false;
}
 
$placeholder = $this->openingDelimiter . "__" .
$innerblock . "__" . $this->closingDelimiter;
$outer = str_replace(
$placeholder,
$this->blockdata[$innerblock], $outer
);
$this->blockdata[$innerblock] = "";
}
 
}
 
if (!$flag_recursion && 0 != count($values)) {
if ($this->_options['use_preg']) {
$regs = array_map(array(
&$this, '_addPregDelimiters'),
$regs
);
$funcReplace = 'preg_replace';
} else {
$funcReplace = 'str_replace';
}
 
if ($this->_options['preserve_data']) {
$values = array_map(
array(&$this, '_preserveOpeningDelimiter'), $values
);
}
 
$outer = $funcReplace($regs, $values, $outer);
 
if ($this->removeUnknownVariables) {
$outer = preg_replace($this->removeVariablesRegExp, "", $outer);
}
}
 
if ($empty) {
if (!$this->removeEmptyBlocks) {
$this->blockdata[$block ].= $outer;
} else {
if (isset($this->touchedBlocks[$block])) {
$this->blockdata[$block] .= $outer;
unset($this->touchedBlocks[$block]);
}
}
} else {
$this->blockdata[$block] .= $outer;
}
 
return $empty;
} // end func parse
 
/**
* Parses the current block
* @see parse(), setCurrentBlock(), $currentBlock
* @access public
*/
function parseCurrentBlock()
{
return $this->parse($this->currentBlock);
} // end func parseCurrentBlock
 
/**
* Sets a variable value.
*
* The function can be used eighter like setVariable( "varname", "value")
* or with one array $variables["varname"] = "value"
* given setVariable($variables) quite like phplib templates set_var().
*
* @param mixed string with the variable name or an array
* %variables["varname"] = "value"
* @param string value of the variable or empty if $variable
* is an array.
* @param string prefix for variable names
* @access public
*/
function setVariable($variable, $value = '')
{
if (is_array($variable)) {
$this->variableCache = array_merge(
$this->variableCache, $variable
);
} else {
$this->variableCache[$variable] = $value;
}
} // end func setVariable
 
/**
* Sets the name of the current block that is the block where variables
* are added.
*
* @param string name of the block
* @return boolean false on failure, otherwise true
* @throws PEAR_Error
* @access public
*/
function setCurrentBlock($block = '__global__')
{
 
if (!isset($this->blocklist[$block])) {
return PEAR::raiseError(
$this->errorMessage( IT_BLOCK_NOT_FOUND ) .
'"' . $block . "'", IT_BLOCK_NOT_FOUND
);
}
 
$this->currentBlock = $block;
 
return true;
} // end func setCurrentBlock
 
/**
* Preserves an empty block even if removeEmptyBlocks is true.
*
* @param string name of the block
* @return boolean false on false, otherwise true
* @throws PEAR_Error
* @access public
* @see $removeEmptyBlocks
*/
function touchBlock($block)
{
if (!isset($this->blocklist[$block])) {
return PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND) .
'"' . $block . "'", IT_BLOCK_NOT_FOUND);
}
 
$this->touchedBlocks[$block] = true;
 
return true;
} // end func touchBlock
 
/**
* Clears all datafields of the object and rebuild the internal blocklist
*
* LoadTemplatefile() and setTemplate() automatically call this function
* when a new template is given. Don't use this function
* unless you know what you're doing.
*
* @access public
* @see free()
*/
function init()
{
$this->free();
$this->findBlocks($this->template);
// we don't need it any more
$this->template = '';
$this->buildBlockvariablelist();
} // end func init
 
/**
* Clears all datafields of the object.
*
* Don't use this function unless you know what you're doing.
*
* @access public
* @see init()
*/
function free()
{
$this->err = array();
 
$this->currentBlock = '__global__';
 
$this->variableCache = array();
$this->blocklookup = array();
$this->touchedBlocks = array();
 
$this->flagBlocktrouble = false;
$this->flagGlobalParsed = false;
} // end func free
 
/**
* Sets the template.
*
* You can eighter load a template file from disk with
* LoadTemplatefile() or set the template manually using this function.
*
* @param string template content
* @param boolean remove unknown/unused variables?
* @param boolean remove empty blocks?
* @see LoadTemplatefile(), $template
* @access public
*/
function setTemplate( $template, $removeUnknownVariables = true,
$removeEmptyBlocks = true)
{
$this->removeUnknownVariables = $removeUnknownVariables;
$this->removeEmptyBlocks = $removeEmptyBlocks;
 
if ($template == '' && $this->flagCacheTemplatefile) {
$this->variableCache = array();
$this->blockdata = array();
$this->touchedBlocks = array();
$this->currentBlock = '__global__';
} else {
$this->template = '<!-- BEGIN __global__ -->' . $template .
'<!-- END __global__ -->';
$this->init();
}
 
if ($this->flagBlocktrouble) {
return false;
}
 
return true;
} // end func setTemplate
 
/**
* Reads a template file from the disk.
*
* @param string name of the template file
* @param bool how to handle unknown variables.
* @param bool how to handle empty blocks.
* @access public
* @return boolean false on failure, otherwise true
* @see $template, setTemplate(), $removeUnknownVariables,
* $removeEmptyBlocks
*/
function loadTemplatefile( $filename,
$removeUnknownVariables = true,
$removeEmptyBlocks = true )
{
$template = '';
if (!$this->flagCacheTemplatefile ||
$this->lastTemplatefile != $filename
) {
$template = $this->getFile($filename);
}
$this->lastTemplatefile = $filename;
 
return $template != '' ?
$this->setTemplate(
$template,$removeUnknownVariables, $removeEmptyBlocks
) : false;
} // end func LoadTemplatefile
 
/**
* Sets the file root. The file root gets prefixed to all filenames passed
* to the object.
*
* Make sure that you override this function when using the class
* on windows.
*
* @param string
* @see IntegratedTemplate()
* @access public
*/
function setRoot($root)
{
if ($root != '' && substr($root, -1) != '/') {
$root .= '/';
}
 
$this->fileRoot = $root;
} // end func setRoot
 
/**
* Build a list of all variables within of a block
*/
function buildBlockvariablelist()
{
foreach ($this->blocklist as $name => $content) {
preg_match_all($this->variablesRegExp, $content, $regs);
 
if (count($regs[1]) != 0) {
foreach ($regs[1] as $k => $var) {
$this->blockvariables[$name][$var] = true;
}
} else {
$this->blockvariables[$name] = array();
}
}
} // end func buildBlockvariablelist
 
/**
* Returns a list of all global variables
*/
function getGlobalvariables()
{
$regs = array();
$values = array();
 
foreach ($this->blockvariables['__global__'] as $allowedvar => $v) {
if (isset($this->variableCache[$allowedvar])) {
$regs[] = '@' . $this->openingDelimiter .
$allowedvar . $this->closingDelimiter . '@';
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
}
}
 
return array($regs, $values);
} // end func getGlobalvariables
 
/**
* Recusively builds a list of all blocks within the template.
*
* @param string string that gets scanned
* @see $blocklist
*/
function findBlocks($string)
{
$blocklist = array();
 
if (preg_match_all($this->blockRegExp, $string, $regs, PREG_SET_ORDER)) {
foreach ($regs as $k => $match) {
$blockname = $match[1];
$blockcontent = $match[2];
 
if (isset($this->blocklist[$blockname])) {
$this->err[] = PEAR::raiseError(
$this->errorMessage(
IT_BLOCK_DUPLICATE, $blockname),
IT_BLOCK_DUPLICATE
);
$this->flagBlocktrouble = true;
}
 
$this->blocklist[$blockname] = $blockcontent;
$this->blockdata[$blockname] = "";
 
$blocklist[] = $blockname;
 
$inner = $this->findBlocks($blockcontent);
foreach ($inner as $k => $name) {
$pattern = sprintf(
'@<!--\s+BEGIN\s+%s\s+-->(.*)<!--\s+END\s+%s\s+-->@sm',
$name,
$name
);
 
$this->blocklist[$blockname] = preg_replace(
$pattern,
$this->openingDelimiter .
'__' . $name . '__' .
$this->closingDelimiter,
$this->blocklist[$blockname]
);
$this->blockinner[$blockname][] = $name;
$this->blockparents[$name] = $blockname;
}
}
}
 
return $blocklist;
} // end func findBlocks
 
/**
* Reads a file from disk and returns its content.
* @param string Filename
* @return string Filecontent
*/
function getFile($filename)
{
if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
$filename = substr($filename, 1);
}
 
$filename = $this->fileRoot . $filename;
 
if (!($fh = @fopen($filename, 'r'))) {
$this->err[] = PEAR::raiseError(
$this->errorMessage(IT_TPL_NOT_FOUND) .
': "' .$filename .'"',
IT_TPL_NOT_FOUND
);
return "";
}
 
$content = fread($fh, filesize($filename));
fclose($fh);
 
return preg_replace(
"#<!-- INCLUDE (.*) -->#ime", "\$this->getFile('\\1')", $content
);
} // end func getFile
 
/**
* Adds delimiters to a string, so it can be used as a pattern
* in preg_* functions
*
* @param string
* @return string
*/
function _addPregDelimiters($str)
{
return '@' . $str . '@';
}
 
/**
* Replaces an opening delimiter by a special string
*
* @param string
* @return string
*/
function _preserveOpeningDelimiter($str)
{
return (false === strpos($str, $this->openingDelimiter))?
$str:
str_replace(
$this->openingDelimiter,
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$str
);
}
 
/**
* Return a textual error message for a IT error code
*
* @param integer $value error code
*
* @return string error message, or false if the error code was
* not recognized
*/
function errorMessage($value, $blockname = '')
{
static $errorMessages;
if (!isset($errorMessages)) {
$errorMessages = array(
IT_OK => '',
IT_ERROR => 'unknown error',
IT_TPL_NOT_FOUND => 'Cannot read the template file',
IT_BLOCK_NOT_FOUND => 'Cannot find this block',
IT_BLOCK_DUPLICATE => 'The name of a block must be'.
' uniquewithin a template.'.
' Found "' . $blockname . '" twice.'.
'Unpredictable results '.
'may appear.',
IT_UNKNOWN_OPTION => 'Unknown option'
);
}
 
if (PEAR::isError($value)) {
$value = $value->getCode();
}
 
return isset($errorMessages[$value]) ?
$errorMessages[$value] : $errorMessages[IT_ERROR];
}
} // end class IntegratedTemplate
?>
/trunk/api/arbre/arbre.class.php
16,7 → 16,34
* Derniere mise a jour : 10 decembre 2001
************************************************************************************/
error_reporting (E_ALL) ;
include 'api/arbre/tailles.php3' ;
//l'ecran
//$xres=698; //doit etre divisible par 2 sinon bug d'alignement
$innerTableWidth = 600;
$xres=$innerTableWidth-10;
$yres=600;
 
//les images
$yfait= 50; //la hauteur du "sommet"
$xfait= 1;
$xtronc= 36; //doit etre divisible par 2 sinon bug d'alignement
$ytronc= 559;
$xbranche= 200;
$ybranche= 64;
$xracine= 191;
$yracine= 61;
$xfeuille= 50;
$yfeuille= 45;
$xtextedroite=10;
$ytextedroite=15;
$xtextegauche=10;
$ytextegauche=10;
$yposnom=12;
$xpuce=10;
$ypuce=10;
$taille_mini=60;
$nhi_xsommet=191;
$nhi_ysommet=61;
include 'tailles.php3' ;
 
define ("ARBRE_CHEMIN_IMAGES", 'api/arbre/images/') ;
 
201,9 → 228,36
function cime($nom, $lien_nom, $intensite, $lien_intensite, $lien_feuille) {
//global $nhi_xsommet, $nhi_ysommet,$ybranche,$yfeuille, $yres, $innerTableWidth ;
//l'ecran
//$xres=698; //doit etre divisible par 2 sinon bug d'alignement
$innerTableWidth = 600;
$xres=$innerTableWidth-10;
$yres=600;
 
//les images
$yfait= 50; //la hauteur du "sommet"
$xfait= 1;
$xtronc= 36; //doit etre divisible par 2 sinon bug d'alignement
$ytronc= 559;
$xbranche= 200;
$ybranche= 64;
$xracine= 191;
$yracine= 61;
$xfeuille= 50;
$yfeuille= 45;
$xtextedroite=10;
$ytextedroite=15;
$xtextegauche=10;
$ytextegauche=10;
$yposnom=12;
$xpuce=10;
$ypuce=10;
$taille_mini=60;
$nhi_xsommet=191;
$nhi_ysommet=61;
// tailles.php3 contient les variables de tailles des fichiers graphiques associes
// a l'arbre
include 'api/arbre/tailles.php3' ;
include 'tailles.php3' ;
// Le blanc devant la cime de l'arbre
$this->blanc_cime = round(($xres-$nhi_xsommet)/2);
257,10 → 311,37
* ne renvoie rien
*********************************************************************************************/
function affBranche() {
//l'ecran
//$xres=698; //doit etre divisible par 2 sinon bug d'alignement
$innerTableWidth = 600;
$xres=$innerTableWidth-10;
$yres=600;
 
//les images
$yfait= 50; //la hauteur du "sommet"
$xfait= 1;
$xtronc= 36; //doit etre divisible par 2 sinon bug d'alignement
$ytronc= 559;
$xbranche= 200;
$ybranche= 64;
$xracine= 191;
$yracine= 61;
$xfeuille= 50;
$yfeuille= 45;
$xtextedroite=10;
$ytextedroite=15;
$xtextegauche=10;
$ytextegauche=10;
$yposnom=12;
$xpuce=10;
$ypuce=10;
$taille_mini=60;
$nhi_xsommet=191;
$nhi_ysommet=61;
$tb = "" ; $tb2 = "" ;
//global $nhi_xsommet, $nhi_ysommet,$ybranche,$yfeuille, $xref_branche, $taille_mini;
//global $xtronc, $espace_a_gauche, $xfeuille , $les_slashes, $xres, $innerTableWidth;
include 'api/arbre/tailles.php3' ;
include 'tailles.php3' ;
$xref_branche = calc_xref_branche($xres,$xfeuille,$xtronc);
 
$res = "<!-- xref_branche=$xref_branche -->";