From 6ca736240683100d7feb82ad41573ba2bf645de0 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 3 Feb 2004 16:44:47 +0000 Subject: [PATCH] no longer link to delete/PDF page if nothing selected --- lam-0.4/templates/lists/listdomains.php | 8 +++++--- lam-0.4/templates/lists/listgroups.php | 11 ++++++++--- lam-0.4/templates/lists/listhosts.php | 19 ++++++++++++++----- lam-0.4/templates/lists/listusers.php | 10 ++++++++-- lam/templates/lists/listdomains.php | 8 +++++--- lam/templates/lists/listgroups.php | 11 ++++++++--- lam/templates/lists/listhosts.php | 19 ++++++++++++++----- lam/templates/lists/listusers.php | 10 ++++++++-- 8 files changed, 70 insertions(+), 26 deletions(-) diff --git a/lam-0.4/templates/lists/listdomains.php b/lam-0.4/templates/lists/listdomains.php index 2511ad9d..362a27aa 100644 --- a/lam-0.4/templates/lists/listdomains.php +++ b/lam-0.4/templates/lists/listdomains.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,9 +53,11 @@ if ($_POST['new_domain'] || $_POST['del_domain']){ // search for checkboxes $domains = array_keys($_POST, "on"); $domainstr = implode(";", $domains); - metaRefresh("../domain.php?action=delete&DN='$domainstr'"); + if ($domainstr) { + metaRefresh("../domain.php?action=delete&DN='$domainstr'"); + exit; } - exit; + } } echo $_SESSION['header']; diff --git a/lam-0.4/templates/lists/listgroups.php b/lam-0.4/templates/lists/listgroups.php index 5ad17c0d..fb161a01 100644 --- a/lam-0.4/templates/lists/listgroups.php +++ b/lam-0.4/templates/lists/listgroups.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,13 +48,17 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ // add new group if ($_POST['new_group']){ metaRefresh("../account/groupedit.php"); + exit; } // delete group(s) elseif ($_POST['del_group']){ // search for checkboxes $groups = array_keys($_POST, "on"); $_SESSION['delete_dn'] = $groups; - metaRefresh("../delete.php?type=group"); + if (sizeof($groups) > 0) { + metaRefresh("../delete.php?type=group"); + exit; + } } // PDF for selected groups elseif ($_POST['pdf_group']){ @@ -68,6 +72,7 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ if (sizeof($list) > 0) { createGroupPDF($list); if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + exit; } } // PDF for all groups @@ -79,9 +84,9 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ if (sizeof($list) > 0) { createGroupPDF($list); if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + exit; } } - exit; } echo $_SESSION['header']; diff --git a/lam-0.4/templates/lists/listhosts.php b/lam-0.4/templates/lists/listhosts.php index 1698833a..9258444b 100644 --- a/lam-0.4/templates/lists/listhosts.php +++ b/lam-0.4/templates/lists/listhosts.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,14 +48,18 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd // add new host if ($_POST['new_host']){ metaRefresh("../account/hostedit.php"); + exit; } // delete host(s) elseif ($_POST['del_host']){ // search for checkboxes $hosts = array_keys($_POST, "on"); $_SESSION['delete_dn'] = $hosts; - metaRefresh("../delete.php?type=host"); + if (sizeof($hosts) > 0) { + metaRefresh("../delete.php?type=host"); + exit; } + } // PDF for selected hosts elseif ($_POST['pdf_host']){ // search for checkboxes @@ -65,7 +69,10 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd for ($i = 0; $i < sizeof($hosts); $i++) { $list[$i] = loadhost($hosts[$i]); } - if (sizeof($list) > 0) createHostPDF($list); + if (sizeof($list) > 0) { + createHostPDF($list); + exit; + } } // PDF for all hosts elseif ($_POST['pdf_all']){ @@ -73,9 +80,11 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd for ($i = 0; $i < sizeof($_SESSION['hst_info']); $i++) { $list[$i] = loadhost($_SESSION['hst_info'][$i]['dn']); } - if (sizeof($list) > 0) createHostPDF($list); + if (sizeof($list) > 0) { + createHostPDF($list); + exit; + } } - exit; } echo $_SESSION['header']; diff --git a/lam-0.4/templates/lists/listusers.php b/lam-0.4/templates/lists/listusers.php index 2bd466e4..7bfc0674 100644 --- a/lam-0.4/templates/lists/listusers.php +++ b/lam-0.4/templates/lists/listusers.php @@ -4,6 +4,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) Copyright (C) 2003 Roland Gruber, Leonhard Walchshäusl + Copyright (C) 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,6 +68,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd // add new user if ($_POST['new_user']){ metaRefresh("../account/useredit.php?type=user"); + exit; } // delete user(s) elseif ($_POST['del_user']){ @@ -75,7 +77,10 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (eregi("^uid=.*$", $entry)) $users[] = $entry; } $_SESSION['delete_dn'] = $users; - metaRefresh("../delete.php?type=user"); + if (sizeof($users) > 0) { + metaRefresh("../delete.php?type=user"); + exit; + } } // PDF for selected users elseif ($_POST['pdf_user']){ @@ -93,6 +98,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (sizeof($list) > 0) { if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); createUserPDF($list); + exit; } } // PDF for all users @@ -106,9 +112,9 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (sizeof($list) > 0) { if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); createUserPDF($list); + exit; } } - exit; } echo $_SESSION['header']; diff --git a/lam/templates/lists/listdomains.php b/lam/templates/lists/listdomains.php index 2511ad9d..362a27aa 100644 --- a/lam/templates/lists/listdomains.php +++ b/lam/templates/lists/listdomains.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,9 +53,11 @@ if ($_POST['new_domain'] || $_POST['del_domain']){ // search for checkboxes $domains = array_keys($_POST, "on"); $domainstr = implode(";", $domains); - metaRefresh("../domain.php?action=delete&DN='$domainstr'"); + if ($domainstr) { + metaRefresh("../domain.php?action=delete&DN='$domainstr'"); + exit; } - exit; + } } echo $_SESSION['header']; diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index 5ad17c0d..fb161a01 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,13 +48,17 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ // add new group if ($_POST['new_group']){ metaRefresh("../account/groupedit.php"); + exit; } // delete group(s) elseif ($_POST['del_group']){ // search for checkboxes $groups = array_keys($_POST, "on"); $_SESSION['delete_dn'] = $groups; - metaRefresh("../delete.php?type=group"); + if (sizeof($groups) > 0) { + metaRefresh("../delete.php?type=group"); + exit; + } } // PDF for selected groups elseif ($_POST['pdf_group']){ @@ -68,6 +72,7 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ if (sizeof($list) > 0) { createGroupPDF($list); if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + exit; } } // PDF for all groups @@ -79,9 +84,9 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ if (sizeof($list) > 0) { createGroupPDF($list); if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + exit; } } - exit; } echo $_SESSION['header']; diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index 1698833a..9258444b 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) - Copyright (C) 2003 Roland Gruber + Copyright (C) 2003 - 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,14 +48,18 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd // add new host if ($_POST['new_host']){ metaRefresh("../account/hostedit.php"); + exit; } // delete host(s) elseif ($_POST['del_host']){ // search for checkboxes $hosts = array_keys($_POST, "on"); $_SESSION['delete_dn'] = $hosts; - metaRefresh("../delete.php?type=host"); + if (sizeof($hosts) > 0) { + metaRefresh("../delete.php?type=host"); + exit; } + } // PDF for selected hosts elseif ($_POST['pdf_host']){ // search for checkboxes @@ -65,7 +69,10 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd for ($i = 0; $i < sizeof($hosts); $i++) { $list[$i] = loadhost($hosts[$i]); } - if (sizeof($list) > 0) createHostPDF($list); + if (sizeof($list) > 0) { + createHostPDF($list); + exit; + } } // PDF for all hosts elseif ($_POST['pdf_all']){ @@ -73,9 +80,11 @@ if ($_POST['new_host'] || $_POST['del_host'] || $_POST['pdf_host'] || $_POST['pd for ($i = 0; $i < sizeof($_SESSION['hst_info']); $i++) { $list[$i] = loadhost($_SESSION['hst_info'][$i]['dn']); } - if (sizeof($list) > 0) createHostPDF($list); + if (sizeof($list) > 0) { + createHostPDF($list); + exit; + } } - exit; } echo $_SESSION['header']; diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index 2bd466e4..7bfc0674 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -4,6 +4,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) Copyright (C) 2003 Roland Gruber, Leonhard Walchshäusl + Copyright (C) 2004 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,6 +68,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd // add new user if ($_POST['new_user']){ metaRefresh("../account/useredit.php?type=user"); + exit; } // delete user(s) elseif ($_POST['del_user']){ @@ -75,7 +77,10 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (eregi("^uid=.*$", $entry)) $users[] = $entry; } $_SESSION['delete_dn'] = $users; - metaRefresh("../delete.php?type=user"); + if (sizeof($users) > 0) { + metaRefresh("../delete.php?type=user"); + exit; + } } // PDF for selected users elseif ($_POST['pdf_user']){ @@ -93,6 +98,7 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (sizeof($list) > 0) { if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); createUserPDF($list); + exit; } } // PDF for all users @@ -106,9 +112,9 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd if (sizeof($list) > 0) { if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); createUserPDF($list); + exit; } } - exit; } echo $_SESSION['header'];