From 929dd15d2eb21faf7edd4b4c60c01c1c6a18a6fd Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 4 Oct 2006 23:27:10 +0000 Subject: [PATCH] r1233: Remove warnings when there are no components or products --- docs/changes.txt | 1 + explain.php | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 0ce01b4..e7b75ae 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -4,6 +4,7 @@ - Removed TABLE_PREFIX-related SQL errors in syndicate.php - Use the correct language variable key for exporting the XML encoding in syndicate.php - API-level errors are not caught in the registration process before insertion because of user_cumulative [register.php] +- Remove warnings on explain.php?do=products (http://www.bluestatic.org/bugs/showreport.php?bugid=29) 1.1.0 =============================== diff --git a/explain.php b/explain.php index fc59924..e4b2bab 100644 --- a/explain.php +++ b/explain.php @@ -42,6 +42,11 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'products') { + if (!is_array($bugsys->datastore['product'])) + { + $message->error(_('There are no products set up.')); + } + foreach ($bugsys->datastore['product'] AS $product) { if ($product['componentmother']) @@ -77,12 +82,15 @@ if ($_REQUEST['do'] == 'products') $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"'; eval('$productlist .= "' . $template->fetch('explain_row') . '";'); - foreach ($components["$product[productid]"] AS $component) + if (is_array($components["$product[productid]"])) { - $left = '  ›   ' . $component['title']; - $right = $component['description']; - $trextra = ''; - eval('$productlist .= "' . $template->fetch('explain_row') . '";'); + foreach ($components["$product[productid]"] AS $component) + { + $left = '  ›   ' . $component['title']; + $right = $component['description']; + $trextra = ''; + eval('$productlist .= "' . $template->fetch('explain_row') . '";'); + } } } -- 2.43.5