| Line 17... |
Line 17... |
| 17 |
// | |
|
17 |
// | |
|
| 18 |
// | You should have received a copy of the GNU Lesser General Public |
|
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 |
|
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 |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
| 22 |
// CVS : $Id: inscription.php,v 1.21 2007-01-04 16:39:48 alexandre_tb Exp $
|
22 |
// CVS : $Id: inscription.php,v 1.22 2007-04-06 08:35:46 neiluj Exp $
|
| 23 |
/**
|
23 |
/**
|
| 24 |
* Inscription
|
24 |
* Inscription
|
| 25 |
*
|
25 |
*
|
| 26 |
* Un module d'inscription, en général ce code est spécifique à
|
26 |
* Un module d'inscription, en général ce code est spécifique à
|
| 27 |
* un site web
|
27 |
* un site web
|
| Line 30... |
Line 30... |
| 30 |
//Auteur original :
|
30 |
//Auteur original :
|
| 31 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
31 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
| 32 |
//Autres auteurs :
|
32 |
//Autres auteurs :
|
| 33 |
*@author Florian SCHMITT <florian@ecole-et-nature.org>
|
33 |
*@author Florian SCHMITT <florian@ecole-et-nature.org>
|
| 34 |
*@copyright Tela-Botanica 2000-2004
|
34 |
*@copyright Tela-Botanica 2000-2004
|
| 35 |
*@version $Revision: 1.21 $ $Date: 2007-01-04 16:39:48 $
|
35 |
*@version $Revision: 1.22 $ $Date: 2007-04-06 08:35:46 $
|
| 36 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
| 37 |
*/
|
37 |
*/
|
| Line 38... |
Line 38... |
| 38 |
|
38 |
|
| 39 |
// +------------------------------------------------------------------------------------------------------+
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
| 40 |
// | ENTETE du PROGRAMME |
|
40 |
// | ENTETE du PROGRAMME |
|
| 41 |
// +------------------------------------------------------------------------------------------------------+
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
| 42 |
include_once 'configuration/bottin.config.inc.php';
|
- |
|
| 43 |
include_once 'configuration/annuaire_backoffice_bottin.config.inc.php';
|
42 |
include_once 'configuration/bottin.config.inc.php';
|
| 44 |
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
|
- |
|
| 45 |
|
- |
|
| 46 |
// Inclusion d'une classe personnalisé si elle existe
|
- |
|
| 47 |
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
|
- |
|
| 48 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;
|
- |
|
| 49 |
} else {
|
43 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.fonct.php';
|
| 50 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
|
- |
|
| Line 51... |
Line 44... |
| 51 |
}
|
44 |
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.php';
|
| 52 |
|
45 |
|
| 53 |
// +------------------------------------------------------------------------------------------------------+
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
| 54 |
// | LISTE de FONCTIONS |
|
- |
|
| 55 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 56 |
if ( isset($_GET['voir_fiche']) or isset($_GET['voir_abonnement']) or isset($_GET['voir_actus']) or isset($_GET['voir_ressources']) or isset($_GET['voir_competences'])
|
- |
|
| 57 |
or (isset($_REQUEST['action'])&&($_REQUEST['action']=='modifier_v'||$_REQUEST['action']=='modifier_v'))
|
- |
|
| 58 |
or ($GLOBALS['AUTH']->getAuth() && (isset($_REQUEST['action']) && $_REQUEST['action']!='modifier')) ) {
|
- |
|
| 59 |
//---------------le menu de l'appli-----------
|
- |
|
| 60 |
function afficherContenuNavigation () {
|
- |
|
| 61 |
$res =inscription_onglets();
|
- |
|
| 62 |
return $res ;
|
47 |
// | LISTE de FONCTIONS |
|
| Line 63... |
Line 48... |
| 63 |
}
|
48 |
// +------------------------------------------------------------------------------------------------------+
|
| - |
|
49 |
|
| 64 |
}
|
50 |
|
| 65 |
|
51 |
function afficherContenuCorps() {
|
| 66 |
function afficherContenuCorps() {
|
52 |
|
| 67 |
$res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
|
53 |
$res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
|
| Line 68... |
Line 54... |
| 68 |
if (!isset($_REQUEST['action'])) {
|
54 |
if (!isset($_REQUEST['action'])) {
|
| 69 |
$_REQUEST['action']='';
|
55 |
$_REQUEST['action']='';
|
| 70 |
}
|
56 |
}
|
| 71 |
|
57 |
|
| 72 |
//cas de la déconnexion----------------------------------------------------------------------------------
|
58 |
//cas de la dàconnexion----------------------------------------------------------------------------------
|
| 73 |
if ($_REQUEST['action'] == 'deconnexion') {
|
59 |
if ($_REQUEST['action'] == 'deconnexion') {
|
| 74 |
$GLOBALS['AUTH']->logout() ;
|
60 |
$GLOBALS['AUTH']->logout() ;
|
| Line 75... |
Line 61... |
| 75 |
$_POST['username'] = '' ;
|
61 |
$_POST['username'] = '' ;
|
| 76 |
$_POST['password'] = '' ;
|
62 |
$_POST['password'] = '' ;
|
| 77 |
return $res.AUTH_formulaire_login() ;
|
63 |
return $res.AUTH_formulaire_login() ;
|
| - |
|
64 |
}
|
| - |
|
65 |
|
| - |
|
66 |
//cas de la désinscription-------------------------------------------------------------------------------
|
| - |
|
67 |
if ($_REQUEST['action'] == 'supprimer') {
|
| 78 |
}
|
68 |
$id_utilisateur = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
|
| 79 |
|
69 |
$resultat = $GLOBALS['AUTH']->removeUser($GLOBALS['AUTH']->getUsername()) ;
|
| 80 |
//cas de la désinscription-------------------------------------------------------------------------------
|
70 |
if (PEAR::isError($resultat)) {
|
| 81 |
if ($_REQUEST['action'] == 'supprimer') {
|
71 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
| 82 |
$id_utilisateur = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
|
72 |
}
|
| 83 |
// Suppression dans SPIP
|
73 |
// Suppression dans SPIP
|
| 84 |
if (INS_UTILISE_SPIP) {
|
74 |
if (INS_UTILISE_SPIP) {
|
| 85 |
desinscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) ;
|
75 |
desinscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) ;
|
| 86 |
}
|
76 |
}
|
| 87 |
// Suppression dans Wikini
|
77 |
// Suppression dans Wikini
|
| 88 |
if (INS_UTILISE_WIKINI) {
|
78 |
if (INS_UTILISE_WIKINI) {
|
| 89 |
$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_NOM_WIKINI) ;
|
79 |
$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_NOM_WIKI) ;
|
| 90 |
desinscription_interwikini_users($nom_wiki) ;
|
80 |
desinscription_interwikini_users($nom_wiki) ;
|
| 91 |
}
|
81 |
}
|
| 92 |
// Appel des actions desinscriptions des applications clientes
|
82 |
// Appel des actions desinscriptions des applications clientes
|
| 93 |
$d = dir(GEN_CHEMIN_CLIENT);
|
83 |
$d = dir(GEN_CHEMIN_CLIENT);
|
| 94 |
while (false !== ($repertoire = $d->read())) {
|
- |
|
| 95 |
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
|
- |
|
| 96 |
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;
|
- |
|
| 97 |
}
|
- |
|
| 98 |
$d->close();
|
- |
|
| 99 |
|
- |
|
| 100 |
$resultat = $GLOBALS['AUTH']->removeUser($GLOBALS['AUTH']->getUsername()) ;
|
- |
|
| 101 |
if (PEAR::isError($resultat)) {
|
84 |
while (false !== ($repertoire = $d->read())) {
|
| 102 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
85 |
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
|
| 103 |
}
|
86 |
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;
|
| 104 |
|
87 |
}
|
| Line 121... |
Line 104... |
| 121 |
if ($_REQUEST['form_structure']==1) {
|
104 |
if ($_REQUEST['form_structure']==1) {
|
| 122 |
$formulaire->formulaireStructure() ;
|
105 |
$formulaire->formulaireStructure() ;
|
| 123 |
}
|
106 |
}
|
| 124 |
}
|
107 |
}
|
| Line 125... |
Line -... |
| 125 |
|
- |
|
| 126 |
// On ajoute la règle de vérification mail uniquement lors de l inscription
|
- |
|
| 127 |
if ($_REQUEST['action'] == 'inscription') {
|
- |
|
| 128 |
$formulaire->registerRule('doublonmail', 'callback', 'verif_doublonMail');
|
- |
|
| 129 |
$formulaire->addRule('email', INS_MAIL_DOUBLE, 'doublonmail', true);
|
- |
|
| 130 |
}
|
108 |
|
| 131 |
//pour la modification d'une inscription, on charge les valeurs par défauts
|
109 |
//pour la modification d'une inscription, on charge les valeurs par défauts
|
| 132 |
if ($_REQUEST['action'] == 'modifier') {
|
110 |
if ($_REQUEST['action'] == 'modifier') {
|
| 133 |
$formulaire->addElement('hidden', 'action', 'modifier_v') ;
|
111 |
$formulaire->addElement('hidden', 'action', 'modifier_v') ;
|
| 134 |
$formulaire->setDefaults(formulaire_defaults()) ;
|
112 |
$formulaire->setDefaults(formulaire_defaults()) ;
|
| Line 137... |
Line 115... |
| 137 |
if ($_REQUEST['action'] == 'inscription') {
|
115 |
if ($_REQUEST['action'] == 'inscription') {
|
| 138 |
if ($GLOBALS['AUTH']->getAuth()) {
|
116 |
if ($GLOBALS['AUTH']->getAuth()) {
|
| Line 139... |
Line 117... |
| 139 |
|
117 |
|
| 140 |
} else {
|
118 |
} else {
|
| 141 |
$formulaire->addElement('hidden', 'action', 'inscription_v') ;
|
119 |
$formulaire->addElement('hidden', 'action', 'inscription_v') ;
|
| 142 |
$formulaire->setDefaults(array('pays' => 'fr', 'visible' => 1,'lettre'=>1));
|
120 |
$formulaire->setDefaults(array('pays' => 'FR', 'visible' => 1));
|
| 143 |
}
|
121 |
}
|
| Line 144... |
Line 122... |
| 144 |
}
|
122 |
}
|
| 145 |
|
123 |
|
| 146 |
if ($_REQUEST['action'] == 'inscription_v') {
|
124 |
if ($_REQUEST['action'] == 'inscription_v') {
|
| 147 |
if ($formulaire->validate()) {
|
125 |
if ($formulaire->validate()) {
|
| 148 |
if (INS_MAIL_VALIDATION_INSCRIPTION) {
|
126 |
if (INS_MAIL_VALIDATION_INSCRIPTION) {
|
| 149 |
$formulaire->process('inscription_demande', false) ;
|
127 |
$formulaire->process('demande_inscription', false) ;
|
| 150 |
return $res.INS_MESSAGE_INSCRIPTION;
|
128 |
return $res.INS_MESSAGE_INSCRIPTION;
|
| 151 |
} else {
|
- |
|
| 152 |
$formulaire->process('inscription_validee', false) ;
|
- |
|
| 153 |
$id_utilisateur = $GLOBALS['ins_db']->getOne('SELECT MAX('.INS_CHAMPS_ID.') FROM '.INS_ANNUAIRE) ;
|
- |
|
| 154 |
// Appel des actions des inscriptions des applications clientes
|
- |
|
| 155 |
$d = dir(GEN_CHEMIN_CLIENT);
|
- |
|
| 156 |
while (false !== ($repertoire = $d->read())) {
|
- |
|
| 157 |
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
|
- |
|
| 158 |
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
|
- |
|
| 159 |
}
|
129 |
} else {
|
| 160 |
$d->close();
|
130 |
$formulaire->process('inscription_validee', false) ;
|
| 161 |
return $res.info();
|
- |
|
| 162 |
}
|
- |
|
| 163 |
} else {
|
- |
|
| 164 |
// Si le formulaire n'est pas bon on remet l'action à inscription_v
|
131 |
return $res.info();
|
| 165 |
$formulaire->addElement('hidden', 'action', 'inscription_v') ;
|
132 |
}
|
| 166 |
}
|
133 |
}
|
| 167 |
}
|
134 |
}
|
| 168 |
if ($_REQUEST['action'] == 'modifier_v') {
|
135 |
if ($_REQUEST['action'] == 'modifier_v') {
|
| 169 |
if ($formulaire->validate()) {
|
- |
|
| 170 |
$formulaire->process('inscription_mise_a_jour', false) ;
|
136 |
if ($formulaire->validate()) {
|
| 171 |
} else {
|
137 |
$formulaire->process('mise_a_jour', false) ;
|
| 172 |
return $formulaire->toHTML();
|
- |
|
| 173 |
}
|
138 |
return $res.info();
|
| Line 174... |
Line 139... |
| 174 |
return $res.info();
|
139 |
}
|
| 175 |
}
|
140 |
}
|
| Line 187... |
Line 152... |
| 187 |
if ($resultat->numRows() == 0) {
|
152 |
if ($resultat->numRows() == 0) {
|
| 188 |
return $res.INS_MESSAGE_EXPIRATION;
|
153 |
return $res.INS_MESSAGE_EXPIRATION;
|
| 189 |
}
|
154 |
}
|
| 190 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
|
155 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
|
| 191 |
$donnees = unserialize (stripslashes($ligne->id_donnees)) ;
|
156 |
$donnees = unserialize (stripslashes($ligne->id_donnees)) ;
|
| 192 |
$id_utilisateur = insertion($donnees) ;
|
157 |
insertion($donnees) ;
|
| 193 |
$GLOBALS['AUTH']->username = $donnees['email'] ;
|
158 |
$GLOBALS['AUTH']->username = $donnees['email'] ;
|
| 194 |
$GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
|
159 |
$GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
|
| Line 195... |
Line 160... |
| 195 |
|
160 |
|
| 196 |
// On loggue l'utilisateur
|
161 |
// On loggue l'utilisateur
|
| Line 204... |
Line 169... |
| 204 |
$requete = 'delete from inscription_demande where id_identifiant_session="'.$_GET['id'].'"' ;
|
169 |
$requete = 'delete from inscription_demande where id_identifiant_session="'.$_GET['id'].'"' ;
|
| 205 |
$resultat = $GLOBALS['ins_db']->query($requete) ;
|
170 |
$resultat = $GLOBALS['ins_db']->query($requete) ;
|
| 206 |
if (DB::isError($resultat)) {
|
171 |
if (DB::isError($resultat)) {
|
| 207 |
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
|
172 |
die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
|
| 208 |
}
|
173 |
}
|
| 209 |
// Appel des actions desinscriptions des applications clientes
|
- |
|
| 210 |
$d = dir(GEN_CHEMIN_CLIENT);
|
- |
|
| 211 |
while (false !== ($repertoire = $d->read())) {
|
- |
|
| 212 |
if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
|
- |
|
| 213 |
include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
|
- |
|
| 214 |
}
|
- |
|
| 215 |
$d->close();
|
- |
|
| 216 |
envoie_mail() ;
|
174 |
envoie_mail() ;
|
| 217 |
}
|
175 |
}
|
| Line 218... |
Line 176... |
| 218 |
|
176 |
|
| 219 |
if ((!$GLOBALS['AUTH']->getAuth())&&($_REQUEST['action']!='inscription')&&($_REQUEST['action']!='inscription_v')) {
|
177 |
if ((!$GLOBALS['AUTH']->getAuth())&&($_REQUEST['action']!='inscription')&&($_REQUEST['action']!='inscription_v')) {
|
| Line 222... |
Line 180... |
| 222 |
} else {
|
180 |
} else {
|
| 223 |
$res .= AUTH_formulaire_login() ;
|
181 |
$res .= AUTH_formulaire_login() ;
|
| 224 |
}
|
182 |
}
|
| 225 |
}
|
183 |
}
|
| Line 226... |
Line 184... |
| 226 |
|
184 |
|
| 227 |
//cas d'une authentification réussie---------------------------------------------------------------------
|
185 |
//cas d'une authentification ràussie---------------------------------------------------------------------
|
| 228 |
if ($GLOBALS['AUTH']->getAuth() && ($_REQUEST['action']!='modifier')) {
|
186 |
if ($GLOBALS['AUTH']->getAuth() && ($_REQUEST['action']!='modifier')) {
|
| 229 |
return info() ;
|
187 |
return info() ;
|
| Line 230... |
Line 188... |
| 230 |
}
|
188 |
}
|
| 231 |
|
189 |
|
| Line 232... |
Line 190... |
| 232 |
return $res ;
|
190 |
return $res ;
|
| 233 |
}
|
191 |
}
|
| 234 |
|
192 |
|
| 235 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
| 236 |
*
|
- |
|
| 237 |
* $Log: not supported by cvs2svn $
|
- |
|
| 238 |
* Revision 1.20 2006/12/01 13:23:17 florian
|
- |
|
| 239 |
* integration annuaire backoffice
|
- |
|
| 240 |
*
|
- |
|
| 241 |
* Revision 1.19 2006/10/05 13:53:54 florian
|
- |
|
| 242 |
* amélioration des fichiers sql
|
- |
|
| 243 |
*
|
- |
|
| 244 |
* Revision 1.18 2006/07/20 09:48:07 alexandre_tb
|
- |
|
| 245 |
* réglages
|
- |
|
| 246 |
*
|
- |
|
| 247 |
* Revision 1.17 2006/07/06 10:33:30 alexandre_tb
|
- |
|
| 248 |
* correction bug du à dernière mise à jour
|
- |
|
| 249 |
*
|
- |
|
| 250 |
* Revision 1.16 2006/07/04 09:38:31 alexandre_tb
|
- |
|
| 251 |
* Ajout de la règle doublon email uniquement lors de création d'une entrée
|
- |
|
| 252 |
*
|
- |
|
| 253 |
* Revision 1.15 2006/06/01 10:00:35 alexandre_tb
|
- |
|
| 254 |
* correction bug désinscription des appli cliente
|
- |
|
| 255 |
*
|
- |
|
| 256 |
* Revision 1.14 2006/04/10 09:48:16 alexandre_tb
|
- |
|
| 257 |
* Correction de bug pour les inscriptions aux autres applications
|
- |
|
| 258 |
*
|
- |
|
| 259 |
* Revision 1.13 2006/04/04 12:23:05 florian
|
- |
|
| 260 |
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
|
- |
|
| 261 |
*
|
- |
|
| 262 |
* Revision 1.12 2006/03/15 11:05:45 alexandre_tb
|
- |
|
| 263 |
* ajout de l'action caché inscription_v lors du réaffichage du formulaire après erreur de saisie.
|
- |
|
| 264 |
*
|
- |
|
| 265 |
* Revision 1.11 2006/03/02 14:10:35 alexandre_tb
|
- |
|
| 266 |
* correction du bug desinscription wikini
|
- |
|
| 267 |
*
|
- |
|
| 268 |
* Revision 1.10 2006/03/02 13:03:45 alexandre_tb
|
- |
|
| 269 |
* bug de désinscription interwikini_users
|
- |
|
| 270 |
*
|
- |
|
| 271 |
* Revision 1.9 2006/02/28 14:08:27 alexandre_tb
|
- |
|
| 272 |
* appel des inscriptions des autres appli, sous le format:
|
- |
|
| 273 |
* client/appli/appli.inscription.php
|
- |
|
| 274 |
*
|
- |
|
| 275 |
* Revision 1.8 2006/02/14 10:21:08 alexandre_tb
|
193 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 276 |
* ajout d'un appel à un fichier de classe personnalisé
|
194 |
*
|
| 277 |
*
|
195 |
* $Log: not supported by cvs2svn $
|
| 278 |
* Revision 1.7 2005/12/19 13:16:14 alexandre_tb
|
196 |
* Revision 1.7 2005/12/19 13:16:14 alexandre_tb
|
| 279 |
* correction d'un bug
|
197 |
* correction d'un bug
|