6 |
jpm |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2001 Laurent COUDOUNEAU (lc@gsite.org) |
|
|
|
7 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
8 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
9 |
// | This library is free software; you can redistribute it and/or |
|
|
|
10 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
11 |
// | License as published by the Free Software Foundation; either |
|
|
|
12 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
13 |
// | |
|
|
|
14 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
15 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
16 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
17 |
// | Lesser General Public License for more details. |
|
|
|
18 |
// | |
|
|
|
19 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
20 |
// | License along with this library; if not, write to the Free Software |
|
|
|
21 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
22 |
// +------------------------------------------------------------------------------------------------------+
|
25 |
jpm |
23 |
// CVS : $Id: adsi_admin.fonct.php,v 1.2 2004-07-06 17:08:01 jpm Exp $
|
6 |
jpm |
24 |
/**
|
|
|
25 |
* Bibliothèque de fonctions pour la manipulation des administrateurs par l'application Administrateur de Papyrus.
|
|
|
26 |
*
|
|
|
27 |
* Contient principalement des fonctions permettant d'obtenir des informations sur les administrateurs de Papyrus.
|
|
|
28 |
*
|
25 |
jpm |
29 |
*@package Admin_site
|
6 |
jpm |
30 |
*@subpackage Fonctions
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Laurent COUDOUNEAU <lc@gsite.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.orG>
|
|
|
35 |
*@copyright Tela-Botanica 2000-2004
|
25 |
jpm |
36 |
*@version $Revision: 1.2 $ $Date: 2004-07-06 17:08:01 $
|
6 |
jpm |
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
**/
|
|
|
39 |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
// | ENTÊTE du PROGRAMME |
|
|
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
43 |
define ('level_admin', 0);
|
|
|
44 |
|
|
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
46 |
// | LISTE des FONCTIONS |
|
|
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
48 |
|
|
|
49 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
50 |
function getUserInfos ($db, $link, $appl, $project, $userid)
|
|
|
51 |
{
|
|
|
52 |
$query =
|
|
|
53 |
"select * from $db.annu_ADMIN".
|
|
|
54 |
" where AA_USER_ID='$userid'".
|
|
|
55 |
" and AA_PROJECT='$project'".
|
|
|
56 |
" and AA_APPL='$appl'";
|
|
|
57 |
|
|
|
58 |
$result = mysql_query ($query, $link);
|
|
|
59 |
|
|
|
60 |
if (! $result) {
|
|
|
61 |
die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
if (mysql_num_rows ($result) != 1) {
|
|
|
65 |
mysql_free_result ($result);
|
|
|
66 |
return array ('level' => -1, 'args' => '');
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
$row = mysql_fetch_object ($result);
|
|
|
70 |
|
|
|
71 |
mysql_free_result ($result);
|
|
|
72 |
|
|
|
73 |
return array ('level' => $row->AA_LEVEL, 'args' => $row->AA_ARGUMENT);
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
77 |
|
|
|
78 |
function getUserLevel ($db, $link, $appl, $project, $userid)
|
|
|
79 |
{
|
|
|
80 |
$infos = getUserInfos ($db, $link, $appl, $project, $userid);
|
|
|
81 |
|
|
|
82 |
return $infos['level'];
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
86 |
|
|
|
87 |
function userIsAdministrator ($db, $link, $appl, $project, $userid)
|
|
|
88 |
{
|
|
|
89 |
return (getUserLevel ($db, $link, $appl, $project, $userid) == level_admin);
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
94 |
*
|
|
|
95 |
* $Log: not supported by cvs2svn $
|
25 |
jpm |
96 |
* Revision 1.1 2004/06/16 14:22:26 jpm
|
|
|
97 |
* Changement de nom de Génésia en Papyrus.
|
|
|
98 |
* Changement de l'arborescence.
|
|
|
99 |
*
|
6 |
jpm |
100 |
* Revision 1.4 2004/04/01 11:24:19 jpm
|
|
|
101 |
* Ajout et modification de commentaires pour PhpDocumentor.
|
|
|
102 |
*
|
|
|
103 |
* Revision 1.3 2004/03/26 12:50:52 jpm
|
|
|
104 |
* Mise en forme de l'indentation des fonctions.
|
|
|
105 |
*
|
|
|
106 |
* Revision 1.2 2004/03/23 08:28:23 jpm
|
|
|
107 |
* Mise en conformité avec la convention de codage.
|
|
|
108 |
* Ajout de l'entête conforme.
|
|
|
109 |
*
|
|
|
110 |
*
|
|
|
111 |
*/
|
|
|
112 |
?>
|