From 80802d631b45559b981da80a5f565338f007a818 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 8 Nov 2003 20:26:28 +0000 Subject: [PATCH] added quota to PDF, fixed HTML errors --- lam/templates/lists/listgroups.php | 12 ++++++++---- lam/templates/lists/listhosts.php | 2 -- lam/templates/lists/listusers.php | 28 ++++------------------------ 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index 47f6a399..0c9e1363 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -65,7 +65,10 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ for ($i = 0; $i < sizeof($hosts); $i++) { $list[$i] = loadgroup($hosts[$i]); } - if (sizeof($list) > 0) createGroupPDF($list); + if (sizeof($list) > 0) { + createGroupPDF($list); + if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + } } // PDF for all groups elseif ($_POST['pdf_all']){ @@ -73,7 +76,10 @@ if ($_POST['new_group'] || $_POST['del_group'] || $_POST['pdf_group'] || $_POST[ for ($i = 0; $i < sizeof($_SESSION['grp_info']); $i++) { $list[$i] = loadgroup($_SESSION['grp_info'][$i]['dn']); } - if (sizeof($list) > 0) createGroupPDF($list); + if (sizeof($list) > 0) { + createGroupPDF($list); + if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + } } exit; } @@ -300,7 +306,6 @@ if (sizeof($grp_units) > 1) { echo ("

 

\n"); } -echo ("

\n"); echo ("\n"); if (sizeof($grp_info) > 0) { echo ("\n"); @@ -311,7 +316,6 @@ if (sizeof($grp_info) > 0) { echo ("\n"); echo ""; } -echo ("

\n"); echo ("\n"); echo "\n"; diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index a5b13572..d1db5cc1 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -291,7 +291,6 @@ echo ("

 

\n"); } // add/delete/PDF buttons -echo ("

\n"); echo ("\n"); if (sizeof($hst_info) > 0) { echo ("\n"); @@ -302,7 +301,6 @@ if (sizeof($hst_info) > 0) { echo ("\n"); echo ""; } -echo ("

\n"); echo ("\n"); echo "\n"; diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index 34c506ba..3dc70b14 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -91,9 +91,8 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd $list[$i]->smb_password = ""; } if (sizeof($list) > 0) { - $list = quotas($list); - if ($list) createUserPDF($list); - else StatusMessage("ERROR", _("Unable to get quota information!"), ""); + if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + createUserPDF($list); } } // PDF for all users @@ -105,9 +104,8 @@ if ($_POST['new_user'] || $_POST['del_user'] || $_POST['pdf_user'] || $_POST['pd $list[$i]->smb_password = ""; } if (sizeof($list) > 0) { - $list = quotas($list); - if ($list) createUserPDF($list); - else StatusMessage("ERROR", _("Unable to get quota information!"), ""); + if ($_SESSION['config']->get_scriptServer()) $list = getquotas($list); + createUserPDF($list); } } exit; @@ -443,24 +441,6 @@ function cmp_array($a, $b) { } } -// takes an array of account and fill the accounts with quota information -function quotas($list) { - if (! is_array($list)) return false; - for ($i = 0; $i < sizeof($list); $i++) { - $usernames[] = $list[$i]->general_username; - } - $data = getquotas("user", $usernames); - if (sizeof($data) != sizeof($list)) { - return false; - } - for ($i = 0; $i < sizeof($data); $i++) { - $ret[$i] = $list[$i]; - $ret[$i]->quota = $data[$i]->quota; - } - return $ret; -} - - // save variables to session $_SESSION['usr_units'] = $usr_units; $_SESSION['usr_suffix'] = $usr_suffix;