Ignore:
Timestamp:
Dec 18, 2004, 11:05:30 PM (20 years ago)
Author:
plg
Message:
  • bug fixed : in admin/cat_list, next_rank cant' be calculted and query to count sub-categories per sub-categories became false if no sub-categories
  • virtual association come back in admin/infos_images (not only in admin/picture_modify)
  • check_favorites function in admin section becomes check_user_favorites in public section : favorites are checked when user tries to display his favorites. Function was optimized.
  • in function update_category, wrap of long queries due to many categories to update at the same time
  • typo fixed in description of paginate_pages_around configuration parameter
  • bug fixed in new navigation bar : no separation pipe was displayed between next and last when the page displayed was the last
  • sessions.expiration changed of type from int to datetime (a lot easier to read)
  • sessions.ip removed : IP address is no longer used to verify session
  • typo fixed in language/en_UK.iso-8859-1/admin.lang.php on editcat_lock_info language item
File:
1 edited

Legend:

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

    r631 r647  
    238238  return ( $row = mysql_fetch_array($result) ) ? $row : false;
    239239}
     240
     241/*
     242 * deletes favorites of the current user if he's not allowed to see them
     243 *
     244 * @return void
     245 */
     246function check_user_favorites()
     247{
     248  global $user;
     249
     250  if ($user['forbidden_categories'] == '')
     251  {
     252    return;
     253  }
     254 
     255  $query = '
     256SELECT f.image_id
     257  FROM '.FAVORITES_TABLE.' AS f INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
     258    ON f.image_id = ic.image_id
     259  WHERE f.user_id = '.$user['id'].'
     260    AND ic.category_id IN ('.$user['forbidden_categories'].')
     261;';
     262  $result = pwg_query($query);
     263  $elements = array();
     264  while ($row = mysql_fetch_array($result))
     265  {
     266    array_push($elements, $row['image_id']);
     267  }
     268
     269  if (count($elements) > 0)
     270  {
     271    $query = '
     272DELETE FROM '.FAVORITES_TABLE.'
     273  WHERE image_id IN ('.implode(',', $elements).')
     274    AND user_id = '.$user['id'].'
     275;';
     276    pwg_query($query);
     277  }
     278}
    240279?>
Note: See TracChangeset for help on using the changeset viewer.