Ignore:
Timestamp:
Aug 31, 2011, 5:12:14 PM (13 years ago)
Author:
flop25
Message:

feature:2418
adding an option to apply permission of users to sub-albums
changing the name of vars $private_uppercats->$private_cats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r11853 r12019  
    21442144  }
    21452145 
    2146   // make sure categories are private and select uppercats
     2146  // make sure categories are private and select uppercats or subcats
     2147  $cat_ids = (isset($_POST['apply_on_sub'])) ? implode(',', get_subcat_ids($category_ids)).",".implode(',', get_uppercat_ids($category_ids)) : implode(',', get_uppercat_ids($category_ids));
    21472148  $query = '
    21482149SELECT
    21492150    id
    21502151  FROM '.CATEGORIES_TABLE.'
    2151   WHERE id IN ('.implode(',', get_uppercat_ids($category_ids)).')
     2152  WHERE id IN ('.$cat_ids.')
    21522153    AND status = \'private\'
    21532154;';
    2154   $private_uppercats = array_from_query($query, 'id');
    2155 
    2156   if (count($private_uppercats) == 0)
     2155  $private_cats = array_from_query($query, 'id');
     2156
     2157  if (count($private_cats) == 0)
    21572158  {
    21582159    return;
     
    21612162  // We must not reinsert already existing lines in user_access table
    21622163  $granteds = array();
    2163   foreach ($private_uppercats as $cat_id)
     2164  foreach ($private_cats as $cat_id)
    21642165  {
    21652166    $granteds[$cat_id] = array();
     
    21712172    cat_id
    21722173  FROM '.USER_ACCESS_TABLE.'
    2173   WHERE cat_id IN ('.implode(',', $private_uppercats).')
     2174  WHERE cat_id IN ('.implode(',', $private_cats).')
    21742175    AND user_id IN ('.implode(',', $user_ids).')
    21752176;';
     
    21822183  $inserts = array();
    21832184 
    2184   foreach ($private_uppercats as $cat_id)
     2185  foreach ($private_cats as $cat_id)
    21852186  {
    21862187    $grant_to_users = array_diff($user_ids, $granteds[$cat_id]);
Note: See TracChangeset for help on using the changeset viewer.