310 |
florian |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: inscription.php,v 1.4 2005-03-21 16:57:30 florian Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Inscription
|
|
|
25 |
*
|
|
|
26 |
* Un module d'inscription, en général ce code est spécifique à
|
|
|
27 |
* un site web
|
|
|
28 |
*
|
|
|
29 |
*@package inscription
|
|
|
30 |
//Auteur original :
|
|
|
31 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
|
|
32 |
//Autres auteurs :
|
|
|
33 |
*@copyright Tela-Botanica 2000-2004
|
|
|
34 |
*@version $Revision: 1.4 $ $Date: 2005-03-21 16:57:30 $
|
|
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
|
|
|
42 |
include_once "client/inscription/configuration/ins_config.inc.php";
|
|
|
43 |
if (!isset($GLOBALS['lang'])) {
|
|
|
44 |
$GLOBALS['lang'] = INS_LANGUE_DEFAUT ;
|
|
|
45 |
}
|
|
|
46 |
include_once INS_CHEMIN_FICHIER."langues/ins_langue_".$GLOBALS['lang'].".inc.php" ;
|
|
|
47 |
include_once INS_CHEMIN_FICHIER."bibliotheque/inscription.fonct.php" ;
|
|
|
48 |
include_once INS_CHEMIN_FICHIER."classes/inscription.class.php" ;
|
|
|
49 |
|
|
|
50 |
if (!isset($GLOBALS['logout'])) {$GLOBALS['logout']=0;}
|
|
|
51 |
|
|
|
52 |
// Ajout d'une feuille de style externe
|
|
|
53 |
GEN_stockerStyleExterne('inscription', INS_CHEMIN_FICHIER.'inscription.css') ;
|
|
|
54 |
|
|
|
55 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
56 |
// | LISTE de FONCTIONS |
|
|
|
57 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
function afficherContenuCorps() {
|
|
|
61 |
|
|
|
62 |
$url = preg_replace ('/&/', '&', $GLOBALS['ins_url']->getURL()) ;
|
|
|
63 |
if (!isset ($GLOBALS['action'])) $GLOBALS['action'] = '';
|
|
|
64 |
$res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
|
|
|
65 |
$est_loggue = true ;
|
|
|
66 |
|
|
|
67 |
if ($GLOBALS['logout'] == 1) {
|
|
|
68 |
$GLOBALS['AUTH']->logout() ;
|
|
|
69 |
$GLOBALS['username'] = '';
|
|
|
70 |
$GLOBALS['password'] = '';
|
|
|
71 |
return $res.AUTH_formulaire_login() ;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
// L'utilisateur a-t-il cliqué sur Supprimer inscription
|
|
|
75 |
if (isset ($GLOBALS['supprimer'])) {
|
|
|
76 |
$id_utilisateur = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
|
|
|
77 |
//desinscription_interwikini_users ($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_LOGIN)) ;
|
|
|
78 |
$resultat = $GLOBALS['AUTH']->removeUser($id_utilisateur) ;
|
|
|
79 |
|
|
|
80 |
if (PEAR::isError($resultat)) {
|
|
|
81 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
|
|
82 |
}
|
|
|
83 |
// Suppression dans SPIP
|
|
|
84 |
if (INS_UTILISE_SPIP) {
|
|
|
85 |
desinscription_spip($id_utilisateur) ;
|
|
|
86 |
}
|
|
|
87 |
// Suppression dans Wikini
|
|
|
88 |
if (INS_UTILISE_WIKINI) {
|
|
|
89 |
$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_NOM_WIKI) ;
|
|
|
90 |
desinscription_interwikini_users($nom_wiki) ;
|
|
|
91 |
}
|
|
|
92 |
$GLOBALS['AUTH']->logout() ;
|
|
|
93 |
return $res.AUTH_formulaire_login() ;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
if ($GLOBALS['action'] == 'sendpasswd') {
|
|
|
97 |
return $res.envoie_passe() ;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
// L'utilisateur a cliqué sur Inscription ou Inscription structure ou
|
|
|
101 |
if ($GLOBALS['action'] != '' || isset($GLOBALS['modifier'])) {
|
|
|
102 |
$action = preg_replace ("/&/", "&", $GLOBALS['ins_url']->getURL()) ;
|
|
|
103 |
$formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', $action, '_self', '', 0) ;
|
|
|
104 |
// Construction de la liste des pays
|
|
|
105 |
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
|
|
|
106 |
$formulaire->construitFormulaire($action, $liste_pays->getListePays($GLOBALS['lang'])) ;
|
|
|
107 |
if (isset($GLOBALS['form_structure'])) {
|
|
|
108 |
$formulaire->formulaireStructure() ;
|
|
|
109 |
}
|
|
|
110 |
if (isset($GLOBALS['modifier'])) {
|
|
|
111 |
$formulaire->addElement ('hidden', 'action', 'modifier_v') ;
|
|
|
112 |
$formulaire->setDefaults(formulaire_defaults()) ;
|
|
|
113 |
}
|
|
|
114 |
if ($GLOBALS['action'] == 'inscription') {
|
|
|
115 |
$formulaire->addElement ('hidden', 'action', 'inscription_v') ;
|
|
|
116 |
}
|
|
|
117 |
if ($GLOBALS['action'] == 'inscription_v') {
|
|
|
118 |
if ($formulaire->validate()) {
|
|
|
119 |
$formulaire->process('demande_inscription', false) ;
|
|
|
120 |
return $res.message_inscription() ;
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
if ($GLOBALS['action'] == 'modifier_v') {
|
|
|
124 |
if ($formulaire->validate()) {
|
|
|
125 |
$formulaire->process('mise_a_jour', false) ;
|
|
|
126 |
}
|
|
|
127 |
return $res.info($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)).bouton(str_replace ("&", "&", $GLOBALS['ins_url']->getURL())) ;
|
|
|
128 |
}
|
|
|
129 |
return $res.$formulaire->toHTML() ;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
// L'inscription dans la base si l'utilisateur clique sur le lien du mail
|
|
|
133 |
if (isset($GLOBALS['id']) && $GLOBALS['id'] == session_id()) {
|
|
|
134 |
if (isset ($_SESSION['donnees_inscription'])) {
|
|
|
135 |
insertion($_SESSION['donnees_inscription']) ;
|
|
|
136 |
|
|
|
137 |
$GLOBALS['AUTH']->username = $_SESSION['donnees_inscription']['email'] ;
|
|
|
138 |
$GLOBALS['AUTH']->password = $_SESSION['donnees_inscription']['mot_de_passe'] ;
|
|
|
139 |
// On loggue l'utilisateur
|
|
|
140 |
$GLOBALS['AUTH']->login() ;
|
|
|
141 |
unset ($_SESSION['donnees_inscription']) ;
|
|
|
142 |
envoie_mail() ;
|
|
|
143 |
} else {
|
|
|
144 |
return $res.INS_MESSAGE_EXPIRATION ;
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
if (!$GLOBALS['AUTH']->getAuth() && $GLOBALS['action'] != "inscription" && $GLOBALS['action'] != 'inscription_v') {
|
|
|
149 |
if (isset($_POST['username']) && $_POST['username'] != '') {
|
|
|
150 |
$res .= message_erreur() ;
|
|
|
151 |
} else {
|
|
|
152 |
$res .= AUTH_formulaire_login() ;
|
|
|
153 |
}
|
|
|
154 |
}
|
|
|
155 |
if ($GLOBALS['AUTH']->getAuth() && !isset($GLOBALS['modifier'])) {
|
|
|
156 |
return $res.info().bouton(str_replace ("&", "&", $GLOBALS['ins_url']->getURL())).deconnexion($GLOBALS['ins_url']->getURL()) ;
|
|
|
157 |
}
|
|
|
158 |
return $res ;
|
|
|
159 |
}
|
|
|
160 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
161 |
*
|
|
|
162 |
* $Log: not supported by cvs2svn $
|
|
|
163 |
* Revision 1.3 2005/03/08 17:44:02 alex
|
|
|
164 |
* suppression en utilisant removeUser de Auth plutôt qu'en requete directe
|
|
|
165 |
*
|
|
|
166 |
* Revision 1.2 2005/03/02 12:44:41 alex
|
|
|
167 |
* Correction du bug message d'erreur alors qu'on tente de s'inscrire simplement
|
|
|
168 |
*
|
|
|
169 |
* Revision 1.1 2004/12/15 13:32:15 alex
|
|
|
170 |
* version initiale
|
|
|
171 |
*
|
|
|
172 |
* Revision 1.2 2004/09/01 16:36:37 alex
|
|
|
173 |
* changement du chemin pour les include
|
|
|
174 |
*
|
|
|
175 |
* Revision 1.1 2004/07/06 15:42:28 alex
|
|
|
176 |
* en cours
|
|
|
177 |
*
|
|
|
178 |
* Revision 1.5 2004/07/06 15:28:56 alex
|
|
|
179 |
* en cours
|
|
|
180 |
*
|
|
|
181 |
* Revision 1.4 2004/06/25 14:26:03 alex
|
|
|
182 |
* modification de la suppression
|
|
|
183 |
*
|
|
|
184 |
* Revision 1.3 2004/06/23 12:41:44 alex
|
|
|
185 |
* amélioration de la gestion de la perte de mot de passe
|
|
|
186 |
*
|
|
|
187 |
* Revision 1.2 2004/06/18 09:18:23 alex
|
|
|
188 |
* version initiale
|
|
|
189 |
*
|
|
|
190 |
*
|
|
|
191 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
192 |
*/
|
|
|
193 |
?>
|