- more unneeded user code

This commit is contained in:
dave 2008-10-19 23:14:02 +00:00
parent a0d27df91e
commit d1c7fa968e

View File

@ -109,30 +109,7 @@ function user_load_volunteer(&$u)
function user_load($user)
{
$id = 0;
/* Sort out the type first */
if(is_array($user)){
/* User already loaded*/
$id = $user['id'];
$where = "id='$id'";
} else {
$id = intval($user);
if($id > 0) {
/* Load by ID FIXME: if we enable load-by-email below,
* then a user could use a number at the beginning of
* their email address to exploit here, must fix that.
* */
$where = "id='$id'";
} else {
echo "Can't load user by non-number id";
return false;
/* Load by email */
// $e = stripslashes($user);
// $where = "email='$e'";
}
}
$id = intval($user);
/* So, it turns out that doing one big load is faster than loading just
* from the users table then loading only the specific types the user
@ -142,7 +119,7 @@ function user_load($user)
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`users`.`id`
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`users`.`id`
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`users`.`id`
WHERE $where
WHERE `users`.`id`='$id'
AND `users`.`deleted`='no' ";
$q=mysql_query($query);