Subversion Repositories Applications.papyrus

Rev

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

Rev 1292 Rev 1298
Line 6... Line 6...
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later veRrsion.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
16
// | Lesser General Public License for more details.                                                      |
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.26 2007-04-06 08:35:46 neiluj Exp $
22
// CVS : $Id: inscription.fonct.php,v 1.27 2007-04-11 08:30:12 neiluj Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.26 2007-04-06 08:35:46 neiluj Exp $
23
// CVS : $Id: inscription.fonct.php,v 1.27 2007-04-11 08:30:12 neiluj 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.26 $ $Date: 2007-04-06 08:35:46 $
35
*@version       $Revision: 1.27 $ $Date: 2007-04-11 08:30:12 $
36
*@version       $Revision: 1.26 $ $Date: 2007-04-06 08:35:46 $
36
*@version       $Revision: 1.27 $ $Date: 2007-04-11 08:30:12 $
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
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
-
 
46
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm.php' ;
-
 
Line 47... Line 45...
47
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/checkbox.php' ;
45
include_once 'inscription.class.php' ;
48
require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/password.php' ;
46
if (INS_UTILISE_SPIP) include_once 'inscription.fonct.spip.php' ;
49
 
47
 
Line 50... Line 48...
50
// +------------------------------------------------------------------------------------------------------+
48
// +------------------------------------------------------------------------------------------------------+
51
// |                                           LISTE de FONCTIONS                                         |
49
// |                                           LISTE de FONCTIONS                                         |
203
    if (INS_UTILISE_SPIP) {
209
    if (INS_UTILISE_SPIP) {
204
        mod_inscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID), $valeur) ;
210
        mod_inscription_spip($GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID), $valeur) ;
205
    }
211
    }
206
}
212
}
Line 207... Line 213...
207
 
213
 
208
/** requete_annuaire () - Renvoie une chaine contenant les champs de l'annuaire avec leur valeur suite à le fonction process de QuickForm
214
/** requete_annuaire () - Renvoie une chaine contenant les champs de l'annuaire avec leur valeur suite à le fonction process de QuickForm
209
*
215
*
210
* @return   string  une requete du type champs="valeur",...
216
* @return   string  une requete du type champs="valeur",...
-
 
217
*/
-
 
218
 
-
 
219
function requete_annuaire($valeur) {
211
*/
220
    $req = INS_CHAMPS_NOM.'="'.addslashes($valeur['nom']).'", ';
212
 
-
 
213
function requete_annuaire($valeur, $maj = FALSE) {
-
 
214
    $req = INS_CHAMPS_NOM.'="'.addslashes($valeur['nom']).'", ';
-
 
215
    if (INS_UTILISE_WIKINI) {
-
 
216
    	$req .= INS_CHAMPS_NOM_WIKINI.'="'.genere_nom_wiki($valeur['nom']).'", ' ;
-
 
217
    }
-
 
218
    
-
 
219
    if($maj)
-
 
220
    {
-
 
221
    	$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
-
 
222
    	
-
 
223
    	if(!$id) die("erreur"); // ne devrai jamais arriver --julien
-
 
224
    	
-
 
Line 225... Line -...
225
    	$requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
-
 
226
               .INS_CHAMPS_ID.'="'.$id.'"' ;          
-
 
227
    	$resultat = $GLOBALS['ins_db'] -> query($requete) ; 
-
 
228
    	if (DB::isError($resultat)) {
-
 
229
    		die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
221
    if (isset($valeur['est_structure']) && $valeur['est_structure'] == 0) 
230
    	}
-
 
231
 
-
 
232
    	$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
-
 
233
    } else 
-
 
234
    	$id_utilisateur = nextId(INS_ANNUAIRE, INS_CHAMPS_ID, $GLOBALS['ins_db']) ;
-
 
235
    
-
 
236
    $req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
-
 
237
    
-
 
238
    if(is_file($_FILES['image']['tmp_name']))
-
 
239
    {
-
 
240
    	if($maj && is_file($ligne[INS_CHAMPS_AVATAR]))
-
 
241
    		@unlink($ligne[INS_CHAMPS_AVATAR]);
-
 
242
    	
222
    			$req .= INS_CHAMPS_PRENOM.'="'.addslashes($valeur['prenom']).'", ';
243
    	$chemin_destination=INS_CHEMIN_APPLI.'images/'. ($maj ? $id : $id_utilisateur) .'_'.md5($_FILES['image']['name']).'.jpg';
-
 
244
	    move_uploaded_file($_FILES['image']['tmp_name'], $chemin_destination);
-
 
245
	    
223
    // Initialisation de variable pour éviter des notices
246
    } elseif(is_file($ligne[INS_CHAMPS_AVATAR]))
-
 
247
    	$chemin_destination=$ligne[INS_CHAMPS_AVATAR];
224
    foreach (array ('adresse_1', 'adresse_2', 'ville', 'telephone', 'fax', 'site') as $val) {
248
 
225
    	if (!isset ($valeur[$val])) $valeur[$val] = '' ;   	
249
    $req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
226
    }
250
            'a_description="'.addslashes($valeur['description']).'", '.
-
 
251
            'a_logo="'.$chemin_destination.'", '.
227
 
252
            INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
228
    $req .= INS_CHAMPS_MAIL.'="'.addslashes($valeur['email']).'", ' ;
253
    	    'niveauscolaire="'.addslashes($valeur['nom_ref']).'", '.
229
    $req .= INS_CHAMPS_PASSE.'="'.md5($valeur['mot_de_passe']).'", '.
254
            INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
230
            INS_CHAMPS_PAYS.'="'.addslashes($valeur['pays']).'", '.
255
            INS_CHAMPS_ADRESSE_2.'="'.addslashes($valeur['adresse_2']).'", '.
231
            INS_CHAMPS_ADRESSE_1.'="'.addslashes($valeur['adresse_1']).'", '.
256
            INS_CHAMPS_DATE_INSCRIPTION.'="'. 
232
            INS_CHAMPS_ADRESSE_2.'="'.addslashes($valeur['adresse_2']).'", '.
Line 257... Line 233...
257
            	($maj ? $ligne[INS_CHAMPS_DATE_INSCRIPTION] : 'NOW()'). '", '.
233
            INS_CHAMPS_DATE_INSCRIPTION.'=NOW(), '.
258
            INS_CHAMPS_CODE_POSTAL.'="'.addslashes($valeur['cp']).'", '.
234
            INS_CHAMPS_CODE_POSTAL.'="'.addslashes($valeur['cp']).'", '.
Line 289... Line 265...
289
        } else {
265
        } else {
290
            $n_dpt = substr($valeur['cp'], 0, 2) ;
266
            $n_dpt = substr($valeur['cp'], 0, 2) ;
291
        }
267
        }
292
        $req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
268
        $req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
293
    }
269
    }
-
 
270
    if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
294
    return $req ;
271
    return $req ;
295
}
272
}
Line 312... Line 289...
312
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
289
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
313
    }
290
    }
314
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
291
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
315
    $valeurs_par_defaut = array() ;
292
    $valeurs_par_defaut = array() ;
316
    $valeurs_par_defaut['email'] = $ligne[INS_CHAMPS_MAIL];
293
    $valeurs_par_defaut['email'] = $ligne[INS_CHAMPS_MAIL];
317
    $valeurs_par_defaut['description'] = $ligne['a_description'];
-
 
318
    $valeurs_par_defaut['image'] = $ligne['a_logo'];
-
 
319
    $valeurs_par_defaut['nom'] = $ligne[INS_CHAMPS_NOM];
294
    $valeurs_par_defaut['nom'] = $ligne[INS_CHAMPS_NOM];
320
    $valeurs_par_defaut['prenom'] = $ligne[INS_CHAMPS_PRENOM] ;
295
    $valeurs_par_defaut['prenom'] = $ligne[INS_CHAMPS_PRENOM] ;
321
    $valeurs_par_defaut['pays'] = $ligne[INS_CHAMPS_PAYS] ;
296
    $valeurs_par_defaut['pays'] = $ligne[INS_CHAMPS_PAYS] ;
322
    $valeurs_par_defaut['niveauscolaire'] = $ligne['niveauscolaire'];
-
 
323
    if (INS_UTILISE_WIKINI) {$valeurs_par_defaut['nomwiki'] = $ligne[INS_CHAMPS_NOM_WIKINI] ;}
297
    if (INS_UTILISE_WIKINI) {$valeurs_par_defaut['nomwiki'] = $ligne[INS_CHAMPS_NOM_WIKINI] ;}
324
    $valeurs_par_defaut['cp'] = $ligne[INS_CHAMPS_CODE_POSTAL] ;
298
    $valeurs_par_defaut['cp'] = $ligne[INS_CHAMPS_CODE_POSTAL] ;
325
    $valeurs_par_defaut['ville'] = $ligne[INS_CHAMPS_VILLE] ;
299
    $valeurs_par_defaut['ville'] = $ligne[INS_CHAMPS_VILLE] ;
326
    $valeurs_par_defaut['adresse_1'] = $ligne[INS_CHAMPS_ADRESSE_1] ;
300
    $valeurs_par_defaut['adresse_1'] = $ligne[INS_CHAMPS_ADRESSE_1] ;
327
    $valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
301
    $valeurs_par_defaut['adresse_2'] = $ligne[INS_CHAMPS_ADRESSE_2] ;
328
    $valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
302
    $valeurs_par_defaut['telephone'] = $ligne[INS_CHAMPS_TELEPHONE] ;
-
 
303
    $valeurs_par_defaut['fax'] = $ligne[INS_CHAMPS_FAX] ;
-
 
304
    if (INS_CHAMPS_STRUCTURE != '' && isset($ligne[INS_CHAMPS_STRUCTURE])) {
-
 
305
    	$valeurs_par_defaut['structure'] = $ligne[INS_CHAMPS_STRUCTURE] ;
-
 
306
    	//$valeurs_par_defaut['type_structure'] = $ligne['a_type_structure'];	
-
 
307
    }
329
    $valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
308
    $valeurs_par_defaut['site'] = $ligne[INS_CHAMPS_SITE_INTERNET] ;
330
    $valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
309
    $valeurs_par_defaut['lettre'] = $ligne[INS_CHAMPS_LETTRE] ;
331
    $valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
310
    $valeurs_par_defaut['visible'] = $ligne[INS_CHAMPS_VISIBLE] ;
332
    $valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
311
    $valeurs_par_defaut['sigle_structure'] = $ligne[INS_CHAMPS_SIGLE_STRUCTURE] ;
-
 
312
    if (INS_CHAMPS_NUM_AGREMENT != '') $valeurs_par_defaut['num_agrement'] = $ligne[INS_CHAMPS_NUM_AGREMENT] ;
333
    return $valeurs_par_defaut ;
313
    return $valeurs_par_defaut ;
334
}
314
}
335
 
315
 
336
 
316
 
337
/** info() - Renvoie une fiche d'information sur la personne ou la structure
317
/** info() - Renvoie une fiche d'information sur la personne ou la structure
338
*
318
* 
-
 
319
* @param  integer  identifiant de la fiche a afficher, mettre -1 pour voir sa propre fiche
-
 
320
* @param  text     nom de l'onglet de la fiche
-
 
321
*
339
* @return   text   Code HTML de la fiche
322
* @return   text   Code HTML de la fiche
340
*/
323
*/
341
function info($id=-1) {
324
function info($id=-1, $type_info='fiche') {
342
	if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
325
	if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
343
    	$requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
326
    $requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
344
               .INS_CHAMPS_ID.'="'.$id.'"' ;          
327
               .INS_CHAMPS_ID.'="'.$id.'"' ;          
345
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
328
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
346
    if (DB::isError($resultat)) {
329
    if (DB::isError($resultat)) {
347
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
330
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
348
    }
331
    }
349
 
332
 
350
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
333
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
-
 
334
    
-
 
335
    //voir la présentation de la fiche
-
 
336
    if ($type_info=='fiche') {
351
    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
337
	    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
352
    	$res = '<h1>'.INS_FICHE_STRUCTURE.'</h1>'."\n" ;
338
	    	$res = '<h1>'.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
353
	    $res .= '<h2>'.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
339
	    	$res .= '<h2>'.INS_FICHE_STRUCTURE.'</h2>'."\n" ;		    
354
	    $res .= '<dl class="affiche_infos">'."\n";
340
		    $res .= '<ul class="affiche_infos">'."\n";
355
	    $res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
341
		    $res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
356
	    $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
342
		    if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
357
    } else {
343
	    } else {
358
    	$res = '<h1>'.INS_FICHE_PERSONNELLE.'</h1>'."\n" ;
-
 
359
    	if(!empty($ligne[INS_CHAMPS_AVATAR]) && is_file($ligne[INS_CHAMPS_AVATAR]))
344
	    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
360
    		$res = '<img src="'. INS_URL_IMAGES . $ligne[INS_CHAMPS_AVATAR] .'" style="float:right;" alt="avatar de '.$ligne[INS_CHAMPS_NOM_WIKINI].'" />'."\n" ;
-
 
361
    	
-
 
362
    	$res .= '<h2>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h2>'."\n";
345
	    	$res .= '<h2>'.INS_FICHE_PERSONNELLE.'</h2>'."\n" ;	    	
363
    	$res .= '<dl class="affiche_infos">'."\n";
346
	    	$res .= '<ul class="affiche_infos">'."\n";
364
    }
347
	    }
-
 
348
	    
365
    $res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
349
	    $res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
366
    $res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
350
	    $res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
367
    $res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
351
	    $res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
368
    $res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
352
	    $res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
369
    $pays = new ListeDePays($GLOBALS['ins_db']) ;
353
	    $pays = new ListeDePays($GLOBALS['ins_db']) ;
370
    
-
 
371
    $res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
354
	    $res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
372
    $res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
355
	    $res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
373
    $res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
356
	    $res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
374
    $res .= ligne_inscription('&nbsp;', '&nbsp;') ;
-
 
375
    if (INS_UTILISE_WIKINI) {
357
	    if (INS_UTILISE_WIKINI) {
376
		$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
358
			$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
377
	}
359
		}
378
    $res .= ligne_inscription(INS_EMAIL, $ligne[INS_CHAMPS_MAIL]);
-
 
379
    if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
360
	    if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
380
    	$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>');
361
	    	$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>');
381
    }
362
	    }
382
    $res .= '</dl>'."\n";
-
 
383
    $res .= '<br />'."\n";
-
 
384
    if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
-
 
385
	    $res .= '<br />'."\n";
-
 
386
	    $res .= '<ul>'."\n";
-
 
387
	    if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
-
 
388
	    	$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
-
 
389
	    } else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
-
 
390
	    if ($ligne[INS_CHAMPS_LETTRE] == 1) {
-
 
391
	    	$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
-
 
392
	    } else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
-
 
393
	    $res .= '</ul>'."\n";
-
 
394
	    $res .= '<br />'."\n";
-
 
395
	    $res .= '<ul>'."\n";;
-
 
396
	    $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" ;
363
	    if ($GLOBALS['AUTH']->getAuth()) $res .= ligne_inscription(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
397
	    $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" ;
364
	    else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
398
	    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
-
 
399
	    $res .= '</ul>'."\n";
365
	    $res .= '</ul>'."\n";
-
 
366
	    if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
-
 
367
		    $res .= '<br />'."\n";
-
 
368
		    $res .= '<ul>'."\n";
-
 
369
		    if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
-
 
370
		    	$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
-
 
371
		    } else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
-
 
372
		    if (INS_CHAMPS_LETTRE != '') {
-
 
373
		    		if ($ligne[INS_CHAMPS_LETTRE] == 1) {
-
 
374
		    			$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
-
 
375
		    		} else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
-
 
376
		    }
-
 
377
		    $res .= '</ul>'."\n";
-
 
378
		    $res .= '<br />'."\n";
-
 
379
		    $res .= '<ul>'."\n";;
-
 
380
		    $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" ;
-
 
381
		    $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" ;
-
 
382
		    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
-
 
383
		    $res .= '</ul>'."\n";
-
 
384
	    } 
-
 
385
	    
-
 
386
	//voir les abonnements presents dans les applis clientes    
-
 
387
    } elseif ($type_info=='abonnement') {
-
 
388
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
389
    	$res .= '<h2>'.INS_GESTION_DES_ABONNEMENTS.'</h2>'."\n" ;
-
 
390
    	
-
 
391
    	// Appel des actions d'abonnement des applications clientes
-
 
392
        $d = dir(GEN_CHEMIN_CLIENT);
-
 
393
        $abonnement='';
-
 
394
        $abonnements='';
-
 
395
		while (false !== ($repertoire = $d->read())) {
-
 
396
			if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php')) {
-
 
397
				require_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php' ;
-
 
398
				$abonnements .= $abonnement;   
-
 
399
			}
-
 
400
		}
-
 
401
		$d->close();
-
 
402
		$res .= $abonnements;
-
 
403
		
-
 
404
    //voir les actus			
-
 
405
    } elseif ($type_info=='actus') {
-
 
406
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
407
    	$res .= '<h2>'.INS_ACTUALITES_DEPOSEES.'</h2>'."\n" ;
-
 
408
    	require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'configuration'.GEN_SEP.'baz_config.inc.php';
-
 
409
    	require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'bibliotheque'.GEN_SEP.'bazar.fonct.rss.php';
-
 
410
    	$_GET['action']=1;
-
 
411
    	$res .= RSSversHTML(gen_RSS('', '', $id, 1, ''), 0, 'jma', 0);
-
 
412
    	
-
 
413
	//voir les ressources	
-
 
414
    } elseif ($type_info=='ressources') {
-
 
415
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
416
    	$res .= '<h2>'.INS_RESSOURCES_ASSOCIEES.'</h2>'."\n" ;
-
 
417
    	$requete = 'SELECT bf_id_fiche, bf_titre FROM bazar_fiche, bazar_appropriation WHERE  ba_ce_id_fiche=bf_id_fiche AND ba_ce_id_structure='.$id ;
-
 
418
    	$resultat = $GLOBALS['ins_db'] -> query($requete) ;
-
 
419
    	$res .= '<ul>'."\n";
-
 
420
    	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
421
			$res .= '<li><a href="'.INS_URL_BAZAR.'&amp;action=8&amp;id_fiche='.$ligne['bf_id_fiche'].'" onclick="window.open(this.href,\'_blank\');return false;">'.$ligne['bf_titre'].'</a></li>'."\n";
-
 
422
		}
-
 
423
		$res .= '</ul><br />'."\n";
-
 
424
    
-
 
425
    //voir les competences		    
-
 
426
    } elseif ($type_info=='competences') {
-
 
427
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
428
    	$res .= '<h2>'.INS_COMPETENCES_ASSOCIEES.'</h2>'."\n" ;
-
 
429
    }
-
 
430
    return $res ;
-
 
431
}
-
 
432
 
-
 
433
 
-
 
434
/**	ligne_inscription() - Renvoie une ligne avec label et valeur
-
 
435
 *
-
 
436
 * @param string label Le label
-
 
437
 * @param string valeur
-
 
438
 * @return	string HTML
-
 
439
 */
-
 
440
function ligne_inscription($label, $valeur) {
-
 
441
    if ($valeur == '') {
-
 
442
        return;
-
 
443
    }
-
 
444
    if (($label == '')or($label == '&nbsp;')) {
-
 
445
    	return '<li>'."\n".$valeur."\n".'</li>'."\n" ;
-
 
446
    } else {
-
 
447
    	return '<li>'."\n".'<strong>'.$label.' : </strong>'."\n".$valeur."\n".'</li>'."\n" ;    	
400
    }
448
    }
401
    $res .=  '{{Syndication titre="Les fiches associ&eacute;es &agrave; ce participant" url="http://ekotribu.localhost/papyrus.php?menu=48&action=18&emetteur='. $ligne[INS_CHAMPS_ID].'" nb=0 nouvellefenetre=0 formatdate="jma"}}';
-
 
402
    
-
 
403
    return $res ;
-
 
404
}
449
}
405
 
-
 
406
 
-
 
407
/**	ligne_inscription() - Renvoie une ligne avec label et valeur
-
 
408
 *
-
 
409
 * @param string label Le label
-
 
410
 * @param string valeur
-
 
411
 * @return	string HTML
-
 
412
 */
-
 
413
function ligne_inscription($label, $valeur) {
-
 
414
    if ($valeur == '') {
-
 
415
        return;
-
 
416
    }
-
 
417
    if (($label == '')or($label == '&nbsp;')) {
-
 
418
    	return '<dt>&nbsp;</dt>'."\n".'<dd>'.$valeur.'</dd>'."\n" ;
-
 
419
    } else {
-
 
420
    	return '<dt>'.$label.' : </dt>'."\n".'<dd>'.$valeur.'</dd>'."\n" ;    	
-
 
421
    }
-
 
422
}
-
 
423
 
450
 
424
 
451
 
425
/** Renvoie vrai si l'email passé en paramètre n'est pas déjà dans l'annuaire
452
/** Renvoie vrai si l'email passé en paramètre n'est pas déjà dans l'annuaire
426
*   ou si, en cas de modification d'inscription, l'inscrit ne modifie pas son email
453
*   ou si, en cas de modification d'inscription, l'inscrit ne modifie pas son email
427
*
454
*
428
*   @return boolean 
455
*   @return boolean 
429
*/
456
*/
430
function verif_doublonMail($mail, $id = '') {
457
function verif_doublonMail($mail, $id = '') {
431
	if ($id == '') {
458
	if ($id == '') {
432
		if (isset ($GLOBALS['AUTH'])) {
459
		if (isset ($GLOBALS['AUTH'])) {
433
			$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
460
			$id = $GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID) ;
434
		}
461
		}
435
	}
462
	}
588
 *  fait une requete dans la base
605
 *  fait une requete dans la base
589
 * 
606
 *
590
 * --> révision par julien suite nouvelle fonction get_wiki_name();
-
 
591
 * --> ajout de la vérification des doublons.
-
 
592
 *
-
 
593
 * @return  string un nom wiki valide
607
 * @return  string un nom wiki valide
594
 */
608
 */
595
 
609
 
596
function genere_nom_wiki($nom) {
610
function genere_nom_wiki($prenom, $nom) {
-
 
611
    // 1. suppression des espaces
-
 
612
    $nom = trim ($nom) ;
-
 
613
    $prenom = trim ($prenom) ;
597
  
614
    
598
  	// si le nom est trop invalide (____) on génère une chaine au hazard..
615
    // 2. suppression des caractères non ascii et ajout de la première lettre en majuscule
-
 
616
    $nom = trim_non_ascii ($nom) ;
599
  	$nom_wiki = (!get_wiki_name($nom) ? get_wiki_name(create_new_random(5)) : get_wiki_name($nom));
617
    $prenom = trim_non_ascii ($prenom) ;
600
  	
618
    
601
	// si le nom existe déjà: on ajoute des _ à la fin jusqu'à ce qu'il soit libre !
-
 
602
	while(!verif_doublonNomWiki($nom_wiki))
619
    // Vérification
603
	{
-
 
604
		$nom_wiki .= '_';
620
    $nom_wiki = $prenom.$nom ;
-
 
621
    if (!preg_match('/^[A-Z][a-z]+[A-Z,0-9][A-Z,a-z,0-9]*$/', $nom_wiki)) {
-
 
622
        $nom_wiki = chr(rand(65, 90)).$nom_wiki.chr(rand(65, 90)) ;
605
	}
623
    }
606
  
-
 
607
    return $nom_wiki ;
624
    return $nom_wiki ;
608
}
625
}
Line 609... Line 626...
609
 
626
 
610
/**
627
/**
Line 613... Line 630...
613
 * @return	string la chaine épurée
630
 * @return	string la chaine épurée
614
 */
631
 */
Line 615... Line 632...
615
 
632
 
616
function trim_non_ascii ($nom) {
633
function trim_non_ascii ($nom) {
617
    $premiere_lettre = true ;
634
    $premiere_lettre = true ;
618
    for ($i = 0; $i <= strlen ($nom); $i++) {
635
    for ($i = 0; $i < strlen ($nom); $i++) {
619
        if (!preg_match ('/[a-zA-Z0-9]/', $nom[$i])) {
636
        if (!preg_match ('/[a-zA-Z0-9]/', $nom[$i])) {
620
            $nom[$i] = '_' ;
637
            $nom[$i] = '_' ;
621
        }
638
        }
622
    // remplacement de la première lettre en majuscule
639
    // remplacement de la première lettre en majuscule
Line 631... Line 648...
631
    }
648
    }
632
    $nom = preg_replace ('/_/', '', $nom) ;
649
    $nom = preg_replace ('/_/', '', $nom) ;
633
    return $nom ;
650
    return $nom ;
634
}
651
}
Line 635... Line -...
635
 
-
 
636
//function get_wiki_name($nom)
-
 
637
//{
-
 
638
//	$temp = explode('', $nom);
-
 
639
//	$count = 0;
-
 
640
//	$final = NULL;
-
 
641
//	foreach($temp as $letter)
-
 
642
//	{
-
 
643
//		if(preg_match ('/[a-zA-Z0-9]/', $letter)) {
-
 
644
//            $final .= (($count == 0 || $count == (strlen($nom) - 1)) ? strtoupper($letter) : strtolower($letter));
-
 
645
//        }
-
 
646
//	}
-
 
647
//	return($final);
-
 
648
//}
-
 
649
 
-
 
650
// fonction révisée de get_wiki_name() --julien
-
 
651
function get_wiki_name($nom)
-
 
652
{
-
 
653
	// traitement des accents
-
 
654
	$nom = str_replace(array('é','è','ë','ê','É','È','Ë','Ê','&','£'), 'e', $nom);
-
 
655
	$nom = str_replace(array('à','ä','â','Â','Ä','À','@'), 'a', $nom);
-
 
656
	$nom = str_replace(array('ç','Ç'), 'c', $nom);
-
 
657
	$nom = str_replace(array('ÿ','¾'), 'y', $nom);
-
 
658
	$nom = str_replace(array('ô','ö','ò','Ô','Ò','Ö'), 'o', $nom);
-
 
659
	$nom = str_replace(array('ï','î','ì','Î','Ï','Ì'), 'i', $nom);
-
 
660
	$nom = str_replace('$', 's', $nom);
-
 
661
    
-
 
662
	$temp = mb_str_split($nom);
-
 
663
	
-
 
664
	$count = 0;
-
 
665
	$final = NULL;
-
 
666
	foreach($temp as $letter)
-
 
667
	{
-
 
668
		if(preg_match('/([[:space:]]|[[:punct:]])/', $letter))
-
 
669
		{
-
 
670
			$final .= '_';
-
 
671
		} elseif(preg_match ('/[a-zA-Z0-9]/', $letter)) {
-
 
672
            $final .= (($count == 0 || $count == (strlen($nom) - 1)) ? strtoupper($letter) : strtolower($letter));
-
 
673
        }
-
 
674
        $count++;
-
 
675
	}
-
 
676
	
-
 
677
	// vérifions que le retour n'est pas uniquement un underscore
-
 
678
	if(preg_match('/^[[:punct:]]+$/', $final)) return FALSE;
-
 
679
 
-
 
680
 	// sinon retour du nom formaté
-
 
681
	return($final);
-
 
682
}
-
 
683
 
-
 
684
 
652
 
685
// For users prior to PHP 4.3.0 you may do this:
653
// For users prior to PHP 4.3.0 you may do this:
686
function unhtmlentities($string)
654
function unhtmlentities($string)
687
{
655
{
688
    $trans_tbl = get_html_translation_table (HTML_ENTITIES);
656
    $trans_tbl = get_html_translation_table (HTML_ENTITIES);
689
    $trans_tbl = array_flip ($trans_tbl);
657
    $trans_tbl = array_flip ($trans_tbl);
690
    return strtr ($string, $trans_tbl);
658
    return strtr ($string, $trans_tbl);
Line 691... Line 659...
691
}
659
}
692
 
660
 
693
//==============================================================================
661
//==============================================================================
694
/** function create_new_random($n,$type) permet de générer un nombre de caractères alçatoires.
662
/** function create_new_random($n,$type) permet de générer un nombre de caractères aléatoires.
695
*
663
*
696
*  
664
*  
697
*
665
*
Line 748... Line 716...
748
}
716
}
Line 749... Line 717...
749
 
717
 
750
/* +--Fin du code ----------------------------------------------------------------------------------------+
718
/* +--Fin du code ----------------------------------------------------------------------------------------+
751
*
719
*
-
 
720
* $Log: not supported by cvs2svn $
-
 
721
* Revision 1.23  2006/12/01 13:23:15  florian
-
 
722
* integration annuaire backoffice
-
 
723
*
-
 
724
* Revision 1.22  2006/10/05 13:53:53  florian
-
 
725
* amélioration des fichiers sql
-
 
726
*
-
 
727
* Revision 1.21  2006/09/20 13:10:01  alexandre_tb
-
 
728
* Ajout d'un test sur la lettre d'actualité
-
 
729
*
-
 
730
* Revision 1.20  2006/07/06 10:33:58  alexandre_tb
-
 
731
* Suppression d'un warning
-
 
732
*
-
 
733
* Revision 1.19  2006/07/04 09:39:27  alexandre_tb
-
 
734
* correction d'un bug mineur
-
 
735
*
-
 
736
* Revision 1.18  2006/06/01 14:42:20  alexandre_tb
-
 
737
* suppression d'un commentaire inutile
-
 
738
*
-
 
739
* Revision 1.17  2006/04/28 12:44:05  florian
-
 
740
* integration bazar
-
 
741
*
-
 
742
* Revision 1.16  2006/04/11 08:41:41  alexandre_tb
-
 
743
* Ajout du champs nom wiki dans le formulaire si la constante INS_GENERE_NOM_WIKI n'est pas activé
-
 
744
*
-
 
745
* Revision 1.15  2006/04/10 14:01:36  florian
-
 
746
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
-
 
747
*
-
 
748
* Revision 1.14  2006/04/04 12:23:05  florian
-
 
749
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
-
 
750
*
-
 
751
* Revision 1.13  2006/03/21 10:25:33  alexandre_tb
-
 
752
* ajout d'un template pour le mail de confirmation
-
 
753
*
-
 
754
* Revision 1.12  2006/03/15 11:02:35  alexandre_tb
-
 
755
* ajout de l'insertion du prénom qui avait disparu
-
 
756
*
-
 
757
* Revision 1.11  2006/03/02 16:57:31  alexandre_tb
-
 
758
* correction appel au générateur de nom wiki
-
 
759
*
-
 
760
* Revision 1.10  2006/02/28 14:02:20  alexandre_tb
-
 
761
* suppression des insertion dans les tables du bazar
-
 
762
*
-
 
763
* Revision 1.9  2006/02/14 10:19:10  alexandre_tb
-
 
764
* Mise en place des templates
-
 
765
* CREATE TABLE `inscription_template` (
-
 
766
*   `it_id_template` smallint(5) unsigned NOT NULL default '0',
-
 
767
*   `it_i18n` varchar(5) NOT NULL default '',
-
 
768
*   `it_template` text NOT NULL,
-
 
769
*   PRIMARY KEY  (`it_id_template`)
-
 
770
* ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
752
* $Log: not supported by cvs2svn $
771
*
753
* Revision 1.8  2006/01/02 09:51:38  alexandre_tb
772
* Revision 1.8  2006/01/02 09:51:38  alexandre_tb
754
* généralisation du code et intégration au bottin
773
* généralisation du code et intégration au bottin
755
*
774
*
756
* Revision 1.7  2005/12/19 13:19:07  alexandre_tb
775
* Revision 1.7  2005/12/19 13:19:07  alexandre_tb