Subversion Repositories Applications.papyrus

Rev

Rev 436 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 436 Rev 437
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Integrateur Wikini.                                                             |
8
// | This file is part of Integrateur Wikini.                                                             |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: integrateur_wikini.php,v 1.3 2005-08-31 17:34:52 ddelon Exp $
24
// CVS : $Id: integrateur_wikini.php,v 1.4 2005-09-02 11:29:25 ddelon Exp $
25
/**
25
/**
26
* Integrateur de page Wikini
26
* Integrateur de page Wikini
27
*
27
*
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
28
* Application permettant d'intégrer des pages wikini dans Papyrus.
29
*
29
*
30
*@package IntegrateurWikini
30
*@package IntegrateurWikini
31
//Auteur original :
31
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.3 $ $Date: 2005-08-31 17:34:52 $
36
*@version       $Revision: 1.4 $ $Date: 2005-09-02 11:29:25 $
37
*
37
*
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
42
 
42
 
43
/** Inclusion de la classe PEAR de gestion des URL. */
43
/** Inclusion de la classe PEAR de gestion des URL. */
44
require_once 'Net/URL.php';
44
require_once 'Net/URL.php';
45
 
45
 
46
// TODO : un seul fichier de configuration ?
46
// TODO : un seul fichier de configuration ?
47
/** Inclusion du fichier de configuration de cette application.*/
47
/** Inclusion du fichier de configuration de cette application.*/
48
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
48
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
49
 
49
 
50
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
50
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
51
 
51
 
52
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
52
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
53
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
53
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php';
54
 
54
 
55
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
55
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/
56
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
56
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
57
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
57
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/
58
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
58
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
59
 
59
 
60
global $wikini_config_defaut;
60
global $wikini_config_defaut;
61
global $wiki;
61
global $wiki;
62
global $wiki_p;
62
global $wiki_p;
63
 
63
 
64
 
64
 
65
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
65
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
66
 
66
 
67
if ( ! isset( $_REQUEST['wiki'] ) ) {
67
if ( ! isset( $_REQUEST['wiki'] ) ) {
68
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
68
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
69
}
69
}
70
 
70
 
71
$server=$_SERVER['PHP_SELF'];
71
$server=$_SERVER['PHP_SELF'];
72
$_SERVER['PHP_SELF']="wakka.php";
72
$_SERVER['PHP_SELF']="wakka.php";
73
 
73
 
74
// Utilise le wakkaconfig de la racine ...
74
// Utilise le wakkaconfig de la racine ...
75
// TODO : generer un wakkaconfig en fonction des parametres, dans un temp et l'ecrire
75
// TODO : Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
76
// juste avant ... : bof (car conflits possibles).
76
// TODO : Customiser son menu avec papyrus ...
77
// Ou alors : on utilise un wakkaconfig generique à minima ...
77
// TODO : un wiki par défaut pour chaque papyrus à l'installation de Papyrus
-
 
78
// TODO : message erreur session 
78
// Dans tous les cas, il faut gerer le WakaConfig Generique !
79
// TODO : message erreur interwiki
79
// Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
80
// TODO : verifier bon dimensionnement des champs et clef de la table papyrus_wiki
-
 
81
// TODO : creation des tables par defaut à l'installation d'un wikini
-
 
82
// TODO : Fusion des fichiers de configuration ?
80
// Customiser son menu avec papyrus ...
83
// TODO : creation automatique des Wikis ...
81
 
84
 
82
ob_start();
85
ob_start();
83
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
86
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
84
ob_end_clean();
87
ob_end_clean();
85
$_SERVER['PHP_SELF']=$server;
88
$_SERVER['PHP_SELF']=$server;
86
 
89
 
87
 
90
 
88
// On surcharge la classe Wiki pour en faire ce qu'on en veut
91
// On surcharge la classe Wiki pour en faire ce qu'on en veut
89
Class Wiki_Papyrus extends Wiki {
92
Class Wiki_Papyrus extends Wiki {
90
    function Format($text, $formatter = "wakka") {
93
    function Format($text, $formatter = "wakka") {
91
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
94
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
92
	}
95
	}
93
	function Header() {
96
	function Header() {
94
		
97
		
95
		$sortie='';
98
		$sortie='';
96
		$sortie.='<h1 class="wiki_name">';
99
		$sortie.='<h1 class="wiki_name">';
97
		// Todo : Initialiser : wakka_nom
100
		// Todo : Initialiser : wakka_nom
98
		$sortie.= $this->config["wakka_name"];
101
		$sortie.= $this->config["wakka_name"];
99
		$sortie.='</h1>';
102
		$sortie.='</h1>';
100
		$sortie.='<h1 class="page_name">';
103
		$sortie.='<h1 class="page_name">';
101
		$sortie.='<a href="';
104
		$sortie.='<a href="';
102
		$sortie.=$this->config["base_url"];
105
		$sortie.=$this->config["base_url"];
103
		$sortie.='RechercheTexte&amp;phrase=';
106
		$sortie.='RechercheTexte&amp;phrase=';
104
		$sortie.=htmlentities($this->GetPageTag());
107
		$sortie.=htmlentities($this->GetPageTag());
105
		$sortie.='">';
108
		$sortie.='">';
106
		$sortie.=htmlentities($this->GetPageTag()); 
109
		$sortie.=htmlentities($this->GetPageTag()); 
107
		$sortie.='</a>';
110
		$sortie.='</a>';
108
		$sortie.='</h1>';
111
		$sortie.='</h1>';
109
 
112
 
110
		$sortie.='<div class="header">';
113
		$sortie.='<div class="header">';
111
		$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
114
		$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
112
		$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
115
		$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
113
		$sortie.='Vous &ecirc;tes ';
116
		$sortie.='Vous &ecirc;tes ';
114
		$sortie.= $this->Format($this->GetUserName());
117
		$sortie.= $this->Format($this->GetUserName());
115
		if ($user = $this->GetUser()) { 
118
		if ($user = $this->GetUser()) { 
116
			$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n";
119
			$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n";
117
		}
120
		}
118
		$sortie.='</div>';
121
		$sortie.='</div>';
119
		return $sortie;
122
		return $sortie;
120
	}
123
	}
121
	
124
	
122
	function Footer() {
125
	function Footer() {
123
		return;
126
		return;
124
	}	
127
	}	
125
}
128
}
126
 
129
 
127
 
130
 
128
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
131
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
129
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
132
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
130
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
133
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
131
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
134
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
132
} else {
135
} else {
133
    /** Inclusion du fichier de traduction fr par défaut. */
136
    /** Inclusion du fichier de traduction fr par défaut. */
134
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
137
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
135
}
138
}
136
 
139
 
137
 
140
 
138
// +------------------------------------------------------------------------------------------------------+
141
// +------------------------------------------------------------------------------------------------------+
139
// |                                            CORPS du PROGRAMME                                        |
142
// |                                            CORPS du PROGRAMME                                        |
140
// +------------------------------------------------------------------------------------------------------+
143
// +------------------------------------------------------------------------------------------------------+
141
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
144
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
142
*
145
*
143
* Elle retourne le contenu de l'application.
146
* Elle retourne le contenu de l'application.
144
*
147
*
145
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
148
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
146
*/
149
*/
147
function afficherContenuCorps()
150
function afficherContenuCorps()
148
{
151
{
149
	
152
	
150
	global $wiki;
153
	global $wiki;
151
	global $wikini_config_defaut;
154
	global $wikini_config_defaut;
152
	$sortie='';
155
	$sortie='';
153
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
156
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
154
    $wiki  = new Wiki_Papyrus($wakkaConfig);
157
    $wiki  = new Wiki_Papyrus($wakkaConfig);
155
 
158
 
156
	// Gestion de la variable de session "linktracking"
159
	// Gestion de la variable de session "linktracking"
157
    if ( ! isset( $_SESSION['linktracking'] ) ) {
160
    if ( ! isset( $_SESSION['linktracking'] ) ) {
158
        $_SESSION['linktracking'] = 1;
161
        $_SESSION['linktracking'] = 1;
159
    }
162
    }
160
 
163
 
161
    // Suppression des slash.
164
    // Suppression des slash.
162
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
165
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
163
 
166
 
164
    // split into page/method
167
    // split into page/method
165
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
168
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
166
        list(, $page, $method) = $matches;
169
        list(, $page, $method) = $matches;
167
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
170
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
168
        list(, $page) = $matches;
171
        list(, $page) = $matches;
169
    }
172
    }
170
    
173
    
171
    // Vérification de la méthode d'affichage employée!
174
    // Vérification de la méthode d'affichage employée!
172
    if ( ! isset( $method ) ) {
175
    if ( ! isset( $method ) ) {
173
        $method = '';
176
        $method = '';
174
    }
177
    }
175
		
178
		
176
    //Récupération du contenu de la page Wikini
179
    //Récupération du contenu de la page Wikini
177
    
180
    
178
    ob_start();
181
    ob_start();
179
    
182
    
180
    $server=$_SERVER['PHP_SELF'];
183
    $server=$_SERVER['PHP_SELF'];
181
	$_SERVER['PHP_SELF']="wakka.php";
184
	$_SERVER['PHP_SELF']="wakka.php";
182
    
185
    
183
	$wiki->Run($page, $method);
186
	$wiki->Run($page, $method);
184
    
187
    
185
    $_SERVER['PHP_SELF']=$server;
188
    $_SERVER['PHP_SELF']=$server;
186
    
189
    
187
    $sortie.= ob_get_contents();
190
    $sortie.= ob_get_contents();
188
    ob_end_clean();
191
    ob_end_clean();
189
 
192
 
190
 
193
 
191
	return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
194
	return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
192
			
195
			
193
		
196
		
194
}
197
}
195
 
198
 
196
 
199
 
197
// TODO : qu'affiche-t-on en pied ?
200
// TODO : qu'affiche-t-on en pied ?
198
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
201
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
199
*
202
*
200
* Elle retourne le pied de l'application.
203
* Elle retourne le pied de l'application.
201
*
204
*
202
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
205
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
203
*/
206
*/
204
function afficherContenuPied()
207
function afficherContenuPied()
205
{
208
{
206
	return;
-
 
207
    return inclusion_html('pied_page');
209
    return inclusion_html('pied_page');
208
}
210
}
209
?>
211
?>