Modif gestion des variables

This commit is contained in:
Rodolphe Quiedeville 2003-11-21 17:33:36 +00:00
parent 5a6f4b9a82
commit a5f27bb4e9

View File

@ -24,16 +24,16 @@ require("./pre.inc.php");
$form = new Form($db); $form = new Form($db);
if ($subaction == 'addrights' && $user->admin) if ($_GET["subaction"] == 'addrights' && $user->admin)
{ {
$edituser = new User($db,$id); $edituser = new User($db,$_GET["id"]);
$edituser->addrights($rights); $edituser->addrights($_GET["rights"]);
} }
if ($subaction == 'delrights' && $user->admin) if ($_GET["subaction"] == 'delrights' && $user->admin)
{ {
$edituser = new User($db,$id); $edituser = new User($db,$_GET["id"]);
$edituser->delrights($rights); $edituser->delrights($_GET["rights"]);
} }
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == "yes") if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == "yes")
@ -158,16 +158,16 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
else else
{ {
if ($id) if ($_GET["id"])
{ {
$fuser = new User($db, $id); $fuser = new User($db, $_GET["id"]);
$fuser->fetch(); $fuser->fetch();
print_fiche_titre("Fiche utilisateur",$message); print_fiche_titre("Fiche utilisateur",$message);
if ($request == 'delete') if ($request == 'delete')
{ {
print '<form method="post" action="'.$PHP_SELF.'?id='.$id.'">'; print '<form method="post" action="'.$PHP_SELF.'?id='.$fuser->id.'">';
print '<input type="hidden" name="action" value="confirm_delete">'; print '<input type="hidden" name="action" value="confirm_delete">';
print '<table class="border" cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table class="border" cellspacing="0" border="1" width="100%" cellpadding="3">';
@ -184,7 +184,7 @@ else
} }
if ($request == 'perms') if ($_GET["request"] == 'perms')
{ {
/* /*
* Droits * Droits
@ -192,7 +192,7 @@ else
print '<table class="border" width="100%" border="0" cellpadding="3" cellspacing="0">'; print '<table class="border" width="100%" border="0" cellpadding="3" cellspacing="0">';
print "<tr>".'<td width="25%" valign="top">Nom</td>'; print '<tr><td width="25%" valign="top">Nom</td>';
print '<td width="25%" class="valeur">'.$fuser->nom.'</td>'; print '<td width="25%" class="valeur">'.$fuser->nom.'</td>';
print '<td width="25%" valign="top">Prénom</td>'; print '<td width="25%" valign="top">Prénom</td>';
print '<td width="25%" class="valeur">'.$fuser->prenom.'</td></tr>'; print '<td width="25%" class="valeur">'.$fuser->prenom.'</td></tr>';
@ -214,9 +214,9 @@ else
$oldmod = $obj->module; $oldmod = $obj->module;
$var = !$var; $var = !$var;
} }
print '<tr '. $bc[$var].'><td><a href="fiche.php?id='.$id.'&amp;request=perms&amp;subaction=addrights&amp;rights='.$obj->id.'">Ajouter</a></td><td>'; print '<tr '. $bc[$var].'><td><a href="fiche.php?id='.$fuser->id.'&amp;request=perms&amp;subaction=addrights&amp;rights='.$obj->id.'">Ajouter</a></td><td>';
print $obj->libelle . '</td>'; print $obj->libelle . '</td></tr>';
print '<td><a href="fiche.php?id='.$id.'&amp;request=perms&amp;subaction=delrights&amp;rights='.$obj->id.'">Supprimer</a></td></tr>';
$i++; $i++;
} }
} }
@ -227,7 +227,7 @@ else
* Droits * Droits
*/ */
print '<table class="noborder" width="100%" cellpadding="2" cellspacing="0">'; print '<table class="noborder" width="100%" cellpadding="2" cellspacing="0">';
$sql = "SELECT r.libelle, r.module FROM llx_rights_def as r, llx_user_rights as ur"; $sql = "SELECT r.id, r.libelle, r.module FROM llx_rights_def as r, llx_user_rights as ur";
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC"; $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
$var = True; $var = True;
if ($db->query($sql)) if ($db->query($sql))
@ -243,7 +243,8 @@ else
$var = !$var; $var = !$var;
} }
print "<tr $bc[$var]><td>".$obj->libelle . '</td></tr>'; print "<tr $bc[$var]><td>".$obj->libelle . '</td>';
print '<td align="right"><a href="fiche.php?id='.$fuser->id.'&amp;request=perms&amp;subaction=delrights&amp;rights='.$obj->id.'">Supprimer</a></td></tr>';
$i++; $i++;
} }
} }
@ -338,7 +339,7 @@ else
if ($user->admin) if ($user->admin)
{ {
print '<td width="20%" align="center"><a href="fiche.php?action=edit&amp;id='.$id.'">Editer</a></td>'; print '<td width="20%" align="center"><a href="fiche.php?action=edit&amp;id='.$fuser->id.'">Editer</a></td>';
} }
else else
{ {
@ -348,7 +349,7 @@ else
if ($user->id == $id or $user->admin) if ($user->id == $id or $user->admin)
{ {
print '<td width="20%" align="center"><a href="fiche.php?action=password&amp;id='.$id.'">Nouveau mot de passe</a></td>'; print '<td width="20%" align="center"><a href="fiche.php?action=password&amp;id='.$fuser->id.'">Nouveau mot de passe</a></td>';
} }
else else
{ {
@ -357,7 +358,7 @@ else
if ($user->admin) if ($user->admin)
{ {
print '<td width="20%" align="center"><a href="fiche.php?request=perms&amp;id='.$id.'">Permissions</a></td>'; print '<td width="20%" align="center"><a href="fiche.php?request=perms&amp;id='.$fuser->id.'">Permissions</a></td>';
} }
else else
{ {
@ -367,7 +368,7 @@ else
if ($user->admin && $user->id <> $id) if ($user->admin && $user->id <> $id)
{ {
print '<td width="20%" align="center"><a href="fiche.php?request=delete&amp;id='.$id.'">Supprimer</a></td>'; print '<td width="20%" align="center"><a href="fiche.php?request=delete&amp;id='.$fuser->id.'">Supprimer</a></td>';
} }
else else
{ {