From 914e32fc571797c0672efcdb44aefc09aaa54887 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Apr 2005 15:06:18 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Ne=20plante=20plus=20sur=20les=20permiss?= =?UTF-8?q?ions=20si=20un=20module=20a=20=E9t=E9=20effac=E9=20sans=20avoir?= =?UTF-8?q?=20=E9t=E9=20d=E9sactiv=E9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/perms.php | 89 ++++++++++++++++++++----------------- htdocs/user/group/perms.php | 8 ++++ htdocs/user/perms.php | 8 ++++ 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index f55ec328143..e99e3bfaa6e 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -96,56 +96,63 @@ $sql.=" WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.=" ORDER BY r.id, r.module"; $result = $db->query($sql); -if ($result) +if ($result) { - $num = $db->num_rows(); - $i = 0; - $var=True; - $old = ""; - while ($i < $num) + $num = $db->num_rows(); + $i = 0; + $var=True; + $old = ""; + while ($i < $num) { - $obj = $db->fetch_object($result); - $var=!$var; + $obj = $db->fetch_object($result); - if ($old <> $obj->module) - { - // Rupture détectée, on récupère objMod - $objMod=$modules[$obj->module]; - $picto=($objMod->picto?$objMod->picto:'generic'); + // Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore + if (! $modules[$obj->module]) + { + $i++; + continue; + } - print ''; - print ''.$langs->trans("Module").''; - print ''.$langs->trans("Permission").''; - print ''.$langs->trans("Default").''; - print ' '; - print "\n"; - $old = $obj->module; - } + if ($old <> $obj->module) + { + // Rupture détectée, on récupère objMod + $objMod=$modules[$obj->module]; + $picto=($objMod->picto?$objMod->picto:'generic'); - print ''; + print ''; + print ''.$langs->trans("Module").''; + print ''.$langs->trans("Permission").''; + print ''.$langs->trans("Default").''; + print ' '; + print "\n"; + $old = $obj->module; + } - print ''.img_object('',$picto).' '.$objMod->getName(); + $var=!$var; + print ''; - $perm_libelle=(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle); - print ''.$perm_libelle. ''; - - print ''; - if ($obj->bydefault == 1) - { + print ''.img_object('',$picto).' '.$objMod->getName(); - print img_tick(); - print ''; - print ''.img_edit_remove().''; - } - else - { - print ' '; - print ''; - print ''.img_edit_add().''; - } + $perm_libelle=(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle); + print ''.$perm_libelle. ''; - print ''; - $i++; + print ''; + if ($obj->bydefault == 1) + { + + print img_tick(); + print ''; + print ''.img_edit_remove().''; + } + else + { + print ' '; + print ''; + print ''.img_edit_add().''; + } + + print ''; + $i++; } } diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index ddbe07bcb00..1bb2e286e26 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -171,6 +171,14 @@ if ($_GET["id"]) while ($i < $num) { $obj = $db->fetch_object($result); + + // Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore + if (! $modules[$obj->module]) + { + $i++; + continue; + } + if ($oldmod <> $obj->module) { $oldmod = $obj->module; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 05673da90e8..5e5cac4f4a4 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -211,6 +211,14 @@ if ($_GET["id"]) while ($i < $num) { $obj = $db->fetch_object($result); + + // Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore + if (! $modules[$obj->module]) + { + $i++; + continue; + } + if ($oldmod <> $obj->module) { $oldmod = $obj->module;