mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 09:13:02 +02:00
- 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 - $lang['cat_options'] was missing in en_UK.iso-8859-1 - typo fixed in language/en_UK.iso-8859-1/admin.lang.php on editcat_lock_info language item git-svn-id: http://piwigo.org/svn/trunk@647 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -237,4 +237,43 @@ function getuserdata($user)
|
||||
$result = pwg_query($sql);
|
||||
return ( $row = mysql_fetch_array($result) ) ? $row : false;
|
||||
}
|
||||
|
||||
/*
|
||||
* deletes favorites of the current user if he's not allowed to see them
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function check_user_favorites()
|
||||
{
|
||||
global $user;
|
||||
|
||||
if ($user['forbidden_categories'] == '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT f.image_id
|
||||
FROM '.FAVORITES_TABLE.' AS f INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
|
||||
ON f.image_id = ic.image_id
|
||||
WHERE f.user_id = '.$user['id'].'
|
||||
AND ic.category_id IN ('.$user['forbidden_categories'].')
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
$elements = array();
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
array_push($elements, $row['image_id']);
|
||||
}
|
||||
|
||||
if (count($elements) > 0)
|
||||
{
|
||||
$query = '
|
||||
DELETE FROM '.FAVORITES_TABLE.'
|
||||
WHERE image_id IN ('.implode(',', $elements).')
|
||||
AND user_id = '.$user['id'].'
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user