231 |
alex |
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.1 2004-12-15 13:32:15 alex 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.1 $ $Date: 2004-12-15 13:32:15 $
|
|
|
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 |
|
|
|
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 ("/&/", "&", INS_URL_DOCUMENT) ;
|
|
|
63 |
if (!isset ($GLOBALS['action'])) $GLOBALS['action'] = "" ;
|
|
|
64 |
$res = "" ;
|
|
|
65 |
$est_loggue = true ;
|
|
|
66 |
|
|
|
67 |
if ($GLOBALS['logout'] == 1) {
|
|
|
68 |
$GLOBALS['AUTH']->logout() ;
|
|
|
69 |
$GLOBALS['username'] = "" ;
|
|
|
70 |
$GLOBALS['password'] = "" ;
|
|
|
71 |
return 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 |
$requete = "delete from ".INS_ANNUAIRE." where ".INS_CHAMPS_ID."=".$id_utilisateur;
|
|
|
79 |
|
|
|
80 |
$GLOBALS['ins_db']->query ($requete) ;
|
|
|
81 |
if (DB::isError($resultat)) {
|
|
|
82 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
|
|
83 |
}
|
|
|
84 |
// Suppression dans SPIP
|
|
|
85 |
if (INS_UTILISE_SPIP) {
|
|
|
86 |
desinscription_spip($id_utilisateur) ;
|
|
|
87 |
}
|
|
|
88 |
$GLOBALS['AUTH']->logout() ;
|
|
|
89 |
return AUTH_formulaire_login() ;
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
if ($GLOBALS['action'] == 'sendpasswd') {
|
|
|
93 |
return envoie_passe() ;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
// L'utilisateur a cliqué sur Inscription ou Inscription structure ou
|
|
|
97 |
if ($GLOBALS['action'] != '' || isset($GLOBALS['modifier'])) {
|
|
|
98 |
$action = preg_replace ("/&/", "&", $GLOBALS['ins_url']->getURL()) ;
|
|
|
99 |
$formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', $action) ;
|
|
|
100 |
// Construction de la liste des pays
|
|
|
101 |
$liste_pays = new ListeDePays($GLOBALS['ins_db']) ;
|
|
|
102 |
$formulaire->construitFormulaire($action, $liste_pays->getListePays($GLOBALS['lang'])) ;
|
|
|
103 |
if (isset($GLOBALS['structure'])) {
|
|
|
104 |
$formulaire->formulaireStructure() ;
|
|
|
105 |
}
|
|
|
106 |
if (isset($GLOBALS['modifier'])) {
|
|
|
107 |
$formulaire->addElement ('hidden', 'action', 'modifier_v') ;
|
|
|
108 |
$formulaire->setDefaults(formulaire_defaults()) ;
|
|
|
109 |
}
|
|
|
110 |
if ($GLOBALS['action'] == 'inscription') {
|
|
|
111 |
$formulaire->addElement ('hidden', 'action', 'inscription_v') ;
|
|
|
112 |
}
|
|
|
113 |
if ($GLOBALS['action'] == 'inscription_v') {
|
|
|
114 |
if ($formulaire->validate()) {
|
|
|
115 |
$formulaire->process('demande_inscription', false) ;
|
|
|
116 |
return message_inscription() ;
|
|
|
117 |
}
|
|
|
118 |
}
|
|
|
119 |
if ($GLOBALS['action'] == 'modifier_v') {
|
|
|
120 |
if ($formulaire->validate()) {
|
|
|
121 |
$formulaire->process('mise_a_jour', false) ;
|
|
|
122 |
}
|
|
|
123 |
return info ($GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)).bouton (str_replace ("&", "&", $GLOBALS['ins_url']->getURL())) ;
|
|
|
124 |
}
|
|
|
125 |
return $formulaire->toHTML() ;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
// L'inscription dans la base si l'utilisateur clique sur le lien du mail
|
|
|
129 |
if (isset($GLOBALS['id']) && $GLOBALS['id'] == session_id()) {
|
|
|
130 |
if (isset ($_SESSION['donnees_inscription'])) {
|
|
|
131 |
insertion ($_SESSION['donnees_inscription']) ;
|
|
|
132 |
|
|
|
133 |
$GLOBALS['AUTH']->username = $_SESSION['donnees_inscription']['email'] ;
|
|
|
134 |
$GLOBALS['AUTH']->password = $_SESSION['donnees_inscription']['mot_de_passe'] ;
|
|
|
135 |
// On loggue l'utilisateur
|
|
|
136 |
$GLOBALS['AUTH']->login() ;
|
|
|
137 |
unset ($_SESSION['donnees_inscription']) ;
|
|
|
138 |
envoie_mail() ;
|
|
|
139 |
} else {
|
|
|
140 |
return INS_MESSAGE_EXPIRATION ;
|
|
|
141 |
}
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
if (!$GLOBALS['AUTH']->getAuth() && $GLOBALS['action'] != "inscription" && $GLOBALS['action'] != 'inscription_v') {
|
|
|
145 |
if (isset($GLOBALS['username']) && $GLOBALS['username'] != '') {
|
|
|
146 |
$res .= message_erreur() ;
|
|
|
147 |
} else {
|
|
|
148 |
$res .= AUTH_formulaire_login() ;
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
if ($GLOBALS['AUTH']->getAuth () && !isset($GLOBALS['modifier'])) {
|
|
|
152 |
return info ()
|
|
|
153 |
.bouton (str_replace ("&", "&", $GLOBALS['ins_url']->getURL()))
|
|
|
154 |
.deconnexion($GLOBALS['ins_url']->getURL()) ;
|
|
|
155 |
}
|
|
|
156 |
return $res ;
|
|
|
157 |
}
|
|
|
158 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
159 |
*
|
|
|
160 |
* $Log: not supported by cvs2svn $
|
|
|
161 |
* Revision 1.2 2004/09/01 16:36:37 alex
|
|
|
162 |
* changement du chemin pour les include
|
|
|
163 |
*
|
|
|
164 |
* Revision 1.1 2004/07/06 15:42:28 alex
|
|
|
165 |
* en cours
|
|
|
166 |
*
|
|
|
167 |
* Revision 1.5 2004/07/06 15:28:56 alex
|
|
|
168 |
* en cours
|
|
|
169 |
*
|
|
|
170 |
* Revision 1.4 2004/06/25 14:26:03 alex
|
|
|
171 |
* modification de la suppression
|
|
|
172 |
*
|
|
|
173 |
* Revision 1.3 2004/06/23 12:41:44 alex
|
|
|
174 |
* amélioration de la gestion de la perte de mot de passe
|
|
|
175 |
*
|
|
|
176 |
* Revision 1.2 2004/06/18 09:18:23 alex
|
|
|
177 |
* version initiale
|
|
|
178 |
*
|
|
|
179 |
*
|
|
|
180 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
181 |
*/
|
|
|
182 |
?>
|