Subversion Repositories Sites.obs-saisons.fr

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 aurelien 1
<?
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 4.1                                                                                      |
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
7
// | This library is free software; you can redistribute it and/or                                        |
8
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | License as published by the Free Software Foundation; either                                         |
10
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// |                                                                                                      |
12
// | This library is distributed in the hope that it will be useful,                                      |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | Lesser General Public License for more details.                                                      |
16
// |                                                                                                      |
17
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | License along with this library; if not, write to the Free Software                                  |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// +------------------------------------------------------------------------------------------------------+
21
/**
22
* programme principal du module annuaire
23
*
24
* programme principal du module annuaire
25
*
26
*@package annuaire
27
//Auteur original :
28
*@author        Alexandre Granier <alexandre@tela-botanica.org>
29
//Autres auteurs :
30
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
*@copyright     Tela-Botanica 2000-2007
32
*@version       $Id: annuaire.php,v 1.4 2005/03/24 08:24:39 alex Exp $
33
// +------------------------------------------------------------------------------------------------------+
34
*/
35
 
36
// +------------------------------------------------------------------------------------------------------+
37
// |                                            ENTETE du PROGRAMME                                       |
38
// +------------------------------------------------------------------------------------------------------+
39
 
40
include_once 'connect.php';
41
include_once 'configuration/car_config.inc.php' ;
42
include_once CAR_CHEMIN_APPLI.'bibliotheque/annuaire.fonct.php' ;
43
 
44
 
45
 
46
//================================================================================================
47
 
48
$GLOBALS['car_auth']->start();
49
 
50
 
51
/**
52
 *  Renvoie le code HTML de l'application
53
 *
54
 * @return  string  HTML
55
 */
56
function afficherContenuCorps () {
57
 
58
	$res="";
59
    if ($GLOBALS['car_auth']->getAuth()) {
60
 
61
 
62
	 // Synchronisation avec l'identification d'origine
63
 
64
 
65
	   if (!PARTICIPANT_EST_ADULTE) {
66
	   		$requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=0");
67
 
68
	   }
69
	   else {
70
 
71
	   		$requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=1");
72
	   }
73
 
74
 
75
  	   $participant_ligne = mysql_fetch_row($requete_participant);
76
 
77
 
78
	   if ($participant_ligne) {
79
        	$_SESSION['participant'] = $participant_ligne[0];
80
	   }
81
 
82
	  if($_GET[act] == 'logout') {
83
			// Synchronisation avec l'identification d'origine
84
			unset($_SESSION['participant']);
85
			// on déconnecte l'utilisateur
86
			$GLOBALS['car_auth']->logout();
87
			$res .= 'Vous êtes présentement déconnecté. '."\n";
88
			$res .= loginFunction();
89
 
90
 
91
	 } else {
92
 
93
	 		$check_pseudo=array_flip($GLOBALS['pseudo_annu']);
94
 
95
	    	if (isset($check_pseudo[$GLOBALS["car_auth"]->getUserName()])) {
96
 
97
	    	$res = '<h1 class="annuaire_titre1">'.CAR_TITRE.'</h1>'."\n";
98
 
99
			// on affiche la possibilité de se déconnecter
100
	        $java ="<script language=\"javascript\">\n" .
101
	            "function setCheckboxes(the_form)
102
	            {
103
	            var do_check=document.forms[the_form].elements['selecttotal'].checked;
104
	            var elts            = document.forms[the_form].elements['select[]'];
105
	            var elts_cnt = (typeof(elts.length) != 'undefined')
106
	                                ? elts.length
107
	                                : 0;
108
	            if (elts_cnt) {
109
	                for (var i = 0; i < elts_cnt; i++) {
110
	                    elts[i].checked = do_check;
111
	                } // Fin for
112
	            } else {
113
	                elts.checked = do_check;
114
	            } // Fin if... else
115
	            return true;
116
	        } // Fin de la fonction 'setCheckboxes()'" .
117
	        "</script>\n";
118
	        $res .= $java;
119
 
120
	        $res .= '<h2 class="annuaire_titre2">'.CAR_CLIQUEZ_LETTRE.'</h2>'."\n";
121
 
122
			// Nettoyage des variables du POST
123
			$cles = array('corps', 'titre_mail');
124
			foreach ($cles as $cle) {
125
				if (isset($_POST[$cle]) && !empty($_POST[$cle])) {
126
					$_POST[$cle] = translittererCp1252VersIso88591(stripslashes($_POST[$cle]));
127
				}
128
			}
129
 
130
			// S'il y a un mail a envoyé, on l'envoie
131
			if (isset($_POST['select']) && is_array($_POST['select'])) {
132
	 			if (isset($_POST['corps']) && isset($_POST['titre_mail'])) {
133
	 				$res .= envoie_mail($_POST['select'], $_POST['titre_mail'], $_POST['corps']) ;
134
	 			}
135
	 		}
136
	        $res .= parcourrirAnnu();
137
	        $res .= carto_texte_cocher();
138
	        $res .= carto_formulaire();
139
 
140
			// On affiche la possibilité de se déconnecter
141
			//$res .= 'Connecté en tant que '.$GLOBALS['car_auth']->getUsername().'. '."\n";
142
			//$res .= '<br><a href= "'.$GLOBALS['car_url']->getURL().'&act=logout">Se déconnecter</a><br />'."\n";
143
 
144
	    	}
145
	    	else {
146
	    		$res .= "Non autorisé !";
147
	    	}
148
 
149
	 }
150
	} else  {
151
		// Not authenticated
152
		$res .= loginFunction();
153
	}
154
    return $res;
155
}
156
 
157
echo afficherContenuCorps();
158
?>