Rev 6 | Blame | Last modification | View Log | RSS feed
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2001 Laurent COUDOUNEAU (lc@gsite.org) |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: adsi_admin.fonct.php,v 1.2 2004-07-06 17:08:01 jpm Exp $
/**
* Bibliothèque de fonctions pour la manipulation des administrateurs par l'application Administrateur de Papyrus.
*
* Contient principalement des fonctions permettant d'obtenir des informations sur les administrateurs de Papyrus.
*
*@package Admin_site
*@subpackage Fonctions
//Auteur original :
*@author Laurent COUDOUNEAU <lc@gsite.org>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.orG>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $ $Date: 2004-07-06 17:08:01 $
// +------------------------------------------------------------------------------------------------------+
**/
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
define ('level_admin', 0);
// +------------------------------------------------------------------------------------------------------+
// | LISTE des FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
// +------------------------------------------------------------------------------------------------------+
function getUserInfos ($db, $link, $appl, $project, $userid)
{
$query =
"select * from $db.annu_ADMIN".
" where AA_USER_ID='$userid'".
" and AA_PROJECT='$project'".
" and AA_APPL='$appl'";
$result = mysql_query ($query, $link);
if (! $result) {
die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
}
if (mysql_num_rows ($result) != 1) {
mysql_free_result ($result);
return array ('level' => -1, 'args' => '');
}
$row = mysql_fetch_object ($result);
mysql_free_result ($result);
return array ('level' => $row->AA_LEVEL, 'args' => $row->AA_ARGUMENT);
}
// +------------------------------------------------------------------------------------------------------+
function getUserLevel ($db, $link, $appl, $project, $userid)
{
$infos = getUserInfos ($db, $link, $appl, $project, $userid);
return $infos['level'];
}
// +------------------------------------------------------------------------------------------------------+
function userIsAdministrator ($db, $link, $appl, $project, $userid)
{
return (getUserLevel ($db, $link, $appl, $project, $userid) == level_admin);
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2004/06/16 14:22:26 jpm
* Changement de nom de Génésia en Papyrus.
* Changement de l'arborescence.
*
* Revision 1.4 2004/04/01 11:24:19 jpm
* Ajout et modification de commentaires pour PhpDocumentor.
*
* Revision 1.3 2004/03/26 12:50:52 jpm
* Mise en forme de l'indentation des fonctions.
*
* Revision 1.2 2004/03/23 08:28:23 jpm
* Mise en conformité avec la convention de codage.
* Ajout de l'entête conforme.
*
*
*/
?>