From 61d3ba5822b045fc63c3538a97a60e39be2782de Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 22 Aug 2006 01:35:49 +0000 Subject: [PATCH] r1125: A much better fix --- admin/user.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/admin/user.php b/admin/user.php index e30eab7..074b987 100644 --- a/admin/user.php +++ b/admin/user.php @@ -132,14 +132,17 @@ if ($_POST['do'] == 'update') $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $bugsys->userinfo['userid']); $bugsys->input_clean('emailopts', TYPE_INT); - foreach ((array)$bugsys->in['emailopts'] AS $relation => $bitarr) + 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->values['userid'] . ", $relation, $bitmask)"); } - $db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $user->values['userid'] . ", $relation, $bitmask)"); } $admin->redirect('user.php?do=edit&userid=' . $user->objdata['userid']); -- 2.43.5