Subversion Repositories Applications.papyrus

Rev

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

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