Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 230 → Rev 231

/trunk/client/inscription/inscription.php
New file
0,0 → 1,182
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: inscription.php,v 1.1 2004-12-15 13:32:15 alex Exp $
/**
* Inscription
*
* Un module d'inscription, en général ce code est spécifique à
* un site web
*
*@package inscription
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-12-15 13:32:15 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
include_once "client/inscription/configuration/ins_config.inc.php";
if (!isset($GLOBALS['lang'])) {
$GLOBALS['lang'] = INS_LANGUE_DEFAUT ;
}
include_once INS_CHEMIN_FICHIER."langues/ins_langue_".$GLOBALS['lang'].".inc.php" ;
include_once INS_CHEMIN_FICHIER."bibliotheque/inscription.fonct.php" ;
include_once INS_CHEMIN_FICHIER."classes/inscription.class.php" ;
 
 
 
// Ajout d'une feuille de style externe
GEN_stockerStyleExterne ('inscription', INS_CHEMIN_FICHIER.'inscription.css') ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
 
function afficherContenuCorps() {
 
$url = preg_replace ("/&amp;/", "&", INS_URL_DOCUMENT) ;
if (!isset ($GLOBALS['action'])) $GLOBALS['action'] = "" ;
$res = "" ;
$est_loggue = true ;
 
if ($GLOBALS['logout'] == 1) {
$GLOBALS['AUTH']->logout() ;
$GLOBALS['username'] = "" ;
$GLOBALS['password'] = "" ;
return AUTH_formulaire_login() ;
}
 
// L'utilisateur a-t-il cliqué sur Supprimer inscription
if (isset ($GLOBALS['supprimer'])) {
$id_utilisateur = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
//desinscription_interwikini_users ($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_LOGIN)) ;
$requete = "delete from ".INS_ANNUAIRE." where ".INS_CHAMPS_ID."=".$id_utilisateur;
 
$GLOBALS['ins_db']->query ($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
// Suppression dans SPIP
if (INS_UTILISE_SPIP) {
desinscription_spip($id_utilisateur) ;
}
$GLOBALS['AUTH']->logout() ;
return AUTH_formulaire_login() ;
}
 
if ($GLOBALS['action'] == 'sendpasswd') {
return envoie_passe() ;
}
 
// L'utilisateur a cliqué sur Inscription ou Inscription structure ou
if ($GLOBALS['action'] != '' || isset($GLOBALS['modifier'])) {
$action = preg_replace ("/&amp;/", "&", $GLOBALS['ins_url']->getURL()) ;
$formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', $action) ;
// Construction de la liste des pays
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
$formulaire->construitFormulaire($action, $liste_pays->getListePays($GLOBALS['lang'])) ;
if (isset($GLOBALS['structure'])) {
$formulaire->formulaireStructure() ;
}
if (isset($GLOBALS['modifier'])) {
$formulaire->addElement ('hidden', 'action', 'modifier_v') ;
$formulaire->setDefaults(formulaire_defaults()) ;
}
if ($GLOBALS['action'] == 'inscription') {
$formulaire->addElement ('hidden', 'action', 'inscription_v') ;
}
if ($GLOBALS['action'] == 'inscription_v') {
if ($formulaire->validate()) {
$formulaire->process('demande_inscription', false) ;
return message_inscription() ;
}
}
if ($GLOBALS['action'] == 'modifier_v') {
if ($formulaire->validate()) {
$formulaire->process('mise_a_jour', false) ;
}
return info ($GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)).bouton (str_replace ("&amp;", "&", $GLOBALS['ins_url']->getURL())) ;
}
return $formulaire->toHTML() ;
}
// L'inscription dans la base si l'utilisateur clique sur le lien du mail
if (isset($GLOBALS['id']) && $GLOBALS['id'] == session_id()) {
if (isset ($_SESSION['donnees_inscription'])) {
insertion ($_SESSION['donnees_inscription']) ;
$GLOBALS['AUTH']->username = $_SESSION['donnees_inscription']['email'] ;
$GLOBALS['AUTH']->password = $_SESSION['donnees_inscription']['mot_de_passe'] ;
// On loggue l'utilisateur
$GLOBALS['AUTH']->login() ;
unset ($_SESSION['donnees_inscription']) ;
envoie_mail() ;
} else {
return INS_MESSAGE_EXPIRATION ;
}
}
 
if (!$GLOBALS['AUTH']->getAuth() && $GLOBALS['action'] != "inscription" && $GLOBALS['action'] != 'inscription_v') {
if (isset($GLOBALS['username']) && $GLOBALS['username'] != '') {
$res .= message_erreur() ;
} else {
$res .= AUTH_formulaire_login() ;
}
}
if ($GLOBALS['AUTH']->getAuth () && !isset($GLOBALS['modifier'])) {
return info ()
.bouton (str_replace ("&amp;", "&", $GLOBALS['ins_url']->getURL()))
.deconnexion($GLOBALS['ins_url']->getURL()) ;
}
return $res ;
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.2 2004/09/01 16:36:37 alex
* changement du chemin pour les include
*
* Revision 1.1 2004/07/06 15:42:28 alex
* en cours
*
* Revision 1.5 2004/07/06 15:28:56 alex
* en cours
*
* Revision 1.4 2004/06/25 14:26:03 alex
* modification de la suppression
*
* Revision 1.3 2004/06/23 12:41:44 alex
* amélioration de la gestion de la perte de mot de passe
*
* Revision 1.2 2004/06/18 09:18:23 alex
* version initiale
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>