/trunk/client/integrateur_wikini/configuration/iw_config.inc.php |
---|
New file |
0,0 → 1,137 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Integrateur Wikini. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: iw_config.inc.php,v 1.1 2005-08-18 10:19:55 ddelon Exp $ |
/** |
* Configuration de l'intégrateur de page Wikini |
* |
* Fichier de configuration de l'intégrateur de page Wikini |
* |
*@package IntegrateurWikini |
*@subpackage Configuration |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:19:55 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// Définition de la langue |
/** Constante stockant la valeur i18n fournie par Papyrus et pouvant être passée dans l'url.*/ |
define('IW_I18N', $GLOBALS['_GEN_commun']['i18n']); |
// +------------------------------------------------------------------------------------------------------+ |
// Définition des chemins de fichiers. |
/** Constante stockant le chemin du dossier racine.*/ |
define('IW_CHEMIN_RACINE', GEN_CHEMIN_CLIENT.'integrateur_wikini'.GEN_SEP); |
/** Constante stockant le chemin du dossier contenant les traductions.*/ |
define('IW_CHEMIN_LANGUES', IW_CHEMIN_RACINE.'langues'.GEN_SEP); |
/** Constante stockant le chemin du dossier contenant la bibliothèque de code.*/ |
define('IW_CHEMIN_BIBLIO', IW_CHEMIN_RACINE.'bibliotheque'.GEN_SEP); |
/** Constante stockant le chemin du dossier contenant la bibliothèque Wikini.*/ |
define('IW_CHEMIN_BIBLIO_WIKINI', IW_CHEMIN_BIBLIO.'wikini'.GEN_SEP); |
if (!isset($GLOBALS['_GEN_commun']['info_application']->bdd_hote)) { |
$GLOBALS['_GEN_commun']['info_application']->bdd_hote = 'localhost'; |
} |
/** Constante stockant le nom de l'hôte MySQL*/ |
define('HOTE', $GLOBALS['_GEN_commun']['info_application']->bdd_hote); |
if (!isset($GLOBALS['_GEN_commun']['info_application']->bdd_utilisateur)) { |
$GLOBALS['_GEN_commun']['info_application']->bdd_utilisateur = ''; |
} |
/** Constante stockant le nom de l'utilisateur MySQL*/ |
define('UTILISATEUR', $GLOBALS['_GEN_commun']['info_application']->bdd_utilisateur); |
if (!isset($GLOBALS['_GEN_commun']['info_application']->bdd_mdp)) { |
$GLOBALS['_GEN_commun']['info_application']->bdd_mdp = ''; |
} |
/** Constante stockant le mot de passe de l'utilisateur MySQL*/ |
define('MDP', $GLOBALS['_GEN_commun']['info_application']->bdd_mdp); |
if (!isset($GLOBALS['_GEN_commun']['info_application']->bdd_nom)) { |
$GLOBALS['_GEN_commun']['info_application']->bdd_nom = ''; |
} |
/** Constante stockant le nom de la base de données MySQL pour le wikini*/ |
define('BD_WIKINI', $GLOBALS['_GEN_commun']['info_application']->bdd_nom); |
/** Constante stockant le nom de la base de données MySQL générale*/ |
define('BD_GENERALE', PAP_BDD_NOM);//Nom de la base des tables de la carto (et éventuellement de chorologie) |
if (!isset($GLOBALS['_GEN_commun']['info_application']->page)) { |
$GLOBALS['_GEN_commun']['info_application']->page = 'AccueiL'; |
} |
if (!isset($GLOBALS['_GEN_commun']['info_application']->table_prefix)) { |
$GLOBALS['_GEN_commun']['info_application']->table_prefix = 'wikini_'; |
} |
if (!isset($GLOBALS['_GEN_commun']['info_application']->wikini_nom)) { |
$GLOBALS['_GEN_commun']['info_application']->wikini_nom = ''; |
} |
/** Constantes de connexion aux bases de données MySQL*/ |
global $wikini_config_defaut; |
$wikini_config_defaut = array( |
'wakka_version' => '', |
'debug' => 'yes', |
'mysql_host' => HOTE, |
'mysql_database' => BD_WIKINI, |
'mysql_user' => UTILISATEUR, |
'mysql_password' => MDP, |
'table_prefix' => $GLOBALS['_GEN_commun']['info_application']->table_prefix, |
'root_page' => $GLOBALS['_GEN_commun']['info_application']->page, |
'wakka_name' => $GLOBALS['_GEN_commun']['info_application']->wikini_nom, |
'base_url' => $GLOBALS['_GEN_commun']['url']->getUrl().'&wiki=', |
'rewrite_mode' => '0', |
'meta_keywords' => '', |
'meta_description' => '', |
'action_path' => IW_CHEMIN_BIBLIO_WIKINI.'actions', |
'handler_path' => IW_CHEMIN_BIBLIO_WIKINI.'handlers', |
'formatters_path' => IW_CHEMIN_BIBLIO_WIKINI.'formatters', |
'interwiki_path' => IW_CHEMIN_BIBLIO_WIKINI, |
'header_action' => 'header', |
'footer_action' => 'footer', |
'navigation_links' => 'DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur', |
'referrers_purge_time' => 24, |
'pages_purge_time' => 90, |
'default_write_acl' => '*', |
'default_read_acl' => '*', |
'default_comment_acl' => '*', |
'preview_before_save' => '0'); |
// +------------------------------------------------------------------------------------------------------+ |
// | PIED du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.1 2005/03/02 17:47:05 jpm |
* Ajout des fichiers necessaires à l'intégrateur de wikini. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
/trunk/client/integrateur_wikini/documentation/gen_application.sql |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/client/integrateur_wikini/documentation/gen_application.sql |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/client/integrateur_wikini/integrateur_wikini.php |
---|
New file |
0,0 → 1,148 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Integrateur Wikini. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with 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.1 2005-08-18 10:20:07 ddelon Exp $ |
/** |
* Integrateur de page Wikini |
* |
* Application permettant d'intégrer des pages wikini dans Papyrus. |
* |
*@package IntegrateurWikini |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:07 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/** Inclusion de la classe PEAR de gestion des URL. */ |
require_once 'Net/URL.php'; |
/** Inclusion du fichier de configuration général de IntegrateurWikini.*/ |
require_once 'client'.GEN_SEP.'integrateur_wikini'.GEN_SEP.'configuration'.GEN_SEP.'iw_config.inc.php'; |
/** Inclusion du fichier permettant d'encoder du texte mais pas les balises XHTML.*/ |
require_once IW_CHEMIN_BIBLIO.'iw_encodage.fonct.php'; |
/** Inclusion du fichier permettant d'inclure les données dans du XHTML.*/ |
require_once IW_CHEMIN_BIBLIO.'iw_affichage_xhtml.fonct.php'; |
/** Inclusion du fichier permettant l'utilisation de la classe wiki.*/ |
require_once IW_CHEMIN_BIBLIO_WIKINI.'wakka.php'; |
// Appel du fichier de traduction des textes de l'application Integrateur Wikini |
if (file_exists(IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php')) { |
/** Inclusion du fichier de traduction de l'application Integrateur Wikini. */ |
include_once IW_CHEMIN_LANGUES.'iw_langue_'.IW_I18N.'.inc.php'; |
} else { |
/** Inclusion du fichier de traduction fr par défaut. */ |
include_once IW_CHEMIN_LANGUES.'iw_langue_fr.inc.php'; |
} |
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/** Fonction afficherContenuCorps() - Fonction appelé par le gestionnaire Papyrus. |
* |
* Elle retourne le contenu de l'application. |
* |
* @return string du code XHTML correspondant au contenu renvoyé par l'application. |
*/ |
function afficherContenuCorps() |
{ |
$wakkaConfig = $GLOBALS['wikini_config_defaut']; |
// Démarrage de session php |
//session_start(); |
// Récupération du nom de la page wikini recherchée |
if ( ! isset( $_REQUEST['wiki'] ) ) { |
$GLOBALS['wiki'] = $GLOBALS['_GEN_commun']['info_application']->page; |
} else { |
$GLOBALS['wiki'] = $_REQUEST['wiki']; |
} |
// Gestion de la variable de session "linktracking" |
if ( ! isset( $_SESSION['linktracking'] ) ) { |
$_SESSION['linktracking'] = 1; |
} |
// Suppression des slash. |
$wiki = preg_replace("/^\//", '', $GLOBALS['wiki']); |
// split into page/method |
if ( preg_match( "#^(.+?)/(.*)$#", $GLOBALS['wiki'], $matches ) ) { |
list(, $page, $method) = $matches; |
} else if ( preg_match( "#^(.*)$#", $GLOBALS['wiki'], $matches ) ) { |
list(, $page) = $matches; |
} |
// Création de l'objet Wiki |
$GLOBALS['wiki'] = new Wiki( $GLOBALS['wikini_config_defaut'] ); |
// Vérification de la méthode d'affichage employée! |
if ( ! isset( $method ) ) { |
$method = ''; |
} |
//Récupération du contenu de la page Wikini |
$sortie = remplacerEntiteHTLM('<div id="wikini_page">'."\n".$GLOBALS['wiki']->Run($page, $method).'</div>'."\n"); |
return $sortie; |
} |
/** Fonction afficherContenuPied() - Fonction appelé par le gestionnaire Papyrus. |
* |
* Elle retourne le pied de l'application. |
* |
* @return string du code XHTML correspondant au pied renvoyé par l'application. |
*/ |
function afficherContenuPied() |
{ |
return inclusion_html('pied_page'); |
} |
// +------------------------------------------------------------------------------------------------------+ |
// | PIED du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.3 2005/05/19 15:22:46 jpm |
* Ajout du remplacement des & par des & |
* |
* Revision 1.2 2005/05/19 13:17:02 jpm |
* Ajout d'une balise div pour encadre le contenu du wikini. |
* |
* Revision 1.1 2005/03/02 17:47:05 jpm |
* Ajout des fichiers necessaires à l'intégrateur de wikini. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
/trunk/client/integrateur_wikini/bibliotheque/iw_affichage_xhtml.fonct.php |
---|
New file |
0,0 → 1,86 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.3 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Integrateur Wikini. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: iw_affichage_xhtml.fonct.php,v 1.1 2005-08-18 10:20:08 ddelon Exp $ |
/** |
* Fichier permettant d'inclure les données dans du XHTML. |
* |
* Fichier contenant des fonctions retournant du XHTML une fois les données passées en paramêtre incluse à l 'intérieur. |
* |
*@package IntegrateurWikini |
*@subpackage Fonctions |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2005 |
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:08 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// | LISTE de FONCTIONS | |
// +------------------------------------------------------------------------------------------------------+ |
/** |
* Fonction inclusion_html() - Gestion des inclusions XHTML dans le code PHP. |
* |
* Cette fonction retourne du XHTML à insérer dans le code PHP. |
* |
* @param string le type d'inclusion de XHTML à retourner. |
* @param array le tableau des paramêtre à inclure dans le XHTML à retourner. |
* @return string contient du XHTML à insérer dans le code PHP. |
*/ |
function inclusion_html($type_inclusion, $variable = array()){ |
$html_renvoyer = ''; |
switch ($type_inclusion){ |
// +------------------------------------------------------------------------------------------------------+ |
// LES TITRES |
// +------------------------------------------------------------------------------------------------------+ |
// LES TEXTES |
// +------------------------------------------------------------------------------------------------------+ |
// LES PIEDS DE PAGES |
case "pied_page" : |
$html_renvoyer = |
'<p class="eflore_pied_page">'. |
'Si vous constatez des problèmes ou des insuffisances en utilisant cette application, veuillez contacter :'. |
'<a href="mailto:jpm@tela-botanica.org">Jean-Pascal MILCENT</a>'. |
'</p>'; |
break; |
}//fin du switch |
return remplacerEntiteHTLM($html_renvoyer); |
}//fin fonction inclusion_html |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/pageindex.php |
---|
New file |
0,0 → 1,28 |
<?php |
if ($pages = $this->LoadAllPages()) |
{ |
foreach ($pages as $page) |
{ |
if (!preg_match("/^Comment/", $page["tag"])) { |
$firstChar = strtoupper($page["tag"][0]); |
if (!preg_match("/[A-Z,a-z]/", $firstChar)) { |
$firstChar = "#"; |
} |
if ($firstChar != $curChar) { |
if ($curChar) print("<br />\n"); |
print("<b>$firstChar</b><br />\n"); |
$curChar = $firstChar; |
} |
print($this->ComposeLinkToPage($page["tag"])."<br />\n"); |
} |
} |
} |
else |
{ |
print("<i>Aucune page trouvée.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/mypages.php |
---|
New file |
0,0 → 1,50 |
<?php |
// actions/mypages.php |
// written by Carlo Zottmann |
// http://wakkawikki.com/CarloZottmann |
if ($user = $this->GetUser()) |
{ |
print("<b>Liste des pages dont vous êtes le propriétaire.</b><br /><br />\n"); |
$my_pages_count = 0; |
if ($pages = $this->LoadAllPages()) |
{ |
foreach ($pages as $page) |
{ |
if ($this->UserName() == $page["owner"] && !preg_match("/^Comment/", $page["tag"])) { |
$firstChar = strtoupper($page["tag"][0]); |
if (!preg_match("/[A-Z,a-z]/", $firstChar)) { |
$firstChar = "#"; |
} |
if ($firstChar != $curChar) { |
if ($curChar) print("<br />\n"); |
print("<b>$firstChar</b><br />\n"); |
$curChar = $firstChar; |
} |
print($this->ComposeLinkToPage($page["tag"])."<br />\n"); |
$my_pages_count++; |
} |
} |
if ($my_pages_count == 0) |
{ |
print("<i>Vous n'êtes le propriétaire d'aucune page.</i>"); |
} |
} |
else |
{ |
print("<i>Aucune page trouvée.</i>"); |
} |
} |
else |
{ |
print("<i>Vous n'êtes pas identifié : impossible d'afficher la liste des pages que vous avez modifiées.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/resetpassword.php |
---|
New file |
0,0 → 1,59 |
<?php |
if (($user = $this->GetUser()) && ($user["name"]==$this->GetConfigValue("admin")) && $this->GetConfigValue("admin")) |
{ |
if (($_REQUEST["action"] == "resetpass")) |
{ |
$this->Query("update ".$this->config["table_prefix"]."users set ". |
"password = md5('".mysql_escape_string($_POST["password"])."') ". |
"where name = '".mysql_escape_string($_POST["name"])."' limit 1"); |
$this->SetMessage("Mot de passe réinitialisé !"); |
$this->Redirect($this->href()); |
} |
else |
{ |
$error=""; |
//$error = "Il est interdit de réinistialiser le mot de pass de cet utilisateur ! Non mais !"; |
} |
print($this->FormOpen()); |
$name=$_GET["name"]; |
?> |
<input type="hidden" name="action" value="resetpass"> |
<table> |
<tr> |
<td align="right"></td> |
<td><?php echo $this->Format("Réinitialisation du mot de passe"); ?></td> |
</tr> |
<?php |
if ($error) |
{ |
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n"); |
} |
?> |
<tr> |
<td align="right">Login:</td> |
<td><input name="name" size="40" value="<?php echo $name ?>"></td> |
</tr> |
<tr> |
<td align="right">Nouveau mot de passe:</td> |
<td><input type="password" name="password" size="40"></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Reset password" size="40"></td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} |
else |
{ |
print("<i>Vous n'avez pas les permissions nécessaires pour l'exécution de cette action.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/recentchanges.php |
---|
New file |
0,0 → 1,46 |
<?php |
// Which is the max number of pages to be shown ? |
if ($max = $this->GetParameter("max")) |
{ |
if ($max=="last") $max=50; else $last = (int) $max; |
} |
elseif ($user = $this->GetUser()) |
{ |
$max = $user["changescount"]; |
} |
else |
{ |
$max = 50; |
} |
// Show recently changed pages |
if ($pages = $this->LoadRecentlyChanged($max)) |
{ |
if ($this->GetParameter("max")) |
{ |
foreach ($pages as $i => $page) |
{ |
// print entry |
print("(".$page["time"].") (".$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0).") ".$this->ComposeLinkToPage($page["tag"], "", "", 0)." . . . . ".$this->Format($page["user"])."<br />\n"); |
} |
} |
else |
{ |
$curday=''; |
foreach ($pages as $i => $page) |
{ |
// day header |
list($day, $time) = explode(" ", $page["time"]); |
if ($day != $curday) |
{ |
if ($curday) print("<br />\n"); |
print("<b>$day :</b><br />\n"); |
$curday = $day; |
} |
// print entry |
print(" (".$time.") (".$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0).") ".$this->ComposeLinkToPage($page["tag"], "", "", 0)." . . . . ".$this->Format($page["user"])."<br />\n"); |
} |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/textsearch.php |
---|
New file |
0,0 → 1,28 |
<?php echo $this->FormOpen("", "", "get") ?> |
<table border="0" cellspacing="0" cellpadding="0"> |
<tr> |
<td>Ce que vous souhaitez chercher : </td> |
<td><input name="phrase" size="40" value="<?php echo htmlentities($_REQUEST["phrase"]) ?>" /> <input type="submit" value="Chercher" /></td> |
</tr> |
</table> |
<?php echo $this->FormClose(); ?> |
<?php |
if ($phrase = $_REQUEST["phrase"]) |
{ |
print("<br />"); |
if ($results = $this->FullTextSearch($phrase)) |
{ |
print("<b>Résultat(s) de la recherche de \"$phrase\":</b><br /><br />\n"); |
foreach ($results as $i => $page) |
{ |
print(($i+1).". ".$this->ComposeLinkToPage($page["tag"])."<br />\n"); |
} |
} |
else |
{ |
print("Aucun résultat pour \"$phrase\". :-("); |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/findpage.php |
---|
New file |
0,0 → 1,0 |
The unfinished FindPage action. |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/mychanges.php |
---|
New file |
0,0 → 1,95 |
<?php |
// actions/mychanges.php |
// written by Carlo Zottmann |
// http://wakkawikki.com/CarloZottmann |
if ($user = $this->GetUser()) |
{ |
$my_edits_count = 0; |
if ($_REQUEST["bydate"] == 1) |
{ |
print("<b>Liste des pages que vous avez modifiées, triée par date de modification (<a href=\"".$this->href("", $tag)."\">tri alphabétique</a>).</b><br /><br />\n"); |
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY time ASC, tag ASC")) |
{ |
foreach ($pages as $page) |
{ |
$edited_pages[$page["tag"]] = $page["time"]; |
} |
$edited_pages = array_reverse($edited_pages); |
foreach ($edited_pages as $page["tag"] => $page["time"]) |
{ |
// day header |
list($day, $time) = explode(" ", $page["time"]); |
if ($day != $curday) |
{ |
if ($curday) print("<br />\n"); |
print("<b>$day:</b><br />\n"); |
$curday = $day; |
} |
// print entry |
print(" ($time) (".$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0).") ".$this->ComposeLinkToPage($page["tag"], "", "", 0)."<br />\n"); |
$my_edits_count++; |
} |
if ($my_edits_count == 0) |
{ |
print("<i>Vous n'avez pas modifié de page.</i>"); |
} |
} |
else |
{ |
print("<i>Aucune page trouvée.</i>"); |
} |
} |
else |
{ |
print("<b>Liste des pages que vous avez modifiées, triée par date de modification (<a href=\"".$this->href("", $tag)."&bydate=1\">tri par date</a>).</b><br /><br />\n"); |
if ($pages = $this->LoadAll("SELECT tag, time FROM ".$this->config["table_prefix"]."pages WHERE user = '".mysql_escape_string($this->UserName())."' AND tag NOT LIKE 'Comment%' ORDER BY tag ASC, time DESC")) |
{ |
foreach ($pages as $page) |
{ |
if ($last_tag != $page["tag"]) { |
$last_tag = $page["tag"]; |
$firstChar = strtoupper($page["tag"][0]); |
if (!preg_match("/[A-Z,a-z]/", $firstChar)) { |
$firstChar = "#"; |
} |
if ($firstChar != $curChar) { |
if ($curChar) print("<br />\n"); |
print("<b>$firstChar</b><br />\n"); |
$curChar = $firstChar; |
} |
// print entry |
print(" (".$page["time"].") (".$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0).") ".$this->ComposeLinkToPage($page["tag"], "", "", 0)."<br />\n"); |
$my_edits_count++; |
} |
} |
if ($my_edits_count == 0) |
{ |
print("<i>Vous n'avez pas modifié de page.</i>"); |
} |
} |
else |
{ |
print("<i>Aucune page trouvée.</i>"); |
} |
} |
} |
else |
{ |
print("<i>Vous n'etes pas identifié : impossible d'afficher la liste des pages que vous avez modifiées.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/test.php |
---|
New file |
0,0 → 1,0 |
I'm a test! |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/orphanedpages.php |
---|
New file |
0,0 → 1,15 |
<?php |
if ($pages = $this->LoadOrphanedPages()) |
{ |
foreach ($pages as $page) |
{ |
print($this->ComposeLinkToPage($page["tag"], "", "", 0)."<br />\n"); |
} |
} |
else |
{ |
print("<i>Pas de pages orphelines</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/recentlycommented.php |
---|
New file |
0,0 → 1,25 |
<?php |
if ($pages = $this->LoadRecentlyCommented()) |
{ |
foreach ($pages as $page) |
{ |
// day header |
list($day, $time) = explode(" ", $page["time"]); |
if ($day != $curday) |
{ |
if ($curday) print("<br />\n"); |
print("<b>$day:</b><br />\n"); |
$curday = $day; |
} |
// print entry |
print(" (".$page["comment_time"].") <a href=\"".$this->href("", $page["tag"], "show_comments=1")."#".$page["comment_tag"]."\">".$page["tag"]."</a> . . . . dernier commentaire par ".$this->Format($page["comment_user"])."<br />\n"); |
} |
} |
else |
{ |
print("<i>Aucune page n'a été commentée récemment.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/recentcomments.php |
---|
New file |
0,0 → 1,25 |
<?php |
if ($comments = $this->LoadRecentComments()) |
{ |
foreach ($comments as $comment) |
{ |
// day header |
list($day, $time) = explode(" ", $comment["time"]); |
if ($day != $curday) |
{ |
if ($curday) print("<br />\n"); |
print("<b>$day:</b><br />\n"); |
$curday = $day; |
} |
// print entry |
print(" (".$comment["time"].") <a href=\"".$this->href("", $comment["comment_on"], "show_comments=1")."#".$comment["tag"]."\">".$comment["comment_on"]."</a> . . . . ".$this->Format($comment["user"])."<br />\n"); |
} |
} |
else |
{ |
print("<i>Pas de commentaires récents.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/header.php |
---|
New file |
0,0 → 1,46 |
<?php |
$message = $this->GetMessage(); |
$user = $this->GetUser(); |
?> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html> |
<head> |
<title><?php echo $this->GetWakkaName().":".$this->GetPageTag(); ?></title> |
<?php if ($this->GetMethod() != 'show') |
echo "<meta name=\"robots\" content=\"noindex, nofollow\"/>\n";?> |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> |
<meta name="keywords" content="<?php echo $this->GetConfigValue("meta_keywords") ?>" /> |
<meta name="description" content="<?php echo $this->GetConfigValue("meta_description") ?>" /> |
<link rel="stylesheet" type="text/css" media="screen" href="wakka.basic.css" /> |
<style type="text/css" media="all"> @import "wakka.css";</style> |
<script type="text/javascript"> |
function fKeyDown() { if (event.keyCode == 9) { |
event.returnValue= false; |
document.selection.createRange().text = String.fromCharCode(9) } } |
</script> |
</head> |
<body <?php echo (!$user || ($user["doubleclickedit"] == 'Y')) && ($this->GetMethod() == "show") ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "" ?> |
<?php echo $message ? "onLoad=\"alert('".$message."');\" " : "" ?> |
> |
<h1 class="wiki_name"><?php echo $this->config["wakka_name"] ?></h1> |
<h1 class="page_name"> |
<a href="<?php echo $this->config["base_url"] ?>RechercheTexte&phrase=<?php echo urlencode($this->GetPageTag()); ?>"> |
<?php echo $this->GetPageTag(); ?> |
</a> |
</h1> |
<div class="header"> |
<?php echo $this->ComposeLinkToPage($this->config["root_page"]); ?> :: |
<?php echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"])." :: \n" : "" ?> |
Vous êtes <?php echo $this->Format($this->GetUserName()); if ($user = $this->GetUser()) echo " (<a href=\"".$this->config["base_url"] ."ParametresUtilisateur&action=logout\">Déconnexion</a>)\n"; ?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/listpages.php |
---|
New file |
0,0 → 1,65 |
<?php |
if (!function_exists("TreeView")) |
{ |
function TreeView($node,$level,$indent=0) |
{ |
global $wiki; |
if ($level>0) { |
$head=split(" :: ",$wiki->GetConfigValue("navigation_links")); |
// we don't want page from the header |
if (!in_array($node, $head, TRUE)) |
{ |
if (($indent>0) && (!($wiki->GetConfigValue("root_page")==$node)) || ($indent==0) ) |
{ |
// Ignore users too ... |
if (!$wiki->LoadUser($node)) |
{ |
if ($indent) |
print((str_repeat(" ",$indent)).$wiki->Link($node)."<br/>\n"); |
$pages = $wiki->LoadAll("select to_tag from ".$wiki->config["table_prefix"]."links where from_tag='".mysql_escape_string($node)."' order by to_tag asc"); |
if (is_array($pages)) { |
foreach ($pages as $page) |
{ |
$wiki->CachePage($page); |
TreeView($page["to_tag"],$level-1,$indent+1); |
} |
} |
} |
} |
} |
} |
} |
} |
if($sortkey = $this->GetParameter("sort")) { |
if (($sortkey != "tag") && ($sortkey != "time") && ($sortkey != "owner") && ($sortkey != "user")) $sortkey = "tag"; |
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by $sortkey asc"); |
foreach ($pages as $page) { |
$this->CachePage($page); |
$owner=$page["owner"]?$page["owner"]:"Inconnu"; |
print(" ".$this->ComposeLinkToPage($page["tag"], "", "", 0)." . . . . ".$this->Format($owner).". . . . dernière modification par " . $this->Format($page["user"]) . "<br/>\n"); |
} |
} |
// Tree display |
else if ($sortkey = $this->GetParameter("tree")) |
{ |
// No rootpage specified, assume root_page |
if ($sortkey=="tree") $sortkey=$this->GetConfigValue("root_page"); |
print($this->ComposeLinkToPage($sortkey)."<br /><br/>\n"); |
// 3 levels displayed, It should be parameter ... |
TreeView($sortkey,3); |
} |
// Default Action : sort by tag |
else |
{ |
$pages = $this->LoadAll("select tag, owner, user from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by tag asc"); |
foreach ($pages as $page) { |
$this->CachePage($page); |
$owner=$page["owner"]?$page["owner"]:"Inconnu"; |
print(" ".$this->ComposeLinkToPage($page["tag"], "", "", 0)." . . . . ".$this->Format($owner)."<br/>\n"); |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/listusers.php |
---|
New file |
0,0 → 1,24 |
<?php |
if ($last = $this->GetParameter("last")) |
{ |
if ($last=="last") $last=150; else $last= (int) $last; |
if ($last) |
{ |
$last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by signuptime desc limit $last"); |
foreach($last_users as $user) { print($this->Format($user["name"])." . . . ".$user["signuptime"]."<br />\n"); } |
} |
} |
else |
{ |
if ($last_users = $this->LoadAll("select name, signuptime from ".$this->config["table_prefix"]."users order by name asc") |
) |
{ |
foreach($last_users as $user) |
{ |
print($this->Format($user["name"])." . . . ".$user["signuptime"]."<br />\n"); |
} |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/footer.php |
---|
New file |
0,0 → 1,71 |
<div class="footer"> |
<?php |
echo $this->FormOpen("", "RechercheTexte", "get"); |
echo $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour éditer cette page.\">Éditer cette page</a> ::\n" : ""; |
echo $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les dernières modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : ""; |
// if this page exists |
if ($this->page) |
{ |
// if owner is current user |
if ($this->UserIsOwner()) |
{ |
"Propriétaire : vous :: \n". |
"<a href=\"".$this->href("acls")."\" title=\"Cliquez pour éditer les permissions de cette page.\">Éditer permissions</a> :: \n". |
"<a href=\"".$this->href("deletepage")."\">Supprimer</a> :: \n"; |
} |
else |
{ |
if ($owner = $this->GetPageOwner()) |
{ |
print "Propriétaire : ".$this->Format($owner); |
} |
else |
{ |
print "Pas de propriétaire ".($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : ""); |
} |
print " :: \n"; |
} |
} |
?> |
<a href="<?php echo $this->href("referrers") ?>" title="Cliquez pour voir les URLs faisant référence à cette page."> |
References</a> :: |
Recherche : <input name="phrase" size="15" class="searchbox" /> |
<?php echo $this->FormClose(); ?> |
</div> |
<div class="copyright"> |
<a href="http://validator.w3.org/check/referer">Valid XHTML 1.0</a> :: |
<a href="http://jigsaw.w3.org/css-validator/check/referer">Valid CSS</a> :: |
-- powered by <?php echo $this->Link("WikiNi:PagePrincipale", "", "WikiNi ".$this->GetWikiNiVersion()) . "\n"; ?> |
</div> |
<?php |
if ($this->GetConfigValue("debug")=="yes") |
{ |
print "<span class=\"debug\"><b>Query log :</b><br />\n"; |
$t_SQL=0; |
foreach ($this->queryLog as $query) |
{ |
print $query["query"]." (".round($query["time"],4).")<br />\n"; |
$t_SQL = $t_SQL + $query["time"]; |
} |
print "</span>\n"; |
print "<span class=\"debug\">".round($t_SQL, 4)." s (total SQL time)</span><br />\n"; |
list($g2_usec, $g2_sec) = explode(" ",microtime()); |
define ("t_end", (float)$g2_usec + (float)$g2_sec); |
print "<span class=\"debug\"><b>".round(t_end-t_start, 4)." s (total time)</b></span><br />\n"; |
print "<span class=\"debug\">SQL time represent : ".round((($t_SQL/(t_end-t_start))*100),2)."% of total time</span>\n"; |
} |
?> |
</body> |
</html> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/usersettings.php |
---|
New file |
0,0 → 1,223 |
<?php |
if ($_REQUEST["action"] == "logout") |
{ |
$this->LogoutUser(); |
$this->SetMessage("Vous êtes maintenant déconnecté !"); |
$this->Redirect($this->href()); |
} |
else if ($user = $this->GetUser()) |
{ |
// is user trying to update? |
if ($_REQUEST["action"] == "update") |
{ |
$this->Query("update ".$this->config["table_prefix"]."users set ". |
"email = '".mysql_escape_string($_POST["email"])."', ". |
"doubleclickedit = '".mysql_escape_string($_POST["doubleclickedit"])."', ". |
"show_comments = '".mysql_escape_string($_POST["show_comments"])."', ". |
"revisioncount = '".mysql_escape_string($_POST["revisioncount"])."', ". |
"changescount = '".mysql_escape_string($_POST["changescount"])."', ". |
"motto = '".mysql_escape_string($_POST["motto"])."' ". |
"where name = '".$user["name"]."' limit 1"); |
$this->SetUser($this->LoadUser($user["name"])); |
// forward |
$this->SetMessage("Paramètres sauvegardés !"); |
$this->Redirect($this->href()); |
} |
if ($_REQUEST["action"] == "changepass") |
{ |
// check password |
$password = $_POST["password"]; |
if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans les mots de passe."; |
else if (strlen($password) < 5) $error = "Password too short."; |
else if ($user["password"] != md5($_POST["oldpass"])) $error = "Mauvais mot de passe."; |
else |
{ |
$this->Query("update ".$this->config["table_prefix"]."users set "."password = md5('".mysql_escape_string($password)."') "."where name = '".$user["name"]."'"); |
$this->SetMessage("Mot de passe changé !"); |
$user["password"]=md5($password); |
$this->SetUser($user); |
$this->Redirect($this->href()); |
} |
} |
// user is logged in; display config form |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="update" /> |
<table> |
<tr> |
<td align="right"></td> |
<td>Hello, <?php echo $this->Link($user["name"]) ?>!</td> |
</tr> |
<tr> |
<td align="right">Votre adresse e-mail :</td> |
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Edition en Doublecliquant :</td> |
<td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $user["doubleclickedit"] == "Y" ? "checked=\"checked\"" : "" ?> /></td> |
</tr> |
<tr> |
<td align="right">Montrer les commentaires par default :</td> |
<td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $user["show_comments"] == "Y" ? "checked\"checked\"" : "" ?> /></td> |
</tr> |
<tr> |
<td align="right">Nombre maximum de derniers commentaires :</td> |
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Nombre maximum de versions :</td> |
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Votre devise :</td> |
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Mise à jour" /> <input type="button" value="Déconnection" onClick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td> |
</tr> |
<?php |
print($this->FormClose()); |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="changepass" /> |
<tr> |
<td> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"></td> |
<td><?php echo $this->Format("Changement de mot de passe"); ?></td> |
</tr> |
<?php |
if ($error) |
{ |
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n"); |
} |
?> |
<tr> |
<td align="right">Votre ancien mot de passe :</td> |
<td><input type="password" name="oldpass" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Nouveau mot de passe :</td> |
<td><input type="password" name="password" size="40" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Changer" size="40" /></td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} |
else |
{ |
// user is not logged in |
// is user trying to log in or register? |
if ($_REQUEST["action"] == "login") |
{ |
// if user name already exists, check password |
if ($existingUser = $this->LoadUser($_POST["name"])) |
{ |
// check password |
if ($existingUser["password"] == md5($_POST["password"])) |
{ |
$this->SetUser($existingUser, $_POST["remember"]); |
$this->Redirect($this->href()); |
} |
else |
{ |
$error = "Mauvais mot de passe !"; |
} |
} |
// otherwise, create new account |
else |
{ |
$name = trim($_POST["name"]); |
$email = trim($_POST["email"]); |
$password = $_POST["password"]; |
$confpassword = $_POST["confpassword"]; |
// check if name is WikkiName style |
if (!$this->IsWikiName($name)) $error = "Votre nom d'utilisateur dois être formaté en NomWiki."; |
else if (!$email) $error = "Vous devez spécifier une adresse e-mail."; |
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas à une adresse e-mail."; |
else if ($confpassword != $password) $error = "Les mots de passe n'étaient pas identiques"; |
else if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans un mot de passe."; |
else if (strlen($password) < 5) $error = "Mot de passe trop court. Un mot de passe doit contenir au minimum 5 caractères alphanumériques."; |
else |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."users set ". |
"signuptime = now(), ". |
"name = '".mysql_escape_string($name)."', ". |
"email = '".mysql_escape_string($email)."', ". |
"password = md5('".mysql_escape_string($_POST["password"])."')"); |
// log in |
$this->SetUser($this->LoadUser($name)); |
// forward |
$this->Redirect($this->href()); |
} |
} |
} |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="login" /> |
<table> |
<tr> |
<td align="right"></td> |
<td><?php echo $this->Format("Si vous êtes déjà enregistré, identifiez-vous ici"); ?></td> |
</tr> |
<?php |
if ($error) |
{ |
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n"); |
} |
?> |
<tr> |
<td align="right">Votre NomWiki :</td> |
<td><input name="name" size="40" value="<?php echo $name ?>" /></td> |
</tr> |
<tr> |
<td align="right">Mot de passe (5 caractères minimum) :</td> |
<td><input type="password" name="password" size="40" /> |
<input type="hidden" name="remember" value="0" /><input type="checkbox" name="remember" value="1" /> <?php echo $this->Format("Se souvenir de moi.") ?> </td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Identification" size="40" /></td> |
</tr> |
<tr> |
<td align="right"></td> |
<td width="500"><?php echo $this->Format("Les champs suivants sont à remplir si vous vous identifiez pour la première fois (vous créérez ainsi un compte)"); ?></td> |
</tr> |
<tr> |
<td align="right">Confirmation du mot de passe :</td> |
<td><input type="password" name="confpassword" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Adresse e-mail :</td> |
<td><input name="email" size="40" value="<?php echo $email ?>" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Nouveau compte" size="40" /></td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/backlinks.php |
---|
New file |
0,0 → 1,15 |
<?php |
if ($pages = $this->LoadPagesLinkingTo($this->getPageTag())) |
{ |
print("Pages ayant un lien vers la page courante : <br />\n"); |
foreach ($pages as $page) |
{ |
print($this->ComposeLinkToPage($page["tag"])."<br />\n"); |
} |
} |
else |
{ |
print("<i>Aucune page n'a de lien vers ".$this->ComposeLinkToPage($this->getPageTag()).".</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/interwikilist.php |
---|
New file |
0,0 → 1,4 |
<?php |
$file = implode("", file("interwiki.conf", 1)); |
print($this->Format("%%".$file."%%")); |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/recentchangesrss.php |
---|
New file |
0,0 → 1,41 |
<?php |
if ($user = $this->GetUser()) |
{ |
$max = $user["changescount"]; |
} |
else |
{ |
$max = 50; |
} |
if ($pages = $this->LoadRecentlyChanged($max)) |
{ |
if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"]; |
$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n"; |
$output .= "<!-- RSS v0.91 generated by Wikini -->\n"; |
$output .= "<rdf:RDF\n"; |
$output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; |
$output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n"; |
$output .= "<channel>\n"; |
$output .= "<title> Derniers changements sur ". $this->config["wakka_name"] . "</title>\n"; |
$output .= "<link>" . $this->config["base_url"] . $link . "</link>\n"; |
$output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n"; |
$output .= "<language>fr</language>\n"; |
$output .= "</channel>\n"; |
foreach ($pages as $i => $page) |
{ |
list($day, $time) = explode(" ", $page["time"]); |
$day= preg_replace("/-/", " ", $day); |
list($hh,$mm,$ss) = explode(":", $time); |
$output .= "<item>\n"; |
$output .= "<title>" . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n"; |
$output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n"; |
$output .= "<link>" . $this->config["base_url"] . $page["tag"] . "&time=" . rawurlencode($page["time"]) . "</link>\n"; |
$output .= "</item>\n"; |
} |
$output .= "</rdf:RDF>\n"; |
print($output); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/actions/wantedpages.php |
---|
New file |
0,0 → 1,14 |
<?php |
if ($pages = $this->LoadWantedPages()) |
{ |
foreach ($pages as $page) |
{ |
print($this->Link($page["tag"])." (<a |
ref=\"".$this->href()."&linking_to=".$page["tag"]."\">".$page["count"]."</a>)<br />\n"); |
} |
} |
else |
{ |
print("<i>Aucune page à créer.</i>"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/addcomment.php |
---|
New file |
0,0 → 1,38 |
<?php |
//print("<xmp>"); print_r($_REQUEST); exit; |
if ($this->HasAccess("comment")) |
{ |
// find number |
if ($latestComment = $this->LoadSingle("select tag, id from ".$this->config["table_prefix"]."pages where comment_on != '' order by id desc limit 1")) |
{ |
preg_match("/^Comment([0-9]+)$/", $latestComment["tag"], $matches); |
$num = $matches[1] + 1; |
} |
else |
{ |
$num = "1"; |
} |
$body = trim($_POST["body"]); |
if (!$body) |
{ |
$this->SetMessage("Comment body was empty -- not saved!"); |
} |
else |
{ |
// store new comment |
$this->SavePage("Comment".$num, $body, $this->tag); |
} |
// redirect to page |
$this->redirect($this->href()); |
} |
else |
{ |
print("<div class=\"page\"><i>Sorry, you're not allowed to post comments to this page.</i></div>\n"); |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/wakka.php |
---|
New file |
0,0 → 1,591 |
<?php |
/* |
Yes, most of the formatting used in this file is HORRIBLY BAD STYLE. However, |
most of the action happens outside of this file, and I really wanted the code |
to look as small as what it does. Basically. Oh, I just suck. :) |
*/ |
// do not change this line, you fool. In fact, don't change anything! Ever! |
define("WAKKA_VERSION", "0.1.1"); |
define("WIKINI_VERSION", "0.3"); |
/* Mise en commentaire pour transformation en bibliothèque |
// start the compute time |
list($g_usec, $g_sec) = explode(" ",microtime()); |
define ("t_start", (float)$g_usec + (float)$g_sec); |
$t_SQL=0; |
*/ |
class Wiki |
{ |
var $dblink; |
var $page; |
var $tag; |
var $parameter = array(); |
var $queryLog = array(); |
var $interWiki = array(); |
var $VERSION; |
// constructor |
function Wiki($config) |
{ |
$this->config = $config; |
/* might be a good idea to change this to mysql_connect */ |
$this->dblink = mysql_pconnect ( |
$this->config["mysql_host"], |
$this->config["mysql_user"], |
$this->config["mysql_password"]); |
mysql_select_db($this->config["mysql_database"], $this->dblink); |
$this->VERSION = WAKKA_VERSION; |
} |
// DATABASE |
function Query($query) |
{ |
if($this->GetConfigValue("debug")) $start = $this->GetMicroTime(); |
if (!$result = mysql_query($query, $this->dblink)) |
{ |
ob_end_clean(); |
die("Query failed: ".$query." (".mysql_error().")"); |
} |
if($this->GetConfigValue("debug")) |
{ |
$time = $this->GetMicroTime() - $start; |
$this->queryLog[] = array( |
"query" => $query, |
"time" => $time); |
} |
return $result; |
} |
function LoadSingle($query) { if ($data = $this->LoadAll($query)) return $data[0]; } |
function LoadAll($query) |
{ |
$data=array(); |
if ($r = $this->Query($query)) |
{ |
while ($row = mysql_fetch_assoc($r)) $data[] = $row; |
mysql_free_result($r); |
} |
return $data; |
} |
// MISC |
function GetMicroTime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } |
function IncludeBuffered($filename, $notfoundText = "", $vars = "", $path = "") |
{ |
if ($path) $dirs = explode(":", $path); |
else $dirs = array(""); |
foreach($dirs as $dir) |
{ |
if ($dir) $dir .= "/"; |
$fullfilename = $dir.$filename; |
if (file_exists($fullfilename)) |
{ |
if (is_array($vars)) extract($vars); |
ob_start(); |
include($fullfilename); |
$output = ob_get_contents(); |
ob_end_clean(); |
return $output; |
} |
} |
if ($notfoundText) return $notfoundText; |
else return false; |
} |
// VARIABLES |
function GetPageTag() { return $this->tag; } |
function GetPageTime() { return $this->page["time"]; } |
function GetMethod() { return $this->method; } |
function GetConfigValue($name) { return $this->config[$name]; } |
function GetWakkaName() { return $this->GetConfigValue("wakka_name"); } |
function GetWakkaVersion() { return $this->VERSION; } |
function GetWikiNiVersion() { $ver=$this->GetWakkaVersion().'.'.WIKINI_VERSION; return $ver; } |
// PAGES |
function LoadPage($tag, $time = "", $cache = 1) { |
// retrieve from cache |
if (!$time && $cache && ($cachedPage = $this->GetCachedPage($tag))) { $page = $cachedPage;} |
// load page |
if (!isset($page)) $page = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($tag)."' ".($time ? "and time = '".mysql_escape_string($time)."'" : "and latest = 'Y'")." limit 1"); |
// cache result |
if (!$time) $this->CachePage($page); |
return $page; |
} |
function GetCachedPage($tag) {return (isset($this->pageCache[$tag]) ? $this->pageCache[$tag] : ''); } |
function CachePage($page) { $this->pageCache[$page["tag"]] = $page; } |
function SetPage($page) { $this->page = $page; if ($this->page["tag"]) $this->tag = $this->page["tag"]; } |
function LoadPageById($id) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".mysql_escape_string($id)."' limit 1"); } |
function LoadRevisions($page) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page)."' order by time desc"); } |
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_escape_string($tag)."' order by tag"); } |
function LoadRecentlyChanged($limit=50) |
{ |
$limit= (int) $limit; |
if ($pages = $this->LoadAll("select tag, time, user, owner from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by time desc limit $limit")) |
{ |
foreach ($pages as $page) |
{ |
$this->CachePage($page); |
} |
return $pages; |
} |
} |
function LoadAllPages() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' order by tag"); } |
function FullTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(tag, body) against('".mysql_escape_string($phrase)."')"); } |
function LoadWantedPages() { return $this->LoadAll("select distinct ".$this->config["table_prefix"]."links.to_tag as tag,count(".$this->config["table_prefix"]."links.from_tag) as count from ".$this->config["table_prefix"]."links left join ".$this->config["table_prefix"]."pages on ".$this->config["table_prefix"]."links.to_tag = ".$this->config["table_prefix"]."pages.tag where ".$this->config["table_prefix"]."pages.tag is NULL group by tag order by count desc"); } |
function LoadOrphanedPages() { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on = '' order by tag"); } |
function IsOrphanedPage($tag) { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on ='' and tag='".mysql_escape_string($tag)."'"); } |
function DeleteOrphanedPage($tag) |
{ |
$this->Query("delete from ".$this->config["table_prefix"]."pages where tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."acls where page_tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."referrers where page_tag='".mysql_escape_string($tag)."' "); |
} |
function SavePage($tag, $body, $comment_on = "") |
{ |
// get current user |
$user = $this->GetUserName(); |
//die($tag); |
// TODO: check write privilege |
if ($this->HasAccess("write", $tag)) |
{ |
// is page new? |
if (!$oldPage = $this->LoadPage($tag)) |
{ |
// create default write acl. store empty write ACL for comments. |
$this->SaveAcl($tag, "write", ($comment_on ? "" : $this->GetConfigValue("default_write_acl"))); |
// create default read acl |
$this->SaveAcl($tag, "read", $this->GetConfigValue("default_read_acl")); |
// create default comment acl. |
$this->SaveAcl($tag, "comment", $this->GetConfigValue("default_comment_acl")); |
// current user is owner; if user is logged in! otherwise, no owner. |
if ($this->GetUser()) $owner = $user; |
} |
else |
{ |
// aha! page isn't new. keep owner! |
$owner = $oldPage["owner"]; |
} |
// set all other revisions to old |
$this->Query("update ".$this->config["table_prefix"]."pages set latest = 'N' where tag = '".mysql_Escape_string($tag)."'"); |
// add new revision |
$this->Query("insert into ".$this->config["table_prefix"]."pages set ". |
"tag = '".mysql_escape_string($tag)."', ". |
($comment_on ? "comment_on = '".mysql_escape_string($comment_on)."', " : ""). |
"time = now(), ". |
"owner = '".mysql_escape_string($owner)."', ". |
"user = '".mysql_escape_string($user)."', ". |
"latest = 'Y', ". |
"body = '".mysql_escape_string(trim($body))."'"); |
} |
} |
// COOKIES |
function SetSessionCookie($name, $value) { SetCookie($name, $value, 0, "/"); $_COOKIE[$name] = $value; } |
function SetPersistentCookie($name, $value, $remember = 0) { SetCookie($name, $value, time() + ($remember ? 90*24*60*60 : 60 * 60), "/"); $_COOKIE[$name] = $value; } |
function DeleteCookie($name) { SetCookie($name, "", 1, "/"); $_COOKIE[$name] = ""; } |
function GetCookie($name) { return $_COOKIE[$name]; } |
// HTTP/REQUEST/LINK RELATED |
function SetMessage($message) { $_SESSION["message"] = $message; } |
function GetMessage() { $message = $_SESSION["message"]; $_SESSION["message"] = ""; return $message; } |
function Redirect($url) { header("Location: $url"); exit; } |
// returns just PageName[/method]. |
function MiniHref($method = "", $tag = "") { if (!$tag = trim($tag)) $tag = $this->tag; return $tag.($method ? "/".$method : ""); } |
// returns the full url to a page/method. |
function Href($method = "", $tag = "", $params = "") |
{ |
$href = $this->config["base_url"].$this->MiniHref($method, $tag); |
if ($params) |
{ |
$href .= ($this->config["rewrite_mode"] ? "?" : "&").$params; |
} |
return $href; |
} |
function Link($tag, $method = "", $text = "", $track = 1) { |
$tag=htmlspecialchars($tag);//avoid xss |
$text=htmlspecialchars($text);//paranoiac again |
if (!$text) $text = $tag; |
// is this an interwiki link? |
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $tag, $matches)) |
{ |
$tag = $this->GetInterWikiUrl($matches[1], $matches[2]); |
return "<a href=\"$tag\">$text (interwiki)</a>"; |
} |
// is this a full link? ie, does it contain alpha-numeric characters? |
else if (preg_match("/[^[:alnum:]]/", $tag)) |
{ |
// check for email addresses |
if (preg_match("/^.+\@.+$/", $tag)) |
{ |
$tag = "mailto:".$tag; |
} |
// check for protocol-less URLs |
else if (!preg_match("/:\/\//", $tag)) |
{ |
$tag = "http://".$tag; //Very important for xss (avoid javascript:() hacking) |
} |
// is this an inline image (text!=tag and url ends png,gif,jpeg) |
if($text!=$tag and preg_match("/.(gif|jpeg|png|jpg)$/i",$tag)){ |
return "<img src=\"$tag\" alt=\"$text\" \\>"; |
}else{ |
return "<a href=\"$tag\">$text</a>"; |
} |
} |
else |
{ |
// it's a Wiki link! |
if ($_SESSION["linktracking"] && $track) $this->TrackLinkTo($tag); |
return ($this->LoadPage($tag) ? "<a href=\"".$this->href($method, $tag)."\">".$text."</a>" : "<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>"); |
} |
} |
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1) |
{ |
if (!$text) $text = $tag; |
$text = htmlentities($text); |
if ($_SESSION["linktracking"] && $track) |
$this->TrackLinkTo($tag); |
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>'; |
} |
// function PregPageLink($matches) { return $this->Link($matches[1]); } |
function IsWikiName($text) { return preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/", $text); } |
function TrackLinkTo($tag) { $_SESSION["linktable"][] = $tag; } |
function GetLinkTable() { return $_SESSION["linktable"]; } |
function ClearLinkTable() { $_SESSION["linktable"] = array(); } |
function StartLinkTracking() { $_SESSION["linktracking"] = 1; } |
function StopLinkTracking() { $_SESSION["linktracking"] = 0; } |
function WriteLinkTable() |
{ |
// delete old link table |
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag = '".mysql_escape_string($this->GetPageTag())."'"); |
if ($linktable = $this->GetLinkTable()) |
{ |
$from_tag = mysql_escape_string($this->GetPageTag()); |
foreach ($linktable as $to_tag) |
{ |
$lower_to_tag = strtolower($to_tag); |
if (!$written[$lower_to_tag]) |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."links set from_tag = '".$from_tag."', to_tag = '".mysql_escape_string($to_tag)."'"); |
$written[$lower_to_tag] = 1; |
} |
} |
} |
} |
function Header() { return $this->Action($this->GetConfigValue("header_action"), 1); } |
function Footer() { return $this->Action($this->GetConfigValue("footer_action"), 1); } |
// FORMS |
function FormOpen($method = "", $tag = "", $formMethod = "post") |
{ |
$result = "<form action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n"; |
if (!$this->config["rewrite_mode"]) $result .= "<input type=\"hidden\" name=\"wiki\" value=\"".$this->MiniHref($method, $tag)."\" />\n"; |
return $result; |
} |
function FormClose() |
{ |
return "</form>\n"; |
} |
// INTERWIKI STUFF |
function ReadInterWikiConfig() |
{ |
if ($lines = file("php/lib/wikini/interwiki.conf")) |
{ |
foreach ($lines as $line) |
{ |
if ($line = trim($line)) |
{ |
list($wikiName, $wikiUrl) = explode(" ", trim($line)); |
$this->AddInterWiki($wikiName, $wikiUrl); |
} |
} |
} |
} |
function AddInterWiki($name, $url) |
{ |
$this->interWiki[$name] = $url; |
} |
function GetInterWikiUrl($name, $tag) |
{ |
if (isset($this->interWiki[$name])) |
{ |
return $this->interWiki[$name].$tag; |
}else{ |
return 'http://'.$tag; //avoid xss by putting http:// in front of JavaScript:() |
} |
} |
// REFERRERS |
function LogReferrer($tag = "", $referrer = "") |
{ |
// fill values |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
if (!$referrer = trim($referrer) AND isset($_SERVER["HTTP_REFERER"])) $referrer = $_SERVER["HTTP_REFERER"]; |
// check if it's coming from another site |
if ($referrer && !preg_match("/^".preg_quote($this->GetConfigValue("base_url"), "/")."/", $referrer)) |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."referrers set ". |
"page_tag = '".mysql_escape_string($tag)."', ". |
"referrer = '".mysql_escape_string($referrer)."', ". |
"time = now()"); |
} |
} |
function LoadReferrers($tag = "") |
{ |
return $this->LoadAll("select referrer, count(referrer) as num from ".$this->config["table_prefix"]."referrers ".($tag = trim($tag) ? "where page_tag = '".mysql_escape_string($tag)."'" : "")." group by referrer order by num desc"); |
} |
// PLUGINS |
function Action($action, $forceLinkTracking = 0) |
{ |
$action = trim($action); $vars=array(); |
// stupid attributes check |
if ((stristr($action, "=\"")) || (stristr($action, "/"))) |
{ |
// extract $action and $vars_temp ("raw" attributes) |
preg_match("/^([A-Za-z0-9]*)\/?(.*)$/", $action, $matches); |
list(, $action, $vars_temp) = $matches; |
// match all attributes (key and value) |
$this->parameter[$vars_temp]=$vars_temp; |
preg_match_all("/([A-Za-z0-9]*)=\"(.*)\"/U", $vars_temp, $matches); |
// prepare an array for extract() to work with (in $this->IncludeBuffered()) |
if (is_array($matches)) |
{ |
for ($a = 0; $a < count($matches); $a++) |
{ |
$vars[$matches[1][$a]] = $matches[2][$a]; |
$this->parameter[$matches[1][$a]]=$matches[2][$a]; |
} |
} |
} |
if (!$forceLinkTracking) $this->StopLinkTracking(); |
$result = $this->IncludeBufferedim(strtolower($action).".php", "<i>Action inconnue \"$action\"</i>", $vars, $this->config["action_path"]); |
$this->StartLinkTracking(); |
if (isset($parameter)) unset($this->parameter[$parameter]); |
unset($this->parameter); |
return $result; |
} |
function Method($method) |
{ |
if (!$handler = $this->page["handler"]) $handler = "page"; |
$methodLocation = $handler."/".$method.".php"; |
return $this->IncludeBuffered($methodLocation, "<i>Méthode inconue \"$methodLocation\"</i>", "", $this->config["handler_path"]); |
} |
function Format($text, $formatter = "wakka") |
{ |
//Modification : inclusion d'un chemin d'accès provenant du fichier de config. |
return $this->IncludeBuffered($formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"), $this->config["formatters_path"] ); |
} |
// USERS |
function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1"); } |
function LoadUsers() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."users order by name"); } |
function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; } |
function UserName() { /* deprecated! */ return $this->GetUserName(); } |
function GetUser() { return (isset($_SESSION["user"]) ? $_SESSION["user"] : '');} |
function SetUser($user, $remember=0) { $_SESSION["user"] = $user; $this->SetPersistentCookie("name", $user["name"], $remember); $this->SetPersistentCookie("password", $user["password"], $remember); $this->SetPersistentCookie("remember", $remember, $remember); } |
function LogoutUser() { $_SESSION["user"] = ""; $this->DeleteCookie("name"); $this->DeleteCookie("password"); } |
function UserWantsComments() { if (!$user = $this->GetUser()) return false; return ($user["show_comments"] == "Y"); } |
function GetParameter($parameter) { return (isset($this->parameter[$parameter]) ? $this->parameter[$parameter] :''); } |
// COMMENTS |
function LoadComments($tag) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on = '".mysql_escape_string($tag)."' and latest = 'Y' order by time"); } |
function LoadRecentComments() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on != '' and latest = 'Y' order by time desc"); } |
function LoadRecentlyCommented($limit = 50) |
{ |
// NOTE: this is really stupid. Maybe my SQL-Fu is too weak, but apparently there is no easier way to simply select |
// all comment pages sorted by their first revision's (!) time. ugh! |
// load ids of the first revisions of latest comments. err, huh? |
if ($ids = $this->LoadAll("select min(id) as id from ".$this->config["table_prefix"]."pages where comment_on != '' group by tag order by id desc")) |
{ |
// load complete comments |
foreach ($ids as $id) |
{ |
$comment = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".$id["id"]."' limit 1"); |
if (!$comments[$comment["comment_on"]] && $num < $limit) |
{ |
$comments[$comment["comment_on"]] = $comment; |
$num++; |
} |
} |
// now load pages |
if ($comments) |
{ |
// now using these ids, load the actual pages |
foreach ($comments as $comment) |
{ |
$page = $this->LoadPage($comment["comment_on"]); |
$page["comment_user"] = $comment["user"]; |
$page["comment_time"] = $comment["time"]; |
$page["comment_tag"] = $comment["tag"]; |
$pages[] = $page; |
} |
} |
} |
// load tags of pages |
//return $this->LoadAll("select comment_on as tag, max(time) as time, tag as comment_tag, user from ".$this->config["table_prefix"]."pages where comment_on != '' group by comment_on order by time desc"); |
return $pages; |
} |
// ACCESS CONTROL |
// returns true if logged in user is owner of current page, or page specified in $tag |
function UserIsOwner($tag = "") |
{ |
// check if user is logged in |
if (!$this->GetUser()) return false; |
// set default tag |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
// check if user is owner |
if ($this->GetPageOwner($tag) == $this->GetUserName()) return true; |
} |
function GetPageOwner($tag = "", $time = "") { if (!$tag = trim($tag)) $tag = $this->GetPageTag(); if ($page = $this->LoadPage($tag, $time)) return $page["owner"]; } |
function SetPageOwner($tag, $user) |
{ |
// check if user exists |
if (!$this->LoadUser($user)) return; |
// updated latest revision with new owner |
$this->Query("update ".$this->config["table_prefix"]."pages set owner = '".mysql_escape_string($user)."' where tag = '".mysql_escape_string($tag)."' and latest = 'Y' limit 1"); |
} |
function LoadAcl($tag, $privilege, $useDefaults = 1) |
{ |
if ((!$acl = $this->LoadSingle("select * from ".$this->config["table_prefix"]."acls where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1")) && $useDefaults) |
{ |
$acl = array("page_tag" => $tag, "privilege" => $privilege, "list" => $this->GetConfigValue("default_".$privilege."_acl")); |
} |
return $acl; |
} |
function SaveAcl($tag, $privilege, $list) { |
if ($this->LoadAcl($tag, $privilege, 0)) $this->Query("update ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."' where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1"); |
else $this->Query("insert into ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."', page_tag = '".mysql_escape_string($tag)."', privilege = '".mysql_escape_string($privilege)."'"); |
} |
// returns true if $user (defaults to current user) has access to $privilege on $page_tag (defaults to current page) |
function HasAccess($privilege, $tag = "", $user = "") |
{ |
// set defaults |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
if (!$user = $this->GetUserName()); |
// load acl |
$acl = $this->LoadAcl($tag, $privilege); |
// if current user is owner, return true. owner can do anything! |
if ($this->UserIsOwner($tag)) return true; |
// fine fine... now go through acl |
foreach (explode("\n", $acl["list"]) as $line) |
{ |
$line = trim($line); |
// check for inversion character "!" |
if (preg_match("/^[!](.*)$/", $line, $matches)) |
{ |
$negate = 1; |
$line = $matches[1]; |
} |
else |
{ |
$negate = 0; |
} |
// if there's still anything left... lines with just a "!" don't count! |
if ($line) |
{ |
switch ($line[0]) |
{ |
// comments |
case "#": |
break; |
// everyone |
case "*": |
return !$negate; |
// aha! a user entry. |
case "+": |
if (!$this->LoadUser($user)) |
{ |
return $negate; |
} |
else |
{ |
return !$negate; |
} |
default: |
if ($line == $user) |
{ |
return !$negate; |
} |
} |
} |
} |
// tough luck. |
return false; |
} |
// MAINTENANCE |
function Maintenance() |
{ |
// purge referrers |
if ($days = $this->GetConfigValue("referrers_purge_time")) { |
$this->Query("delete from ".$this->config["table_prefix"]."referrers where time < date_sub(now(), interval '".mysql_escape_string($days)."' day)"); |
} |
// purge old page revisions |
if ($days = $this->GetConfigValue("pages_purge_time")) { |
$this->Query("delete from ".$this->config["table_prefix"]."pages where time < date_sub(now(), interval '".mysql_escape_string($days)."' day) and latest = 'N'"); |
} |
} |
// THE BIG EVIL NASTY ONE! |
function Run($tag, $method = "") |
{ |
if(!($this->GetMicroTime()%3)) $this->Maintenance(); |
$this->ReadInterWikiConfig(); |
// do our stuff! |
if (!$this->method = trim($method)) $this->method = "show"; |
if (!$this->tag = trim($tag)) $this->Redirect($this->href("", $this->config["root_page"])); |
if ((!$this->GetUser() && isset($_COOKIE["name"])) && ($user = $this->LoadUser($_COOKIE["name"], $_COOKIE["password"]))) $this->SetUser($user, $_COOKIE["remember"]); |
$this->SetPage($this->LoadPage($tag, (isset($_REQUEST["time"]) ? $_REQUEST["time"] :''))); |
$this->LogReferrer(); |
switch ($this->method) |
{ |
case "xml": |
header("Content-type: text/xml"); |
case "raw": |
//ATTENTION: remplacement print par return et retourne seulement le contenu de la page wikini |
return ( $this->Method( $this->method ) ); |
break; |
default: |
//ATTENTION: remplacement print par return et retourne seulement le contenu de la page wikini |
return ( $this->Method( $this->method ) ); |
} |
} |
}//Fin de la classe Wiki |
//ATTENTION : Suppression du reste du fichier car géré par les applications de Génésia. |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/deletepage.php |
---|
New file |
0,0 → 1,25 |
<div class="page"> |
<?php |
if ($this->UserIsOwner()) |
{ |
if ($pages = $this->IsOrphanedPage($this->GetPageTag())) |
{ |
foreach ($pages as $page) |
{ |
$this->DeleteOrphanedPage($this->GetPageTag()); |
} |
} |
else |
{ |
print("<i>This is not an orphaned page.</i>"); |
} |
} |
else |
{ |
print("<i>You're not the owner of this page.</i>"); |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/referrers.php |
---|
New file |
0,0 → 1,48 |
<div class="page"> |
<?php |
if ($global = $_REQUEST["global"]) |
{ |
$title = "Sites faisant référence à ce wiki (<a href=\"".$this->href("referrers_sites", "", "global=1")."\">voir la liste des domaines</a>):"; |
$referrers = $this->LoadReferrers(); |
} |
else |
{ |
$title = "Pages externes faisant référence à ".$this->ComposeLinkToPage($this->GetPageTag()). |
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers_sites")."\">voir la liste des domaines</a>):"; |
$referrers = $this->LoadReferrers($this->GetPageTag()); |
} |
print("<b>$title</b><br /><br />\n"); |
if ($referrers) |
{ |
{ |
print("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"); |
foreach ($referrers as $referrer) |
{ |
print("<tr>"); |
print("<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">".$referrer["num"]."</td>"); |
print("<td valign=\"top\"><a href=\"".$referrer["referrer"]."\">".$referrer["referrer"]."</a></td>"); |
print("</tr>\n"); |
} |
print("</table>\n"); |
} |
} |
else |
{ |
print("<i>Aucune <acronym tilte=\"Uniform Resource Locator (adresse web)\">URL</acronym> ne fait référence à cette page.</i><br />\n"); |
} |
if ($global) |
{ |
print("<br />[<a href=\"".$this->href("referrers_sites")."\">Voir les domaines faisant référence à ".$this->GetPageTag()." seulement</a> | <a href=\"".$this->href("referrers")."\">Voir les références à ".$this->GetPageTag()." seulement</a>]"); |
} |
else |
{ |
print("<br />[<a href=\"".$this->href("referrers_sites", "", "global=1")."\">Voir tous les domaines faisant référence </a> | <a href=\"".$this->href("referrers", "", "global=1")."\">Voir toutes les références </a>]"); |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/show.php |
---|
New file |
0,0 → 1,131 |
<div class="page"> |
<?php |
if ($HasAccessRead=$this->HasAccess("read")) |
{ |
if (!$this->page) |
{ |
print("Cette page n'existe pas encore, voulez vous la <a href=\"".$this->href("edit")."\">créer</a> ?"); |
} |
else |
{ |
// comment header? |
if ($this->page["comment_on"]) |
{ |
print("<div class=\"commentinfo\">Ceci est un commentaire sur ".$this->ComposeLinkToPage($this->page["comment_on"], "", "", 0).", posté par ".$this->Format($this->page["user"])." à ".$this->page["time"]."</div>"); |
} |
if ($this->page["latest"] == "N") |
{ |
print("<div class=\"revisioninfo\">Ceci est une version archivée de <a href=\"".$this->href()."\">".$this->GetPageTag()."</a> à ".$this->page["time"].".</div>"); |
} |
// display page |
print($this->Format($this->page["body"], "wakka")); |
// if this is an old revision, display some buttons |
if (($this->page["latest"] == "N") && $this->HasAccess("write")) |
{ |
$latest = $this->LoadPage($this->tag); |
?> |
<br /> |
<?php echo $this->FormOpen("edit") ?> |
<input type="hidden" name="previous" value="<?php echo $latest["id"] ?>"> |
<input type="hidden" name="body" value="<?php echo htmlentities($this->page["body"]) ?>"> |
<input type="submit" value="Re-éditer cette version archivée"> |
<?php echo $this->FormClose(); ?> |
<?php |
} |
} |
} |
else |
{ |
print("<i>Vous n'êtes pas autorisé à lire cette page</i>"); |
} |
?> |
</div> |
<?php |
if ($HasAccessRead) |
{ |
// load comments for this page |
$comments = $this->LoadComments($this->tag); |
// store comments display in session |
$tag = $this->GetPageTag(); |
if (!isset($_SESSION["show_comments"][$tag])) |
$_SESSION["show_comments"][$tag] = ($this->UserWantsComments() ? "1" : "0"); |
if (isset($_REQUEST["show_comments"])){ |
switch($_REQUEST["show_comments"]) |
{ |
case "0": |
$_SESSION["show_comments"][$tag] = 0; |
break; |
case "1": |
$_SESSION["show_comments"][$tag] = 1; |
break; |
} |
} |
// display comments! |
if ($this->page && $_SESSION["show_comments"][$tag]) |
{ |
// display comments header |
?> |
<div class="commentsheader"> |
Commentaires [<a href="<?php echo $this->href("", "", "show_comments=0") ?>">Cacher commentaires/formulaire</a>] |
</div> |
<?php |
// display comments themselves |
if ($comments) |
{ |
foreach ($comments as $comment) |
{ |
print("<a name=\"".$comment["tag"]."\"></a>\n"); |
print("<div class=\"comment\">\n"); |
print($this->Format($comment["body"])."\n"); |
print("<div class=\"commentinfo\">\n-- ".$this->Format($comment["user"])." (".$comment["time"].")\n</div>\n"); |
print("</div>\n"); |
} |
} |
// display comment form |
print("<div class=\"commentform\">\n"); |
if ($this->HasAccess("comment")) |
{ |
?> |
Ajouter un commentaire à cette page:<br /> |
<?php echo $this->FormOpen("addcomment"); ?> |
<textarea name="body" rows="6" style="width: 100%"></textarea><br /> |
<input type="submit" value="Ajouter Commentaire" accesskey="s"> |
<?php echo $this->FormClose(); ?> |
<?php |
} |
print("</div>\n"); |
} |
else |
{ |
?> |
<div class="commentsheader"> |
<?php |
switch (count($comments)) |
{ |
case 0: |
print("Il n'y a pas de commentaire sur cette page."); |
break; |
case 1: |
print("Il y a un commentaire sur cette page."); |
break; |
default: |
print("Il y a ".count($comments)." commentaires sur cette page."); |
} |
?> |
[<a href="<?php echo $this->href("", "", "show_comments=1") ?>">Afficher commentaires/formulaire</a>] |
</div> |
<?php |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/xml.php |
---|
New file |
0,0 → 1,12 |
<?php |
if ($HasAccessRead=$this->HasAccess("read")) |
{ |
// TODO : Return an empty xml ? |
// TODO : Return an error read (noaccess) xml ? |
if ($this->page) |
{ |
// display page |
print($this->Format($this->page["body"], "action")); |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/revisions.php |
---|
New file |
0,0 → 1,49 |
<div class="page"> |
<?php |
// load revisions for this pageif |
if ($this->HasAccess("read")) { |
if ($pages = $this->LoadRevisions($this->tag)) |
{ |
$output .= $this->FormOpen("diff", "", "get"); |
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; |
$output .= "<tr>\n"; |
$output .= "<td><input type=\"submit\" value=\"Voir Différences\" /></td>"; |
$output .= "<td><input type=\"checkbox\" name=\"fastdiff\"/>\n".$this->Format("Affichage simplifié")."</td>"; |
$output .= "</tr>\n"; |
$output .= "</table>\n"; |
$output .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; |
if ($user = $this->GetUser()) |
{ |
$max = $user["revisioncount"]; |
} |
else |
{ |
$max = 20; |
} |
$c = 0; |
foreach ($pages as $page) |
{ |
$c++; |
if (($c <= $max) || !$max) |
{ |
$output .= "<tr>"; |
$output .= "<td><input type=\"radio\" name=\"a\" value=\"".$page["id"]."\" ".($c == 1 ? "checked=\"checked\"" : "")." /></td>"; |
$output .= "<td><input type=\"radio\" name=\"b\" value=\"".$page["id"]."\" ".($c == 2 ? "checked=\"checked\"" : "")." /></td>"; |
$output .= "<td> <a href=\"".$this->href("show")."&time=".urlencode($page["time"])."\">".$page["time"]."</a></td>"; |
$output .= "<td> by ".$this->Format($page["user"])."</td>"; |
$output .= "</tr>\n"; |
} |
} |
$output .= "</table>\n".$this->FormClose()."\n"; |
} |
print($output); |
} |
else |
{ |
print("<i>Vous n'avez pas accès à cette page.</i>"); |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/acls.php |
---|
New file |
0,0 → 1,90 |
<div class="page"> |
<?php |
if ($this->UserIsOwner()) |
{ |
if ($_POST) |
{ |
// store lists |
$this->SaveAcl($this->GetPageTag(), "read", $_POST["read_acl"]); |
$this->SaveAcl($this->GetPageTag(), "write", $_POST["write_acl"]); |
$this->SaveAcl($this->GetPageTag(), "comment", $_POST["comment_acl"]); |
$message = "Mise à jour des droits d\'accés";//$message = "Access control lists updated"; |
// change owner? |
if ($newowner = $_POST["newowner"]) |
{ |
$this->SetPageOwner($this->GetPageTag(), $newowner); |
$message .= " et changement du propriétaire. Nouveau propriétaire : ".$newowner;//$message .= " and gave ownership to ".$newowner; |
} |
// redirect back to page |
$this->SetMessage($message."!"); |
$this->Redirect($this->Href()); |
} |
else |
{ |
// load acls |
$readACL = $this->LoadAcl($this->GetPageTag(), "read"); |
$writeACL = $this->LoadAcl($this->GetPageTag(), "write"); |
$commentACL = $this->LoadAcl($this->GetPageTag(), "comment"); |
// show form |
?> |
<h3>Liste des droits d'accés de la page <?php echo $this->ComposeLinkToPage($this->GetPageTag()) ?></h3><!-- Access Control Lists for--> |
<br /> |
<?php echo $this->FormOpen("acls") ?> |
<table border="0" cellspacing="0" cellpadding="0"> |
<tr> |
<td valign="top" style="padding-right: 20px"> |
<b>Droits de lecture :</b><br /><!-- Read ACL:--> |
<textarea name="read_acl" rows="4" cols="20"><?php echo $readACL["list"] ?></textarea> |
<td> |
<td valign="top" style="padding-right: 20px"> |
<b>Droits d'écriture :</b><br /><!-- Write ACL:--> |
<textarea name="write_acl" rows="4" cols="20"><?php echo $writeACL["list"] ?></textarea> |
<td> |
<td valign="top" style="padding-right: 20px"> |
<b>Droits des commentaires :</b><br /><!-- Comments ACL:--> |
<textarea name="comment_acl" rows="4" cols="20"><?php echo $commentACL["list"] ?></textarea> |
<td> |
</tr> |
<tr> |
<td colspan="3"> |
<b>Changer le propriétaire :</b><br /><!-- Set Owner:--> |
<select name="newowner"> |
<option value="">Ne rien modifier</option><!-- Don't change--> |
<option value=""></option> |
<?php |
if ($users = $this->LoadUsers()) |
{ |
foreach($users as $user) |
{ |
print("<option value=\"".htmlentities($user["name"])."\">".$user["name"]."</option>\n"); |
} |
} |
?> |
</select> |
<td> |
</tr> |
<tr> |
<td colspan="3"> |
<br /> |
<input type="submit" value="Enregistrer" style="width: 120px" accesskey="s"><!-- Store ACLs--> |
<input type="button" value="Annuler" onClick="history.back();" style="width: 120px"><!-- Cancel --> |
</td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} |
} |
else |
{ |
print("<i>Vous n'êtes pas le propriétaire de cette page.</i>"); |
//print("<i>You're not the owner of this page.</i>"); |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/claim.php |
---|
New file |
0,0 → 1,12 |
<?php |
// only claim ownership if this page has no owner, and if user is logged in. |
if ($this->page && !$this->GetPageOwner() && $this->GetUser()) |
{ |
$this->SetPageOwner($this->GetPageTag(), $this->GetUserName()); |
$this->SetMessage("Vous êtes maintenant le propriétaire de cette page"); |
} |
$this->Redirect($this->href()); |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/edit.php |
---|
New file |
0,0 → 1,106 |
<div class="page"> |
<?php |
if ($this->HasAccess("write") && $this->HasAccess("read")) |
{ |
if ($_POST) |
{ |
// only if saving: |
if ($_POST["submit"] == "Sauver") |
{ |
// check for overwriting |
if ($this->page) |
{ |
if ($this->page["id"] != $_POST["previous"]) |
{ |
$error = "ALERTE : ". |
"Cette page a été modifiée par quelqu'un d'autre pendant que vous l'éditiez.<br />\n". |
"Veuillez copier vos changements et re-editer cette page.\n"; |
} |
} |
// store |
if (!$error) |
{ |
$body = str_replace("\r", "", $_POST["body"]); |
// add page (revisions) |
$this->SavePage($this->tag, $body); |
// now we render it internally so we can write the updated link table. |
$this->ClearLinkTable(); |
$this->StartLinkTracking(); |
$dummy = $this->Header(); |
$dummy .= $this->Format($body); |
$dummy .= $this->Footer(); |
$this->StopLinkTracking(); |
$this->WriteLinkTable(); |
$this->ClearLinkTable(); |
// forward |
$this->Redirect($this->href()); |
} |
} |
} |
// fetch fields |
if (!$previous = $_POST["previous"]) $previous = $this->page["id"]; |
if (!$body = $_POST["body"]) $body = $this->page["body"]; |
// preview? |
if ($_POST["submit"] == "Aperçu") |
{ |
$previewButtons = |
"<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n". |
"<input name=\"submit\" type=\"submit\" value=\"Re-Editer\" accesskey=\"p\" />\n". |
"<input type=\"button\" value=\"Annulation\" onClick=\"document.location='".$this->href("")."';\" />\n"; |
$output .= "<div class=\"prev_alert\"><strong>Aperçu</strong></div>\n"; |
$output .= |
$this->FormOpen("edit")."\n". |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n". |
"<input type=\"hidden\" name=\"body\" value=\"".htmlentities($body)."\" />\n"; |
$output .= $this->Format($body); |
$output .= |
"<br />\n". |
$previewButtons. |
$this->FormClose()."\n"; |
} |
else |
{ |
// display form |
if ($error) |
{ |
$output .= "<div class=\"error\">$error</div>\n"; |
} |
// append a comment? |
if ($_REQUEST["appendcomment"]) |
{ |
$body = trim($body)."\n\n----\n\n--".$this->UserName()." (".strftime("%c").")"; |
} |
$output .= |
$this->FormOpen("edit"). |
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n". |
"<textarea onKeyDown=\"fKeyDown()\" name=\"body\" cols=\"60\" rows=\"40\" wrap=\"soft\" class=\"edit\">\n". |
htmlspecialchars($body). |
"\n</textarea><br />\n". |
($this->config["preview_before_save"] ? "" : "<input name=\"submit\" type=\"submit\" value=\"Sauver\" accesskey=\"s\" />\n"). |
"<input name=\"submit\" type=\"submit\" value=\"Aperçu\" accesskey=\"p\" />\n". |
"<input type=\"button\" value=\"Annulation\" onClick=\"document.location='".$this->href("")."';\" />\n". |
$this->FormClose(); |
} |
echo $output; |
} |
else |
{ |
echo "<i>Vous n'avez pas accès en écriture à cette page !</i>\n"; |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/referrers_sites.php |
---|
New file |
0,0 → 1,62 |
<div class="page"> |
<?php |
if ($global = $_REQUEST["global"]) |
{ |
$title = "Domaines faisant référence à ce wiki (<a href=\"".$this->href("referrers", "", "global=1")."\">voir la liste des pages externes</a>):"; |
$referrers = $this->LoadReferrers(); |
} |
else |
{ |
$title = "Domaines faisant référence à ".$this->Link($this->GetPageTag()). |
($this->GetConfigValue("referrers_purge_time") ? " (depuis ".($this->GetConfigValue("referrers_purge_time") == 1 ? "24 heures" : $this->GetConfigValue("referrers_purge_time")." jours").")" : "")." (<a href=\"".$this->href("referrers")."\">voir la liste des pages externes</a>):"; |
$referrers = $this->LoadReferrers($this->GetPageTag()); |
} |
print("<b>$title</b><br /><br />\n"); |
if ($referrers) |
{ |
for ($a = 0; $a < count($referrers); $a++) |
{ |
$temp_parse_url = parse_url($referrers[$a]["referrer"]); |
$temp_parse_url = ($temp_parse_url["host"] != "") ? strtolower(preg_replace("/^www\./Ui", "", $temp_parse_url["host"])) : "inconnu"; |
if (isset($referrer_sites["$temp_parse_url"])) |
{ |
$referrer_sites["$temp_parse_url"] += $referrers[$a]["num"]; |
} |
else |
{ |
$referrer_sites["$temp_parse_url"] = $referrers[$a]["num"]; |
} |
} |
array_multisort($referrer_sites, SORT_DESC, SORT_NUMERIC); |
reset($referrer_sites); |
print("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"); |
foreach ($referrer_sites as $site => $site_count) |
{ |
print("<tr>"); |
print("<td width=\"30\" align=\"right\" valign=\"top\" style=\"padding-right: 10px\">$site_count</td>"); |
print("<td valign=\"top\">" . (($site != "unknown") ? "<a href=\"http://$site\">$site</a>" : $site) . "</td>"); |
print("</tr>\n"); |
} |
print("</table>\n"); |
} |
else |
{ |
print("<i>None</i><br />\n"); |
} |
if ($global) |
{ |
print("<br />[<a href=\"".$this->href("referrers_sites")."\">Voir les domaines faisant référence à ".$this->GetPageTag()." seulement</a> | <a href=\"".$this->href("referrers")."\">Voir les références ".$this->GetPageTag()." seulement</a>]"); |
} |
else |
{ |
print("<br />[<a href=\"".$this->href("referrers_sites", "", "global=1")."\">Voir tous les domaines faisant référence </a> | <a href=\"".$this->href("referrers", "", "global=1")."\">Voir toutes les références </a>]"); |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/diff.orig.php |
---|
New file |
0,0 → 1,39 |
<div class="page"> |
<?php |
/* NOTE: This is a really cheap way to do it. I think it may be more intelligent to write the two |
pages to temporary files and run /usr/bin/diff over them. Then again, maybe not. */ |
// load pages |
$pageA = $this->LoadPageById($_REQUEST["a"]); |
$pageB = $this->LoadPageById($_REQUEST["b"]); |
// prepare bodies |
$bodyA = explode("\n", $pageA["body"]); |
$bodyB = explode("\n", $pageB["body"]); |
$added = array_diff($bodyA, $bodyB); |
$deleted = array_diff($bodyB, $bodyA); |
$output .= "<b>Comparing <a href=\"".$this->href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> to <a href=\"".$this->href("", "", "time=".urlencode($pageB["time"]))."\">".$pageB["time"]."</a></b><br />\n"; |
if ($added) |
{ |
// remove blank lines |
$output .= "<br />\n<b>Additions:</b><br />\n"; |
$output .= "<div class=\"additions\">".$this->Format(implode("\n", $added))."</div>"; |
} |
if ($deleted) |
{ |
$output .= "<br />\n<b>Deletions:</b><br />\n"; |
$output .= "<div class=\"deletions\">".$this->Format(implode("\n", $deleted))."</div>"; |
} |
if (!$added && !$deleted) |
{ |
$output .= "<br />\nNo differences."; |
} |
print($output); |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/diff.php |
---|
New file |
0,0 → 1,973 |
<div class="page"> |
<?php |
if ($this->HasAccess("read")) |
{ |
/* A php wdiff (word diff) for wakka, adapted by David Delon |
based on wdiff and phpwiki diff (copyright below). |
TODO : Since wdiff use only directive lines, all stuff in diff class |
related to line and context display should be removed. |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2, or (at your option) |
any later version. */ |
/* A PHP diff engine for phpwiki. |
Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org> |
You may copy this code freely under the conditions of the GPL. |
*/ |
/* wdiff -- front end to diff for comparing on a word per word basis. |
Copyright (C) 1992 Free Software Foundation, Inc. |
Francois Pinard <pinard@iro.umontreal.ca>. |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation; either version 2, or (at your option) |
any later version. |
*/ |
// If asked, call original diff |
if ($_REQUEST["fastdiff"]) { |
/* NOTE: This is a really cheap way to do it. I think it may be more intelligent to write the two pages to temporary files and run /usr/bin/diff over them. Then again, maybe not. */ |
// load pages |
$pageA = $this->LoadPageById($_REQUEST["a"]); |
$pageB = $this->LoadPageById($_REQUEST["b"]); |
// prepare bodies |
$bodyA = explode("\n", $pageA["body"]); |
$bodyB = explode("\n", $pageB["body"]); |
$added = array_diff($bodyA, $bodyB); |
$deleted = array_diff($bodyB, $bodyA); |
$output .= "<b>Comparaison de <a href=\"".$this->href("", "", "time=".urlencode($pageA["time"]))."\">".$pageA["time"]."</a> à <a href=\"".$this->href("", "", "time=".urlencode($pageB["time"]))."\">".$pageB["time"]."</a></b><br />\n"; |
if ($added) |
{ |
// remove blank lines |
$output .= "<br />\n<b>Additions:</b><br />\n"; |
$output .= "<div class=\"additions\">".$this->Format(implode("\n", $added))."</div>"; |
} |
if ($deleted) |
{ |
$output .= "<br />\n<b>Deletions:</b><br />\n"; |
$output .= "<div class=\"deletions\">".$this->Format(implode("\n", $deleted))."</div>"; |
} |
if (!$added && !$deleted) |
{ |
$output .= "<br />\nNo differences."; |
} |
print($output); |
} |
else { |
// load pages |
$pageA = $this->LoadPageById($_REQUEST["b"]); |
$pageB = $this->LoadPageById($_REQUEST["a"]); |
// extract text from bodies |
$textA = $pageA["body"]; |
$textB = $pageB["body"]; |
$sideA = new Side($textA); |
$sideB = new Side($textB); |
$bodyA=''; |
$sideA->split_file_into_words($bodyA); |
$bodyB=''; |
$sideB->split_file_into_words($bodyB); |
// diff on these two file |
$diff = new Diff(split("\n",$bodyA),split("\n",$bodyB)); |
// format output |
$fmt = new DiffFormatter(); |
$sideO = new Side($fmt->format($diff)); |
$resync_left=0; |
$resync_right=0; |
$count_total_right=$sideB->getposition() ; |
$sideA->init(); |
$sideB->init(); |
$output=''; |
while (1) { |
$sideO->skip_line(); |
if ($sideO->isend()) { |
break; |
} |
if ($sideO->decode_directive_line()) { |
$argument=$sideO->getargument(); |
$letter=$sideO->getdirective(); |
switch ($letter) { |
case 'a': |
$resync_left = $argument[0]; |
$resync_right = $argument[2] - 1; |
break; |
case 'd': |
$resync_left = $argument[0] - 1; |
$resync_right = $argument[2]; |
break; |
case 'c': |
$resync_left = $argument[0] - 1; |
$resync_right = $argument[2] - 1; |
break; |
} |
$sideA->skip_until_ordinal($resync_left); |
$sideB->copy_until_ordinal($resync_right,$output); |
// deleted word |
if (($letter=='d') || ($letter=='c')) { |
$sideA->copy_whitespace($output); |
$output .="@@"; |
$sideA->copy_word($output); |
$sideA->copy_until_ordinal($argument[1],$output); |
$output .="@@"; |
} |
// inserted word |
if ($letter == 'a' || $letter == 'c') { |
$sideB->copy_whitespace($output); |
$output .="££"; |
$sideB->copy_word($output); |
$sideB->copy_until_ordinal($argument[3],$output); |
$output .="££"; |
} |
} |
} |
$sideB->copy_until_ordinal($count_total_right,$output); |
$sideB->copy_whitespace($output); |
$out=$this->Format($output); |
print $out; |
} |
} |
else{ |
print("<i>Vous n'etes pas autorisé à lire cette page.</i>"); |
} |
// Side : a string for wdiff |
class Side { |
var $position; |
var $cursor; |
var $content; |
var $character; |
var $directive; |
var $argument; |
var $length; |
function Side($content) { |
$this->content=$content; |
$this->position=0; |
$this->cursor=0; |
$this->directive=''; |
$this->argument=array(); |
$this->length=strlen($this->content); |
$this->character=substr($this->content,0,1); |
} |
function getposition() { |
return $this->position; |
} |
function getcharacter() { |
return $this->character; |
} |
function getdirective() { |
return $this->directive; |
} |
function getargument() { |
return $this->argument; |
} |
function nextchar() { |
$this->cursor++; |
$this->character=substr($this->content,$this->cursor,1); |
} |
function copy_until_ordinal($ordinal,&$out) { |
while ($this->position < $ordinal) { |
$this->copy_whitespace($out); |
$this->copy_word($out); |
} |
} |
function skip_until_ordinal($ordinal) { |
while ($this->position < $ordinal) { |
$this->skip_whitespace(); |
$this->skip_word(); |
} |
} |
function split_file_into_words (&$out) { |
while (!$this->isend()) { |
$this->skip_whitespace(); |
if ($this->isend()) { |
break; |
} |
$this->copy_word($out); |
$out .="\n"; |
} |
} |
function init() { |
$this->position=0; |
$this->cursor=0; |
$this->directive=''; |
$this->argument=array(); |
$this->character=substr($this->content,0,1); |
} |
function isspace($char) { |
if (ereg('[[:space:]]',$char)) { |
return true; |
} |
else { |
return false; |
} |
} |
function isdigit($char) { |
if (ereg('[[:digit:]]',$char)) { |
return true; |
} |
else { |
return false; |
} |
} |
function isend() { |
if (($this->cursor)>=($this->length)) { |
return true; |
} |
else { |
return false; |
} |
} |
function copy_whitespace(&$out) { |
while (!$this->isend() && $this->isspace($this->character)) { |
$out .=$this->character; |
$this->nextchar(); |
} |
} |
function skip_whitespace() { |
while (!$this->isend() && $this->isspace($this->character)) { |
$this->nextchar(); |
} |
} |
function skip_line() { |
while (!$this->isend() && !$this->isdigit($this->character)) { |
while (!$this->isend() && $this->character!="\n") |
$this->nextchar(); |
if($this->character=="\n") |
$this->nextchar(); |
} |
} |
function copy_word(&$out) { |
while (!$this->isend() && !($this->isspace($this->character))) { |
$out.=$this->character; |
$this->nextchar(); |
} |
$this->position++; |
} |
function skip_word() { |
while (!$this->isend() && !($this->isspace($this->character))) { |
$this->nextchar(); |
} |
$this->position++; |
} |
function decode_directive_line() { |
$value=0; |
$state=0; |
$error=0; |
while (!$error && $state < 4) { |
if ($this->isdigit($this->character)) { |
$value = 0; |
while($this->isdigit($this->character)) { |
$value = 10 * $value + $this->character - '0'; |
$this->nextchar(); |
} |
} |
else if ($state != 1 && $state != 3) |
$error = 1; |
/* Assign the proper value. */ |
$this->argument[$state] = $value; |
/* Skip the following character. */ |
switch ($state) { |
case 0: |
case 2: |
if ($this->character == ',') |
$this->nextchar(); |
break; |
case 1: |
if ($this->character == 'a' || $this->character == 'd' || $this->character == 'c') { |
$this->directive = $this->character; |
$this->nextchar(); |
} |
else |
$error = 1; |
break; |
case 3: |
if ($this->character != "\n") |
$error = 1; |
break; |
} |
$state++; |
} |
/* Complete reading of the line and return success value. */ |
while ((!$this->isend()) && ($this->character != "\n")) { |
$this->nextchar(); |
} |
if ($this->character == "\n") |
$this->nextchar(); |
return !$error; |
} |
} |
// difflib |
// |
// A PHP diff engine for phpwiki. |
// |
// Copyright (C) 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org> |
// You may copy this code freely under the conditions of the GPL. |
// |
// PHP3 does not have assert() |
define('USE_ASSERTS', function_exists('assert')); |
class _DiffOp { |
var $type; |
var $orig; |
var $final; |
function norig() { |
return $this->orig ? sizeof($this->orig) : 0; |
} |
function nfinal() { |
return $this->final ? sizeof($this->final) : 0; |
} |
} |
class _DiffOp_Copy extends _DiffOp { |
var $type = 'copy'; |
function _DiffOp_Copy ($orig, $final = false) { |
if (!is_array($final)) |
$final = $orig; |
$this->orig = $orig; |
$this->final = $final; |
} |
} |
class _DiffOp_Delete extends _DiffOp { |
var $type = 'delete'; |
function _DiffOp_Delete ($lines) { |
$this->orig = $lines; |
$this->final = false; |
} |
} |
class _DiffOp_Add extends _DiffOp { |
var $type = 'add'; |
function _DiffOp_Add ($lines) { |
$this->final = $lines; |
$this->orig = false; |
} |
} |
class _DiffOp_Change extends _DiffOp { |
var $type = 'change'; |
function _DiffOp_Change ($orig, $final) { |
$this->orig = $orig; |
$this->final = $final; |
} |
} |
/** |
* Class used internally by Diff to actually compute the diffs. |
* |
* The algorithm used here is mostly lifted from the perl module |
* Algorithm::Diff (version 1.06) by Ned Konz, which is available at: |
* http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip |
* |
* More ideas are taken from: |
* http://www.ics.uci.edu/~eppstein/161/960229.html |
* |
* Some ideas are (and a bit of code) are from from analyze.c, from GNU |
* diffutils-2.7, which can be found at: |
* ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz |
* |
* Finally, some ideas (subdivision by NCHUNKS > 2, and some optimizations) |
* are my own. |
* |
* @author Geoffrey T. Dairiki |
* @access private |
*/ |
class _DiffEngine |
{ |
function diff ($from_lines, $to_lines) { |
$n_from = sizeof($from_lines); |
$n_to = sizeof($to_lines); |
$this->xchanged = $this->ychanged = array(); |
$this->xv = $this->yv = array(); |
$this->xind = $this->yind = array(); |
unset($this->seq); |
unset($this->in_seq); |
unset($this->lcs); |
// Skip leading common lines. |
for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) { |
if ($from_lines[$skip] != $to_lines[$skip]) |
break; |
$this->xchanged[$skip] = $this->ychanged[$skip] = false; |
} |
// Skip trailing common lines. |
$xi = $n_from; $yi = $n_to; |
for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) { |
if ($from_lines[$xi] != $to_lines[$yi]) |
break; |
$this->xchanged[$xi] = $this->ychanged[$yi] = false; |
} |
// Ignore lines which do not exist in both files. |
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) |
$xhash[$from_lines[$xi]] = 1; |
for ($yi = $skip; $yi < $n_to - $endskip; $yi++) { |
$line = $to_lines[$yi]; |
if ( ($this->ychanged[$yi] = empty($xhash[$line])) ) |
continue; |
$yhash[$line] = 1; |
$this->yv[] = $line; |
$this->yind[] = $yi; |
} |
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { |
$line = $from_lines[$xi]; |
if ( ($this->xchanged[$xi] = empty($yhash[$line])) ) |
continue; |
$this->xv[] = $line; |
$this->xind[] = $xi; |
} |
// Find the LCS. |
$this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv)); |
// Merge edits when possible |
$this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged); |
$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged); |
// Compute the edit operations. |
$edits = array(); |
$xi = $yi = 0; |
while ($xi < $n_from || $yi < $n_to) { |
USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]); |
USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]); |
// Skip matching "snake". |
$copy = array(); |
while ( $xi < $n_from && $yi < $n_to |
&& !$this->xchanged[$xi] && !$this->ychanged[$yi]) { |
$copy[] = $from_lines[$xi++]; |
++$yi; |
} |
if ($copy) |
$edits[] = new _DiffOp_Copy($copy); |
// Find deletes & adds. |
$delete = array(); |
while ($xi < $n_from && $this->xchanged[$xi]) |
$delete[] = $from_lines[$xi++]; |
$add = array(); |
while ($yi < $n_to && $this->ychanged[$yi]) |
$add[] = $to_lines[$yi++]; |
if ($delete && $add) |
$edits[] = new _DiffOp_Change($delete, $add); |
elseif ($delete) |
$edits[] = new _DiffOp_Delete($delete); |
elseif ($add) |
$edits[] = new _DiffOp_Add($add); |
} |
return $edits; |
} |
/* Divide the Largest Common Subsequence (LCS) of the sequences |
* [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally |
* sized segments. |
* |
* Returns (LCS, PTS). LCS is the length of the LCS. PTS is an |
* array of NCHUNKS+1 (X, Y) indexes giving the diving points between |
* sub sequences. The first sub-sequence is contained in [X0, X1), |
* [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note |
* that (X0, Y0) == (XOFF, YOFF) and |
* (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). |
* |
* This function assumes that the first lines of the specified portions |
* of the two files do not match, and likewise that the last lines do not |
* match. The caller must trim matching lines from the beginning and end |
* of the portions it is going to specify. |
*/ |
function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) { |
$flip = false; |
if ($xlim - $xoff > $ylim - $yoff) { |
// Things seems faster (I'm not sure I understand why) |
// when the shortest sequence in X. |
$flip = true; |
list ($xoff, $xlim, $yoff, $ylim) |
= array( $yoff, $ylim, $xoff, $xlim); |
} |
if ($flip) |
for ($i = $ylim - 1; $i >= $yoff; $i--) |
$ymatches[$this->xv[$i]][] = $i; |
else |
for ($i = $ylim - 1; $i >= $yoff; $i--) |
$ymatches[$this->yv[$i]][] = $i; |
$this->lcs = 0; |
$this->seq[0]= $yoff - 1; |
$this->in_seq = array(); |
$ymids[0] = array(); |
$numer = $xlim - $xoff + $nchunks - 1; |
$x = $xoff; |
for ($chunk = 0; $chunk < $nchunks; $chunk++) { |
if ($chunk > 0) |
for ($i = 0; $i <= $this->lcs; $i++) |
$ymids[$i][$chunk-1] = $this->seq[$i]; |
$x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks); |
for ( ; $x < $x1; $x++) { |
$line = $flip ? $this->yv[$x] : $this->xv[$x]; |
if (empty($ymatches[$line])) |
continue; |
$matches = $ymatches[$line]; |
reset($matches); |
while (list ($junk, $y) = each($matches)) |
if (empty($this->in_seq[$y])) { |
$k = $this->_lcs_pos($y); |
USE_ASSERTS && assert($k > 0); |
$ymids[$k] = $ymids[$k-1]; |
break; |
} |
while (list ($junk, $y) = each($matches)) { |
if ($y > $this->seq[$k-1]) { |
USE_ASSERTS && assert($y < $this->seq[$k]); |
// Optimization: this is a common case: |
// next match is just replacing previous match. |
$this->in_seq[$this->seq[$k]] = false; |
$this->seq[$k] = $y; |
$this->in_seq[$y] = 1; |
} |
else if (empty($this->in_seq[$y])) { |
$k = $this->_lcs_pos($y); |
USE_ASSERTS && assert($k > 0); |
$ymids[$k] = $ymids[$k-1]; |
} |
} |
} |
} |
$seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); |
$ymid = $ymids[$this->lcs]; |
for ($n = 0; $n < $nchunks - 1; $n++) { |
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); |
$y1 = $ymid[$n] + 1; |
$seps[] = $flip ? array($y1, $x1) : array($x1, $y1); |
} |
$seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); |
return array($this->lcs, $seps); |
} |
function _lcs_pos ($ypos) { |
$end = $this->lcs; |
if ($end == 0 || $ypos > $this->seq[$end]) { |
$this->seq[++$this->lcs] = $ypos; |
$this->in_seq[$ypos] = 1; |
return $this->lcs; |
} |
$beg = 1; |
while ($beg < $end) { |
$mid = (int)(($beg + $end) / 2); |
if ( $ypos > $this->seq[$mid] ) |
$beg = $mid + 1; |
else |
$end = $mid; |
} |
USE_ASSERTS && assert($ypos != $this->seq[$end]); |
$this->in_seq[$this->seq[$end]] = false; |
$this->seq[$end] = $ypos; |
$this->in_seq[$ypos] = 1; |
return $end; |
} |
/* Find LCS of two sequences. |
* |
* The results are recorded in the vectors $this->{x,y}changed[], by |
* storing a 1 in the element for each line that is an insertion |
* or deletion (ie. is not in the LCS). |
* |
* The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. |
* |
* Note that XLIM, YLIM are exclusive bounds. |
* All line numbers are origin-0 and discarded lines are not counted. |
*/ |
function _compareseq ($xoff, $xlim, $yoff, $ylim) { |
// Slide down the bottom initial diagonal. |
while ($xoff < $xlim && $yoff < $ylim |
&& $this->xv[$xoff] == $this->yv[$yoff]) { |
++$xoff; |
++$yoff; |
} |
// Slide up the top initial diagonal. |
while ($xlim > $xoff && $ylim > $yoff |
&& $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) { |
--$xlim; |
--$ylim; |
} |
if ($xoff == $xlim || $yoff == $ylim) |
$lcs = 0; |
else { |
// This is ad hoc but seems to work well. |
//$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); |
//$nchunks = max(2,min(8,(int)$nchunks)); |
$nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; |
list ($lcs, $seps) |
= $this->_diag($xoff,$xlim,$yoff, $ylim,$nchunks); |
} |
if ($lcs == 0) { |
// X and Y sequences have no common subsequence: |
// mark all changed. |
while ($yoff < $ylim) |
$this->ychanged[$this->yind[$yoff++]] = 1; |
while ($xoff < $xlim) |
$this->xchanged[$this->xind[$xoff++]] = 1; |
} |
else { |
// Use the partitions to split this problem into subproblems. |
reset($seps); |
$pt1 = $seps[0]; |
while ($pt2 = next($seps)) { |
$this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]); |
$pt1 = $pt2; |
} |
} |
} |
/* Adjust inserts/deletes of identical lines to join changes |
* as much as possible. |
* |
* We do something when a run of changed lines include a |
* line at one end and has an excluded, identical line at the other. |
* We are free to choose which identical line is included. |
* `compareseq' usually chooses the one at the beginning, |
* but usually it is cleaner to consider the following identical line |
* to be the "change". |
* |
* This is extracted verbatim from analyze.c (GNU diffutils-2.7). |
*/ |
function _shift_boundaries ($lines, &$changed, $other_changed) { |
$i = 0; |
$j = 0; |
USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)'); |
$len = sizeof($lines); |
$other_len = sizeof($other_changed); |
while (1) { |
/* |
* Scan forwards to find beginning of another run of changes. |
* Also keep track of the corresponding point in the other file. |
* |
* Throughout this code, $i and $j are adjusted together so that |
* the first $i elements of $changed and the first $j elements |
* of $other_changed both contain the same number of zeros |
* (unchanged lines). |
* Furthermore, $j is always kept so that $j == $other_len or |
* $other_changed[$j] == false. |
*/ |
while ($j < $other_len && $other_changed[$j]) |
$j++; |
while ($i < $len && ! $changed[$i]) { |
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]'); |
$i++; $j++; |
while ($j < $other_len && $other_changed[$j]) |
$j++; |
} |
if ($i == $len) |
break; |
$start = $i; |
// Find the end of this run of changes. |
while (++$i < $len && $changed[$i]) |
continue; |
do { |
/* |
* Record the length of this run of changes, so that |
* we can later determine whether the run has grown. |
*/ |
$runlength = $i - $start; |
/* |
* Move the changed region back, so long as the |
* previous unchanged line matches the last changed one. |
* This merges with previous changed regions. |
*/ |
while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) { |
$changed[--$start] = 1; |
$changed[--$i] = false; |
while ($start > 0 && $changed[$start - 1]) |
$start--; |
USE_ASSERTS && assert('$j > 0'); |
while ($other_changed[--$j]) |
continue; |
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]'); |
} |
/* |
* Set CORRESPONDING to the end of the changed run, at the last |
* point where it corresponds to a changed run in the other file. |
* CORRESPONDING == LEN means no such point has been found. |
*/ |
$corresponding = $j < $other_len ? $i : $len; |
/* |
* Move the changed region forward, so long as the |
* first changed line matches the following unchanged one. |
* This merges with following changed regions. |
* Do this second, so that if there are no merges, |
* the changed region is moved forward as far as possible. |
*/ |
while ($i < $len && $lines[$start] == $lines[$i]) { |
$changed[$start++] = false; |
$changed[$i++] = 1; |
while ($i < $len && $changed[$i]) |
$i++; |
USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]'); |
$j++; |
if ($j < $other_len && $other_changed[$j]) { |
$corresponding = $i; |
while ($j < $other_len && $other_changed[$j]) |
$j++; |
} |
} |
} while ($runlength != $i - $start); |
/* |
* If possible, move the fully-merged run of changes |
* back to a corresponding run in the other file. |
*/ |
while ($corresponding < $i) { |
$changed[--$start] = 1; |
$changed[--$i] = 0; |
USE_ASSERTS && assert('$j > 0'); |
while ($other_changed[--$j]) |
continue; |
USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]'); |
} |
} |
} |
} |
/** |
* Class representing a 'diff' between two sequences of strings. |
*/ |
class Diff |
{ |
var $edits; |
/** |
* Constructor. |
* Computes diff between sequences of strings. |
* |
* @param $from_lines array An array of strings. |
* (Typically these are lines from a file.) |
* @param $to_lines array An array of strings. |
*/ |
function Diff($from_lines, $to_lines) { |
$eng = new _DiffEngine; |
$this->edits = $eng->diff($from_lines, $to_lines); |
} |
} |
/** |
* A class to format Diffs |
* |
* This class formats the diff in classic diff format. |
* It is intended that this class be customized via inheritance, |
* to obtain fancier outputs. |
*/ |
class DiffFormatter |
{ |
/** |
* Format a diff. |
* |
* @param $diff object A Diff object. |
* @return string The formatted output. |
*/ |
function format($diff) { |
$xi = $yi = 1; |
$block = false; |
$context = array(); |
$this->_start_diff(); |
foreach ($diff->edits as $edit) { |
if ($edit->type == 'copy') { |
if (is_array($block)) { |
if (sizeof($edit->orig) <= 0) { |
$block[] = $edit; |
} |
else{ |
$this->_block($x0, + $xi - $x0, |
$y0, + $yi - $y0, |
$block); |
$block = false; |
} |
} |
} |
else { |
if (! is_array($block)) { |
$x0 = $xi; |
$y0 = $yi; |
$block = array(); |
} |
$block[] = $edit; |
} |
if ($edit->orig) |
$xi += sizeof($edit->orig); |
if ($edit->final) |
$yi += sizeof($edit->final); |
} |
if (is_array($block)) |
$this->_block($x0, $xi - $x0, |
$y0, $yi - $y0, |
$block); |
return $this->_end_diff(); |
} |
function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) { |
$this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen)); |
} |
function _start_diff() { |
ob_start(); |
} |
function _end_diff() { |
$val = ob_get_contents(); |
ob_end_clean(); |
return $val; |
} |
function _block_header($xbeg, $xlen, $ybeg, $ylen) { |
if ($xlen > 1) |
$xbeg .= "," . ($xbeg + $xlen - 1); |
if ($ylen > 1) |
$ybeg .= "," . ($ybeg + $ylen - 1); |
return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; |
} |
function _start_block($header) { |
echo $header."\n"; |
} |
} |
?> |
</div> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/code_bota_wikini.php |
---|
New file |
0,0 → 1,164 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------+ |
// | Code Bota Wikini | |
// +------------------------------------------------------------------------------------+ |
// | Copyright (c) Tela Botanica 1999 - 2004 | |
// +------------------------------------------------------------------------------------+ |
// | Licence | |
// +------------------------------------------------------------------------------------+ |
/** |
* Code Bota Wikini page principale |
* |
* Ce programme permet d'afficher le contenu d'un page d'un wikini. C'est seulement une interface de visualisation |
* du contenu du wikini. Les fonctionnalités d'édition du Wikini ne sont pas reprises ici. |
* |
*@package Code_Bota_Wikini |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Date: 2005-08-18 10:19:59 $ |
// +------------------------------------------------------------------------------------+ |
// |
// $Id: code_bota_wikini.php,v 1.1 2005-08-18 10:19:59 ddelon Exp $ |
// FICHIER : $RCSfile: code_bota_wikini.php,v $ |
// AUTEUR : $Author: ddelon $ |
// VERSION : $Revision: 1.1 $ |
// DATE : $Date: 2005-08-18 10:19:59 $ |
// +------------------------------------------------------------------------------------+ |
**/ |
//============================================================================== |
// Inclusion du fichier contenant les constantes |
// ATTENTION : il doit se situer dans le même dossier que le fichier courrant. |
// Il définit les chemins d'accé et les noms des autres fichiers à inclure ! |
// |
//============================================================================== |
include_once 'code_bota_wikini_config.php'; |
//============================================================================== |
// Inclue la librairie de styles. |
//Définition du style à utiliser si on est dans GSITE. |
//============================================================================== |
if(STYLE_GSITE == 1){//Nous sommes dans une interface GSITE |
global $var_style; |
$var_style=STYLE; |
include_once LIB_STYLE; |
} |
//============================================================================== |
// Inclusion du fichier permettant l'utilisation de la classe wiki. |
// |
//============================================================================== |
include_once LIB_WIKINI; |
//============================================================================== |
// Inclue la librairie gérant les textes. |
// La fonction remplaceEntiteDsHTLM() est utilisée dans le fichier contenant les fonctions d'inclusion du html. |
// |
//============================================================================== |
include_once LIB_TEXTE; |
//============================================================================== |
// Inclue le fichier contenant les fonctions d'inclusion du html |
// |
//============================================================================== |
include_once HTML; |
/** |
//==================================== FUNCTION ================================== |
* La fonction putFrame() renvoie le corps de la page html. |
* |
* Cette fonction retourne le corps de la page html renvoyée au client. |
* Dans le cas présent (Code Bota Wikini), on retourne : |
* le contenue d'un page wikini |
* |
* |
* @return string contient la chaîne html à afficher. |
//============================================================================== |
*/ |
function putFrame () |
{ |
global $wiki; |
global $wikini_config_defaut; |
$wakkaConfig = $wikini_config_defaut; |
// Démarrage de session php |
//session_start(); |
// Récupération du nom de la page wikini recherchée |
if ( ! isset( $_REQUEST["wiki"] ) ) { |
$wiki = 'CinB'; |
} |
else { |
$wiki = $_REQUEST["wiki"]; |
} |
// Gestion de la variable de session "linktracking" |
if ( ! isset( $_SESSION["linktracking"] ) ) { |
$_SESSION["linktracking"] = 1; |
} |
// Suppression des slash. |
$wiki = preg_replace("/^\//", "", $wiki); |
// split into page/method |
if ( preg_match( "#^(.+?)/(.*)$#", $wiki, $matches ) ) { |
list(, $page, $method) = $matches; |
} |
else if ( preg_match( "#^(.*)$#", $wiki, $matches ) ) { |
list(, $page) = $matches; |
} |
// create wiki object |
$wiki = new Wiki( $wikini_config_defaut ); |
// Vérification de la méthode d'affichage employée! |
if ( ! isset( $method ) ) { |
$method = ''; |
} |
//Récupération du contenu de la page Wikini |
$sortie = $wiki->Run($page, $method); |
return $sortie; |
} |
/** |
//==================================== FUNCTION ================================== |
* La fonction putFooter() renvoie le pied de page HTML. |
* |
*Cette fonction retourne le pied de la page html de l'application Code Bota Wikini. |
* |
* @return string contient la chaîne html à afficher en pied de page. |
//============================================================================== |
*/ |
function putFooter() |
{ |
return inclusion_html('pied_page'); |
}//Fin de la fonction putFooter(). |
// +- Fin du code source --------------------------------------------------------------+ |
/* |
* $Log: not supported by cvs2svn $ |
* Revision 1.1 2005/03/02 13:12:53 jpm |
* Fichiers d'un wikini transformés en API. |
* |
* Revision 1.3 2004/02/06 10:18:16 jpm |
* Suppression du code de test. |
* |
* Revision 1.2 2004/02/03 12:39:41 jpm |
* L'affichage du contenu du wikini fonctionne et ne renvoit pas de notice. |
* |
* Revision 1.1 2004/02/02 16:11:34 jpm |
* Le fichier principal de l'application Code_Bota_Wikini. |
* |
* |
*/ |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/handlers/page/raw.php |
---|
New file |
0,0 → 1,18 |
<?php |
if ($this->HasAccess("read")) |
{ |
if (!$this->page) |
{ |
return; |
} |
else |
{ |
// display raw page |
print($this->page["body"]); |
} |
} |
else |
{ |
return; |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/LICENSE |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/client/integrateur_wikini/bibliotheque/wikini/LICENSE |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/client/integrateur_wikini/bibliotheque/wikini/wakka.php |
---|
New file |
0,0 → 1,591 |
<?php |
/* |
Yes, most of the formatting used in this file is HORRIBLY BAD STYLE. However, |
most of the action happens outside of this file, and I really wanted the code |
to look as small as what it does. Basically. Oh, I just suck. :) |
*/ |
// do not change this line, you fool. In fact, don't change anything! Ever! |
define("WAKKA_VERSION", "0.1.1"); |
define("WIKINI_VERSION", "0.3"); |
/* Mise en commentaire pour transformation en bibliothèque |
// start the compute time |
list($g_usec, $g_sec) = explode(" ",microtime()); |
define ("t_start", (float)$g_usec + (float)$g_sec); |
$t_SQL=0; |
*/ |
class Wiki |
{ |
var $dblink; |
var $page; |
var $tag; |
var $parameter = array(); |
var $queryLog = array(); |
var $interWiki = array(); |
var $VERSION; |
// constructor |
function Wiki($config) |
{ |
$this->config = $config; |
/* might be a good idea to change this to mysql_connect */ |
$this->dblink = mysql_pconnect ( |
$this->config["mysql_host"], |
$this->config["mysql_user"], |
$this->config["mysql_password"]); |
mysql_select_db($this->config["mysql_database"], $this->dblink); |
$this->VERSION = WAKKA_VERSION; |
} |
// DATABASE |
function Query($query) |
{ |
if($this->GetConfigValue("debug")) $start = $this->GetMicroTime(); |
if (!$result = mysql_query($query, $this->dblink)) |
{ |
ob_end_clean(); |
die("Query failed: ".$query." (".mysql_error().")"); |
} |
if($this->GetConfigValue("debug")) |
{ |
$time = $this->GetMicroTime() - $start; |
$this->queryLog[] = array( |
"query" => $query, |
"time" => $time); |
} |
return $result; |
} |
function LoadSingle($query) { if ($data = $this->LoadAll($query)) return $data[0]; } |
function LoadAll($query) |
{ |
$data=array(); |
if ($r = $this->Query($query)) |
{ |
while ($row = mysql_fetch_assoc($r)) $data[] = $row; |
mysql_free_result($r); |
} |
return $data; |
} |
// MISC |
function GetMicroTime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } |
function IncludeBuffered($filename, $notfoundText = "", $vars = "", $path = "") |
{ |
if ($path) $dirs = explode(":", $path); |
else $dirs = array(""); |
foreach($dirs as $dir) |
{ |
if ($dir) $dir .= "/"; |
$fullfilename = $dir.$filename; |
if (file_exists($fullfilename)) |
{ |
if (is_array($vars)) extract($vars); |
ob_start(); |
include($fullfilename); |
$output = ob_get_contents(); |
ob_end_clean(); |
return $output; |
} |
} |
if ($notfoundText) return $notfoundText; |
else return false; |
} |
// VARIABLES |
function GetPageTag() { return $this->tag; } |
function GetPageTime() { return $this->page["time"]; } |
function GetMethod() { return $this->method; } |
function GetConfigValue($name) { return $this->config[$name]; } |
function GetWakkaName() { return $this->GetConfigValue("wakka_name"); } |
function GetWakkaVersion() { return $this->VERSION; } |
function GetWikiNiVersion() { $ver=$this->GetWakkaVersion().'.'.WIKINI_VERSION; return $ver; } |
// PAGES |
function LoadPage($tag, $time = "", $cache = 1) { |
// retrieve from cache |
if (!$time && $cache && ($cachedPage = $this->GetCachedPage($tag))) { $page = $cachedPage;} |
// load page |
if (!isset($page)) $page = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($tag)."' ".($time ? "and time = '".mysql_escape_string($time)."'" : "and latest = 'Y'")." limit 1"); |
// cache result |
if (!$time) $this->CachePage($page); |
return $page; |
} |
function GetCachedPage($tag) {return (isset($this->pageCache[$tag]) ? $this->pageCache[$tag] : ''); } |
function CachePage($page) { $this->pageCache[$page["tag"]] = $page; } |
function SetPage($page) { $this->page = $page; if ($this->page["tag"]) $this->tag = $this->page["tag"]; } |
function LoadPageById($id) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".mysql_escape_string($id)."' limit 1"); } |
function LoadRevisions($page) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where tag = '".mysql_escape_string($page)."' order by time desc"); } |
function LoadPagesLinkingTo($tag) { return $this->LoadAll("select from_tag as tag from ".$this->config["table_prefix"]."links where to_tag = '".mysql_escape_string($tag)."' order by tag"); } |
function LoadRecentlyChanged($limit=50) |
{ |
$limit= (int) $limit; |
if ($pages = $this->LoadAll("select tag, time, user, owner from ".$this->config["table_prefix"]."pages where latest = 'Y' and comment_on = '' order by time desc limit $limit")) |
{ |
foreach ($pages as $page) |
{ |
$this->CachePage($page); |
} |
return $pages; |
} |
} |
function LoadAllPages() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' order by tag"); } |
function FullTextSearch($phrase) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and match(tag, body) against('".mysql_escape_string($phrase)."')"); } |
function LoadWantedPages() { return $this->LoadAll("select distinct ".$this->config["table_prefix"]."links.to_tag as tag,count(".$this->config["table_prefix"]."links.from_tag) as count from ".$this->config["table_prefix"]."links left join ".$this->config["table_prefix"]."pages on ".$this->config["table_prefix"]."links.to_tag = ".$this->config["table_prefix"]."pages.tag where ".$this->config["table_prefix"]."pages.tag is NULL group by tag order by count desc"); } |
function LoadOrphanedPages() { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on = '' order by tag"); } |
function IsOrphanedPage($tag) { return $this->LoadAll("select distinct tag from ".$this->config["table_prefix"]."pages left join ".$this->config["table_prefix"]."links on ".$this->config["table_prefix"]."pages.tag = ".$this->config["table_prefix"]."links.to_tag where ".$this->config["table_prefix"]."links.to_tag is NULL and ".$this->config["table_prefix"]."pages.comment_on ='' and tag='".mysql_escape_string($tag)."'"); } |
function DeleteOrphanedPage($tag) |
{ |
$this->Query("delete from ".$this->config["table_prefix"]."pages where tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."acls where page_tag='".mysql_escape_string($tag)."' "); |
$this->Query("delete from ".$this->config["table_prefix"]."referrers where page_tag='".mysql_escape_string($tag)."' "); |
} |
function SavePage($tag, $body, $comment_on = "") |
{ |
// get current user |
$user = $this->GetUserName(); |
//die($tag); |
// TODO: check write privilege |
if ($this->HasAccess("write", $tag)) |
{ |
// is page new? |
if (!$oldPage = $this->LoadPage($tag)) |
{ |
// create default write acl. store empty write ACL for comments. |
$this->SaveAcl($tag, "write", ($comment_on ? "" : $this->GetConfigValue("default_write_acl"))); |
// create default read acl |
$this->SaveAcl($tag, "read", $this->GetConfigValue("default_read_acl")); |
// create default comment acl. |
$this->SaveAcl($tag, "comment", $this->GetConfigValue("default_comment_acl")); |
// current user is owner; if user is logged in! otherwise, no owner. |
if ($this->GetUser()) $owner = $user; |
} |
else |
{ |
// aha! page isn't new. keep owner! |
$owner = $oldPage["owner"]; |
} |
// set all other revisions to old |
$this->Query("update ".$this->config["table_prefix"]."pages set latest = 'N' where tag = '".mysql_Escape_string($tag)."'"); |
// add new revision |
$this->Query("insert into ".$this->config["table_prefix"]."pages set ". |
"tag = '".mysql_escape_string($tag)."', ". |
($comment_on ? "comment_on = '".mysql_escape_string($comment_on)."', " : ""). |
"time = now(), ". |
"owner = '".mysql_escape_string($owner)."', ". |
"user = '".mysql_escape_string($user)."', ". |
"latest = 'Y', ". |
"body = '".mysql_escape_string(trim($body))."'"); |
} |
} |
// COOKIES |
function SetSessionCookie($name, $value) { SetCookie($name, $value, 0, "/"); $_COOKIE[$name] = $value; } |
function SetPersistentCookie($name, $value, $remember = 0) { SetCookie($name, $value, time() + ($remember ? 90*24*60*60 : 60 * 60), "/"); $_COOKIE[$name] = $value; } |
function DeleteCookie($name) { SetCookie($name, "", 1, "/"); $_COOKIE[$name] = ""; } |
function GetCookie($name) { return $_COOKIE[$name]; } |
// HTTP/REQUEST/LINK RELATED |
function SetMessage($message) { $_SESSION["message"] = $message; } |
function GetMessage() { $message = $_SESSION["message"]; $_SESSION["message"] = ""; return $message; } |
function Redirect($url) { header("Location: $url"); exit; } |
// returns just PageName[/method]. |
function MiniHref($method = "", $tag = "") { if (!$tag = trim($tag)) $tag = $this->tag; return $tag.($method ? "/".$method : ""); } |
// returns the full url to a page/method. |
function Href($method = "", $tag = "", $params = "") |
{ |
$href = $this->config["base_url"].$this->MiniHref($method, $tag); |
if ($params) |
{ |
$href .= ($this->config["rewrite_mode"] ? "?" : "&").$params; |
} |
return $href; |
} |
function Link($tag, $method = "", $text = "", $track = 1) { |
$tag=htmlspecialchars($tag);//avoid xss |
$text=htmlspecialchars($text);//paranoiac again |
if (!$text) $text = $tag; |
// is this an interwiki link? |
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $tag, $matches)) |
{ |
$tag = $this->GetInterWikiUrl($matches[1], $matches[2]); |
return "<a href=\"$tag\">$text (interwiki)</a>"; |
} |
// is this a full link? ie, does it contain alpha-numeric characters? |
else if (preg_match("/[^[:alnum:]]/", $tag)) |
{ |
// check for email addresses |
if (preg_match("/^.+\@.+$/", $tag)) |
{ |
$tag = "mailto:".$tag; |
} |
// check for protocol-less URLs |
else if (!preg_match("/:\/\//", $tag)) |
{ |
$tag = "http://".$tag; //Very important for xss (avoid javascript:() hacking) |
} |
// is this an inline image (text!=tag and url ends png,gif,jpeg) |
if($text!=$tag and preg_match("/.(gif|jpeg|png|jpg)$/i",$tag)){ |
return "<img src=\"$tag\" alt=\"$text\" \\>"; |
}else{ |
return "<a href=\"$tag\">$text</a>"; |
} |
} |
else |
{ |
// it's a Wiki link! |
if ($_SESSION["linktracking"] && $track) $this->TrackLinkTo($tag); |
return ($this->LoadPage($tag) ? "<a href=\"".$this->href($method, $tag)."\">".$text."</a>" : "<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>"); |
} |
} |
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1) |
{ |
if (!$text) $text = $tag; |
$text = htmlentities($text); |
if ($_SESSION["linktracking"] && $track) |
$this->TrackLinkTo($tag); |
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>'; |
} |
// function PregPageLink($matches) { return $this->Link($matches[1]); } |
function IsWikiName($text) { return preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/", $text); } |
function TrackLinkTo($tag) { $_SESSION["linktable"][] = $tag; } |
function GetLinkTable() { return $_SESSION["linktable"]; } |
function ClearLinkTable() { $_SESSION["linktable"] = array(); } |
function StartLinkTracking() { $_SESSION["linktracking"] = 1; } |
function StopLinkTracking() { $_SESSION["linktracking"] = 0; } |
function WriteLinkTable() |
{ |
// delete old link table |
$this->Query("delete from ".$this->config["table_prefix"]."links where from_tag = '".mysql_escape_string($this->GetPageTag())."'"); |
if ($linktable = $this->GetLinkTable()) |
{ |
$from_tag = mysql_escape_string($this->GetPageTag()); |
foreach ($linktable as $to_tag) |
{ |
$lower_to_tag = strtolower($to_tag); |
if (!$written[$lower_to_tag]) |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."links set from_tag = '".$from_tag."', to_tag = '".mysql_escape_string($to_tag)."'"); |
$written[$lower_to_tag] = 1; |
} |
} |
} |
} |
function Header() { return $this->Action($this->GetConfigValue("header_action"), 1); } |
function Footer() { return $this->Action($this->GetConfigValue("footer_action"), 1); } |
// FORMS |
function FormOpen($method = "", $tag = "", $formMethod = "post") |
{ |
$result = "<form action=\"".$this->href($method, $tag)."\" method=\"".$formMethod."\">\n"; |
if (!$this->config["rewrite_mode"]) $result .= "<input type=\"hidden\" name=\"wiki\" value=\"".$this->MiniHref($method, $tag)."\" />\n"; |
return $result; |
} |
function FormClose() |
{ |
return "</form>\n"; |
} |
// INTERWIKI STUFF |
function ReadInterWikiConfig() |
{ |
if ($lines = file($this->config['interwiki_path'])) |
{ |
foreach ($lines as $line) |
{ |
if ($line = trim($line)) |
{ |
list($wikiName, $wikiUrl) = explode(" ", trim($line)); |
$this->AddInterWiki($wikiName, $wikiUrl); |
} |
} |
} |
} |
function AddInterWiki($name, $url) |
{ |
$this->interWiki[$name] = $url; |
} |
function GetInterWikiUrl($name, $tag) |
{ |
if (isset($this->interWiki[$name])) |
{ |
return $this->interWiki[$name].$tag; |
}else{ |
return 'http://'.$tag; //avoid xss by putting http:// in front of JavaScript:() |
} |
} |
// REFERRERS |
function LogReferrer($tag = "", $referrer = "") |
{ |
// fill values |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
if (!$referrer = trim($referrer) AND isset($_SERVER["HTTP_REFERER"])) $referrer = $_SERVER["HTTP_REFERER"]; |
// check if it's coming from another site |
if ($referrer && !preg_match("/^".preg_quote($this->GetConfigValue("base_url"), "/")."/", $referrer)) |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."referrers set ". |
"page_tag = '".mysql_escape_string($tag)."', ". |
"referrer = '".mysql_escape_string($referrer)."', ". |
"time = now()"); |
} |
} |
function LoadReferrers($tag = "") |
{ |
return $this->LoadAll("select referrer, count(referrer) as num from ".$this->config["table_prefix"]."referrers ".($tag = trim($tag) ? "where page_tag = '".mysql_escape_string($tag)."'" : "")." group by referrer order by num desc"); |
} |
// PLUGINS |
function Action($action, $forceLinkTracking = 0) |
{ |
$action = trim($action); $vars=array(); |
// stupid attributes check |
if ((stristr($action, "=\"")) || (stristr($action, "/"))) |
{ |
// extract $action and $vars_temp ("raw" attributes) |
preg_match("/^([A-Za-z0-9]*)\/?(.*)$/", $action, $matches); |
list(, $action, $vars_temp) = $matches; |
// match all attributes (key and value) |
$this->parameter[$vars_temp]=$vars_temp; |
preg_match_all("/([A-Za-z0-9]*)=\"(.*)\"/U", $vars_temp, $matches); |
// prepare an array for extract() to work with (in $this->IncludeBuffered()) |
if (is_array($matches)) |
{ |
for ($a = 0; $a < count($matches); $a++) |
{ |
$vars[$matches[1][$a]] = $matches[2][$a]; |
$this->parameter[$matches[1][$a]]=$matches[2][$a]; |
} |
} |
} |
if (!$forceLinkTracking) $this->StopLinkTracking(); |
$result = $this->IncludeBufferedim(strtolower($action).".php", "<i>Action inconnue \"$action\"</i>", $vars, $this->config["action_path"]); |
$this->StartLinkTracking(); |
if (isset($parameter)) unset($this->parameter[$parameter]); |
unset($this->parameter); |
return $result; |
} |
function Method($method) |
{ |
if (!$handler = $this->page["handler"]) $handler = "page"; |
$methodLocation = $handler."/".$method.".php"; |
return $this->IncludeBuffered($methodLocation, "<i>Méthode inconue \"$methodLocation\"</i>", "", $this->config["handler_path"]); |
} |
function Format($text, $formatter = "wakka") |
{ |
//Modification : inclusion d'un chemin d'accès provenant du fichier de config. |
return $this->IncludeBuffered($formatter.".php", "<i>Impossible de trouver le formateur \"$formatter\"</i>", compact("text"), $this->config["formatters_path"] ); |
} |
// USERS |
function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config["table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1"); } |
function LoadUsers() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."users order by name"); } |
function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; } |
function UserName() { /* deprecated! */ return $this->GetUserName(); } |
function GetUser() { return (isset($_SESSION["user"]) ? $_SESSION["user"] : '');} |
function SetUser($user, $remember=0) { $_SESSION["user"] = $user; $this->SetPersistentCookie("name", $user["name"], $remember); $this->SetPersistentCookie("password", $user["password"], $remember); $this->SetPersistentCookie("remember", $remember, $remember); } |
function LogoutUser() { $_SESSION["user"] = ""; $this->DeleteCookie("name"); $this->DeleteCookie("password"); } |
function UserWantsComments() { if (!$user = $this->GetUser()) return false; return ($user["show_comments"] == "Y"); } |
function GetParameter($parameter) { return (isset($this->parameter[$parameter]) ? $this->parameter[$parameter] :''); } |
// COMMENTS |
function LoadComments($tag) { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on = '".mysql_escape_string($tag)."' and latest = 'Y' order by time"); } |
function LoadRecentComments() { return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where comment_on != '' and latest = 'Y' order by time desc"); } |
function LoadRecentlyCommented($limit = 50) |
{ |
// NOTE: this is really stupid. Maybe my SQL-Fu is too weak, but apparently there is no easier way to simply select |
// all comment pages sorted by their first revision's (!) time. ugh! |
// load ids of the first revisions of latest comments. err, huh? |
if ($ids = $this->LoadAll("select min(id) as id from ".$this->config["table_prefix"]."pages where comment_on != '' group by tag order by id desc")) |
{ |
// load complete comments |
foreach ($ids as $id) |
{ |
$comment = $this->LoadSingle("select * from ".$this->config["table_prefix"]."pages where id = '".$id["id"]."' limit 1"); |
if (!$comments[$comment["comment_on"]] && $num < $limit) |
{ |
$comments[$comment["comment_on"]] = $comment; |
$num++; |
} |
} |
// now load pages |
if ($comments) |
{ |
// now using these ids, load the actual pages |
foreach ($comments as $comment) |
{ |
$page = $this->LoadPage($comment["comment_on"]); |
$page["comment_user"] = $comment["user"]; |
$page["comment_time"] = $comment["time"]; |
$page["comment_tag"] = $comment["tag"]; |
$pages[] = $page; |
} |
} |
} |
// load tags of pages |
//return $this->LoadAll("select comment_on as tag, max(time) as time, tag as comment_tag, user from ".$this->config["table_prefix"]."pages where comment_on != '' group by comment_on order by time desc"); |
return $pages; |
} |
// ACCESS CONTROL |
// returns true if logged in user is owner of current page, or page specified in $tag |
function UserIsOwner($tag = "") |
{ |
// check if user is logged in |
if (!$this->GetUser()) return false; |
// set default tag |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
// check if user is owner |
if ($this->GetPageOwner($tag) == $this->GetUserName()) return true; |
} |
function GetPageOwner($tag = "", $time = "") { if (!$tag = trim($tag)) $tag = $this->GetPageTag(); if ($page = $this->LoadPage($tag, $time)) return $page["owner"]; } |
function SetPageOwner($tag, $user) |
{ |
// check if user exists |
if (!$this->LoadUser($user)) return; |
// updated latest revision with new owner |
$this->Query("update ".$this->config["table_prefix"]."pages set owner = '".mysql_escape_string($user)."' where tag = '".mysql_escape_string($tag)."' and latest = 'Y' limit 1"); |
} |
function LoadAcl($tag, $privilege, $useDefaults = 1) |
{ |
if ((!$acl = $this->LoadSingle("select * from ".$this->config["table_prefix"]."acls where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1")) && $useDefaults) |
{ |
$acl = array("page_tag" => $tag, "privilege" => $privilege, "list" => $this->GetConfigValue("default_".$privilege."_acl")); |
} |
return $acl; |
} |
function SaveAcl($tag, $privilege, $list) { |
if ($this->LoadAcl($tag, $privilege, 0)) $this->Query("update ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."' where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1"); |
else $this->Query("insert into ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."', page_tag = '".mysql_escape_string($tag)."', privilege = '".mysql_escape_string($privilege)."'"); |
} |
// returns true if $user (defaults to current user) has access to $privilege on $page_tag (defaults to current page) |
function HasAccess($privilege, $tag = "", $user = "") |
{ |
// set defaults |
if (!$tag = trim($tag)) $tag = $this->GetPageTag(); |
if (!$user = $this->GetUserName()); |
// load acl |
$acl = $this->LoadAcl($tag, $privilege); |
// if current user is owner, return true. owner can do anything! |
if ($this->UserIsOwner($tag)) return true; |
// fine fine... now go through acl |
foreach (explode("\n", $acl["list"]) as $line) |
{ |
$line = trim($line); |
// check for inversion character "!" |
if (preg_match("/^[!](.*)$/", $line, $matches)) |
{ |
$negate = 1; |
$line = $matches[1]; |
} |
else |
{ |
$negate = 0; |
} |
// if there's still anything left... lines with just a "!" don't count! |
if ($line) |
{ |
switch ($line[0]) |
{ |
// comments |
case "#": |
break; |
// everyone |
case "*": |
return !$negate; |
// aha! a user entry. |
case "+": |
if (!$this->LoadUser($user)) |
{ |
return $negate; |
} |
else |
{ |
return !$negate; |
} |
default: |
if ($line == $user) |
{ |
return !$negate; |
} |
} |
} |
} |
// tough luck. |
return false; |
} |
// MAINTENANCE |
function Maintenance() |
{ |
// purge referrers |
if ($days = $this->GetConfigValue("referrers_purge_time")) { |
$this->Query("delete from ".$this->config["table_prefix"]."referrers where time < date_sub(now(), interval '".mysql_escape_string($days)."' day)"); |
} |
// purge old page revisions |
if ($days = $this->GetConfigValue("pages_purge_time")) { |
$this->Query("delete from ".$this->config["table_prefix"]."pages where time < date_sub(now(), interval '".mysql_escape_string($days)."' day) and latest = 'N'"); |
} |
} |
// THE BIG EVIL NASTY ONE! |
function Run($tag, $method = "") |
{ |
if(!($this->GetMicroTime()%3)) $this->Maintenance(); |
$this->ReadInterWikiConfig(); |
// do our stuff! |
if (!$this->method = trim($method)) $this->method = "show"; |
if (!$this->tag = trim($tag)) $this->Redirect($this->href("", $this->config["root_page"])); |
if ((!$this->GetUser() && isset($_COOKIE["name"])) && ($user = $this->LoadUser($_COOKIE["name"], $_COOKIE["password"]))) $this->SetUser($user, $_COOKIE["remember"]); |
$this->SetPage($this->LoadPage($tag, (isset($_REQUEST["time"]) ? $_REQUEST["time"] :''))); |
$this->LogReferrer(); |
switch ($this->method) |
{ |
case "xml": |
header("Content-type: text/xml"); |
case "raw": |
//ATTENTION: remplacement print par return et retourne seulement le contenu de la page wikini |
return ( $this->Method( $this->method ) ); |
break; |
default: |
//ATTENTION: remplacement print par return et retourne seulement le contenu de la page wikini |
return ( $this->Method( $this->method ) ); |
} |
} |
}//Fin de la classe Wiki |
//ATTENTION : Suppression du reste du fichier car géré par les applications de Génésia. |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/formatters/php.php |
---|
New file |
0,0 → 1,3 |
<?php |
highlight_string($text) |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/formatters/raw.php |
---|
New file |
0,0 → 1,12 |
<?php |
if ($test=$_REQUEST["text"]) { |
print ""; |
} |
else if ($lines = file($text)) { |
foreach ($lines as $line) { |
// To avoid loop:ignore inclusion of other raw link |
if (!(preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $line, $matches))) |
print $line; |
} |
} |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/formatters/code.php |
---|
New file |
0,0 → 1,4 |
<pre> |
<?php echo htmlentities($text)."\n"; ?> |
</pre> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/formatters/action.php |
---|
New file |
0,0 → 1,37 |
<?php |
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup! |
if (!function_exists("wakka2callback")) |
{ |
function wakka2callback($things) |
{ |
$thing = $things[1]; |
global $wiki; |
// events |
if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches)) |
{ |
if ($matches[1]) |
return $wiki->Action($matches[1]); |
else |
return "{{}}"; |
} |
else if (preg_match("/^.*$/s", $thing, $matches)) |
{ |
return ""; |
} |
// if we reach this point, it must have been an accident. |
return $thing; |
} |
} |
$text = str_replace("\r", "", $text); |
$text = trim($text)."\n"; |
$text = preg_replace_callback( |
"/(\{\{.*?\}\}|.*)/msU", "wakka2callback", $text); |
print($text); |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/formatters/wakka.php |
---|
New file |
0,0 → 1,301 |
<?php |
// This may look a bit strange, but all possible formatting tags have to be in a single regular expression for this to work correctly. Yup! |
if (!function_exists("wakka2callback")) |
{ |
function wakka2callback($things) |
{ |
$thing = $things[1]; |
$result=''; |
static $oldIndentLevel = 0; |
static $oldIndentLength= 0; |
static $indentClosers = array(); |
static $newIndentSpace= array(); |
static $br = 1; |
global $wiki; |
// convert HTML thingies |
if ($thing == "<") |
return "<"; |
else if ($thing == ">") |
return ">"; |
// bold |
else if ($thing == "**") |
{ |
static $bold = 0; |
return (++$bold % 2 ? "<b>" : "</b>"); |
} |
// italic |
else if ($thing == "//") |
{ |
static $italic = 0; |
return (++$italic % 2 ? "<i>" : "</i>"); |
} |
// underlinue |
else if ($thing == "__") |
{ |
static $underline = 0; |
return (++$underline % 2 ? "<u>" : "</u>"); |
} |
// monospace |
else if ($thing == "##") |
{ |
static $monospace = 0; |
return (++$monospace % 2 ? "<tt>" : "</tt>"); |
} |
// Deleted |
else if ($thing == "@@") |
{ |
static $deleted = 0; |
return (++$deleted % 2 ? "<span class=\"del\">" : "</span>"); |
} |
// Inserted |
else if ($thing == "££") |
{ |
static $inserted = 0; |
return (++$inserted % 2 ? "<span class=\"add\">" : "</span>"); |
} |
// urls |
else if (preg_match("/^([a-z]+:\/\/\S+?)([^[:alnum:]^\/])?$/", $thing, $matches)) { |
$url = $matches[1]; |
return "<a href=\"$url\">$url</a>".$matches[2]; |
} |
// header level 5 |
else if ($thing == "==") |
{ |
static $l5 = 0; |
$br = 0; |
return (++$l5 % 2 ? "<h5>" : "</h5>"); |
} |
// header level 4 |
else if ($thing == "===") |
{ |
static $l4 = 0; |
$br = 0; |
return (++$l4 % 2 ? "<h4>" : "</h4>"); |
} |
// header level 3 |
else if ($thing == "====") |
{ |
static $l3 = 0; |
$br = 0; |
return (++$l3 % 2 ? "<h3>" : "</h3>"); |
} |
// header level 2 |
else if ($thing == "=====") |
{ |
static $l2 = 0; |
$br = 0; |
return (++$l2 % 2 ? "<h2>" : "</h2>"); |
} |
// header level 1 |
else if ($thing == "======") |
{ |
static $l1 = 0; |
$br = 0; |
return (++$l1 % 2 ? "<h1>" : "</h1>"); |
} |
// separators |
else if (preg_match("/-{4,}/", $thing, $matches)) |
{ |
// TODO: This could probably be improved for situations where someone puts text on the same line as a separator. |
// Which is a stupid thing to do anyway! HAW HAW! Ahem. |
$br = 0; |
return "<hr noshade=\"noshade\" size=\"1\" />"; |
} |
// forced line breaks |
else if ($thing == "---") |
{ |
return "<br />"; |
} |
// escaped text |
else if (preg_match("/^\"\"(.*)\"\"$/s", $thing, $matches)) |
{ |
return $matches[1]; |
} |
// code text |
else if (preg_match("/^\%\%(.*)\%\%$/s", $thing, $matches)) |
{ |
// check if a language has been specified |
$code = $matches[1]; |
if (preg_match("/^\((.+?)\)(.*)$/s", $code, $matches)) |
{ |
list(, $language, $code) = $matches; |
} |
switch ($language) |
{ |
case "php": |
$formatter = "php"; |
break; |
default: |
$formatter = "code"; |
} |
$output = "<div class=\"code\">"; |
$output .= $wiki->Format(trim($code), $formatter); |
$output .= "</div>"; |
return $output; |
} |
// raw inclusion from another wiki |
else if (preg_match("/^\[\[\|(\S*)(\s+(.+))?\]\]$/", $thing, $matches)) |
{ |
list (,$url,,$text) = $matches; |
if (!$text) $text = "404"; |
if ($url) |
{ |
$url.="/wakka.php?wiki=".$text."/raw"; |
return $wiki->Format($wiki->Format($url, "raw"),"wakka"); |
} |
else |
{ |
return ""; |
} |
} |
// forced links |
else if (preg_match("/^\[\[(\S*)(\s+(.+))?\]\]$/", $thing, $matches)) |
{ |
list (, $url, , $text) = $matches; |
if ($url) |
{ |
if ($url!=($url=(preg_replace("/@@|££||\[\[/","",$url))))$result="</span>"; |
if (!$text) $text = $url; |
$text=preg_replace("/@@|££|\[\[/","",$text); |
return $result.$wiki->Link($url, "", $text); |
} |
else |
{ |
return ""; |
} |
} |
// indented text |
else if (preg_match("/\n(\t+|([ ]{1})+)(-|([0-9,a-z,A-Z]+)\))?/s", $thing, $matches)) |
{ |
// new line |
$result .= ($br ? "<br />\n" : ""); |
// we definitely want no line break in this one. |
$br = 0; |
// find out which indent type we want |
if ( ! isset( $matches[3]) ) $matches[3] = false;//ATTENTION : ajout de cette ligne |
$newIndentType = $matches[3]; |
if (!$newIndentType) { $opener = "<div class=\"indent\">"; $closer = "</div>"; $br = 1; } |
else if ($newIndentType == "-") { $opener = "<ul>\n"; $closer = "</li>\n</ul>"; $li = 1; } |
else { |
if ( ! isset( $matches[4]) ) $matches[4] = '';//ATTENTION : ajout de cette ligne |
$opener = "<ol type=\"".$matches[4]."\">\n"; $closer = "</li>\n</ol>"; $li = 1; |
} |
// get new indent level |
if (strpos($matches[1],"\t")) $newIndentLevel = strlen($matches[1]); |
else |
{ |
$newIndentLevel=$oldIndentLevel; |
$newIndentLength = strlen($matches[1]); |
if ($newIndentLength>$oldIndentLength) |
{ |
$newIndentLevel++; |
$newIndentSpace[$newIndentLength]=$newIndentLevel; |
} |
else if ($newIndentLength<$oldIndentLength) |
if ( ! isset( $newIndentSpace[$newIndentLength] ) ) $newIndentSpace[$newIndentLength] = 0;//ATTENTION : ajout de cette ligne |
$newIndentLevel=$newIndentSpace[$newIndentLength]; |
} |
$op=0; |
if ($newIndentLevel > $oldIndentLevel) |
{ |
for ($i = 0; $i < $newIndentLevel - $oldIndentLevel; $i++) |
{ |
$result .= $opener; |
$op=1; |
array_push($indentClosers, $closer); |
} |
} |
else if ($newIndentLevel < $oldIndentLevel) |
{ |
for ($i = 0; $i < $oldIndentLevel - $newIndentLevel; $i++) |
{ |
$op=1; |
$result .= array_pop($indentClosers); |
if ($oldIndentLevel && isset($li)) $result .= "</li>";//ATTENTION : ajout de isset($li) à la place de$li |
} |
} |
if (isset($li) && $op) $result .= "<li>"; |
else if (isset($li)) |
$result .= "</li>\n<li>"; |
$oldIndentLevel = $newIndentLevel; |
$oldIndentLength= $newIndentLength; |
return $result; |
} |
// new lines |
else if ($thing == "\n") |
{ |
// if we got here, there was no tab in the next line; this means that we can close all open indents. |
$c = count($indentClosers); |
for ($i = 0; $i < $c; $i++) |
{ |
$result .= array_pop($indentClosers); |
$br = 0; |
} |
$oldIndentLevel = 0; |
$oldIndentLength= 0; |
$newIndentSpace=array(); |
$result .= ($br ? "<br />\n" : "\n"); |
$br = 1; |
return $result; |
} |
// events |
else if (preg_match("/^\{\{(.*?)\}\}$/s", $thing, $matches)) |
{ |
if ($matches[1]) |
return $wiki->Action($matches[1]); |
else |
return "{{}}"; |
} |
// interwiki links! |
else if (preg_match("/^[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)$/s", $thing)) |
{ |
return $wiki->Link($thing); |
} |
// wiki links! |
else if (preg_match("/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/s", $thing)) |
{ |
return $wiki->Link($thing); |
} |
// if we reach this point, it must have been an accident. |
return $thing; |
} |
} |
$text = str_replace("\r", "", $text); |
$text = trim($text)."\n"; |
$text = preg_replace_callback( |
"/(\%\%.*?\%\%|". |
"\"\".*?\"\"|". |
"\[\[.*?\]\]|". |
"\b[a-z]+:\/\/\S+|". |
"\*\*|\#\#|@@|££|__|<|>|\/\/|". |
"======|=====|====|===|==|". |
"-{4,}|---|". |
"\n(\t+|([ ]{1})+)(-|[0-9,a-z,A-Z]+\))?|". |
"\{\{.*?\}\}|". |
"\b[A-Z][A-Z,a-z]+[:]([A-Z,a-z,0-9]*)\b|". |
"\b([A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*)\b|". |
"\n)/ms", "wakka2callback", $text); |
// we're cutting the last <br /> |
$text = preg_replace("/<br \/>$/","", trim($text)); |
print($text); |
?> |
/trunk/client/integrateur_wikini/bibliotheque/wikini/interwiki.conf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/client/integrateur_wikini/bibliotheque/wikini/interwiki.conf |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/client/integrateur_wikini/bibliotheque/wikini/README |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/client/integrateur_wikini/bibliotheque/wikini/README |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/client/integrateur_wikini/bibliotheque/iw_encodage.fonct.php |
---|
New file |
0,0 → 1,81 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.3 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of eFlore-Chorologie. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: iw_encodage.fonct.php,v 1.1 2005-08-18 10:20:09 ddelon Exp $ |
/** |
* Fonctions manipulant les encodages |
* |
* Fichiers contenant des fonctions manipulant l'encodage. |
* |
*@package IntegrateurWikini |
*@subpackage Fonctions |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2005 |
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:09 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | LISTE DES FONCTIONS | |
// +------------------------------------------------------------------------------------------------------+ |
/** |
* La fonction remplacerEntiteHTLM() remplace des caractères par les entités html. |
* |
* Cette fonction retourne un texte dans lequel touts les caractères correspondant |
* à des entités html sont remplacés par la valeur de l'entité, à l'exception |
* des caractères <, >, & et ". |
* Cela permet de remplacer toutes les entités dans une chaine contenant du html. |
* |
*@param string la chaîne html à parsser. |
*@return string contient la chaîne html avec les entités intégrées. |
*/ |
function remplacerEntiteHTLM($texte) |
{ |
$texte_retour = ''; |
$tab_entites = get_html_translation_table(HTML_ENTITIES); |
unset($tab_entites['"']); |
unset($tab_entites['<']); |
unset($tab_entites['>']); |
unset($tab_entites['&']); |
$tab_entites[' & '] = ' & '; |
return strtr($texte, $tab_entites); |
} |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.2 2005/05/19 15:11:49 jpm |
* Ajout du remplacement des & par des & |
* |
* Revision 1.1 2005/03/02 17:47:05 jpm |
* Ajout des fichiers necessaires à l'intégrateur de wikini. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
/trunk/client/integrateur_wikini/langues/iw_langue_fr.inc.php |
---|
New file |
0,0 → 1,63 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Integrateur Wikini. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: iw_langue_fr.inc.php,v 1.1 2005-08-18 10:20:01 ddelon Exp $ |
/** |
* Traduction de l'intégrateur de page Wikini : fr |
* |
* Fichier de traduction en français de l'intégrateur de page Wikini. |
* |
*@package IntegrateurWikini |
*@subpackage Traduction |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.1 $ $Date: 2005-08-18 10:20:01 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// | PIED du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |