From 1bae64f4088c80179c915cfb3384395556ff7eb5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 25 Jan 2007 04:32:19 +0000 Subject: [PATCH] r1380: Fix a foreach() warning on admin/user.php at line 102. Thanks to Josh Muheim. --- admin/user.php | 15 +++++++++------ docs/changes.txt | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/admin/user.php b/admin/user.php index c50c70e..e83977d 100644 --- a/admin/user.php +++ b/admin/user.php @@ -98,15 +98,18 @@ if ($_POST['do'] == 'insert') // post_insert will set the email options... so we now have to dump them $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->insertid); - $bugsys->input_clean('emailopts', TYPE_INT); - foreach ($bugsys->in['emailopts'] AS $relation => $bitarr) + $bugsys->input_clean('emailopts', TYPE_INT); + if (is_array($bugsys->in['emailopts'])) { - $bitmask = 0; - foreach ($bitarr AS $option => $yes) + foreach ($bugsys->in['emailopts'] AS $relation => $bitarr) { - $bitmask += $option * $yes; + $bitmask = 0; + foreach ($bitarr AS $option => $yes) + { + $bitmask += $option * $yes; + } + $db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $user->insertid . ", $relation, $bitmask)"); } - $db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $user->insertid . ", $relation, $bitmask)"); } $admin->redirect('user.php?do=edit&userid=' . $user->insertid); diff --git a/docs/changes.txt b/docs/changes.txt index 1bac6f2..493c597 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -18,6 +18,7 @@ - Fixed a SQL error on admin/user.php when adding a new user from the admin section (bug://report/63) - When adding a new user from the admin section, email options were not saved properly - Added an option to only perform header redirects instead of intermediate-stage redirects (bug://report/65) +- Fixed a foreach() error after adding a new user in the admin section without email options [admin/user.php#102] 1.1.4 =============================== -- 2.43.5