Changeset 647 for trunk/include/functions_user.inc.php
- Timestamp:
- Dec 18, 2004, 11:05:30 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r631 r647 238 238 return ( $row = mysql_fetch_array($result) ) ? $row : false; 239 239 } 240 241 /* 242 * deletes favorites of the current user if he's not allowed to see them 243 * 244 * @return void 245 */ 246 function check_user_favorites() 247 { 248 global $user; 249 250 if ($user['forbidden_categories'] == '') 251 { 252 return; 253 } 254 255 $query = ' 256 SELECT 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 = ' 272 DELETE FROM '.FAVORITES_TABLE.' 273 WHERE image_id IN ('.implode(',', $elements).') 274 AND user_id = '.$user['id'].' 275 ;'; 276 pwg_query($query); 277 } 278 } 240 279 ?>
Note: See TracChangeset
for help on using the changeset viewer.