Ignore:
Timestamp:
Feb 16, 2014, 8:39:19 AM (10 years ago)
Author:
rvelices
Message:

more query2array and remove unnecessary tests in often called url functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r27158 r27388  
    427427  WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
    428428    AND level>'.$userdata['level'];
    429       $forbidden_ids = array_from_query($query, 'id');
     429      $forbidden_ids = query2array($query,null, 'id');
    430430
    431431      if ( empty($forbidden_ids) )
     
    545545    ).'
    546546;';
    547   $authorizeds = array_from_query($query, 'image_id');
     547  $authorizeds = query2array($query,null, 'image_id');
    548548
    549549  $query = '
     
    552552  WHERE user_id = '.$user['id'].'
    553553;';
    554   $favorites = array_from_query($query, 'image_id');
     554  $favorites = query2array($query,null, 'image_id');
    555555
    556556  $to_deletes = array_diff($favorites, $authorizeds);
     
    585585  WHERE status = \'private\'
    586586;';
    587   $private_array = array_from_query($query, 'id');
     587  $private_array = query2array($query,null, 'id');
    588588
    589589  // retrieve category ids directly authorized to the user
     
    593593  WHERE user_id = '.$user_id.'
    594594;';
    595   $authorized_array = array_from_query($query, 'cat_id');
     595  $authorized_array = query2array($query,null, 'cat_id');
    596596
    597597  // retrieve category ids authorized to the groups the user belongs to
     
    605605    array_merge(
    606606      $authorized_array,
    607       array_from_query($query, 'cat_id')
     607      query2array($query,null, 'cat_id')
    608608      );
    609609
     
    623623  WHERE visible = \'false\'
    624624;';
    625     $result = pwg_query($query);
    626     while ($row = pwg_db_fetch_assoc($result))
    627     {
    628       $forbidden_array[] = $row['id'];
    629     }
     625    $forbidden_array = array_merge($forbidden_array, query2array($query, null, 'id') );
    630626    $forbidden_array = array_unique($forbidden_array);
    631627  }
     
    869865        $level = max( $conf['available_permission_levels'] );
    870866      }
    871       else if (($user_id == $conf['guest_id']) or
     867      elseif (($user_id == $conf['guest_id']) or
    872868               ($user_id == $conf['default_user_id']))
    873869      {
Note: See TracChangeset for help on using the changeset viewer.