Ignore:
Timestamp:
May 1, 2005, 4:16:43 PM (20 years ago)
Author:
plg
Message:
  • bug 110 fixed : "return to element view from element edition fails depending on permissions". Correction is partial for branch 1.4 : a linked category is randomly chosen but if no linked category is authorized for the admin user, then the link is to the storage category (which can be forbidden).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_4/admin/picture_modify.php

    r732 r782  
    160160
    161161$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
    162 $url_img .= '&cat='.$row['storage_category_id'];
     162
     163$query = '
     164SELECT category_id
     165  FROM '.IMAGE_CATEGORY_TABLE.'
     166  WHERE image_id = '.$_GET['image_id'];
     167
     168if (isset($user['forbidden_categories'])
     169    and !empty($user['forbidden_categories']))
     170{
     171  $query.= '
     172    AND category_id NOT IN ('.$user['forbidden_categories'].')';
     173}
     174$query.= '
     175  ORDER BY RAND()
     176;';
     177$result = pwg_query($query);
     178
     179if (mysql_num_rows($result) > 0)
     180{
     181  list($category_id) = mysql_fetch_array($result);
     182  $url_img .= '&cat='.$category_id;
     183}
     184else
     185{
     186  $url_img .= '&cat='.$row['storage_category_id'];
     187}
     188
    163189$date = isset($_POST['date_creation']) && empty($errors)
    164190?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
Note: See TracChangeset for help on using the changeset viewer.