Subversion Repositories Applications.papyrus

Rev

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

Rev 434 Rev 436
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.2 2005-08-25 08:59:12 ddelon Exp $
24
// CVS : $Id: integrateur_wikini.php,v 1.3 2005-08-31 17:34:52 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.2 $ $Date: 2005-08-25 08:59:12 $
36
*@version       $Revision: 1.3 $ $Date: 2005-08-31 17:34:52 $
37
*
37
*
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
-
 
41
 
-
 
42
 
41
/** Inclusion de la classe PEAR de gestion des URL. */
43
/** Inclusion de la classe PEAR de gestion des URL. */
42
require_once 'Net/URL.php';
44
require_once 'Net/URL.php';
-
 
45
 
-
 
46
// TODO : un seul fichier de configuration ?
-
 
47
/** Inclusion du fichier de configuration de cette application.*/
-
 
48
require_once 'client/integrateur_wikini/configuration/adwi_configuration.inc.php';
-
 
49
 
-
 
50
require_once ADWI_CHEMIN_BIBLIOTHEQUE.'adwi_wikini.fonct.php';
-
 
51
 
43
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
52
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/
44
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';
45
 
54
 
46
/** 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.*/
47
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
56
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php';
48
/** 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.*/
49
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
58
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php';
-
 
59
 
50
 
60
global $wikini_config_defaut;
51
global $wiki;
61
global $wiki;
52
global $wiki_p;
62
global $wiki_p;
-
 
63
 
-
 
64
 
-
 
65
// $_REQUEST['wiki'] est obligatoire, car wakka.php envoie un redirect si non detecté, avec perte de tout l'environnement !
53
 
66
 
54
if ( ! isset( $_REQUEST['wiki'] ) ) {
67
if ( ! isset( $_REQUEST['wiki'] ) ) {
55
    $_REQUEST['wiki'] = $GLOBALS['_GEN_commun']['info_application']->page;
68
	    $_REQUEST['wiki'] = $wikini_config_defaut['root_page'];
56
}
69
}
57
 
70
 
58
$server=$_SERVER['PHP_SELF'];
71
$server=$_SERVER['PHP_SELF'];
59
$_SERVER['PHP_SELF']="wakka.php";
72
$_SERVER['PHP_SELF']="wakka.php";
60
 
73
 
61
// Utilise le wakkaconfig de la racine ...
74
// Utilise le wakkaconfig de la racine ...
62
// TODO : generer un wakkaconfig en fonction des parametres, dans un temp et l'ecrire
75
// TODO : generer un wakkaconfig en fonction des parametres, dans un temp et l'ecrire
63
// juste avant ... : bof (car conflits possibles).
76
// juste avant ... : bof (car conflits possibles).
64
// Ou alors : on utilise un wakkaconfig generique à minima ...
77
// Ou alors : on utilise un wakkaconfig generique à minima ...
65
// Dans tous les cas, il faut gerer le WakaConfig Generique !
78
// Dans tous les cas, il faut gerer le WakaConfig Generique !
66
// Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
79
// Prevoir de revoir la contrib menu ... qui doit être switchable, ou plutot,
67
// Customiser son menu avec papyrus ...
80
// Customiser son menu avec papyrus ...
68
 
81
 
69
ob_start();
82
ob_start();
70
include_once '/home/david/workspace/papyrus/wikini/wikini_01/wakka.php';
83
include_once IW_CHEMIN_WIKINI_COURANT.'wakka.php';
71
ob_end_clean();
84
ob_end_clean();
72
 
-
 
73
$_SERVER['PHP_SELF']=$server;
85
$_SERVER['PHP_SELF']=$server;
74
 
86
 
75
 
87
 
76
// On surcharge la classe Wiki pour en faire ce qu'on en veut
88
// On surcharge la classe Wiki pour en faire ce qu'on en veut
77
Class Wiki_Papyrus extends Wiki {
89
Class Wiki_Papyrus extends Wiki {
78
    function Format($text, $formatter = "wakka") {
90
    function Format($text, $formatter = "wakka") {
79
		return $this->IncludeBuffered("/home/david/workspace/papyrus/wikini/wikini_01/formatters/".$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
91
		return $this->IncludeBuffered(IW_CHEMIN_WIKINI_COURANT_FORMATTER.$formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text")); 
80
	}
92
	}
81
	function Header() {
93
	function Header() {
82
		
94
		
83
		$sortie='';
95
		$sortie='';
84
		$sortie.='<h1 class="wiki_name">';
96
		$sortie.='<h1 class="wiki_name">';
85
		// Todo : Initialiser : wakka_nom
97
		// Todo : Initialiser : wakka_nom
86
		$sortie.= $this->config["wakka_name"];
98
		$sortie.= $this->config["wakka_name"];
87
		$sortie.='</h1>';
99
		$sortie.='</h1>';
88
		$sortie.='<h1 class="page_name">';
100
		$sortie.='<h1 class="page_name">';
89
		$sortie.='<a href="';
101
		$sortie.='<a href="';
90
		$sortie.=$this->config["base_url"];
102
		$sortie.=$this->config["base_url"];
91
		$sortie.='RechercheTexte&amp;phrase=';
103
		$sortie.='RechercheTexte&amp;phrase=';
92
		$sortie.=htmlentities($this->GetPageTag());
104
		$sortie.=htmlentities($this->GetPageTag());
93
		$sortie.='">';
105
		$sortie.='">';
94
		$sortie.=htmlentities($this->GetPageTag()); 
106
		$sortie.=htmlentities($this->GetPageTag()); 
95
		$sortie.='</a>';
107
		$sortie.='</a>';
96
		$sortie.='</h1>';
108
		$sortie.='</h1>';
97
 
109
 
98
		$sortie.='<div class="header">';
110
		$sortie.='<div class="header">';
99
		$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
111
		$sortie.= $this->ComposeLinkToPage($this->config["root_page"]).'::';
100
		$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
112
		$sortie.= $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "";
101
		$sortie.='Vous &ecirc;tes ';
113
		$sortie.='Vous &ecirc;tes ';
102
		$sortie.= $this->Format($this->GetUserName());
114
		$sortie.= $this->Format($this->GetUserName());
103
		if ($user = $this->GetUser()) { 
115
		if ($user = $this->GetUser()) { 
104
			$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n";
116
			$sortie.="(<a href=\"".$this->config["base_url"]."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n";
105
		}
117
		}
106
		$sortie.='</div>';
118
		$sortie.='</div>';
107
		return $sortie;
119
		return $sortie;
108
	}
120
	}
109
	
121
	
110
	function Footer() {
122
	function Footer() {
111
		return;
123
		return;
112
	}	
124
	}	
113
}
125
}
114
 
126
 
115
 
127
 
116
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
128
// Appel du fichier de traduction des textes de l'application Integrateur Wikini
117
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
129
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) {
118
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
130
    /** Inclusion du fichier de traduction de l'application Integrateur Wikini. */
119
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
131
    include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php';
120
} else {
132
} else {
121
    /** Inclusion du fichier de traduction fr par défaut. */
133
    /** Inclusion du fichier de traduction fr par défaut. */
122
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
134
    include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php';
123
}
135
}
124
 
136
 
125
 
137
 
126
// +------------------------------------------------------------------------------------------------------+
138
// +------------------------------------------------------------------------------------------------------+
127
// |                                            CORPS du PROGRAMME                                        |
139
// |                                            CORPS du PROGRAMME                                        |
128
// +------------------------------------------------------------------------------------------------------+
140
// +------------------------------------------------------------------------------------------------------+
129
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
141
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus.
130
*
142
*
131
* Elle retourne le contenu de l'application.
143
* Elle retourne le contenu de l'application.
132
*
144
*
133
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
145
* @return  string  du code XHTML correspondant au contenu renvoyé par l'application.
134
*/
146
*/
135
function afficherContenuCorps()
147
function afficherContenuCorps()
136
{
148
{
137
	global $wiki;
-
 
-
 
149
	
-
 
150
	global $wiki;
138
	
151
	global $wikini_config_defaut;
139
	$sortie='';
-
 
140
	
152
	$sortie='';
141
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
153
    $wakkaConfig = $GLOBALS['wikini_config_defaut'];
142
    $wiki  = new Wiki_Papyrus($wakkaConfig);
154
    $wiki  = new Wiki_Papyrus($wakkaConfig);
143
 
155
 
144
	// Gestion de la variable de session "linktracking"
156
	// Gestion de la variable de session "linktracking"
145
    if ( ! isset( $_SESSION['linktracking'] ) ) {
157
    if ( ! isset( $_SESSION['linktracking'] ) ) {
146
        $_SESSION['linktracking'] = 1;
158
        $_SESSION['linktracking'] = 1;
147
    }
159
    }
148
 
160
 
149
    // Suppression des slash.
161
    // Suppression des slash.
150
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
162
    $_REQUEST['wiki'] = preg_replace("/^\//", '',  $_REQUEST['wiki']);
151
 
163
 
152
    // split into page/method
164
    // split into page/method
153
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
165
    if ( preg_match( "#^(.+?)/(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
154
        list(, $page, $method) = $matches;
166
        list(, $page, $method) = $matches;
155
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
167
    } else if ( preg_match( "#^(.*)$#",  $_REQUEST['wiki'], $matches ) ) {
156
        list(, $page) = $matches;
168
        list(, $page) = $matches;
157
    }
169
    }
158
    
170
    
159
    // Vérification de la méthode d'affichage employée!
171
    // Vérification de la méthode d'affichage employée!
160
    if ( ! isset( $method ) ) {
172
    if ( ! isset( $method ) ) {
161
        $method = '';
173
        $method = '';
162
    }
174
    }
163
		
175
		
164
    //Récupération du contenu de la page Wikini
176
    //Récupération du contenu de la page Wikini
165
    
177
    
166
    ob_start();
178
    ob_start();
167
    
179
    
168
    $server=$_SERVER['PHP_SELF'];
180
    $server=$_SERVER['PHP_SELF'];
169
	$_SERVER['PHP_SELF']="wakka.php";
181
	$_SERVER['PHP_SELF']="wakka.php";
170
    
182
    
171
	$wiki->Run($page, $method);
183
	$wiki->Run($page, $method);
172
    
184
    
173
    $_SERVER['PHP_SELF']=$server;
185
    $_SERVER['PHP_SELF']=$server;
174
    
186
    
175
    $sortie.= ob_get_contents();
187
    $sortie.= ob_get_contents();
176
    ob_end_clean();
188
    ob_end_clean();
177
 
189
 
178
 
-
 
179
 
190
 
180
	return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
191
	return remplacerEntiteHTLM("<div id=\"wikini_page\" ondblclick=\"document.location='".$wiki->href("edit")."';"."\">"."\n".$sortie.'</div>'."\n"); 
181
			
192
			
182
		
193
		
183
}
194
}
184
 
195
 
185
 
196
 
186
// TODO : qu'affiche-t-on en pied ?
197
// TODO : qu'affiche-t-on en pied ?
187
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
198
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus.
188
*
199
*
189
* Elle retourne le pied de l'application.
200
* Elle retourne le pied de l'application.
190
*
201
*
191
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
202
* @return  string  du code XHTML correspondant au pied renvoyé par l'application.
192
*/
203
*/
193
function afficherContenuPied()
204
function afficherContenuPied()
194
{
205
{
-
 
206
	return;
195
    return inclusion_html('pied_page');
207
    return inclusion_html('pied_page');
196
}
208
}
197
?>
209
?>