Subversion Repositories Applications.papyrus

Rev

Rev 897 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 897 Rev 1292
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
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 version.                                   |
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.wiki.php,v 1.4 2006-07-04 09:39:03 alexandre_tb Exp $
22
// CVS : $Id: inscription.fonct.wiki.php,v 1.5 2007-04-06 08:35:46 neiluj Exp $
23
/**
23
/**
24
* Fonctions wikini
24
* Fonctions wikini
25
*
25
*
26
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
26
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
27
*
27
*
28
*@package inscription
28
*@package inscription
29
*@subpackage fonctions_wikini
29
*@subpackage fonctions_wikini
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        Aucun
34
*@copyright     Tela-Botanica 2000-2004
34
*@copyright     Tela-Botanica 2000-2004
35
*@version       $Revision: 1.4 $ $Date: 2006-07-04 09:39:03 $
35
*@version       $Revision: 1.5 $ $Date: 2007-04-06 08:35:46 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
44
// |                                           LISTE de FONCTIONS                                         |
44
// |                                           LISTE de FONCTIONS                                         |
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
46
 
46
 
47
function inscription_interwikini_users($id, $valeur) {
47
function inscription_interwikini_users($id, $valeur) {
48
    // On vérifie l'existance du nom wiki dans interwikini_users
-
 
49
    $requete_verif = 'select name from interwikini_users where name="'.$valeur['nom_wiki'].'"';
-
 
50
    $resultat_verif = $GLOBALS['ins_db']->query ($requete_verif) ;
-
 
51
    if (DB::isError($resultat_verif)) {
-
 
52
        echo ("Echec de la requete dans interwikini_users<br />".$resultat_verif->getMessage()) ;
-
 
53
    }
48
    
54
    if ($resultat_verif->numRows() != 0) {
-
 
55
    	return ;	
-
 
56
    }
-
 
57
    $requete = "insert into interwikini_users set name=\"".$valeur['nom_wiki'].
49
    $requete = "insert into interwikini_users set name=\"".$valeur['nom_wiki'].
58
                "\", password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"".
50
                "\", password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"" ;
59
                ', signuptime=now()' ;
-
 
60
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
51
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
61
    if (DB::isError($resultat)) {
52
    if (DB::isError($resultat)) {
62
        echo ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
53
        echo ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
63
    }
54
    }
64
}
55
}
65
 
56
 
66
function mod_inscription_interwikini_users($nomwiki, $valeur) {
57
function mod_inscription_interwikini_users($nomwiki, $valeur) {
67
    
58
    
68
    $requete = "update interwikini_users set password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"".
59
    $requete = "update interwikini_users set password=\"".md5($valeur['mot_de_passe'])."\", email=\"".$valeur['email']."\"".
69
                " where name=\"$nomwiki\"" ;
60
                " where name=\"$nomwiki\"" ;
70
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
61
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
71
    if (DB::isError($resultat)) {
62
    if (DB::isError($resultat)) {
72
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
63
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
73
    }
64
    }
74
}
65
}
75
 
66
 
76
function desinscription_interwikini_users($nomwiki) {
67
function desinscription_interwikini_users($nomwiki) {
77
    $requete = "delete from interwikini_users where name=\"$nomwiki\"" ;
68
    $requete = "delete from interwikini_users where name=\"$nomwiki\"" ;
78
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
69
    $resultat = $GLOBALS['ins_db']->query ($requete) ;
79
    if (DB::isError($resultat)) {
70
    if (DB::isError($resultat)) {
80
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
71
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
81
    }
72
    }
82
}
73
}
83
 
74
 
84
function verif_doublonNomWiki($nom_wiki) {
75
function verif_doublonNomWiki($nom_wiki) {
85
    global $db ;
76
    global $db ;
86
    $requete = "select name from interwikini_users where name = \"$nom_wiki\"" ;
77
    $requete = "select name from interwikini_users where name = \"$nom_wiki\" limit 1" ;
87
    $resultat = $db->query ($requete) ;
78
    $resultat = $db->query ($requete) ;
88
    if (DB::isError ($resultat)) {
79
    if (DB::isError ($resultat)) {
89
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
80
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
90
    }
81
    }
91
    if ($resultat->numRows() == 0) return true ;
82
    if ($resultat->numRows() == 0) return true ;
92
    return false ;
83
    return false ;
93
}
84
}
94
 
85
 
95
function wiki_cookie() {
86
function wiki_cookie() {
96
	if ($userid != "") {
87
	if ($userid != "") {
97
		// 1. name
88
		// 1. name
98
		// On recherche le nom
89
		// On recherche le nom
99
		$nomwikini = $AUTH->getAuthData('ga_login') ;
90
		$nomwikini = $AUTH->getAuthData('ga_login') ;
100
		setcookie ("name", $nomwikini, time () + 3600 * 24 * 30, "/" ) ; // 1 mois
91
		setcookie ("name", $nomwikini, time () + 3600 * 24 * 30, "/" ) ; // 1 mois
101
		//2. password
92
		//2. password
102
		// on recherche le mot de passe crypté
93
		// on recherche le mot de passe crypté
103
		$requete = "select ga_mot_de_passe from gen_annuaire where ga_id_administrateur=$userid" ;
94
		$requete = "select ga_mot_de_passe from gen_annuaire where ga_id_administrateur=$userid" ;
104
		$resultat = $db->query ($requete) ;
95
		$resultat = $db->query ($requete) ;
105
		if (DB::isError($resultat)) {
96
		if (DB::isError($resultat)) {
106
			die ("Erreur") ;
97
			die ("Erreur") ;
107
		}
98
		}
108
		$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
99
		$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
109
		$mot_de_passe = $ligne->ga_mot_de_passe ;
100
		$mot_de_passe = $ligne->ga_mot_de_passe ;
110
		setcookie ("password", $mot_de_passe, time () + 3600 * 24 * 30, "/") ;
101
		setcookie ("password", $mot_de_passe, time () + 3600 * 24 * 30, "/") ;
111
		// 3. remember
102
		// 3. remember
112
		setcookie ("remember", 1, time () + 3600 * 24 * 30, "/") ;
103
		setcookie ("remember", 1, time () + 3600 * 24 * 30, "/") ;
113
	}
104
	}
114
}
105
}
115
 
106
 
116
/* +--Fin du code ----------------------------------------------------------------------------------------+
107
/* +--Fin du code ----------------------------------------------------------------------------------------+
117
*
108
*
118
* $Log: not supported by cvs2svn $
109
* $Log: not supported by cvs2svn $
119
* Revision 1.3  2006/04/11 08:42:07  alexandre_tb
-
 
120
* Vérification de l'existance d'un nom wiki avant son insertion
-
 
121
*
-
 
122
* Revision 1.2  2005/09/29 13:56:48  alexandre_tb
110
* Revision 1.2  2005/09/29 13:56:48  alexandre_tb
123
* En cours de production. Reste à gérer les news letters et d'autres choses.
111
* En cours de production. Reste à gérer les news letters et d'autres choses.
124
*
112
*
125
* Revision 1.1  2005/09/22 14:02:49  ddelon
113
* Revision 1.1  2005/09/22 14:02:49  ddelon
126
* nettoyage annuaire et php5
114
* nettoyage annuaire et php5
127
*
115
*
128
* Revision 1.4  2005/09/22 13:30:49  florian
116
* Revision 1.4  2005/09/22 13:30:49  florian
129
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
117
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
130
*
118
*
131
* Revision 1.2  2005/03/21 16:57:30  florian
119
* Revision 1.2  2005/03/21 16:57:30  florian
132
* correction de bug, mise à jour interface
120
* correction de bug, mise à jour interface
133
*
121
*
134
* Revision 1.1  2004/12/15 13:32:25  alex
122
* Revision 1.1  2004/12/15 13:32:25  alex
135
* version initiale
123
* version initiale
136
*
124
*
137
* Revision 1.1  2004/07/06 15:42:17  alex
125
* Revision 1.1  2004/07/06 15:42:17  alex
138
* en cours
126
* en cours
139
*
127
*
140
* Revision 1.1  2004/06/18 09:20:48  alex
128
* Revision 1.1  2004/06/18 09:20:48  alex
141
* version initiale
129
* version initiale
142
*
130
*
143
*
131
*
144
* +-- Fin du code ----------------------------------------------------------------------------------------+
132
* +-- Fin du code ----------------------------------------------------------------------------------------+
145
*/
133
*/
146
 
134
 
147
 
135
 
148
 
136
 
149
 
137
 
150
?>
138
?>