Subversion Repositories Applications.papyrus

Rev

Rev 787 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 787 Rev 805
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.fonct.php,v 1.13 2006-03-21 10:25:33 alexandre_tb Exp $
22
// CVS : $Id: inscription.fonct.php,v 1.14 2006-04-04 12:23:05 florian Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.13 2006-03-21 10:25:33 alexandre_tb Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.14 2006-04-04 12:23:05 florian Exp $
24
/**
24
/**
25
* Fonctions du module inscription
25
* Fonctions du module inscription
26
*
26
*
27
* Fonctions du module inscription
27
* Fonctions du module inscription
28
*
28
*
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        Aucun
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.13 $ $Date: 2006-03-21 10:25:33 $
35
*@version       $Revision: 1.14 $ $Date: 2006-04-04 12:23:05 $
36
*@version       $Revision: 1.13 $ $Date: 2006-03-21 10:25:33 $
36
*@version       $Revision: 1.14 $ $Date: 2006-04-04 12:23:05 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
41
// |                                            ENTETE du PROGRAMME                                       |
Line 42... Line 42...
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
-
 
43
 
43
 
44
include_once 'inscription.fonct.wiki.php' ;
44
include_once 'inscription.fonct.wiki.php' ;
45
include_once 'inscription.class.php' ;
45
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
46
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
46
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm.php' ;
47
require_once 'HTML/QuickForm.php' ;
Line 47... Line 48...
47
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/checkbox.php' ;
48
require_once 'HTML/QuickForm/checkbox.php' ;
48
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/password.php' ;
49
require_once 'HTML/QuickForm/password.php' ;
49
 
50
 
Line 197... Line 198...
197
		$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
198
		$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
198
	}
199
	}
199
    $requete = 'update '.INS_ANNUAIRE.' set '.
200
    $requete = 'update '.INS_ANNUAIRE.' set '.
200
                requete_annuaire ($valeur).
201
                requete_annuaire ($valeur).
201
                'where '.INS_CHAMPS_ID.'="'.$id.'"';
202
                'where '.INS_CHAMPS_ID.'="'.$id.'"';
202
    $resultat = $GLOBALS['ins_db']->query ($requete) ;echo $requete;
203
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
203
    if (DB::isError($resultat)) {
204
    if (DB::isError($resultat)) {
204
        die ($resultat->getMessage().$resultat->getDebugInfo()) ;
205
        die ($resultat->getMessage().$resultat->getDebugInfo()) ;
205
    }
206
    }
206
    unset ($resultat) ;
207
    unset ($resultat) ;
Line 223... Line 224...
223
    // Initialisation de variable pour éviter des notices
224
    // Initialisation de variable pour éviter des notices
224
    foreach (array ('adresse_1', 'adresse_2', 'ville', 'telephone', 'fax', 'site') as $val) {
225
    foreach (array ('adresse_1', 'adresse_2', 'ville', 'telephone', 'fax', 'site') as $val) {
225
    	if (!isset ($valeur[$val])) $valeur[$val] = '' ;   	
226
    	if (!isset ($valeur[$val])) $valeur[$val] = '' ;   	
226
    }
227
    }
Line 227... Line 228...
227
 
228
 
228
    $req .= INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'", '  ;
229
    //$req .= INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'", '  ;
229
    $req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
230
    $req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
230
    $req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
231
    $req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
231
            INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
232
            INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
232
            INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
233
            INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
Line 301... Line 302...
301
    $valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
302
    $valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
302
    $valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
303
    $valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
303
    $valeurs_par_defaut['fax'] = $ligne[INS_CHAMPS_FAX] ;
304
    $valeurs_par_defaut['fax'] = $ligne[INS_CHAMPS_FAX] ;
304
    if (INS_CHAMPS_STRUCTURE != '') {
305
    if (INS_CHAMPS_STRUCTURE != '') {
305
    	$valeurs_par_defaut['structure'] = $ligne[INS_CHAMPS_STRUCTURE] ;
306
    	$valeurs_par_defaut['structure'] = $ligne[INS_CHAMPS_STRUCTURE] ;
306
    	$valeurs_par_defaut['type_structure'] = $ligne['a_type_structure'];	
307
    	//$valeurs_par_defaut['type_structure'] = $ligne['a_type_structure'];	
307
    }
308
    }
308
    $valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
309
    $valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
309
    $valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
310
    $valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
310
    $valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
311
    $valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
311
    $valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
312
    $valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
Line 316... Line 317...
316
 
317
 
317
/** info() - Renvoie une fiche d'information sur la personne ou la structure
318
/** info() - Renvoie une fiche d'information sur la personne ou la structure
318
*
319
*
319
* @return   text   Code HTML de la fiche
320
* @return   text   Code HTML de la fiche
320
*/
321
*/
-
 
322
function info($id=-1) {
321
function info() {
323
	if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
322
    $requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
324
    $requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
323
               .INS_CHAMPS_ID.'="'.$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID).'"' ;          
325
               .INS_CHAMPS_ID.'="'.$id.'"' ;          
324
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
326
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
325
    if (DB::isError($resultat)) {
327
    if (DB::isError($resultat)) {
326
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
328
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
Line 327... Line 329...
327
    }
329
    }
328
 
330
 
329
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
331
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
330
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
332
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
331
    	$res = '<h1>'.INS_FICHE_STRUCTURE.'</h1>'."\n" ;
333
    	$res = '<h1>'.INS_FICHE_STRUCTURE.'</h1>'."\n" ;
332
	    $res .= '<h2>'.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
334
	    $res .= '<h2>'.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
333
	    $res .= '<dl class="affiche_infos">'."\n";
335
	    $res .= '<ul class="affiche_infos">'."\n";
334
	    $res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
336
	    $res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
335
	    if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
337
	    if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
336
    } else {
338
    } else {
337
    	$res = '<h1>'.INS_FICHE_PERSONNELLE.'</h1>'."\n" ;
339
    	$res = '<h1>'.INS_FICHE_PERSONNELLE.'</h1>'."\n" ;
338
    	$res .= '<h2>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
340
    	$res .= '<h2>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
Line 339... Line 341...
339
    	$res .= '<dl class="affiche_infos">'."\n";
341
    	$res .= '<ul class="affiche_infos">'."\n";
340
    }
342
    }
341
    
343
    
342
    $res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
344
    $res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
343
    $res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
345
    $res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
344
    $res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
346
    $res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
345
    $res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
347
    $res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
346
    $pays = new ListeDePays($GLOBALS['ins_db']) ;
348
    $pays = new ListeDePays($GLOBALS['ins_db']) ;
347
    $res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
-
 
348
    $res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
349
    $res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
349
    $res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
350
    $res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
350
    $res .= ligne_inscription('&nbsp;', '&nbsp;') ;
351
    $res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
351
    if (INS_UTILISE_WIKINI) {
352
    if (INS_UTILISE_WIKINI) {
-
 
353
		$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
352
		$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
354
	}
353
	}
355
    if ($GLOBALS['AUTH']->getAuth()) $res .= ligne_inscription(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
354
    $res .= ligne_inscription(INS_EMAIL, $ligne[INS_CHAMPS_MAIL]);
356
    else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
355
    if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
-
 
356
    	$res .= ligne_inscription(INS_SITE_INTERNET, '<a href="'.$ligne[INS_CHAMPS_SITE_INTERNET].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[INS_CHAMPS_SITE_INTERNET].'</a>');
-
 
357
    }
-
 
358
    $res .= '</dl>'."\n";
-
 
359
    $res .= '<br />'."\n";
-
 
360
    $res .= '<ul>'."\n";
-
 
361
    if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
-
 
362
    	$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
-
 
363
    } else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
-
 
364
    if ($ligne[INS_CHAMPS_LETTRE] == 1) {
-
 
365
    	$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
-
 
366
    } else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
-
 
367
    $res .= '</ul>'."\n";
-
 
368
    $res .= '<br />'."\n";
-
 
369
    $res .= '<ul>'."\n";;
-
 
370
    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=modifier&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'">'.INS_MODIFIER_INSCRIPTION.'</a></li>'."\n" ;
357
    if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
-
 
358
    	$res .= ligne_inscription(INS_SITE_INTERNET, '<a href="'.$ligne[INS_CHAMPS_SITE_INTERNET].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[INS_CHAMPS_SITE_INTERNET].'</a>');
-
 
359
    }
-
 
360
    $res .= '</ul>'."\n";
-
 
361
    if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
-
 
362
	    $res .= '<br />'."\n";
-
 
363
	    $res .= '<ul>'."\n";
-
 
364
	    if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
-
 
365
	    	$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
-
 
366
	    } else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
-
 
367
	    if ($ligne[INS_CHAMPS_LETTRE] == 1) {
-
 
368
	    	$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
-
 
369
	    } else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
-
 
370
	    $res .= '</ul>'."\n";
-
 
371
	    $res .= '<br />'."\n";
-
 
372
	    $res .= '<ul>'."\n";;
-
 
373
	    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=modifier&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'">'.INS_MODIFIER_INSCRIPTION.'</a></li>'."\n" ;
-
 
374
	    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=supprimer&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'" onclick="javascript:return confirm(\''.INS_SUPPRIMER_INSCRIPTION.'?\');">'.INS_SUPPRIMER_INSCRIPTION.'</a></li>'."\n" ;
371
    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=supprimer&amp;form_structure='.$ligne[INS_CHAMPS_EST_STRUCTURE].'" onclick="javascript:return confirm(\''.INS_SUPPRIMER_INSCRIPTION.'?\');">'.INS_SUPPRIMER_INSCRIPTION.'</a></li>'."\n" ;
375
	    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
372
    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
376
	    $res .= '</ul>'."\n";
Line 373... Line 377...
373
    $res .= '</ul>'."\n";
377
    }
Line 384... Line 388...
384
function ligne_inscription($label, $valeur) {
388
function ligne_inscription($label, $valeur) {
385
    if ($valeur == '') {
389
    if ($valeur == '') {
386
        return;
390
        return;
387
    }
391
    }
388
    if (($label == '')or($label == '&nbsp;')) {
392
    if (($label == '')or($label == '&nbsp;')) {
389
    	return '<dt>&nbsp;</dt>'."\n".'<dd>'.$valeur.'</dd>'."\n" ;
393
    	return '<li>'."\n".$valeur."\n".'</li>'."\n" ;
390
    } else {
394
    } else {
391
    	return '<dt>'.$label.' : </dt>'."\n".'<dd>'.$valeur.'</dd>'."\n" ;    	
395
    	return '<li>'."\n".'<strong>'.$label.' : </strong>'."\n".$valeur."\n".'</li>'."\n" ;    	
392
    }
396
    }
393
}
397
}
Line 394... Line 398...
394
 
398
 
Line 660... Line 664...
660
}
664
}
Line 661... Line 665...
661
 
665
 
662
/* +--Fin du code ----------------------------------------------------------------------------------------+
666
/* +--Fin du code ----------------------------------------------------------------------------------------+
663
*
667
*
-
 
668
* $Log: not supported by cvs2svn $
-
 
669
* Revision 1.13  2006/03/21 10:25:33  alexandre_tb
-
 
670
* ajout d'un template pour le mail de confirmation
664
* $Log: not supported by cvs2svn $
671
*
665
* Revision 1.12  2006/03/15 11:02:35  alexandre_tb
672
* Revision 1.12  2006/03/15 11:02:35  alexandre_tb
666
* ajout de l'insertion du prénom qui avait disparu
673
* ajout de l'insertion du prénom qui avait disparu
667
*
674
*
668
* Revision 1.11  2006/03/02 16:57:31  alexandre_tb
675
* Revision 1.11  2006/03/02 16:57:31  alexandre_tb