From a0c64963e00ef10138b1c47b3af92ff114f836bb Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 16 Nov 2010 20:54:46 +0000 Subject: [PATCH] small mod on user save function --- user.inc.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/user.inc.php b/user.inc.php index 7ba8189..e4ff0ed 100644 --- a/user.inc.php +++ b/user.inc.php @@ -689,16 +689,10 @@ function user_save(&$u) array_key_exists('special_awards', $u) && count(array_diff_assoc($u['special_awards'], $u['orig']['special_awards'])) > 0 ){ - $aaids = array(); - foreach($u['special_awards'] as $id => $yesno){ - if(strtolower(trim($yesno)) == 'yes'){ - $aaids[] = $id; - } - } mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id = {$u['id']}"); - if(is_array($aaids)){ + if(count($u['special_awards']) > 0){ $query = "INSERT INTO judges_specialaward_sel (users_id, award_awards_id) VALUES (" . $u['id'] . ", "; - $query .= implode('), (' . $u['id'] . ', ', $aaids); + $query .= implode('), (' . $u['id'] . ', ', $u['specal_awards']); $query .= ")"; mysql_query($query); } @@ -711,12 +705,7 @@ function user_save(&$u) mysql_query("DELETE FROM judges_availability WHERE users_id='{$u['id']}'"); $query = 'SELECT date, starttime, endtime FROM judges_timeslots WHERE id IN ('; - $ids = array(); - foreach($u['available_times'] as $id => $yesno){ - if(strtolower(trim($yesno)) == 'yes'){ - $ids[] = $id; - } - } + $ids = $u['available_times']; $query .= implode(',', $ids) . ')'; if(count($ids) > 0){ $insertVals = array();