/trunk/tools/cms/actions/header__.php |
---|
New file |
0,0 → 1,23 |
<?php |
if (!defined("WIKINI_VERSION")) |
{ |
die ("accès direct interdit"); |
} |
$user = $this->GetUser(); |
$root_page = $this->ComposeLinkToPage($this->config["root_page"]); |
$navigation_links = $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : ""; |
$user_name = $this->Format($this->GetUserName()); |
$disconnect_link = $this->GetUser() ? '(<a href="' . $this->href('', 'Identification', 'action=logout') . "\">Déconnexion</a>)\n" : ''; |
if ($user) { |
$plugin_output_new = preg_replace ('/<!-- ADMIN -->/', |
'<div class="header">'. |
$root_page.' :: '.$navigation_links.' :: '.'Vous êtes '.$user_name.' '.$disconnect_link. |
'</div> |
<div class="page"', |
$plugin_output_new); |
} |
?> |
/trunk/tools/cms/actions/identification.php |
---|
New file |
0,0 → 1,203 |
<?php |
if ($_REQUEST["action"] == "logout") { |
echo 'ici'; |
$this->LogoutUser(); |
$this->SetMessage("Vous êtes maintenant déconnecté !"); |
$this->Redirect($this->href()); |
} else if ($user = $this->GetUser()) { |
// is user trying to update? |
if ($_REQUEST["action"] == "update") |
{ |
$this->Query("update ".$this->config["table_prefix"]."users set ". |
"email = '".mysql_escape_string($_POST["email"])."', ". |
"doubleclickedit = '".mysql_escape_string($_POST["doubleclickedit"])."', ". |
"show_comments = '".mysql_escape_string($_POST["show_comments"])."', ". |
"revisioncount = '".mysql_escape_string($_POST["revisioncount"])."', ". |
"changescount = '".mysql_escape_string($_POST["changescount"])."', ". |
"motto = '".mysql_escape_string($_POST["motto"])."' ". |
"where name = '".$user["name"]."' limit 1"); |
$this->SetUser($this->LoadUser($user["name"])); |
// forward |
$this->SetMessage("Paramètres sauvegardés !"); |
$this->Redirect($this->href()); |
} |
if ($_REQUEST["action"] == "changepass") |
{ |
// check password |
$password = $_POST["password"]; |
if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans les mots de passe."; |
else if (strlen($password) < 5) $error = "Password too short."; |
else if ($user["password"] != md5($_POST["oldpass"])) $error = "Mauvais mot de passe."; |
else |
{ |
$this->Query("update ".$this->config["table_prefix"]."users set "."password = md5('".mysql_escape_string($password)."') "."where name = '".$user["name"]."'"); |
$this->SetMessage("Mot de passe changé !"); |
$user["password"]=md5($password); |
$this->SetUser($user); |
$this->Redirect($this->href()); |
} |
} |
// user is logged in; display config form |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="update" /> |
<table> |
<tr> |
<td align="right"></td> |
<td>Hello, <?php echo $this->Link($user["name"]) ?>!</td> |
</tr> |
<tr> |
<td align="right">Votre adresse e-mail :</td> |
<td><input name="email" value="<?php echo htmlentities($user["email"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Edition en Doublecliquant :</td> |
<td><input type="hidden" name="doubleclickedit" value="N" /><input type="checkbox" name="doubleclickedit" value="Y" <?php echo $user["doubleclickedit"] == "Y" ? "checked=\"checked\"" : "" ?> /></td> |
</tr> |
<tr> |
<td align="right">Montrer les commentaires par default :</td> |
<td><input type="hidden" name="show_comments" value="N" /><input type="checkbox" name="show_comments" value="Y" <?php echo $user["show_comments"] == "Y" ? "checked\"checked\"" : "" ?> /></td> |
</tr> |
<tr> |
<td align="right">Nombre maximum de derniers commentaires :</td> |
<td><input name="changescount" value="<?php echo htmlentities($user["changescount"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Nombre maximum de versions :</td> |
<td><input name="revisioncount" value="<?php echo htmlentities($user["revisioncount"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Votre devise :</td> |
<td><input name="motto" value="<?php echo htmlentities($user["motto"]) ?>" size="40" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Mise à jour" /> <input type="button" value="Déconnection" onClick="document.location='<?php echo $this->href("", "", "action=logout"); ?>'" /></td> |
</tr> |
<?php |
print($this->FormClose()); |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="changepass" /> |
<tr> |
<td> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"></td> |
<td><?php echo $this->Format("Changement de mot de passe"); ?></td> |
</tr> |
<?php |
if ($error) |
{ |
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n"); |
} |
?> |
<tr> |
<td align="right">Votre ancien mot de passe :</td> |
<td><input type="password" name="oldpass" size="40" /></td> |
</tr> |
<tr> |
<td align="right">Nouveau mot de passe :</td> |
<td><input type="password" name="password" size="40" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Changer" size="40" /></td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} else { |
// user is not logged in |
// is user trying to log in or register? |
if ($_REQUEST["action"] == "login") |
{ |
// if user name already exists, check password |
if ($existingUser = $this->LoadUser($_POST["name"])) |
{ |
// check password |
if ($existingUser["password"] == md5($_POST["password"])) |
{ |
$this->SetUser($existingUser, $_POST["remember"]); |
$this->Redirect($this->href()); |
} |
else |
{ |
$error = "Mauvais mot de passe !"; |
} |
} |
// otherwise, create new account |
else |
{ |
$name = trim($_POST["name"]); |
$email = trim($_POST["email"]); |
$password = $_POST["password"]; |
$confpassword = $_POST["confpassword"]; |
// check if name is WikkiName style |
if (!$this->IsWikiName($name)) $error = "Votre nom d'utilisateur dois être formaté en NomWiki."; |
else if (!$email) $error = "Vous devez spécifier une adresse e-mail."; |
else if (!preg_match("/^.+?\@.+?\..+$/", $email)) $error = "Ceci ne ressemble pas à une adresse e-mail."; |
else if ($confpassword != $password) $error = "Les mots de passe n'étaient pas identiques"; |
else if (preg_match("/ /", $password)) $error = "Les espaces ne sont pas permis dans un mot de passe."; |
else if (strlen($password) < 5) $error = "Mot de passe trop court. Un mot de passe doit contenir au minimum 5 caractères alphanumériques."; |
else |
{ |
$this->Query("insert into ".$this->config["table_prefix"]."users set ". |
"signuptime = now(), ". |
"name = '".mysql_escape_string($name)."', ". |
"email = '".mysql_escape_string($email)."', ". |
"password = md5('".mysql_escape_string($_POST["password"])."')"); |
// log in |
$this->SetUser($this->LoadUser($name)); |
// forward |
$this->Redirect($this->href()); |
} |
} |
} |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="login" /> |
<table> |
<tr> |
<td align="right"></td> |
<td><?php echo $this->Format("Si vous êtes déjà enregistré, identifiez-vous ici"); ?></td> |
</tr> |
<?php |
if ($error) |
{ |
print("<tr><td></td><td><div class=\"error\">".$this->Format($error)."</div></td></tr>\n"); |
} |
?> |
<tr> |
<td align="right">Votre NomWiki :</td> |
<td><input name="name" size="40" value="<?php echo $name ?>" /></td> |
</tr> |
<tr> |
<td align="right">Mot de passe (5 caractères minimum) :</td> |
<td><input type="password" name="password" size="40" /> |
<input type="hidden" name="remember" value="0" /><input type="checkbox" name="remember" value="1" /> <?php echo $this->Format("Se souvenir de moi.") ?> </td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Identification" size="40" /></td> |
</tr> |
</table> |
<?php |
print($this->FormClose()); |
} |
?> |
/trunk/tools/cms/actions/textsearch.php |
---|
New file |
0,0 → 1,111 |
<?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. |
*/ |
// Contient les pages pouvant être affiché |
$tab_pages_ok = array('Accueil', 'Historique', 'Pierres', 'Materiaux', 'ProduitsSemiFinis', 'ProduitsFinis', 'Contacts', 'Telechargement'); |
// label à afficher devant la zone de saisie |
$label = $this->GetParameter('label', 'Ce que vous souhaitez chercher : '); |
// 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 (!$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 ' <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ésultat(s) de la recherche de "', htmlspecialchars($phrase), '" : '; |
} |
foreach ($results as $i => $page) { |
if ($i > 0) echo $separator; |
echo $this->ComposeLinkToPage($page['tag']); |
} |
if (!$paramPhrase) { |
echo '</p>', "\n"; |
} |
} else { |
$ok = false; |
foreach ($results as $i => $page) { |
foreach ($tab_pages_ok as $tag) { |
if ($page["tag"] == $tag) { |
$ok = true; |
} |
} |
} |
if ($ok) { |
echo '<p><strong>Résultat(s) de la recherche de "', htmlspecialchars($phrase), '" :</strong></p>', "\n", |
'<ol>', "\n"; |
foreach ($results as $i => $page) { |
foreach ($tab_pages_ok as $tag) { |
if ($page["tag"] == $tag) { |
echo "<li>", $this->ComposeLinkToPage($page["tag"]), "</li>\n"; |
} |
} |
} |
echo "</ol>\n"; |
} |
} |
} else { |
if (!$paramPhrase) |
{ |
echo "<p>Aucun résultat pour \"", htmlspecialchars($phrase), "\". :-(</p>"; |
} |
} |
} |
?> |
/trunk/tools/cms/actions/ajoutadmin.php |
---|
New file |
0,0 → 1,70 |
<?php |
// is user trying to log in or register? |
if ($_REQUEST["action"] == "ajout") { |
$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 { |
$reussite = "L'administrateur a bien été ajouté !"; |
$this->Query( "insert into ".$this->config["table_prefix"]."users set ". |
"signuptime = now(), ". |
"name = '".mysql_escape_string($name)."', ". |
"email = '".mysql_escape_string($email)."', ". |
"password = md5('".mysql_escape_string($_POST["password"])."')"); |
// log in |
//$this->SetUser($this->LoadUser($name)); |
// forward |
//$this->Redirect($this->href()); |
} |
} |
print($this->FormOpen()); |
?> |
<input type="hidden" name="action" value="ajout" /> |
<table> |
<tr> |
<td align="left" colspan="2"><?php echo $this->Format("Pour ajouter un administrateur renseigner les champs ci-dessous:"); ?></td> |
</tr> |
<?php |
if ($error) { |
print('<tr><td></td><td><div class="error">'.$this->Format($error)."</div></td></tr>\n"); |
} |
if ($reussite) { |
echo('<tr><td></td><td><div class="reussite">'.$this->Format($reussite)."</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" /></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()); |
?> |