Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/wikini/actions/pageindex.php
New file
0,0 → 1,54
<?php
/*
pageindex.php
Copyright (c) 2003, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
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) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
 
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
}
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
 
?>
/trunk/wikini/actions/attach.php
New file
0,0 → 1,121
<?php
/*
attach.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************************************************
* DOCUMENTATION
*******************************************************************************
RESUME
L'action {{attach}} permet de lier un fichier à une page, d'uploader ce fichier
et de downloader ce fichier. Si le fichier est une image, elle est affichée
dans la page. Lorsque le fichier est sur le serveur, il est possible de faire
une mise à jour de celui-ci.
 
PARAMETRES DE L'ACTION
L'action {{attach}} prend les paramètres suivants :
- file ou attachfile: nom du fichier tel qu'il sera sur le serveur. Les
espaces sont remplacé par des "_". (OBLIGATOIRE)
- desc ou attachdesc: description du fichier. C'est le texte qui sera affiché
comme lien vers le fichier ou dans l'attribut alt de la balise <img>. Ce
paramètre est obligatoire pour les images pour être conforme au XHTML.
- delete ou attachdelete: Si ce paramètre est non vide alors le fichier sera
effacé sur le serveur.
- link ou attachlink: URL de lien pour une image sensible. le lien peut être
un nom de page WikiNi, un lien interwiki ou une adresse http
- class: indique le nom de la ou les classes de style à utiliser pour afficher
l'image. les noms des classes sont séparés par un espace.
 
EXEMPLES
- Attacher un fichier archive:
{{attach file="archive.zip"}}
- Attacher un fichier archive avec une description
{{attach file="archive.zip" desc="Code source de l'application"}}
- Supprimer un fichier:
{{attach file="archive.zip" delete="y"}}
- Afficher une image:
{{attach file="image.png" desc="voici une image"}}
- Afficher une image sensible:
{{attach file="image.png" desc="voici une image" link="PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="WikiNi:PagePrincipale"}}
{{attach file="image.png" desc="voici une image" link="http://www.wikini.net"}}
- Afficher une image collé sur le bord droit et sans contour:
{{attach file="image.png" desc="voici une image" class="right noborder"}}
 
INSTALLATION
1) Copiez le fichier attach.php dans le répertoire des actions (/actions)
2) Copiez le fichier attach.class.php dans le répertoire des actions (/actions)
3) Copiez le fichier attachfm.php dans le repertoire des actions (/actions)
4) Copiez le fichier filamanager.php dans le répertoire des handlers (/handlers/page)
5) Copiez le fichier upload.php dans le répertoire des handlers (/handlers/page)
6) Copiez le fichier download.php dans le répertoire des handlers (/handlers/page)
7) Créez le répertoire racine des uploads sur le site du wiki. Si le SAFE_MODE
de PHP est activé, vous devez créer vous même ce répertoire et autoriser
l'écriture dans ce répertoire pour l'utilisateur et le groupe.
8) Ouvrez le fichier wakka.config.php et ajoutez la configuration de l'action.
Tous les paramètres de configuration ont une valeur par défaut.
Le configuration par défaut est:
 
$wakkaConfig["attach_config"] = array(
"upload_path" => 'files', //repertoire racine des uploads
"ext_images" => 'gif|jpeg|png|jpg', //extension des fichiers images
"ext_script" => 'php|php3|asp|asx|vb|vbs|js', //extension des script(non utilisé)
"update_symbole" => '*', //symbole pour faire un update du fichier
"max_file_size" => 1024*100, //taille maximum du fichier en octer (100Ko par défaut)
"fmDelete_symbole" => 'Supr', //symbole a afficher pour le lien "supprimer" dans le gestionnaire de fichier
"fmRestore_symbole" => 'Rest', //symbole a afficher pour le lien "restaurer" dans le gestionnaire de fichier
"fmTrash_symbole" => 'Poubelle') //symbole a afficher pour le lien "Poubelle" dans le gestionnaire de fichier
 
9) Ajoutez les classes de style au fichier wakka.css. Exemple de style :
.attach_margin05em { margin: 0.5em;}
.attach_margin1em { margin: 1em;}
.attach_left {float: left;}
.attach_right {float: right;}
.attach_noborder {border-width: 0px;}
.attach_vmiddle {vertical-align: text-bottom;}
 
10)Pour configurer l'aspect du gestionnnaire de fichier utiliser les classes de style .tableFM
tableFMCol1 et tableFMCol2
Exemple :
.tableFM {border: thin solid Black; width: 100%; }
.tableFM THEAD { background-color: Silver; font-weight: bold; text-align: center; }
.tableFM TFOOT { background-color: Silver; font-weight: bold; text-align: left; }
.tableFM TBODY TR { text-align: center; }
.tableFMCol1 { background-color: Aqua; }
.tableFMCol2 { background-color: Yellow; }
*******************************************************************************/
 
if (!class_exists('attach')){
include($this->GetConfigValue('action_path').'/attach.class.php');
}
$att = new attach($this);
$att->doAttach();
unset($att);
?>
/trunk/wikini/actions/mypages.php
New file
0,0 → 1,78
<?php
 
// actions/mypages.php
// written by Carlo Zottmann
// http://wakkawikki.com/CarloZottmann
/*
mypages.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Jean Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($user = $this->GetUser())
{
echo "<b>Liste des pages dont vous &ecirc;tes le propri&eacute;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) echo "<br />\n" ;
echo "<b>$firstChar</b><br />\n" ;
$curChar = $firstChar;
}
echo $this->ComposeLinkToPage($page["tag"]),"<br />\n" ;
$my_pages_count++;
}
}
if ($my_pages_count == 0)
{
echo "<i>Vous n'&ecirc;tes le propri&eacute;taire d'aucune page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>" ;
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>" ;
}
 
?>
/trunk/wikini/actions/resetpassword.php
New file
0,0 → 1,80
<?php
/*
resetpassword.php
 
Copyright 2003 Patrick PAUL
Copyright 2003 David DELON
Copyright 2004 David VANTYGHEM
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
 
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&eacute;initialis&eacute; !");
$this->Redirect($this->href());
}
else
{
$error="";
//$error = "Il est interdit de r&eacute;initialiser le mot de passe de cet utilisateur ! Non mais !";
}
echo $this->FormOpen() ;
$name=$_GET["name"];
?>
<input type="hidden" name="action" value="resetpass">
<table>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("R&eacute;initialisation du mot de passe"); ?></td>
</tr>
<?php
if ($error)
{
echo "<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
echo $this->FormClose() ;
}
else
{
echo "<i>Vous n'avez pas les permissions n&eacute;cessaires pour ex&eacute;cuter cette action.</i>" ;
}
 
?>
/trunk/wikini/actions/listuserscommon.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["common_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["common_table_prefix"]."users order by name asc")
)
{
foreach($last_users as $user)
{
print($this->Format($user["name"])." . . . ".$user["signuptime"]."<br />\n");
}
}
}
 
?>
/trunk/wikini/actions/changestyle.php
New file
0,0 → 1,67
<?php
 
// Action changesstyle.php version 0.2 du 16/03/2004
// pour WikiNi 0.4.1rc (=> à la version du 200403xx) et supérieurs
// Par Charles Népote (c) 2004
// Licence GPL
 
 
// Fonctionnement
//
// Cette action regroupe la fonction de changement de style ainsi que l'interface
// de modification du style.
// Une fois le style sélectionné via l'interface, la requête est envoyée sous la forme :
// http://example.org/PageTest&set="NomDeFeuilleDeStyle"
// . si ce nom n'est pas constitué uniquement de caractères alphanumériques,
// une erreur est retournée
// . si ce nom est valide et que la feuille de style existe :
// . on change le cookie utilisateur
// . on redirrige l'utilisateur vers http://example.org/PageTest où
// l'utilisateur peut alors constater le changement de style
 
 
// Usage :
//
// -- {{changestyle link="xxx.css"}}
// donne le lien suivant :
// Feuille de style xxx.css
//
// -- {{changestyle link="xxx.css" title="Ouragan"}}
// donne le lien suivant :
// Ouragan
 
 
// A compléter (peut-être un jour) :
//
// -- {{changestyle}}
// donne un formulaire :
// Entrer l'adresse de la feuille de style désirée : [ ]
//
// -- {{changestyle choice="zzz.css;ttt.css"}}
// [] Feuille de style zzz
// [] Feuille de style ttt
 
 
$set = $_GET["set"];
 
 
if ($this->GetParameter(link))
{
echo "<a href=\"".$this->href()."&set=".$this->GetParameter(link)."\">";
echo (!$this->GetParameter(title))?"Feuille de style ".$this->GetParameter(link):$this->GetParameter(title);
echo "</a>";
}
 
 
// Do it.
if (preg_match("/^[A-Za-z0-9][A-Za-z0-9]+$/", $set))
{
$this->SetPersistentCookie('sitestyle',$set,1);
header("Location: ".$this->href());
}
else if ($set)
{
$this->SetMessage("La feuille de style ".$set." est non valide !");
header("Location: ".$this->href());
}
?>
/trunk/wikini/actions/attach.class.php
New file
0,0 → 1,625
<?php
/*
attach.class.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
# Classe de gestion de l'action {{attach}}
# voir actions/attach.php ppour la documentation
# copyrigth Eric Feldstein 2003-2004
 
class attach {
var $wiki = ''; //objet wiki courant
var $attachConfig = array(); //configuration de l'action
var $file = ''; //nom du fichier
var $desc = ''; //description du fichier
var $link = ''; //url de lien (image sensible)
var $isPicture = 0; //indique si c'est une image
var $classes = ''; //classe pour afficher une image
var $attachErr = ''; //message d'erreur
var $pageId = 0; //identifiant de la page
var $isSafeMode = false; //indicateur du safe mode de PHP
/**
* Constructeur. Met les valeurs par defaut aux paramètres de configuration
*/
function attach(&$wiki){
$this->wiki = $wiki;
$this->attachConfig = $this->wiki->GetConfigValue("attach_config");
if (empty($this->attachConfig["ext_images"])) $this->attachConfig["ext_images"] = "gif|jpeg|png|jpg";
if (empty($this->attachConfig["ext_script"])) $this->attachConfig["ext_script"] = "php|php3|asp|asx|vb|vbs|js";
if (empty($this->attachConfig['upload_path'])) $this->attachConfig['upload_path'] = 'files';
if (empty($this->attachConfig['update_symbole'])) $this->attachConfig['update_symbole'] = '*';
if (empty($this->attachConfig['max_file_size'])) $this->attachConfig['max_file_size'] = 1024*100; //100ko max
if (empty($this->attachConfig['fmDelete_symbole'])) $this->attachConfig['fmDelete_symbole'] = 'Supr';
if (empty($this->attachConfig['fmRestore_symbole'])) $this->attachConfig['fmRestore_symbole'] = 'Rest';
if (empty($this->attachConfig['fmTrash_symbole'])) $this->attachConfig['fmTrash_symbole'] = 'Poubelle';
$this->isSafeMode = ini_get("safe_mode");
}
/******************************************************************************
* FONCTIONS UTILES
*******************************************************************************/
/**
* Création d'une suite de répertoires récursivement
*/
function mkdir_recursif ($dir) {
if (strlen($dir) == 0) return 0;
if (is_dir($dir)) return 1;
elseif (dirname($dir) == $dir) return 1;
return ($this->mkdir_recursif(dirname($dir)) and mkdir($dir,0755));
}
/**
* Renvois le chemin du script
*/
function GetScriptPath () {
if (preg_match("/.(php)$/i",$_SERVER["PHP_SELF"])){
$a = explode('/',$_SERVER["PHP_SELF"]);
$a[count($a)-1] = '';
$path = implode('/',$a);
}else{
$path = $_SERVER["PHP_SELF"];
}
return !empty($_SERVER["HTTP_HOST"])? 'http://'.$_SERVER["HTTP_HOST"].$path : 'http://'.$_SERVER["SERVER_NAME"].$path ;
}
/**
* Calcul le repertoire d'upload en fonction du safe_mode
*/
function GetUploadPath(){
if ($this->isSafeMode) {
$path = $this->attachConfig['upload_path'];
}else{
$path = $this->attachConfig['upload_path'].'/'.$this->wiki->GetPageTag();
if (! is_dir($path)) $this->mkdir_recursif($path);
}
return $path;
}
/**
* Calcule le nom complet du fichier attaché en fonction du safe_mode, du nom et de la date de
* revision la page courante.
* Le nom du fichier "mon fichier.ext" attache à la page "LaPageWiki"sera :
* mon_fichier_datepage_update.ext
* update : date de derniere mise a jour du fichier
* datepage : date de revision de la page à laquelle le fichier a ete lié/mis a jour
* Si le fichier n'est pas une image un '_' est ajoute : mon_fichier_datepage_update.ext_
* Selon la valeur de safe_mode :
* safe_mode = on : LaPageWiki_mon_fichier_datepage_update.ext_
* safe_mode = off: LaPageWiki/mon_fichier_datepage_update.ext_ avec "LaPageWiki" un sous-repertoire du répertoire upload
*/
function GetFullFilename($newName = false){
$pagedate = $this->convertDate($this->wiki->page['time']);
//decompose le nom du fichier en nom+extension
if (preg_match('`^(.*)\.(.*)$`', str_replace(' ','_',$this->file), $match)){
list(,$file['name'],$file['ext'])=$match;
if(!$this->isPicture()) $file['ext'] .= '_';
}else{
return false;
}
//recuperation du chemin d'upload
$path = $this->GetUploadPath($this->isSafeMode);
//generation du nom ou recherche de fichier ?
if ($newName){
$full_file_name = $file['name'].'_'.$pagedate.'_'.$this->getDate().'.'.$file['ext'];
if($this->isSafeMode){
$full_file_name = $path.'/'.$this->wiki->GetPageTag().'_'.$full_file_name;
}else{
$full_file_name = $path.'/'.$full_file_name;
}
}else{
//recherche du fichier
if($this->isSafeMode){
//TODO Recherche dans le cas ou safe_mode=on
$searchPattern = '`^'.$this->wiki->GetPageTag().'_'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}else{
$searchPattern = '`^'.$file['name'].'_\d{14}_\d{14}\.'.$file['ext'].'$`';
}
$files = $this->searchFiles($searchPattern,$path);
 
$unedate = 0;
foreach ($files as $file){
//recherche du fichier qui une datepage <= a la date de la page
if($file['datepage']<=$pagedate){
//puis qui a une dateupload la plus grande
if ($file['dateupload']>$unedate){
$theFile = $file;
$unedate = $file['dateupload'];
}
}
}
if (is_array($theFile)){
$full_file_name = $path.'/'.$theFile['realname'];
}
}
return $full_file_name;
}
/**
* Test si le fichier est une image
*/
function isPicture(){
return preg_match("/.(".$this->attachConfig["ext_images"].")$/i",$this->file)==1;
}
/**
* Renvoie la date courante au format utilise par les fichiers
*/
function getDate(){
return date('YmdHis');
}
/**
* convertie une date yyyy-mm-dd hh:mm:ss au format yyyymmddhhmmss
*/
function convertDate($date){
$date = str_replace(' ','', $date);
$date = str_replace(':','', $date);
return str_replace('-','', $date);
}
/**
* Parse une date au format yyyymmddhhmmss et renvoie un tableau assiatif
*/
function parseDate($sDate){
$pattern = '`^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$`';
$res = '';
if (preg_match($pattern, $sDate, $m)){
//list(,$res['year'],$res['month'],$res['day'],$res['hour'],$res['min'],$res['sec'])=$m;
$res = $m[1].'-'.$m[2].'-'.$m[3].' '.$m[4].':'.$m[5].':'.$m[6];
}
return ($res?$res:false);
}
/**
* Decode un nom long de fichier
*/
function decodeLongFilename($filename){
$afile = array();
$afile['realname'] = basename($filename);
$afile['size'] = filesize($filename);
$afile['path'] = dirname($filename);
if(preg_match('`^(.*)_(\d{14})_(\d{14})\.(.*)(trash\d{14})?$`', $afile['realname'], $m)){
$afile['name'] = $m[1];
//suppression du nom de la page si safe_mode=on
if ($this->isSafeMode){
$afile['name'] = preg_replace('`^('.$this->wiki->tag.')_(.*)$`i', '$2', $afile['name']);
}
$afile['datepage'] = $m[2];
$afile['dateupload'] = $m[3];
$afile['trashdate'] = preg_replace('`(.*)trash(\d{14})`', '$2', $m[4]);
//suppression de trashxxxxxxxxxxxxxx eventuel
$afile['ext'] = preg_replace('`^(.*)(trash\d{14})$`', '$1', $m[4]);
$afile['ext'] = rtrim($afile['ext'],'_');
//$afile['ext'] = rtrim($m[4],'_');
}
return $afile;
}
/**
* Renvois un tableau des fichiers correspondant au pattern. Chaque element du tableau est un
* tableau associatif contenant les informations sur le fichier
*/
function searchFiles($filepattern,$start_dir){
$files_matched = array();
$start_dir = rtrim($start_dir,'\/');
$fh = opendir($start_dir);
while (($file = readdir($fh)) !== false) {
if (strcmp($file, '.')==0 || strcmp($file, '..')==0 || is_dir($file)) continue;
if (preg_match($filepattern, $file)){
$files_matched[] = $this->decodeLongFilename($start_dir.'/'.$file);
}
}
return $files_matched;
}
/******************************************************************************
* FONCTIONS D'ATTACHEMENTS
*******************************************************************************/
/**
* Test les paramètres passé à l'action
*/
function CheckParams(){
//recuperation des parametres necessaire
$this->file = $this->wiki->GetParameter("attachfile");
if (empty($this->file)) $this->file = $this->wiki->GetParameter("file");
$this->desc = $this->wiki->GetParameter("attachdesc");
if (empty($this->desc)) $this->desc = $this->wiki->GetParameter("desc");
$this->link = $this->wiki->GetParameter("attachlink");//url de lien - uniquement si c'est une image
if (empty($this->link)) $this->link = $this->wiki->GetParameter("link");
//test de validité des parametres
if (empty($this->file)){
$this->attachErr = $this->wiki->Format("//action attach : paramètre **file** manquant//---");
}
if ($this->isPicture() && empty($this->desc)){
$this->attachErr .= $this->wiki->Format("//action attach : paramètre **desc** obligatoire pour une image//---");
}
if ($this->wiki->GetParameter("class")) {
$array_classes = explode(" ", $this->wiki->GetParameter("class"));
foreach ($array_classes as $c) { $this->classes = $this->classes . "attach_" . $c . " "; }
$this->classes = trim($this->classes);
}
}
/**
* Affiche le fichier lié comme une image
*/
function showAsImage($fullFilename){
//c'est une image : balise <IMG..../>
$img = "<img src=\"".$this->GetScriptPath().$fullFilename."\" ".
"alt=\"".$this->desc.($this->link?"\nLien vers: $this->link":"")."\" />";
//test si c'est une image sensible
if(!empty($this->link)){
//c'est une image sensible
//test si le lien est un lien interwiki
if (preg_match("/^([A-Z][A-Z,a-z]+)[:]([A-Z,a-z,0-9]*)$/s", $this->link, $matches))
{ //modifie $link pour être un lien vers un autre wiki
$this->link = $this->wiki->GetInterWikiUrl($matches[1], $matches[2]);
}
//calcule du lien
$output = $this->wiki->Format('[['.$this->link." $this->file]]");
$output = eregi_replace(">$this->file<",">$img<",$output);//insertion du tag <img...> dans le lien
}else{
//ce n'est pas une image sensible
$output = $img;
}
$output = ($this->classes?"<span class=\"$this->classes\">$output</span>":$output);
echo $output;
$this->showUpdateLink();
}
/**
* Affiche le fichier lié comme un lien
*/
function showAsLink($fullFilename){
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=$this->file");
echo '<a href="'.$url.'">'.($this->desc?$this->desc:$this->file)."</a>";
$this->showUpdateLink();
}
/**
* Affiche le lien de mise à jour
*/
function showUpdateLink(){
echo " <a href=\"".
$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file").
"\" title='Mise à jour'>".$this->attachConfig['update_symbole']."</a>";
}
/**
* Affiche un liens comme un fichier inexistant
*/
function showFileNotExits(){
echo $this->file."<a href=\"".$this->wiki->href("upload",$this->wiki->GetPageTag(),"file=$this->file")."\">?</a>";
}
/**
* Affiche l'attachement
*/
function doAttach(){
$this->CheckParams();
if ($this->attachErr) {
echo $this->attachErr;
return;
}
$fullFilename = $this->GetFullFilename();
//test d'existance du fichier
if((!file_exists($fullFilename))||($fullFilename=='')){
$this->showFileNotExits();
return;
}
//le fichier existe : affichage en fonction du type
if($this->isPicture()){
$this->showAsImage($fullFilename);
}else{
$this->showAsLink($fullFilename);
}
}
/******************************************************************************
* FONTIONS D'UPLOAD DE FICHIERS
*******************************************************************************/
/**
* Traitement des uploads
*/
function doUpload(){
$HasAccessWrite=$this->wiki->HasAccess("write");
if ($HasAccessWrite){
switch ($_SERVER["REQUEST_METHOD"]) {
case 'GET' : $this->showUploadForm(); break;
case 'POST': $this->performUpload(); break;
default : echo $this->wiki->Format("//Methode de requete invalide//---");
}
}else{
echo $this->wiki->Format("//Vous n'avez pas l'accès en écriture à cette page//---");
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
}
/**
* Formulaire d'upload
*/
function showUploadForm(){
echo $this->wiki->Format("====Formulaire d'envois de fichier====\n---");
$this->file = $_GET['file'];
echo $this->wiki->Format("**Envois du fichier $this->file :**\n")
."<form enctype=\"multipart/form-data\" name=\"frmUpload\" method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\">\n"
." <input type=\"hidden\" name=\"wiki\" value=\"".$this->wiki->GetPageTag()."/upload\" />\n"
." <input TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$this->attachConfig['max_file_size']."\" />\n"
." <input type=\"hidden\" name=\"file\" value=\"$this->file\" />\n"
." <input type=\"file\" name=\"upFile\" size=\"50\" /><br />\n"
." <input type=\"submit\" value=\"Envoyer\" />\n"
."</form>\n";
}
/**
* Execute l'upload
*/
function performUpload(){
$this->file = $_POST['file'];
 
$destFile = $this->GetFullFilename(true); //nom du fichier destination
//test de la taille du fichier recu
if($_FILES['upFile']['error']==0){
$size = filesize($_FILES['upFile']['tmp_name']);
if ($size > $this->attachConfig['max_file_size']){
$_FILES['upFile']['error']=2;
}
}
switch ($_FILES['upFile']['error']){
case 0:
$srcFile = $_FILES['upFile']['tmp_name'];
if (move_uploaded_file($srcFile,$destFile)){
chmod($destFile,0644);
header("Location: ".$this->wiki->href("",$this->wiki->GetPageTag(),""));
}else{
echo $this->wiki->Format("//Erreur lors du déplacement du fichier temporaire//---");
}
break;
case 1:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de upload_max_filesize, configuré dans le php.ini.//---");
break;
case 2:
echo $this->wiki->Format("//Le fichier téléchargé excède la taille de MAX_FILE_SIZE, qui a été spécifiée dans le formulaire HTML.//---");
break;
case 3:
echo $this->wiki->Format("//Le fichier n'a été que partiellement téléchargé.//---");
break;
case 4:
echo $this->wiki->Format("//Aucun fichier n'a été téléchargé.//---");
break;
}
echo $this->wiki->Format("Retour à la page ".$this->wiki->GetPageTag());
}
/******************************************************************************
* FUNCTIONS DE DOWNLOAD DE FICHIERS
*******************************************************************************/
function doDownload(){
$this->file = $_GET['file'];
$fullFilename = $this->GetUploadPath().'/'.$this->file;
if(!file_exists($fullFilename)){
$fullFilename = $this->GetFullFilename();
$dlFilename = $this->file;
$size = filesize($fullFilename);
}else{
$file = $this->decodeLongFilename($fullFilename);
$size = $file['size'];
$dlFilename =$file['name'].'.'.$file['ext'];
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/force-download");
header('Pragma: public');
header("Pragma: no-cache");// HTTP/1.0
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octet-stream; name="' . $dlFilename . '"'); //This should work for the rest
header('Content-Type: application/octetstream; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Type: application/download; name="' . $dlFilename . '"'); //This should work for IE & Opera
header('Content-Disposition: attachment; filename="'.$dlFilename.'"');
header("Content-Description: File Transfer");
header("Content-length: $size".'bytes');
readfile($fullFilename);
}
/******************************************************************************
* FONTIONS DU FILEMANAGER
*******************************************************************************/
function doFileManager(){
$do = $_GET['do']?$_GET['do']:'';
switch ($do){
case 'restore' :
$this->fmRestore();
$this->fmShow(true);
break;
case 'erase' :
$this->fmErase();
$this->fmShow(true);
break;
case 'del' :
$this->fmDelete();
$this->fmShow();
break;
case 'trash' :
$this->fmShow(true); break;
case 'emptytrash' :
$this->fmEmptyTrash(); //pas de break car apres un emptytrash => retour au gestionnaire
default :
$this->fmShow();
}
}
/**
* Affiche la liste des fichiers
*/
function fmShow($trash=false){
$fmTitlePage = $this->wiki->Format("====Gestion des fichiers attachés à la page ".$this->wiki->tag."====\n---");
if($trash){
//Avertissement
$fmTitlePage .= '<div class="prev_alert">Les fichiers effacés sur cette page le sont définitivement</div>';
//Pied du tableau
$url = $this->wiki->Link($this->wiki->tag,'filemanager','Gestion des fichiers');
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n";
$url = $this->wiki->Link($this->wiki->tag,'filemanager&do=emptytrash','Vider la poubelle');
$fmFootTable.= ' <td>'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}else{
//pied du tableau
$url = '<a href="'.$this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=trash').'" title="Poubelle">'.$this->attachConfig['fmTrash_symbole']."</a>";
$fmFootTable = ' <tfoot>'."\n".
' <tr>'."\n".
' <td colspan="6">'.$url.'</td>'."\n".
' </tr>'."\n".
' </tfoot>'."\n";
}
//entete du tableau
$fmHeadTable = ' <thead>'."\n".
' <tr>'."\n".
' <td>&nbsp;</td>'."\n".
' <td>Nom du fichier</td>'."\n".
' <td>Nom réel du fichier</td>'."\n".
' <td>Taille</td>'."\n".
' <td>Révision de la page</td>'."\n".
' <td>Révison du fichier</td>'."\n";
if($trash){
$fmHeadTable.= ' <td>Suppression</td>'."\n";
}
$fmHeadTable.= ' </tr>'."\n".
' </thead>'."\n";
//corps du tableau
$files = $this->fmGetFiles($trash);
$files = $this->sortByNameRevFile($files);
 
$fmBodyTable = ' <tbody>'."\n";
$i = 0;
foreach ($files as $file){
$i++;
$color= ($i%2?"tableFMCol1":"tableFMCol2");
//lien de suppression
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=erase&file='.$file['realname']);
}else{
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=del&file='.$file['realname']);
}
$dellink = '<a href="'.$url.'" title="Supprimer">'.$this->attachConfig['fmDelete_symbole']."</a>";
//lien de restauration
$restlink = '';
if ($trash){
$url = $this->wiki->href('filemanager',$this->wiki->GetPageTag(),'do=restore&file='.$file['realname']);
$restlink = '<a href="'.$url.'" title="Restaurer">'.$this->attachConfig['fmRestore_symbole']."</a>";
}
 
//lien pour downloader le fichier
$url = $this->wiki->href("download",$this->wiki->GetPageTag(),"file=".$file['realname']);
$dlLink = '<a href="'.$url.'">'.$file['name'].'.'.$file['ext']."</a>";
$fmBodyTable .= ' <tr class="'.$color.'">'."\n".
' <td>'.$dellink.' '.$restlink.'</td>'."\n".
' <td>'.$dlLink.'</td>'."\n".
' <td>'.$file['realname'].'</td>'."\n".
' <td>'.$file['size'].'</td>'."\n".
' <td>'.$this->parseDate($file['datepage']).'</td>'."\n".
' <td>'.$this->parseDate($file['dateupload']).'</td>'."\n";
if($trash){
$fmBodyTable.= ' <td>'.$this->parseDate($file['trashdate']).'</td>'."\n";
}
$fmBodyTable .= ' </tr>'."\n";
}
$fmBodyTable .= ' </tbody>'."\n";
//pied de la page
$fmFooterPage = "---\n-----\n[[".$this->wiki->tag." Retour à la page ".$this->wiki->tag."]]\n";
//affichage
echo $fmTitlePage."\n";
echo '<table class="tableFM" border="0" cellspacing="0">'."\n".$fmHeadTable.$fmFootTable.$fmBodyTable.'</table>'."\n";
echo $this->wiki->Format($fmFooterPage);
}
/**
* Renvoie la liste des fichiers
*/
function fmGetFiles($trash=false){
$path = $this->GetUploadPath();
if($this->isSafeMode){
$filePattern = '^'.$this->wiki->GetPageTag().'_.*_\d{14}_\d{14}\..*';
}else{
$filePattern = '^.*_\d{14}_\d{14}\..*';
}
if($trash){
$filePattern .= 'trash\d{14}';
}else{
$filePattern .= '[^(trash\d{14})]';
}
return $this->searchFiles('`'.$filePattern.'$`', $path);
}
/**
* Vide la poubelle
*/
function fmEmptyTrash(){
$files = $this->fmGetFiles(true);
foreach ($files as $file){
$filename = $file['path'].'/'.$file['realname'];
if(file_exists($filename)){
unlink($filename);
}
}
}
/**
* Effacement d'un fichier dans la poubelle
*/
function fmErase(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
unlink($filename);
}
}
/**
* Met le fichier a la poubelle
*/
function fmDelete(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$trash = $filename.'trash'.$this->getDate();
rename($filename, $trash);
}
}
/**
* Restauration d'un fichier mis a la poubelle
*/
function fmRestore(){
$path = $this->GetUploadPath();
$filename = $path.'/'.($_GET['file']?$_GET['file']:'');
if (file_exists($filename)){
$restFile = preg_replace('`^(.*\..*)trash\d{14}$`', '$1', $filename);
rename($filename, $restFile);
}
}
/**
* Tri tu tableau liste des fichiers par nom puis par date de revision(upload) du fichier, ordre croissant
*/
function sortByNameRevFile($files){
if (!function_exists('ByNameByRevFile')){
function ByNameByRevFile($f1,$f2){
$f1Name = $f1['name'].'.'.$f1['ext'];
$f2Name = $f2['name'].'.'.$f2['ext'];
$res = strcasecmp($f1Name, $f2Name);
if($res==0){
//si meme nom => compare la revision du fichier
$res = strcasecmp($f1['dateupload'], $f2['dateupload']);
}
return $res;
}
}
usort($files,'ByNameByRevFile');
return $files;
}
}
?>
/trunk/wikini/actions/usersettingscommon.php
New file
0,0 → 1,231
<?php
if (!function_exists("LoadUser"))
{
function LoadUser($name, $password = 0)
{
global $wiki;
return $wiki->LoadSingle("select * from ".$wiki->config["common_table_prefix"]."users where name = '".mysql_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_escape_string($password)."'")." limit 1");
}
}
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["common_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(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["common_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>&nbsp;</td>
<td>&nbsp;</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 = 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["common_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(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/wikini/actions/recentchanges.php
New file
0,0 → 1,76
<?php
 
/*
recentchanges.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// 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)
{
// echo entry
echo "(",$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) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$time,") (",$this->ComposeLinkToPage($page["tag"], "revisions", "historique", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($page["user"]),"<br />\n" ;
}
}
}
?>
/trunk/wikini/actions/textsearch.php
New file
0,0 → 1,106
<?php
/*
textsearch.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Patrick PAUL
Copyright 2004 Jean Christophe ANDRÉ
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
// label à afficher devant la zone de saisie
$label = $this->GetParameter('label', 'Ce que vous souhaitez chercher&nbsp;: ');
// largeur de la zone de saisie
$size = $this->GetParameter('size', '40');
// texte du bouton
$button = $this->GetParameter('button', 'Chercher');
// texte à chercher
$phrase = $this->GetParameter('phrase', false);
// séparateur entre les éléments trouvés
$separator = $this->GetParameter('separator', false);
 
// se souvenir si c'était un paramètre de l'action ou du CGI
$paramPhrase = $phrase;
// récupérer le paramètre du CGI le cas échéant
if (!isset($_REQUEST['phrase'])) $_REQUEST['phrase'] = '';
if (!$phrase) $phrase = $_REQUEST['phrase'];
 
// s'il y a un paramètre d'action "phrase", on affiche uniquement le résultat
// dans le cas contraire, présenter une zone de saisie
if (!$paramPhrase)
{
echo $this->FormOpen('', '', 'get');
if ($label)
{
echo $this->Format($label), ' ';
}
echo '<input name="phrase" size="', htmlspecialchars($size), '" value="', htmlentities($phrase), '" />';
if ($button)
{
echo '&nbsp;<input type="submit" value="', htmlspecialchars($button), '" />';
}
echo "\n", $this->FormClose();
}
 
if ($phrase)
{
if ($results = $this->FullTextSearch($phrase))
{
if ($separator)
{
$separator = htmlspecialchars($separator);
if (!$paramPhrase)
{
echo '<p>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;: ';
}
foreach ($results as $i => $page)
{
if ($i > 0) echo $separator;
echo $this->ComposeLinkToPage($page['tag']);
}
if (!$paramPhrase)
{
echo '</p>', "\n";
}
}
else
{
echo '<p><strong>R&eacute;sultat(s) de la recherche de "', htmlspecialchars($phrase), '"&nbsp;:</strong></p>', "\n",
'<ol>', "\n";
foreach ($results as $i => $page)
{
echo "<li>", $this->ComposeLinkToPage($page["tag"]), "</li>\n";
}
echo "</ol>\n";
}
}
else
{
if (!$paramPhrase)
{
echo "<p>Aucun r&eacute;sultat pour \"", htmlspecialchars($phrase), "\". :-(</p>";
}
}
}
?>
/trunk/wikini/actions/trail.php
New file
0,0 → 1,102
<?php
 
/*
trail.php : Permet d'afficher des liens "Page Suivante" "Sommaire" "Page Precedente" dans une page
 
Copyright 2003 Eric FELDSTEIN
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
/*
* Cette action permet de lier des pages entre elle via une page contenant la liste
* ordonnées de ces pages. L'action affiche des liens de navigation permettant de
* passer à la page suivante ou précédente ou de revenir au sommaire.
*
* @param toc string nom de la page contenant la liste ordonnée des pages à liées entre elles
*/
 
/* La page sommaire doit contenir une liste de pages. Le premier mot de chaque élément
de la liste doit être le nom d'une page du wiki, donc un mot wiki ou un lien force
exemple de page sommaire:
 
===Sommaire===
 
IntroductionAuProjet : présentation du projet.
[[AnalyseProjet Analyse]] : analyse des besoins
-BesoinDesUtilisateurs
-ContraintesTechniques
OutilsEtNormes
 
Texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte
texte texte texte texte texte texte texte texte texte texte texte texte
 
*/
 
//echo $this->Format("===Action Trail===");
$sommaire = $this->GetParameter("toc");
if (!$sommaire) {
echo $this->Format("//Indiquez le nom de la page sommaire, paramètre 'toc'//.");
}else{
//chargement de la page sommaire
$tocPage = $this->LoadPage($sommaire);
//analyse de la page sommaire pour récupérer la liste des pages
//recuperation de la liste
if (preg_match_all("/\n[\t ]+(.*)/",$tocPage["body"],$tocListe)){
//analyse de chaque ligne de la liste pour recupérer la page cible
$currentPageIndex = NULL;
foreach ($tocListe[1] as $line){
//suppression d'un signe de liste eventuel
$line = trim(preg_replace("/^([A-Za-z0-9]+\)|-)/","",$line));
//recuperation du 1er mot
$line = preg_replace("/^(\[\[.*\]\]|[A-Za-z0-9]+)\s*(.*)$/","$1",$line);
//ajout a la liste des pages si le 1er mot est un lien force ou un mot wiki
if (preg_match("/\[\[.*\]\]/",$line,$match)|$this->IsWikiName($line)){
$pages[] = $line;
//regarde si la page ajoute a la liste est la page courante
if (strcasecmp($this->GetPageTag(),$line)==0){
$currentPageIndex = count($pages)-1;
}else { //traite le cas des lien force
if (preg_match("/\[\[(.*:)?".$this->GetPageTag()."(\s.*)?\]\]$/",$line)) {
$currentPageIndex = count($pages)-1;
}
}
 
}
}//foreach
}
//ecriture des liens Page Précedente/sommaire/page suivante
if ($currentPageIndex>0) {
$PrevPage = $pages[$currentPageIndex-1];
$btnPrev = "<span class=\"trail_button\">".$this->Format("&lt;&lt; $PrevPage")."</span>";
}else{
$btnPrev = "&nbsp;";
}
$btnTOC = "<span class=\"trail_button\">".$this->Format($sommaire)."</span>";
if ($currentPageIndex < (count($pages)-1)){
$NextPage = $pages[$currentPageIndex+1];
$btnNext = "<span class=\"trail_button\">".$this->Format("$NextPage &gt;&gt;")."</span>";
}else{
$btnNext = "&nbsp;";
}
echo "<table class=\"trail_table\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35%\">$btnPrev</td>\n";
echo " <td align=\"center\">$btnTOC</td>\n";
echo " <td align=\"right\" width=\"35%\">$btnNext</td>\n";
echo " </tr>\n";
echo "</table>\n";
}
?>
/trunk/wikini/actions/findpage.php
New file
0,0 → 1,0
The unfinished FindPage action.
/trunk/wikini/actions/mychanges.php
New file
0,0 → 1,118
<?php
/*
mychanges.php
Copyright (c) 2003, Carlo Zottmann
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($user = $this->GetUser())
{
$my_edits_count = 0;
 
if (($bydate = $this->GetParameter("bydate")))
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par date de modification.</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"];
}
 
arsort($edited_pages);
 
foreach ($edited_pages as $page["tag"] => $page["time"])
{
// day header
list($day, $time) = explode(" ", $page["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n";
echo "<b>$day:</b><br />\n";
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;($time) (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
 
$my_edits_count++;
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
else
{
echo "<b>Liste des pages que vous avez modifi&eacute;es, tri&eacute;e par ordre alphab&eacute;tique.</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) echo "<br />\n";
echo "<b>$firstChar</b><br />\n";
$curChar = $firstChar;
}
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$page["time"],") (",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",$this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n";
$my_edits_count++;
}
}
if ($my_edits_count == 0)
{
echo "<i>Vous n'avez pas modifi&eacute; de page.</i>";
}
}
else
{
echo "<i>Aucune page trouv&eacute;e.</i>";
}
}
}
else
{
echo "<i>Vous n'&ecirc;tes pas identifi&eacute; : impossible d'afficher la liste des pages que vous avez modifi&eacute;es.</i>";
}
 
?>
/trunk/wikini/actions/test.php
New file
0,0 → 1,0
I'm a test!
/trunk/wikini/actions/orphanedpages.php
New file
0,0 → 1,35
<?php
/*
orphanedpages.php
 
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
if ($pages = $this->LoadOrphanedPages())
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"], "", "", 0),"<br />\n" ;
}
}
else
{
echo "<i>Pas de pages orphelines</i>" ;
}
 
?>
/trunk/wikini/actions/recentlycommented.php
New file
0,0 → 1,76
<?php
/*
recentlycommented.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Which is the max number of pages to be shown ?
if ($max = $this->GetParameter("max"))
{
if ($max=="last") $max=50; else $last = (int) $max;
}
else
{
$max = 50;
}
 
// Show recently commented pages
if ($pages = $this->LoadRecentlyCommented($max))
{
if ($this->GetParameter("max"))
{
foreach ($pages as $page)
{
// echo entry
echo "(",$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
{
$curday='';
foreach ($pages as $page)
{
// day header
list($day, $time) = explode(" ", $page["comment_time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day&nbsp;:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$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
{
echo "<i>Aucune page n'a &eacute;t&eacute; comment&eacute;e r&eacute;cemment.</i>" ;
}
 
?>
/trunk/wikini/actions/include.php
New file
0,0 → 1,55
<?php
/*
include.php : Permet d'inclure une page Wiki dans un autre page
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 Charles NEPOTE
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
/* Paramètres :
-- page : nom wiki de la page a inclure (obligatoire)
-- class : nom de la classe de style à inclure (facultatif)
*/
 
 
// récuperation du parametres
$incPageName = $this->GetParameter("page");
// TODO : améliorer le traitement des classes
if ($this->GetParameter("class")) {
$classes='';
$array_classes = explode(" ", $this->GetParameter("class"));
foreach ($array_classes as $c) { $classes = $classes . "include_" . $c . " "; }
}
 
// Affichage de la page ou d'un message d'erreur
if (empty($incPageName)) {
echo $this->Format("//Le paramètre \"page\" est manquant.//");
} else {
if (eregi("^".$incPageName."$",$this->GetPageTag())) {
echo $this->Format("//Impossible à une page de s'inclure dans elle même.//");
} else {
if (!$this->HasAccess("read",$incPageName)){
echo $this->Format("//Lecture de la page inclue $page non autorisée.//");
} else {
$incPage = $this->LoadPage($incPageName);
$output = $this->Format($incPage["body"]);
if ($classes) echo "<div class=\"", $classes,"\">\n", $output, "</div>\n";
else echo $output;
}
}
}
 
?>
/trunk/wikini/actions/recentcomments.php
New file
0,0 → 1,54
<?php
/*
recentcomments.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
if ($comments = $this->LoadRecentComments())
{
foreach ($comments as $comment)
{
// day header
list($day, $time) = explode(" ", $comment["time"]);
if ($day != $curday)
{
if ($curday) echo "<br />\n" ;
echo "<b>$day:</b><br />\n" ;
$curday = $day;
}
 
// echo entry
echo "&nbsp;&nbsp;&nbsp;(",$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
{
echo "<i>Pas de commentaires r&eacute;cents.</i>" ;
}
 
?>
/trunk/wikini/actions/attachfm.php
New file
0,0 → 1,38
<?php
/*
attachfm.php
Code original de ce fichier : Eric FELDSTEIN
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2003,2004 Eric FELDSTEIN
Copyright 2003 Jean-Pascal MILCENT
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
 
*/
$url = $this->href('filemanager',$this->GetPageTag());
echo '<a href="'.$url.'"><span class="attachfm"><span>Gestion des fichiers attachés</span></span></a>';
?>
/trunk/wikini/actions/header.php
New file
0,0 → 1,115
<?php
/* header.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003, 2004 Charles NEPOTE
Copyright 2002 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$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" />
<link rel="stylesheet" type="text/css" media="print" href="wakka.print.css" />
<style type="text/css" media="screen"> @import "<?php echo (!$_COOKIE["sitestyle"])?'wakka':$_COOKIE["sitestyle"] ?>.css";</style>
<style type="text/css" media="print"> @import "wakka.print.css";</style>
<script type="text/javascript">
function fKeyDown() {
if (event.keyCode == 9) {
event.returnValue= false;
document.selection.createRange().text = String.fromCharCode(9) } }
</script>
<!-- Début modif ACeditor -->
<style type="text/css">
.buttons { background: #ccc; border: 1px solid #ccc; margin: 1; float:left; }
.raise{ border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; background: #ccc; margin:1; float:left; }
.press { border-top: 1px solid buttonshadow; border-left: 1px solid buttonshadow; border-bottom: 1px solid buttonhighlight; border-right: 1px solid buttonhighlight; background: #ccc; margin:1; float:left; }
/* ci dessous les petits champs */
.ACsearchbox { background: #FFFFF8; border: 0px; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px; font-size: 10px; }
.texteChampsImage {font-size: 10px; }
#toolbar { margin: 0; width: 450px; padding: 0; height:20px; background: #ccc; border-top: 1px solid buttonhighlight; border-left: 1px solid buttonhighlight; border-bottom: 1px solid buttonshadow; border-right: 1px solid buttonshadow; text-align:left; }
</style>
 
<script type="text/javascript" src="ACeditor.js"></script>
<!-- Fin modif ACeditor -->
</head>
 
 
<body <?php echo (!$user || ($user["doubleclickedit"] == 'Y')) && ($this->GetMethod() == "show") ? "ondblclick=\"document.location='".$this->href("edit")."';\" " : "" ?>
<?php
/*Début modif ACeditor*/
echo $message ? "onLoad=\"alert('".$message."');thisForm=document.ACEditor;\" " : "onLoad=\"thisForm=document.ACEditor;\""
/*Fin modif ACeditor*/
?> >
 
 
<div style="display: none;"><a href="<?php echo $this->href() ?>/resetstyle" accesskey="7"></a></div>
 
<h1 class="wiki_name"><?php echo $this->config["wakka_name"] ?></h1>
 
 
<h1 class="page_name">
<a href="<?php echo $this->config["base_url"] ?>RechercheTexte&amp;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 &ecirc;tes <?php echo $this->Format($this->GetUserName()); if ($user = $this->GetUser()) echo " (<a href=\"".$this->config["base_url"] ."ParametresUtilisateur&amp;action=logout\">D&eacute;connexion</a>)\n"; ?>
</div>
 
<?
/*Début modif Menu Page*/
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!=""))
{
// Ajout Menu de Navigation
echo '<table class="page_table">';
echo '<tr><td class="menu_column">';
$wikiMenu = $this;
$wikiMenu->tag=$menu_page;
$wikiMenu->SetPage($wikiMenu->LoadPage($wikiMenu->tag));
echo $wikiMenu->Format($wikiMenu->page["body"], "wakka");
echo '</td>';
echo '<td class="body_column">';
}
/*Fin modif Menu Page*/
?>
 
/trunk/wikini/actions/listpages.php
New file
0,0 → 1,85
<?php
/*
listpages.php
 
Copyright 2002 David DELON
Copyright 2003 Patrick PAUL
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
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)
echo (str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",$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";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),". . . . derni&egrave;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");
echo $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";
echo "&nbsp;&nbsp;&nbsp;",$this->ComposeLinkToPage($page["tag"], "", "", 0)," . . . . ",$this->Format($owner),"<br/>\n" ;
}
}
?>
/trunk/wikini/actions/listusers.php
New file
0,0 → 1,45
<?php
/*
listusers.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
 
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) { echo $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)
{
echo $this->Format($user["name"])," . . . ",$user["signuptime"],"<br />\n" ;
}
}
}
 
?>
/trunk/wikini/actions/footer.php
New file
0,0 → 1,105
 
 
<div class="footer">
<?php
/* footer.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003, 2004 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002, 2003 Patrick PAUL
Copyright 2003 Eric DELORD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
echo $this->FormOpen("", "RechercheTexte", "get");
echo $this->HasAccess("write") ? "<a href=\"".$this->href("edit")."\" title=\"Cliquez pour &eacute;diter cette page.\">&Eacute;diter cette page</a> ::\n" : "";
echo $this->GetPageTime() ? "<a href=\"".$this->href("revisions")."\" title=\"Cliquez pour voir les derni&egrave;res modifications sur cette page.\">".$this->GetPageTime()."</a> ::\n" : "";
// if this page exists
if ($this->page)
{
// if owner is current user
if ($this->UserIsOwner())
{
echo
"Propri&eacute;taire&nbsp;: vous :: \n",
"<a href=\"",$this->href("acls")."\" title=\"Cliquez pour &eacute;diter les permissions de cette page.\">&Eacute;diter permissions</a> :: \n",
"<a href=\"",$this->href("deletepage")."\">Supprimer</a> :: \n",
"<a href=\"",$this->href("filemanager")."\">Fichiers &amp; images</a> :: \n";//Gestion de l'action ATTACH
}
else
{
if ($owner = $this->GetPageOwner())
{
echo "Propri&eacute;taire : ",$this->Format($owner);
}
else
{
echo "Pas de propri&eacute;taire ";
echo ($this->GetUser() ? "(<a href=\"".$this->href("claim")."\">Appropriation</a>)" : "");
}
echo " :: \n";
}
}
?>
<a href="<?php echo $this->href("referrers") ?>" title="Cliquez pour voir les URLs faisant r&eacute;f&eacute;rence &agrave; cette page.">
R&eacute;f&eacute;rences</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">XHTML 1.0 valide ?</a> ::
<a href="http://jigsaw.w3.org/css-validator/check/referer">CSS valide ?</a> ::
-- Fonctionne avec <?php echo $this->Link("WikiNi:PagePrincipale", "", "WikiNi ".$this->GetWikiNiVersion()) . "\n"; ?>
</div>
 
 
<?php
if ($this->GetConfigValue("debug")=="yes")
{
echo "<span class=\"debug\"><b>Query log :</b><br />\n";
$t_SQL=0;
foreach ($this->queryLog as $query)
{
echo $query["query"]." (".round($query["time"],4).")<br />\n";
$t_SQL = $t_SQL + $query["time"];
}
echo "</span>\n";
 
echo "<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);
echo "<span class=\"debug\"><b>".round(t_end-t_start, 4)." s (total time)</b></span><br />\n";
 
echo "<span class=\"debug\">SQL time represent : ".round((($t_SQL/(t_end-t_start))*100),2)."% of total time</span>\n";
}
?>
 
<?
$menu_page=$this->config["menu_page"];
if (isset($menu_page) and ($menu_page!="")) echo '</td></tr></table>';
?>
</body>
</html>
/trunk/wikini/actions/usersettings.php
New file
0,0 → 1,256
<?php
/*
usersettings.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002, 2003 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (!isset($_REQUEST["action"])) $_REQUEST["action"] = '';
if ($_REQUEST["action"] == "logout")
{
$this->LogoutUser();
$this->SetMessage("Vous &ecirc;tes maintenant d&eacute;connect&eacute; !");
$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&egrave;tres sauvegard&eacute;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 = "Mot de passe trop court.";
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&eacute; !");
$user["password"]=md5($password);
$this->SetUser($user);
$this->Redirect($this->href());
}
}
// user is logged in; display config form
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="update" />
<table>
<tr>
<td align="right"></td>
<td>Bonjour, <?php echo $this->Link($user["name"]) ?>&nbsp;!</td>
</tr>
<tr>
<td align="right">Votre adresse de messagerie &eacute;lectronique&nbsp;:</td>
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">&Eacute;dition en double-cliquant&nbsp;:</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">Par d&eacute;faut, montrer les commentaires&nbsp;:</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&nbsp;:</td>
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Nombre maximum de versions&nbsp;:</td>
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td>
</tr>
<tr>
<td align="right">Votre devise&nbsp;:</td>
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Mise &agrave; jour" /> <input type="button" value="D&eacute;connexion" onclick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td>
</tr>
 
<?php
echo $this->FormClose();
 
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="changepass" />
 
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right"></td>
<td><?php echo $this->Format("Changement de mot de passe"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre ancien mot de passe&nbsp;:</td>
<td><input type="password" name="oldpass" size="40" /></td>
</tr>
<tr>
<td align="right">Nouveau mot de passe&nbsp;:</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
echo $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&nbsp;!";
}
}
// 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 doit &ecirc;tre format&eacute; en NomWiki.";
else if (!$email) $error = "Vous devez sp&eacute;cifier une adresse de messagerie &eacute;lectronique.";
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas &agrave; une adresse de messagerie &eacute;lectronique.";
else if ($confpassword != $password) $error = "Les mots de passe n'&eacute;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&egrave;res alphanum&eacute;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());
}
}
}
echo $this->FormOpen();
?>
<input type="hidden" name="action" value="login" />
<table>
<tr>
<td></td>
<td><?php echo $this->Format("Si vous &ecirc;tes d&eacute;j&agrave; enregistr&eacute;, identifiez-vous ici"); ?></td>
</tr>
<?php
if (isset($error))
{
echo "<tr><td></td><td><div class=\"error\">", $this->Format($error), "</div></td></tr>\n";
}
?>
<tr>
<td align="right">Votre NomWiki&nbsp;:</td>
<td><input name="name" size="40" value="<?php if (isset($name)) echo $name ?>" /></td>
</tr>
<tr>
<td align="right">Mot de passe (5 caract&egrave;res minimum)&nbsp;:</td>
<td>
<input type="password" name="password" size="40" />
<input type="hidden" name="remember" value="0" />
<input type="checkbox" name="remember" value="1" />&nbsp;Se souvenir de moi.
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Identification" size="40" /></td>
</tr>
<tr>
<td></td>
<td width="500"><?php echo $this->Format("Les champs suivants sont &agrave; remplir si vous vous identifiez pour la premi&egrave;re fois (vous cr&eacute;erez ainsi un compte)"); ?></td>
</tr>
<tr>
<td align="right">Confirmation du mot de passe&nbsp;:</td>
<td><input type="password" name="confpassword" size="40" /></td>
</tr>
<tr>
<td align="right">Adresse de messagerie &eacute;lectronique.&nbsp;:</td>
<td><input name="email" size="40" value="<?php if (isset($email)) echo $email ?>" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Nouveau compte" size="40" /></td>
</tr>
</table>
<?php
echo $this->FormClose();
}
?>
 
/trunk/wikini/actions/redirect.php
New file
0,0 → 1,48
<?php
/*
redirect.php : Permet de faire une redirection vers une autre pages Wiki du site
 
Copyright 2003 Eric FELDSTEIN
Copyright 2003 David DELON
Copyright 2004 Jean Christophe ANDRE
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
/*
Parametres : page : nom wiki de la page vers laquelle ont doit rediriger (obligatoire)
exemple : {{redirect page="BacASable"}}
*/
 
//recuperation du parametres
$redirPageName = $this->GetParameter("page");
 
if (empty($redirPageName)){
echo $this->Format("//Le param&ecirc;tre \"page\" est manquant.//");
}else{
if (eregi("^".$redirPageName."$",$this->GetPageTag())){
echo $this->Format("//Impossible &agrave; une page de se rediriger vers elle m&ecirc;me.//");
}else{
$fromPages = array();
$fromPages = explode(":",$_COOKIE['redirectfrom']);
if (in_array($this->GetPageTag(),$fromPages)){
echo $this->Format("//Redirection circulaire.//");
}else{
$fromPages[] = $this->GetPageTag();
SetCookie('redirectfrom', implode(":",$fromPages), time() + 30, $this->CookiePath);
$this->Redirect($this->Href('', $redirPageName));
}
}
}
?>
/trunk/wikini/actions/recentchangesrss.php
New file
0,0 → 1,60
<?php
/*
recentchangesrss.php
 
Copyright 2003 David DELON
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
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>".str_replace('&', '&amp;', $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>".str_replace('&', '&amp;', $this->config["base_url"].$page["tag"])."&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
$output .= "</item>\n";
}
$output .= "</rdf:RDF>\n";
echo $output ;
}
?>
/trunk/wikini/actions/backlinks.php
New file
0,0 → 1,62
<?php
 
/*
backlinks.php
 
Copyright 2002 Patrick PAUL
Copyright 2003 David DELON
Copyright 2003 Charles NEPOTE
 
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 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
 
if ($this->GetParameter("page"))
{
$page = $this->GetParameter("page");
$title = "Pages ayant un lien vers ".$this->ComposeLinkToPage($page)."&nbsp;: <br />\n";
}
else
{
$page = $this->getPageTag();
$title = "Pages ayant un lien vers la page courante&nbsp;: <br />\n";
}
 
$pages = $this->LoadPagesLinkingTo($page);
 
if ($pages)
{
echo $title;
if (!$exclude = $this->GetParameter("exclude"))
{
foreach ($pages as $page)
{
echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
else
{
foreach ($pages as $page)
{
// Show link if it isn't an excluded link
if (!preg_match("/".$page["tag"]."(;|$)/", $exclude)) echo $this->ComposeLinkToPage($page["tag"]), "<br />\n";
}
}
}
else
{
echo "<i>Aucune page n'a de lien vers ", $this->ComposeLinkToPage($page), ".</i>";
}
?>
/trunk/wikini/actions/interwikilist.php
New file
0,0 → 1,30
<?php
/*interwikilist.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2003 David DELON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$file = implode("", file("interwiki.conf", 1));
echo $this->Format("%%".$file."%%") ;
?>
/trunk/wikini/actions/wantedpages.php
New file
0,0 → 1,43
<?php
/*
wantedpages.php
Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>
Copyright 2002, 2003 David DELON
Copyright 2002 Charles NEPOTE
Copyright 2002 Patrick PAUL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if ($pages = $this->LoadWantedPages())
{
foreach ($pages as $page)
{
echo $this->Link($page["tag"])," (<a
ref=\"",$this->href(),"&amp;linking_to=",$page["tag"],"\">",$page["count"],"</a>)<br />\n";
}
}
else
{
echo "<i>Aucune page &agrave; cr&eacute;er.</i>";
}
?>