Changeset 832
- Timestamp:
- Aug 18, 2005, 11:40:59 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/ChangeLog
r831 r832 1 1 2005-08-18 Pierrick LE GALL 2 2 3 * bug 133 fixed : "Nb of images incorectly rendered in "tool tip" 3 * bug 133 fixed : (report from branch 1.4) Deleting user favorites 4 is too restrictive. Instead of deleting a favorite because it 5 belongs to at least one forbidden category, a favorite is deleted 6 if it belongs to no authorized category (which was the expected 7 behaviour). 8 9 2005-08-18 Pierrick LE GALL 10 11 * bug 134 fixed : "Nb of images incorectly rendered in "tool tip" 4 12 near category in category menu". Correction reported (and 5 13 improved) from branch 1.4 -
trunk/include/functions_user.inc.php
r817 r832 9 9 // | last update : $Date$ 10 10 // | last modifier : $Author$ 11 // | revision : $Revision$ 11 12 // | revision : $Revision$ 12 13 // +-----------------------------------------------------------------------+ … … 236 237 return; 237 238 } 238 239 $query = ' 240 SELECT f.image_id 239 240 // retrieving images allowed : belonging to at least one authorized 241 // category 242 $query = ' 243 SELECT DISTINCT f.image_id 241 244 FROM '.FAVORITES_TABLE.' AS f INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic 242 245 ON f.image_id = ic.image_id 243 246 WHERE f.user_id = '.$user['id'].' 244 AND ic.category_id IN ('.$user['forbidden_categories'].')247 AND ic.category_id NOT IN ('.$user['forbidden_categories'].') 245 248 ;'; 246 249 $result = pwg_query($query); 247 $ elements = array();250 $authorizeds = array(); 248 251 while ($row = mysql_fetch_array($result)) 249 252 { 250 array_push($elements, $row['image_id']); 251 } 252 253 if (count($elements) > 0) 253 array_push($authorizeds, $row['image_id']); 254 } 255 256 $query = ' 257 SELECT image_id 258 FROM '.FAVORITES_TABLE.' 259 WHERE user_id = '.$user['id'].' 260 ;'; 261 $result = pwg_query($query); 262 $favorites = array(); 263 while ($row = mysql_fetch_array($result)) 264 { 265 array_push($favorites, $row['image_id']); 266 } 267 268 $to_deletes = array_diff($favorites, $authorizeds); 269 270 if (count($to_deletes) > 0) 254 271 { 255 272 $query = ' 256 273 DELETE FROM '.FAVORITES_TABLE.' 257 WHERE image_id IN ('.implode(',', $ elements).')274 WHERE image_id IN ('.implode(',', $to_deletes).') 258 275 AND user_id = '.$user['id'].' 259 276 ;';
Note: See TracChangeset
for help on using the changeset viewer.