229 |
alex |
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 file is part of Papyrus. |
|
|
|
9 |
// | |
|
|
|
10 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
11 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
12 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
13 |
// | (at your option) any later version. |
|
|
|
14 |
// | |
|
|
|
15 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
16 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
17 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
18 |
// | GNU General Public License for more details. |
|
|
|
19 |
// | |
|
|
|
20 |
// | You should have received a copy of the GNU General Public License |
|
|
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: admi_application.fonct.php,v 1.1 2004-12-13 18:07:28 alex Exp $
|
|
|
25 |
/**
|
|
|
26 |
* Contient les fonctions de l'appli admin_auth
|
|
|
27 |
*
|
|
|
28 |
*
|
|
|
29 |
*
|
|
|
30 |
*
|
|
|
31 |
*@package Admin_auth
|
|
|
32 |
*@subpackage Fonctions
|
|
|
33 |
//Auteur original :
|
|
|
34 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
35 |
//Autres auteurs :
|
|
|
36 |
*@author Aucun
|
|
|
37 |
*@copyright Tela-Botanica 2000-2004
|
|
|
38 |
*@version $Revision: 1.1 $
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
*/
|
|
|
41 |
|
|
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
43 |
// | LISTE de FONCTIONS |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
*
|
|
|
48 |
*
|
|
|
49 |
* @return
|
|
|
50 |
*/
|
|
|
51 |
|
|
|
52 |
function adau_supprimer_authentification($id_auth, &$db) {
|
|
|
53 |
|
|
|
54 |
// on recherche l'identifiant de gen_site_auth_bdd à partir de gen_site_auth
|
|
|
55 |
$requete = "select gsa_ce_auth_bdd from gen_site_auth where gsa_id_auth=".$GLOBALS['id_auth'] ;
|
|
|
56 |
$resultat = $db->query ($requete) ;
|
|
|
57 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
|
|
58 |
$id_auth_bdd = $ligne->gsa_ce_auth_bdd ;
|
|
|
59 |
|
|
|
60 |
$requete = "delete from gen_site_auth where gsa_id_auth=$id_auth" ;
|
|
|
61 |
$resultat = $db->query ($requete) ;
|
|
|
62 |
|
|
|
63 |
$requete = "delete from gen_site_auth_bdd where gsab_id_auth_bdd=$id_auth_bdd" ;
|
|
|
64 |
$resultat = $db->query ($requete) ;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
*
|
|
|
69 |
*
|
|
|
70 |
* @return
|
|
|
71 |
*/
|
|
|
72 |
|
|
|
73 |
function adau_valeurs_par_defaut ($id_auth, &$db) {
|
|
|
74 |
// requete sur gen_site_auth
|
|
|
75 |
|
|
|
76 |
$requete = "select * from gen_site_auth where gsa_id_auth=$id_auth" ;
|
|
|
77 |
$resultat = $db->query ($requete) ;
|
|
|
78 |
if (DB::isError ($resultat)) {
|
|
|
79 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(), E_USER_WARNING) ;
|
|
|
80 |
return ;
|
|
|
81 |
}
|
|
|
82 |
$tableau_retour = array () ;
|
|
|
83 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
|
|
84 |
$tableau_retour['nom_auth'] = $ligne->gsa_nom ;
|
|
|
85 |
$tableau_retour['abreviation'] = $ligne->gsa_abreviation ;
|
|
|
86 |
$tableau_retour['id_auth_bdd'] = $ligne->gsa_ce_auth_bdd ;
|
|
|
87 |
$tableau_retour['id_auth'] = $ligne->gsa_id_auth ;
|
|
|
88 |
unset ($requete, $resultat) ;
|
|
|
89 |
|
|
|
90 |
// requete sur gen_site_auth_bdd
|
|
|
91 |
$requete = "select * from gen_site_auth_bdd where gsab_id_auth_bdd=$ligne->gsa_ce_auth_bdd" ;
|
|
|
92 |
unset ($ligne) ;
|
|
|
93 |
$resultat = $db->query ($requete) ;
|
|
|
94 |
if (DB::isError ($resultat)) {
|
|
|
95 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
|
|
|
96 |
return ;
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
|
|
100 |
$tableau_retour['dsn'] = $ligne->gsab_dsn ;
|
|
|
101 |
$tableau_retour['nom_table'] = $ligne->gsab_nom_table ;
|
|
|
102 |
$tableau_retour['champs_login'] = $ligne->gsab_nom_champ_login ;
|
|
|
103 |
$tableau_retour['champs_passe'] = $ligne->gsab_nom_champ_mdp ;
|
|
|
104 |
$tableau_retour['cryptage'] = $ligne->gsab_cryptage_mdp ;
|
|
|
105 |
|
|
|
106 |
return $tableau_retour ;
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
*
|
|
|
111 |
*
|
|
|
112 |
* @return
|
|
|
113 |
*/
|
|
|
114 |
|
|
|
115 |
function insertion ($valeur, &$db) {
|
|
|
116 |
$id_auth_bdd = SQL_obtenirNouveauId ($db, 'gen_site_auth_bdd', 'gsab_id_auth_bdd') ;
|
|
|
117 |
$requete = "insert into gen_site_auth set gsa_id_auth="
|
|
|
118 |
.SQL_obtenirNouveauId($db, 'gen_site_auth', 'gsa_id_auth').","
|
|
|
119 |
.requete_site_auth($valeur)
|
|
|
120 |
.', gsa_ce_auth_bdd='.$id_auth_bdd ;
|
|
|
121 |
$resultat = $db->query ($requete) ;
|
|
|
122 |
if (DB::isError ($resultat)) {
|
|
|
123 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
|
|
|
124 |
}
|
|
|
125 |
$requete = "insert into gen_site_auth_bdd set gsab_id_auth_bdd=$id_auth_bdd, "
|
|
|
126 |
.requete_site_auth_bdd($valeur) ;
|
|
|
127 |
$resultat = $db->query ($requete) ;
|
|
|
128 |
if (DB::isError ($resultat)) {
|
|
|
129 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
|
|
|
130 |
}
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
/**
|
|
|
134 |
*
|
|
|
135 |
*
|
|
|
136 |
* @return
|
|
|
137 |
*/
|
|
|
138 |
|
|
|
139 |
function mise_a_jour ($valeur, &$db) {
|
|
|
140 |
$requete = "update gen_site_auth set ".requete_site_auth($valeur)
|
|
|
141 |
.' where gsa_id_auth='.$GLOBALS['id_auth'] ;
|
|
|
142 |
$resultat = $db->query ($requete) ;
|
|
|
143 |
if (DB::isError ($resultat)) {
|
|
|
144 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
|
|
|
145 |
}
|
|
|
146 |
unset ($requete) ;
|
|
|
147 |
// on recherche l'identifiant de gen_site_auth_bdd à partir de gen_site_auth
|
|
|
148 |
$requete = "select gsa_ce_auth_bdd from gen_site_auth where gsa_id_auth=".$GLOBALS['id_auth'] ;
|
|
|
149 |
$resultat = $db->query ($requete) ;
|
|
|
150 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
|
|
|
151 |
$id_auth_bdd = $ligne->gsa_ce_auth_bdd ;
|
|
|
152 |
|
|
|
153 |
$requete = "update gen_site_auth_bdd set "
|
|
|
154 |
.requete_site_auth_bdd($valeur)
|
|
|
155 |
.' where gsab_id_auth_bdd='.$id_auth_bdd ;
|
|
|
156 |
$resultat = $db->query ($requete) ;
|
|
|
157 |
if (DB::isError ($resultat)) {
|
|
|
158 |
trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
|
|
|
159 |
}
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
/**
|
|
|
163 |
*
|
|
|
164 |
*
|
|
|
165 |
* @return string un morceau de code SQL
|
|
|
166 |
*/
|
|
|
167 |
|
|
|
168 |
function requete_site_auth (&$valeur) {
|
|
|
169 |
return 'gsa_nom="'.$valeur['nom_auth'].'", '
|
|
|
170 |
.'gsa_ce_type_auth=1, '
|
|
|
171 |
.'gsa_abreviation="'.$valeur['abreviation'].'"' ;
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
/**
|
|
|
175 |
*
|
|
|
176 |
*
|
|
|
177 |
* @return
|
|
|
178 |
*/
|
|
|
179 |
|
|
|
180 |
function requete_site_auth_bdd (&$valeur) {
|
|
|
181 |
return 'gsab_dsn="'.$valeur['dsn'].'", '
|
|
|
182 |
.'gsab_nom_table="'.$valeur['nom_table'].'", '
|
|
|
183 |
.'gsab_nom_champ_login="'.$valeur['champs_login'].'", '
|
|
|
184 |
.'gsab_nom_champ_mdp="'.$valeur['champs_passe'].'", '
|
|
|
185 |
.'gsab_cryptage_mdp="'.$valeur['cryptage'].'"';
|
|
|
186 |
}
|
|
|
187 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
188 |
// | PIED du PROGRAMME |
|
|
|
189 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
193 |
*
|
|
|
194 |
* $Log: not supported by cvs2svn $
|
|
|
195 |
*
|
|
|
196 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
197 |
*/
|
|
|
198 |
?>
|