Subversion Repositories Applications.papyrus

Rev

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

Rev 979 Rev 1081
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.19 2006-10-05 13:53:54 florian Exp $
22
// CVS : $Id: inscription.php,v 1.20 2006-12-01 13:23:17 florian 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.19 $ $Date: 2006-10-05 13:53:54 $
35
*@version       $Revision: 1.20 $ $Date: 2006-12-01 13:23:17 $
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 INS_CHEMIN_APPLI.'bibliotheque/inscription.fonct.php';
42
include_once 'configuration/bottin.config.inc.php';
Line 44... Line 43...
44
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
43
include_once INS_CHEMIN_APPLI.'bibliotheque/bottin.fonct.php';
45
 
44
 
46
// Inclusion d'une classe personnalisé si elle existe
45
// Inclusion d'une classe personnalisé si elle existe
Line 51... Line 50...
51
}
50
}
Line 52... Line 51...
52
 
51
 
53
// +------------------------------------------------------------------------------------------------------+
52
// +------------------------------------------------------------------------------------------------------+
54
// |                                           LISTE de FONCTIONS                                         |
53
// |                                           LISTE de FONCTIONS                                         |
55
// +------------------------------------------------------------------------------------------------------+
54
// +------------------------------------------------------------------------------------------------------+
-
 
55
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']) 
-
 
56
or (isset($_REQUEST['action'])&&($_REQUEST['action']=='modifier_v'||$_REQUEST['action']=='modifier_v'))
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 ($GLOBALS['AUTH']->getAuth() && ($_REQUEST['action']!='modifier')) ) {
57
	//---------------le menu de l'appli-----------
58
	//---------------le menu de l'appli-----------
58
	function afficherContenuNavigation () {
59
	function afficherContenuNavigation () {
59
		$res =inscription_onglets();
60
		$res =inscription_onglets();
60
		return $res ;
61
		return $res ;
Line 70... Line 71...
70
//cas de la déconnexion----------------------------------------------------------------------------------
71
//cas de la déconnexion----------------------------------------------------------------------------------
71
    if ($_REQUEST['action'] == 'deconnexion') {
72
    if ($_REQUEST['action'] == 'deconnexion') {
72
        $GLOBALS['AUTH']->logout() ;
73
        $GLOBALS['AUTH']->logout() ;
73
        $_POST['username'] = '' ;
74
        $_POST['username'] = '' ;
74
        $_POST['password'] = '' ;
75
        $_POST['password'] = '' ;
75
        return $res.AUTH_formulaire_login() ;
76
        return $res.inscription_AUTH_formulaire_login() ;
76
    }
77
    }
Line 77... Line 78...
77
    
78
    
78
//cas de la désinscription-------------------------------------------------------------------------------
79
//cas de la désinscription-------------------------------------------------------------------------------
79
    if ($_REQUEST['action'] == 'supprimer') {
80
    if ($_REQUEST['action'] == 'supprimer') {
Line 101... Line 102...
101
        }
102
        }
Line 102... Line 103...
102
        
103
        
103
        
104
        
104
		// Deconnection        
105
		// Deconnection        
105
        $GLOBALS['AUTH']->logout() ;
106
        $GLOBALS['AUTH']->logout() ;
Line 106... Line 107...
106
        return $res.AUTH_formulaire_login() ;
107
        return $res.inscription_AUTH_formulaire_login() ;
107
    }
108
    }
108
    
109
    
109
//cas de l'envoi de mot de passe par mail----------------------------------------------------------------
110
//cas de l'envoi de mot de passe par mail----------------------------------------------------------------
Line 110... Line 111...
110
    if ($_REQUEST['action'] == 'sendpasswd') {
111
    if ($_REQUEST['action'] == 'sendpasswd') {
111
        return envoie_passe()."\n".formulaire_envoi_passe() ;
112
        return inscription_envoie_passe()."\n".inscription_formulaire_envoi_passe() ;
112
    }
113
    }
Line 127... Line 128...
127
	        $formulaire->addRule('email', INS_MAIL_DOUBLE, 'doublonmail', true);
128
	        $formulaire->addRule('email', INS_MAIL_DOUBLE, 'doublonmail', true);
128
        }
129
        }
129
        //pour la modification d'une inscription, on charge les valeurs par défauts
130
        //pour la modification d'une inscription, on charge les valeurs par défauts
130
        if ($_REQUEST['action'] == 'modifier') {
131
        if ($_REQUEST['action'] == 'modifier') {
131
            $formulaire->addElement('hidden', 'action', 'modifier_v') ;
132
            $formulaire->addElement('hidden', 'action', 'modifier_v') ;
132
            $formulaire->setDefaults(formulaire_defaults()) ;
133
            $formulaire->setDefaults(inscription_formulaire_defaults()) ;
133
        }
134
        }
Line 134... Line 135...
134
	
135
	
135
        if ($_REQUEST['action'] == 'inscription') {
136
        if ($_REQUEST['action'] == 'inscription') {
Line 142... Line 143...
142
        }
143
        }
Line 143... Line 144...
143
	
144
	
144
        if ($_REQUEST['action'] == 'inscription_v') {
145
        if ($_REQUEST['action'] == 'inscription_v') {
145
            if ($formulaire->validate()) {
146
            if ($formulaire->validate()) {
146
			    if (INS_MAIL_VALIDATION_INSCRIPTION) {
147
			    if (INS_MAIL_VALIDATION_INSCRIPTION) {
147
				    $formulaire->process('demande_inscription', false) ;
148
				    $formulaire->process('inscription_demande', false) ;
148
				    return $res.INS_MESSAGE_INSCRIPTION;
149
				    return $res.INS_MESSAGE_INSCRIPTION;
149
			    } else {
150
			    } else {
150
				    $formulaire->process('inscription_validee', false) ;
151
				    $formulaire->process('inscription_validee', false) ;				    
151
				    $id_utilisateur = $GLOBALS['ins_db']->getOne('select '.INS_CHAMPS_ID.' from '.INS_ANNUAIRE.' where '.
-
 
152
				    												INS_CHAMPS_MAIL.'="'.$GLOBALS['AUTH']->getAuthData(INS_CHAMSP_MAIL).'"') ;
152
				    $id_utilisateur = $GLOBALS['ins_db']->getOne('SELECT MAX('.INS_CHAMPS_ID.') FROM '.INS_ANNUAIRE) ;				    
153
				    // Appel des actions des inscriptions des applications clientes
153
				    // Appel des actions des inscriptions des applications clientes
154
			        $d = dir(GEN_CHEMIN_CLIENT);
154
			        $d = dir(GEN_CHEMIN_CLIENT);
155
					while (false !== ($repertoire = $d->read())) {
155
					while (false !== ($repertoire = $d->read())) {
156
						if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
156
						if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.$repertoire.'.inscription.inc.php'))
Line 164... Line 164...
164
            	$formulaire->addElement('hidden', 'action', 'inscription_v') ;	
164
            	$formulaire->addElement('hidden', 'action', 'inscription_v') ;	
165
            }
165
            }
166
        }
166
        }
167
        if ($_REQUEST['action'] == 'modifier_v') {
167
        if ($_REQUEST['action'] == 'modifier_v') {
168
            if ($formulaire->validate()) {
168
            if ($formulaire->validate()) {
169
                $formulaire->process('mise_a_jour', false) ;
169
                $formulaire->process('inscription_mise_a_jour', false) ;
170
            } else {
170
            } else {
171
            	return $formulaire->toHTML();
171
            	return $formulaire->toHTML();
172
            }
172
            }
173
            return $res.info();
173
            return $res.info();
174
        }
174
        }
Line 186... Line 186...
186
	    if ($resultat->numRows() == 0) {
186
	    if ($resultat->numRows() == 0) {
187
		    return $res.INS_MESSAGE_EXPIRATION;
187
		    return $res.INS_MESSAGE_EXPIRATION;
188
	    }
188
	    }
189
	    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
189
	    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
190
	    $donnees = unserialize (stripslashes($ligne->id_donnees)) ;
190
	    $donnees = unserialize (stripslashes($ligne->id_donnees)) ;
191
	    $id_utilisateur = insertion($donnees) ;
191
	    $id_utilisateur = inscription_insertion($donnees) ;
192
	    $GLOBALS['AUTH']->username = $donnees['email'] ;
192
	    $GLOBALS['AUTH']->username = $donnees['email'] ;
193
	    $GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
193
	    $GLOBALS['AUTH']->password = $donnees['mot_de_passe'] ;
Line 194... Line 194...
194
	    
194
	    
195
	    // On loggue l'utilisateur
195
	    // On loggue l'utilisateur
Line 215... Line 215...
215
	    envoie_mail() ;
215
	    envoie_mail() ;
216
    }
216
    }
Line 217... Line 217...
217
    
217
    
218
    if ((!$GLOBALS['AUTH']->getAuth())&&($_REQUEST['action']!='inscription')&&($_REQUEST['action']!='inscription_v')) {    
218
    if ((!$GLOBALS['AUTH']->getAuth())&&($_REQUEST['action']!='inscription')&&($_REQUEST['action']!='inscription_v')) {    
219
        if (isset($_POST['username']) && $_POST['username'] != '') {
219
        if (isset($_POST['username']) && $_POST['username'] != '') {
220
            $res .= '<p class="erreur">'.INS_ERREUR_LOGIN.'</p><br />'."\n".formulaire_envoi_passe();
220
            $res .= '<p class="erreur">'.INS_ERREUR_LOGIN.'</p><br />'."\n".inscription_formulaire_envoi_passe();
221
        } else {
221
        } else {
222
            $res .= AUTH_formulaire_login() ;
222
            $res .= inscription_AUTH_formulaire_login() ;
223
        }
223
        }
Line 224... Line 224...
224
    }
224
    }
225
    
225
    
Line 232... Line 232...
232
}
232
}
Line 233... Line 233...
233
 
233
 
234
/* +--Fin du code ----------------------------------------------------------------------------------------+
234
/* +--Fin du code ----------------------------------------------------------------------------------------+
235
*
235
*
-
 
236
* $Log: not supported by cvs2svn $
-
 
237
* Revision 1.19  2006/10/05 13:53:54  florian
-
 
238
* amélioration des fichiers sql
236
* $Log: not supported by cvs2svn $
239
*
237
* Revision 1.18  2006/07/20 09:48:07  alexandre_tb
240
* Revision 1.18  2006/07/20 09:48:07  alexandre_tb
238
* réglages
241
* réglages
239
*
242
*
240
* Revision 1.17  2006/07/06 10:33:30  alexandre_tb
243
* Revision 1.17  2006/07/06 10:33:30  alexandre_tb