Subversion Repositories Applications.papyrus

Rev

Rev 425 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
425 florian 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
446 florian 22
// CVS : $Id: inscription.fonct.wiki.php,v 1.4 2005-09-22 13:30:49 florian Exp $
425 florian 23
/**
24
* Fonctions wikini
25
*
26
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
27
*
28
*@package inscription
29
*@subpackage fonctions_wikini
30
//Auteur original :
31
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
//Autres auteurs :
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
446 florian 35
*@version       $Revision: 1.4 $ $Date: 2005-09-22 13:30:49 $
425 florian 36
// +------------------------------------------------------------------------------------------------------+
37
*/
38
 
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
42
 
43
// +------------------------------------------------------------------------------------------------------+
44
// |                                           LISTE de FONCTIONS                                         |
45
// +------------------------------------------------------------------------------------------------------+
46
 
47
function inscription_interwikini_users() {
48
    global $db, $HTTP_POST_VARS ;
49
 
50
    $requete = "insert into interwikini_users set name=\"".$HTTP_POST_VARS['nomwiki'].
51
                "\", password=\"".md5($HTTP_POST_VARS['password'])."\", email=\"".$HTTP_POST_VARS['email']."\"" ;
52
    $resultat = $db->query ($requete) ;
53
    if (DB::isError($resultat)) {
54
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
55
    }
56
}
57
 
58
function mod_inscription_interwikini_users($id) {
59
    global $db, $HTTP_POST_VARS, $AUTH ;
60
 
61
    $requete = "update interwikini_users set password=\"".md5($HTTP_POST_VARS['password'])."\", email=\"".$HTTP_POST_VARS['mail']."\"".
62
                " where name=\"".$AUTH->getAuthData(INS_CHAMPS_LOGIN)."\"" ;
63
    $resultat = $db->query ($requete) ;
64
    if (DB::isError($resultat)) {
65
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
66
    }
67
}
68
 
69
function desinscription_interwikini_users($nomwiki) {
70
    global $db ;
71
 
72
    $requete = "delete from interwikini_users where name=\"$nomwiki\"" ;
73
    $resultat = $db->query ($requete) ;
74
    if (DB::isError($resultat)) {
75
        die ("Echec de la requete dans interwikini_users<br />".$resultat->getMessage()) ;
76
    }
77
}
78
 
79
function verif_doublonNomWiki($nom_wiki) {
80
    global $db ;
81
    $requete = "select name from interwikini_users where name = \"$nom_wiki\"" ;
82
    $resultat = $db->query ($requete) ;
83
    if (DB::isError ($resultat)) {
84
    	die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
85
    }
86
    if ($resultat->numRows() == 0) return true ;
87
    return false ;
88
}
89
 
90
function wiki_cookie() {
91
	if ($userid != "") {
92
		// 1. name
93
		// On recherche le nom
94
		$nomwikini = $AUTH->getAuthData('ga_login') ;
95
		setcookie ("name", $nomwikini, time () + 3600 * 24 * 30, "/" ) ; // 1 mois
96
		//2. password
97
		// on recherche le mot de passe crypté
98
		$requete = "select ga_mot_de_passe from gen_annuaire where ga_id_administrateur=$userid" ;
99
		$resultat = $db->query ($requete) ;
100
		if (DB::isError($resultat)) {
101
			die ("Erreur") ;
102
		}
103
		$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
104
		$mot_de_passe = $ligne->ga_mot_de_passe ;
105
		setcookie ("password", $mot_de_passe, time () + 3600 * 24 * 30, "/") ;
106
		// 3. remember
107
		setcookie ("remember", 1, time () + 3600 * 24 * 30, "/") ;
108
	}
109
}
110
 
111
/* +--Fin du code ----------------------------------------------------------------------------------------+
112
*
113
* $Log: not supported by cvs2svn $
114
* Revision 1.2  2005/03/21 16:57:30  florian
115
* correction de bug, mise à jour interface
116
*
117
* Revision 1.1  2004/12/15 13:32:25  alex
118
* version initiale
119
*
120
* Revision 1.1  2004/07/06 15:42:17  alex
121
* en cours
122
*
123
* Revision 1.1  2004/06/18 09:20:48  alex
124
* version initiale
125
*
126
*
127
* +-- Fin du code ----------------------------------------------------------------------------------------+
128
*/
129
 
130
 
131
 
132
 
133
?>