Subversion Repositories Applications.papyrus

Rev

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

Rev 1343 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.fonct.php,v 1.28 2007-04-20 08:39:37 alexandre_tb Exp $
22
// CVS : $Id: inscription.fonct.php,v 1.29 2007-05-25 14:32:17 alexandre_tb Exp $
23
/**
23
/**
24
* Fonctions du module inscription
24
* Fonctions du module inscription
25
*
25
*
26
* Fonctions du module inscription
26
* Fonctions du module inscription
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Florian Schmitt <florian@ecole-et-nature.org>
32
*@author        Florian Schmitt <florian@ecole-et-nature.org>
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.28 $ $Date: 2007-04-20 08:39:37 $
34
*@version       $Revision: 1.29 $ $Date: 2007-05-25 14:32:17 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 94... Line 94...
94
	$tpl->setVariable('URL_INSCRIPTION', $url) ;
94
	$tpl->setVariable('URL_INSCRIPTION', $url) ;
Line 95... Line 95...
95
 
95
 
96
    mail ($GLOBALS['email'], 'Inscription', $tpl->get(), 'From: '.INS_MAIL_ADMIN_APRES_INSCRIPTION) ;
96
    mail ($GLOBALS['email'], 'Inscription', $tpl->get(), 'From: '.INS_MAIL_ADMIN_APRES_INSCRIPTION) ;
Line 97... Line -...
97
}
-
 
98
 
-
 
99
/**
-
 
100
 *
-
 
101
 * @param   array   les valeurs renvoyés par le formulaire
-
 
Line 102... Line -...
102
 * @return
-
 
103
 */
-
 
104
 
-
 
105
function inscription_validee($valeurs) {
-
 
106
	insertion($valeurs) ;
-
 
107
	$GLOBALS['AUTH']->username = $valeurs['email'] ;
-
 
108
	$GLOBALS['AUTH']->password = $valeurs['mot_de_passe'] ;
-
 
109
	// On loggue l'utilisateur
-
 
110
	$GLOBALS['AUTH']->login() ;
-
 
111
	// inscription à la lettre d'information
-
 
112
	if (INS_CHAMPS_LETTRE != '' && isset ($valeurs['lettre'])) {
-
 
Line 113... Line 97...
113
		inscription_lettre(INS_MAIL_INSCRIPTION_LISTE) ;
97
}
114
	}
98
 
115
}
99
 
116
 
100
 
Line 264... Line 248...
264
            $n_dpt = substr($valeur['cp'], 0, 2) ;
248
            $n_dpt = substr($valeur['cp'], 0, 2) ;
265
        }
249
        }
266
        $req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
250
        $req .= ",".INS_CHAMPS_DEPARTEMENT."='$n_dpt'";
267
    }
251
    }
268
    if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
252
    if (INS_UTILISE_WIKINI && isset ($valeur['nom_wiki'])) $req .= ','.INS_CHAMPS_NOM_WIKINI.'="'.$valeur['nom_wiki'].'"';
-
 
253
    if ($GLOBALS['ins_config']['ic_google_key']) {
-
 
254
    	$req .= ', a_longitude="'.$valeur['longitude'].'", a_latitude="'.$valeur['latitude'].'"';
-
 
255
    }
269
    return $req ;
256
    return $req ;
270
}
257
}
Line 310... Line 297...
310
    if (INS_CHAMPS_NUM_AGREMENT != '') $valeurs_par_defaut['num_agrement'] = $ligne[INS_CHAMPS_NUM_AGREMENT] ;
297
    if (INS_CHAMPS_NUM_AGREMENT != '') $valeurs_par_defaut['num_agrement'] = $ligne[INS_CHAMPS_NUM_AGREMENT] ;
311
    return $valeurs_par_defaut ;
298
    return $valeurs_par_defaut ;
312
}
299
}
Line 313... Line -...
313
 
-
 
314
 
-
 
315
/** info() - Renvoie une fiche d'information sur la personne ou la structure
-
 
316
* 
-
 
317
* @param  integer  identifiant de la fiche a afficher, mettre -1 pour voir sa propre fiche
-
 
318
* @param  text     nom de l'onglet de la fiche
-
 
319
*
-
 
320
* @return   text   Code HTML de la fiche
-
 
321
*/
-
 
322
function info($id=-1, $type_info='fiche') {
-
 
323
	if ($id==-1) $id=$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID);
-
 
324
    $requete = 'SELECT * FROM '.INS_ANNUAIRE.' WHERE '.INS_ANNUAIRE.'.'
-
 
325
               .INS_CHAMPS_ID.'="'.$id.'"' ;          
-
 
326
    $resultat = $GLOBALS['ins_db'] -> query($requete) ; 
-
 
327
    if (DB::isError($resultat)) {
-
 
328
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
-
 
329
    }
-
 
330
 
-
 
331
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
-
 
332
    
-
 
333
    //voir la présentation de la fiche
-
 
334
    if ($type_info=='fiche') {
-
 
335
	    if ($ligne[INS_CHAMPS_EST_STRUCTURE] == 1) {
-
 
336
	    	$res = '<h1>'.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
337
	    	$res .= '<h2>'.INS_FICHE_STRUCTURE.'</h2>'."\n" ;		    
-
 
338
		    $res .= '<ul class="affiche_infos">'."\n";
-
 
339
		    $res .= ligne_inscription(INS_SIGLE_DE_LA_STRUCTURE, $ligne[INS_CHAMPS_SIGLE_STRUCTURE]) ;
-
 
340
		    if (INS_CHAMPS_NUM_AGREMENT != '') $res .= ligne_inscription(INS_NUM_AGREMENT, $ligne[INS_CHAMPS_NUM_AGREMENT]) ;
-
 
341
	    } else {
-
 
342
	    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
343
	    	$res .= '<h2>'.INS_FICHE_PERSONNELLE.'</h2>'."\n" ;	    	
-
 
344
	    	$res .= '<ul class="affiche_infos">'."\n";
-
 
345
	    }
-
 
346
	    
-
 
347
	    $res .= ligne_inscription(INS_ADRESSE_1, $ligne[INS_CHAMPS_ADRESSE_1]) ;
-
 
348
	    $res .= ligne_inscription(INS_ADRESSE_2, $ligne[INS_CHAMPS_ADRESSE_2]) ;
-
 
349
	    $res .= ligne_inscription(INS_CODE_POSTAL, $ligne[INS_CHAMPS_CODE_POSTAL]) ;
-
 
350
	    $res .= ligne_inscription(INS_VILLE, $ligne[INS_CHAMPS_VILLE]) ;
-
 
351
	    $pays = new ListeDePays($GLOBALS['ins_db']) ;
-
 
352
	    $res .= ligne_inscription(INS_PAYS, $pays->getNomPays($ligne[INS_CHAMPS_PAYS], INS_LANGUE_DEFAUT)) ;
-
 
353
	    $res .= ligne_inscription(INS_TELEPHONE, $ligne[INS_CHAMPS_TELEPHONE]) ;
-
 
354
	    $res .= ligne_inscription(INS_FAX, $ligne[INS_CHAMPS_FAX]) ;
-
 
355
	    if (INS_UTILISE_WIKINI) {
-
 
356
			$res .= ligne_inscription (INS_NOM_WIKI, $ligne[INS_CHAMPS_NOM_WIKINI]) ;
-
 
357
		}
-
 
358
	    if ($ligne[INS_CHAMPS_SITE_INTERNET]!='') {
-
 
359
	    	$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>');
-
 
360
	    }
-
 
361
	    if ($GLOBALS['AUTH']->getAuth()) $res .= ligne_inscription(INS_EMAIL, '<a href="mailto:'.$ligne[INS_CHAMPS_MAIL].'">'.$ligne[INS_CHAMPS_MAIL].'</a>');
-
 
362
	    else $res .= '<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
-
 
363
	    $res .= '</ul>'."\n";
-
 
364
	    if ($id==$GLOBALS['AUTH']->getAuthData(INS_CHAMPS_ID)) {
-
 
365
		    $res .= '<br />'."\n";
-
 
366
		    $res .= '<ul>'."\n";
-
 
367
		    if ($ligne[INS_CHAMPS_VISIBLE] == 1) {
-
 
368
		    	$res .= '<li>'.INS_VOUS_APPARAISSEZ.'</li>'."\n";
-
 
369
		    } else $res .= '<li>'.INS_VOUS_APPARAISSEZ_PAS.'</li>'."\n";
-
 
370
		    if (INS_CHAMPS_LETTRE != '') {
-
 
371
		    		if ($ligne[INS_CHAMPS_LETTRE] == 1) {
-
 
372
		    			$res .= '<li>'.INS_VOUS_RECEVEZ_LETTRE.'</li>'."\n";
-
 
373
		    		} else $res .= '<li>'.INS_VOUS_RECEVEZ_PAS_LETTRE.'</li>'."\n";
-
 
374
		    }
-
 
375
		    $res .= '</ul>'."\n";
-
 
376
		    $res .= '<br />'."\n";
-
 
377
		    $res .= '<ul>'."\n";;
-
 
378
		    $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" ;
-
 
379
		    $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" ;
-
 
380
		    $res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'&amp;action=deconnexion">'.INS_DECONNEXION.'</a></li>'."\n" ;
-
 
381
		    $res .= '</ul>'."\n";
-
 
382
	    } 
-
 
383
	    
-
 
384
	//voir les abonnements presents dans les applis clientes    
-
 
385
    } elseif ($type_info=='abonnement') {
-
 
386
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
387
    	$res .= '<h2>'.INS_GESTION_DES_ABONNEMENTS.'</h2>'."\n" ;
-
 
388
    	
-
 
389
    	// Appel des actions d'abonnement des applications clientes
-
 
390
        $d = dir(GEN_CHEMIN_CLIENT);
-
 
391
        $abonnement='';
-
 
392
        $abonnements='';
-
 
393
		while (false !== ($repertoire = $d->read())) {
-
 
394
			if (file_exists(GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php')) {
-
 
395
				require_once GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'bibliotheque'.GEN_SEP.$repertoire.'.abonnement.inc.php' ;
-
 
396
				$abonnements .= $abonnement;   
-
 
397
			}
-
 
398
		}
-
 
399
		$d->close();
-
 
400
		$res .= $abonnements;
-
 
401
		
-
 
402
    //voir les actus			
-
 
403
    } elseif ($type_info=='actus') {
-
 
404
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
405
    	$res .= '<h2>'.INS_ACTUALITES_DEPOSEES.'</h2>'."\n" ;
-
 
406
    	require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'configuration'.GEN_SEP.'baz_config.inc.php';
-
 
407
    	require_once GEN_CHEMIN_CLIENT.'bazar'.GEN_SEP.'bibliotheque'.GEN_SEP.'bazar.fonct.rss.php';
-
 
408
    	$_GET['action']=1;
-
 
409
    	$res .= RSSversHTML(gen_RSS('', '', $id, 1, ''), 0, 'jma', 0);
-
 
410
    	
-
 
411
	//voir les ressources	
-
 
412
    } elseif ($type_info=='ressources') {
-
 
413
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
414
    	$res .= '<h2>'.INS_RESSOURCES_ASSOCIEES.'</h2>'."\n" ;
-
 
415
    	$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 ;
-
 
416
    	$resultat = $GLOBALS['ins_db'] -> query($requete) ;
-
 
417
    	$res .= '<ul>'."\n";
-
 
418
    	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
419
			$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";
-
 
420
		}
-
 
421
		$res .= '</ul><br />'."\n";
-
 
422
    
-
 
423
    //voir les competences		    
-
 
424
    } elseif ($type_info=='competences') {
-
 
425
    	$res = '<h1>'.$ligne[INS_CHAMPS_PRENOM].' '.$ligne[INS_CHAMPS_NOM].'</h1>'."\n";
-
 
426
    	$res .= '<h2>'.INS_COMPETENCES_ASSOCIEES.'</h2>'."\n" ;
-
 
427
    }
-
 
428
    return $res ;
-
 
429
}
-
 
430
 
300
 
431
 
301
 
432
/**	ligne_inscription() - Renvoie une ligne avec label et valeur
302
/**	ligne_inscription() - Renvoie une ligne avec label et valeur
433
 *
303
 *
434
 * @param string label Le label
304
 * @param string label Le label
Line 515... Line 385...
515
    }
385
    }
516
    return $res ;
386
    return $res ;
517
}
387
}
Line 518... Line 388...
518
 
388
 
519
/**
-
 
520
 *  Inscrit un adhérent à la lettre d'actualité par l'envoie d'un email subscribe / unsubscribe
-
 
521
 *  à la liste
-
 
522
 *
-
 
523
 * @global  AUTH    Un objet PEAR::Auth
-
 
524
 * @return  boolean true en cas de succès
-
 
525
 */
-
 
526
 
-
 
527
function inscription_lettre($action) {
-
 
528
    include_once PAP_CHEMIN_RACINE.'api/pear/Mail.php' ;
-
 
529
    $mail = & Mail::factory ('smtp') ;
-
 
530
    $email = $GLOBALS['AUTH']->getUsername() ;
-
 
531
    $headers ['Return-Path'] = $email ;
-
 
532
    $headers ['From'] = "<".$email.">" ;
-
 
533
    $headers ['Subject'] = $action ;
-
 
534
    $headers ['Reply-To'] = $email ;
-
 
535
    
-
 
536
    $mail -> send ($action, $headers, "") ;
-
 
537
    if (PEAR::isError ($mail)) {
-
 
538
        echo '<p class="erreur">Le mail n\'est pas parti...</p>' ;
-
 
539
        return false ;
-
 
540
    }
-
 
541
    return true ;
-
 
542
}
-
 
543
 
-
 
544
/**
389
/**
545
 *
390
 *
546
 * @global  ins_db  Un pointeur vers un objet PEAR::DB connecté
391
 * @global  ins_db  Un pointeur vers un objet PEAR::DB connecté
547
 * @return
392
 * @return
Line 655... Line 500...
655
    $trans_tbl = array_flip ($trans_tbl);
500
    $trans_tbl = array_flip ($trans_tbl);
656
    return strtr ($string, $trans_tbl);
501
    return strtr ($string, $trans_tbl);
657
}
502
}
Line 658... Line 503...
658
 
503
 
659
//==============================================================================
-
 
660
/** function create_new_random($n,$type) permet de générer un nombre de caractères aléatoires.
-
 
661
*
-
 
662
*  
-
 
663
*
-
 
664
*  ENTREE :
-
 
665
*  - $n : créer un 'mot' de $n caractères
-
 
666
*  - $type : permet de définir la liste des caractères disponibles
-
 
667
*
-
 
668
*  SORTIE : chaine de $n caractères pris dans une liste $type
-
 
669
*/
-
 
670
 
-
 
671
function create_new_random($n,$type="")
-
 
672
{
-
 
673
    $str = "";
-
 
674
 
-
 
675
    switch ($type){
-
 
676
        default:{
-
 
677
            $chaine = "abcdefghkmnpqrstuvwxyzABCDEFGHKLMNPQRSTUVWXYZ23456789";
-
 
678
        }
-
 
679
            break;
-
 
680
    }
-
 
681
 
-
 
682
    srand((double)microtime()*1000000);
-
 
683
    for($i = 0; $i < $n; $i++){
-
 
684
        $str .= $chaine[rand()%strlen($chaine)];
-
 
685
    }
-
 
686
 
-
 
687
    return "$str";
-
 
688
}
-
 
689
 
-
 
690
//==============================================================================
504
//==============================================================================
691
/** function nextId () Renvoie le prochain identifiant numérique libre d'une table
505
/** function nextId () Renvoie le prochain identifiant numérique libre d'une table
692
*
506
*
693
*   On passe en paramètre le nom de la table et l'identifiant de la base selon PEAR DB
507
*   On passe en paramètre le nom de la table et l'identifiant de la base selon PEAR DB
694
*
508
*
Line 714... Line 528...
714
}
528
}
Line 715... Line 529...
715
 
529
 
716
/* +--Fin du code ----------------------------------------------------------------------------------------+
530
/* +--Fin du code ----------------------------------------------------------------------------------------+
717
*
531
*
-
 
532
* $Log: not supported by cvs2svn $
-
 
533
* Revision 1.28  2007/04/20 08:39:37  alexandre_tb
-
 
534
* correction de commentaire
718
* $Log: not supported by cvs2svn $
535
*
719
* Revision 1.27  2007/04/11 08:30:12  neiluj
536
* Revision 1.27  2007/04/11 08:30:12  neiluj
720
* remise en état du CVS...
537
* remise en état du CVS...
721
*
538
*
722
* Revision 1.23  2006/12/01 13:23:15  florian
539
* Revision 1.23  2006/12/01 13:23:15  florian