Subversion Repositories Applications.papyrus

Rev

Rev 1298 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1298 Rev 1421
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.23 2007-04-11 08:30:12 neiluj Exp $
22
// CVS : $Id: inscription.php,v 1.24 2007-05-25 14:31:10 alexandre_tb 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 29... Line 29...
29
*@package inscription
29
*@package inscription
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-2007
35
*@version       $Revision: 1.23 $ $Date: 2007-04-11 08:30:12 $
35
*@version       $Revision: 1.24 $ $Date: 2007-05-25 14:31:10 $
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';
42
include_once 'configuration/bottin.config.inc.php';
43
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
-
 
-
 
43
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
-
 
44
include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.fonct.php';
44
 
45
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.class.php';
45
// Inclusion d'une classe personnalisé si elle existe
46
// Inclusion d'une classe personnalisé si elle existe
46
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
47
if (file_exists (INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php')) {
47
	include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;	
48
	include_once INS_CHEMIN_APPLI.'bibliotheque/inscription.class.local.php' ;	
48
} else {
49
} else {
Line 69... Line 70...
69
}
70
}
Line 70... Line 71...
70
 
71
 
71
function afficherContenuCorps() {
72
function afficherContenuCorps() {
Line -... Line 73...
-
 
73
    $res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
-
 
74
 
72
    $res = '<h1>'.INS_TITRE_INSCRIPTION.'</h1>'."\n" ;
75
    // Recuperation de la configuration
73
 
76
     $GLOBALS ['ins_config'] = inscription::getConfig();
74
    
77
 
75
//cas de la déconnexion----------------------------------------------------------------------------------
78
//cas de la déconnexion----------------------------------------------------------------------------------
76
    if ($_REQUEST['action'] == 'deconnexion') {
79
    if ($_REQUEST['action'] == 'deconnexion') {
77
        $GLOBALS['AUTH']->logout() ;
80
        $GLOBALS['AUTH']->logout() ;
Line 90... Line 93...
90
		// Suppression dans Wikini
93
		// Suppression dans Wikini
91
        if (INS_UTILISE_WIKINI) {
94
        if (INS_UTILISE_WIKINI) {
92
			$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_NOM_WIKINI) ;
95
			$nom_wiki = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_NOM_WIKINI) ;
93
			desinscription_interwikini_users($nom_wiki) ;
96
			desinscription_interwikini_users($nom_wiki) ;
94
        }
97
        }
-
 
98
        $msg = '';
95
        // Appel des actions desinscriptions des applications clientes
99
        // Appel des actions desinscriptions des applications clientes
96
        $d = dir(GEN_CHEMIN_CLIENT);
100
        $d = dir(GEN_CHEMIN_CLIENT);
97
		while (false !== ($repertoire = $d->read())) {
101
		while (false !== ($repertoire = $d->read())) {
-
 
102
			if ($repertoire != '.' || $repertoire != '..') {
98
			if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
103
				if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php'))
99
			include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;   
104
				include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.desinscription.inc.php' ;   
-
 
105
			}
-
 
106
			if ($msg != '') $res .= $msg;
100
		}
107
		}
101
		$d->close();
108
		$d->close();
Line 102... Line 109...
102
		
109
		
103
    	$resultat = $GLOBALS['AUTH']->removeUser($GLOBALS['AUTH']->getUsername()) ;	
110
    	$resultat = $GLOBALS['AUTH']->removeUser($GLOBALS['AUTH']->getUsername()) ;	
Line 117... Line 124...
117
    }
124
    }
Line 118... Line 125...
118
 
125
 
119
//cas de la saisie ou la modification de l'inscription individuelle ou structure
126
//cas de la saisie ou la modification de l'inscription individuelle ou structure
120
    if (($_REQUEST['action'] == 'modifier')or($_REQUEST['action'] == 'modifier_v')or($_REQUEST['action'] == 'inscription')or($_REQUEST['action'] == 'inscription_v')) {
127
    if (($_REQUEST['action'] == 'modifier')or($_REQUEST['action'] == 'modifier_v')or($_REQUEST['action'] == 'inscription')or($_REQUEST['action'] == 'inscription_v')) {
-
 
128
        $formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()), '_self', '', 0) ;
-
 
129
        if ($_REQUEST['action'] == 'modifier') {
-
 
130
            $formulaire->setDefaults(inscription_formulaire_defaults()) ;
121
        $formulaire = new HTML_formulaireInscription('formulaire_inscription', 'post', preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()), '_self', '', 0) ;
131
        }
122
        $formulaire->construitFormulaire(preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()));
132
        $formulaire->construitFormulaire(preg_replace('/&amp;/', '&', $GLOBALS['ins_url']->getURL()));
123
        if (isset($_REQUEST['form_structure'])) {
133
        if (isset($_REQUEST['form_structure'])) {
124
        	if ($_REQUEST['form_structure']==1) {
134
        	if ($_REQUEST['form_structure']==1) {
125
        		$formulaire->formulaireStructure() ;
135
        		$formulaire->formulaireStructure() ;
Line 146... Line 156...
146
            }
156
            }
147
        }
157
        }
Line 148... Line 158...
148
	
158
	
149
        if ($_REQUEST['action'] == 'inscription_v') {
159
        if ($_REQUEST['action'] == 'inscription_v') {
150
            if ($formulaire->validate()) {
160
            if ($formulaire->validate()) {
151
			    if (INS_MAIL_VALIDATION_INSCRIPTION) {
161
			    if ($GLOBALS['ins_config']['ic_mail_valide_inscription']) {
152
				    $formulaire->process('inscription_demande', false) ;
162
				    $formulaire->process('inscription_demande', false) ;
153
				    return $res.INS_MESSAGE_INSCRIPTION;
163
				    return $res.INS_MESSAGE_INSCRIPTION;
-
 
164
			    } else {
-
 
165
				    if ($GLOBALS['ins_config']['ic_inscription_modere']) {
-
 
166
				    	return inscription::demandeInscriptionModere($formulaire->getSubmitValues());	
154
			    } else {
167
				    }				    
155
				    $formulaire->process('inscription_validee', false) ;				    
168
				    $formulaire->process('inscription_validee', false) ;				    
156
				    $id_utilisateur = $GLOBALS['ins_db']->getOne('SELECT MAX('.INS_CHAMPS_ID.') FROM '.INS_ANNUAIRE) ;				    
169
				    $id_utilisateur = $GLOBALS['ins_db']->getOne('SELECT MAX('.INS_CHAMPS_ID.') FROM '.INS_ANNUAIRE) ;				    
157
				    // Appel des actions des inscriptions des applications clientes
170
				    // Appel des actions des inscriptions des applications clientes
158
			        $d = dir(GEN_CHEMIN_CLIENT);
171
			        $d = dir(GEN_CHEMIN_CLIENT);
-
 
172
					while (false !== ($repertoire = $d->read())) {
159
					while (false !== ($repertoire = $d->read())) {
173
						if ($repertoire != '.' && $repertoire != '..') {
160
						if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
174
							if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
-
 
175
							include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;
161
						include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;   
176
						}   
162
					}
177
					}
163
					$d->close();
178
					$d->close();
164
				    return $res.info();
179
				    return $res.info();
165
			    }
180
			    }
Line 179... Line 194...
179
	
194
	
180
        return $res.$formulaire->toHTML() ;
195
        return $res.$formulaire->toHTML() ;
Line 181... Line 196...
181
    }
196
    }
182
    
197
    
183
//cas de la validation par mail d'une inscription--------------------------------------------------------
-
 
184
    if ((INS_MAIL_VALIDATION_INSCRIPTION)and(isset($_GET['id']))) {
-
 
185
	    $requete = 'SELECT id_donnees FROM inscription_demande WHERE id_identifiant_session="'.$_GET['id'].'"' ;
-
 
186
	    $resultat = $GLOBALS['ins_db']->query($requete) ;
-
 
187
	    if (DB::isError ($resultat)) {
-
 
188
		    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
-
 
189
	    }
-
 
190
	    if ($resultat->numRows() == 0) {
198
//cas de la validation par mail d'une inscription--------------------------------------------------------
191
		    return $res.INS_MESSAGE_EXPIRATION;
-
 
192
	    }
199
    if ($GLOBALS['ins_config']['ic_mail_valide_inscription'] && isset($_GET['id'])) {
193
	    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
-
 
194
	    $donnees = unserialize (stripslashes($ligne->id_donnees)) ;
200
	    
195
	    $id_utilisateur = inscription_insertion($donnees) ;
-
 
Line -... Line 201...
-
 
201
	    // si l inscription est modere on place la demande en attente
-
 
202
	    // et on envoie un mail au moderateur
-
 
203
	    
196
	    $GLOBALS['AUTH']->username = $donnees['email'] ;
204
	    if ($GLOBALS['ins_config']['ic_inscription_modere']) {
-
 
205
	    			
197
	    $GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
206
			$requete_attente = 'insert into inscription_attente select * from inscription_demande where id_identifiant_session="'.
-
 
207
	    					$_GET['id'].'"';
-
 
208
			$resultat = $GLOBALS['ins_db']->query($requete_attente);
-
 
209
			if (DB::isError ($resultat)) {
-
 
210
		    	return ("Echec de la requete : $requete<br />".$resultat->getMessage());
-
 
211
	    	}
-
 
212
	    	$mails_moderateur = split ('/\n/', $GLOBALS['ins_config']['ic_mail_moderateur']);
-
 
213
	    	foreach ($mails_moderateur as $mail) {
-
 
214
	    		mail ($mail, INS_MODERATION_SUJET, INS_NOUVELLE_INSCRIPTION_A_MODERE) ;
Line -... Line 215...
-
 
215
	    	}
-
 
216
	    	
-
 
217
	    } else {
-
 
218
	    
-
 
219
		    $requete = 'SELECT id_donnees FROM inscription_demande WHERE id_identifiant_session="'.$_GET['id'].'"' ;
-
 
220
		    $resultat = $GLOBALS['ins_db']->query($requete) ;
-
 
221
		    if (DB::isError ($resultat)) {
-
 
222
			    return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
-
 
223
		    }
-
 
224
		    if ($resultat->numRows() == 0) {
-
 
225
			    return $res.INS_MESSAGE_EXPIRATION;
-
 
226
		    }
-
 
227
		    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
-
 
228
		    $donnees = unserialize (stripslashes($ligne->id_donnees)) ;
-
 
229
		    $id_utilisateur = inscription_insertion($donnees) ;
-
 
230
		    $GLOBALS['AUTH']->username = $donnees['email'] ;
-
 
231
		    $GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
198
	    
232
		    
199
	    // On loggue l'utilisateur
233
		    // On loggue l'utilisateur
200
	    $GLOBALS['AUTH']->login() ;
234
		    $GLOBALS['AUTH']->login() ;
-
 
235
		    
-
 
236
		    // inscription à la lettre d'information
-
 
237
		    if (isset ($donnees['lettre'])) {
-
 
238
			    inscription_lettre($GLOBALS['ins_config']['ic_mail_inscription_news']) ;
-
 
239
		    }
-
 
240
		    // Appel des actions des inscriptions des applications clientes
-
 
241
	        $d = dir(GEN_CHEMIN_CLIENT);
-
 
242
			while (false !== ($repertoire = $d->read())) {
-
 
243
				if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
201
	    
244
				include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;   
202
	    // inscription à la lettre d'information
245
			}
203
	    if (isset ($donnees['lettre'])) {
246
			$d->close();
204
		    inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
247
		    envoie_mail() ;
205
	    }
248
	    }
206
	    // On supprime la demande d'inscription
249
	    // On supprime la demande d'inscription
207
	    $requete = 'delete from inscription_demande where id_identifiant_session="'.$_GET['id'].'"' ;
250
	    $requete = 'delete from inscription_demande where id_identifiant_session="'.$_GET['id'].'"' ;
208
	    $resultat = $GLOBALS['ins_db']->query($requete) ;
-
 
209
	    if (DB::isError($resultat)) {
-
 
210
		    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
-
 
211
	    }
-
 
212
	    // Appel des actions desinscriptions des applications clientes
-
 
213
        $d = dir(GEN_CHEMIN_CLIENT);
251
	    $resultat = $GLOBALS['ins_db']->query($requete) ;
214
		while (false !== ($repertoire = $d->read())) {
-
 
215
			if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
-
 
216
			include_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php' ;   
252
	    if (DB::isError($resultat)) {
Line 217... Line 253...
217
		}
253
		    return ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
218
		$d->close();
254
	    }
219
	    envoie_mail() ;
255
	    
Line 236... Line 272...
236
}
272
}
Line 237... Line 273...
237
 
273
 
238
/* +--Fin du code ----------------------------------------------------------------------------------------+
274
/* +--Fin du code ----------------------------------------------------------------------------------------+
239
*
275
*
-
 
276
* $Log: not supported by cvs2svn $
-
 
277
* Revision 1.23  2007/04/11 08:30:12  neiluj
-
 
278
* remise en état du CVS...
240
* $Log: not supported by cvs2svn $
279
*
241
* Revision 1.20.2.1  2007/01/26 10:32:59  alexandre_tb
280
* Revision 1.20.2.1  2007/01/26 10:32:59  alexandre_tb
242
* suppression d un notice
281
* suppression d un notice
243
*
282
*
244
* Revision 1.20  2006/12/01 13:23:17  florian
283
* Revision 1.20  2006/12/01 13:23:17  florian