- Timestamp:
- Oct 30, 2013, 9:01:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_perm.php
r25018 r25243 99 99 $cat_ids = array_merge($cat_ids, get_subcat_ids(array($page['cat']))); 100 100 } 101 102 $query = ' 103 SELECT id 104 FROM '.CATEGORIES_TABLE.' 105 WHERE id IN ('.implode(',', $cat_ids).') 106 AND status = \'private\' 107 ;'; 108 $private_cats = array_from_query($query, 'id'); 109 110 // We must not reinsert already existing lines in group_access table 111 $granteds = array(); 112 foreach ($private_cats as $cat_id) 101 102 $inserts = array(); 103 foreach ($cat_ids as $cat_id) 113 104 { 114 $granteds[$cat_id] = array(); 115 } 116 117 $query = ' 118 SELECT 119 group_id, 120 cat_id 121 FROM '.GROUP_ACCESS_TABLE.' 122 WHERE cat_id IN ('.implode(',', $private_cats).') 123 AND group_id IN ('.implode(',', $grant_groups).') 124 ;'; 125 $result = pwg_query($query); 126 while ($row = pwg_db_fetch_assoc($result)) 127 { 128 $granteds[ $row['cat_id'] ][] = $row['group_id']; 129 } 130 131 $inserts = array(); 132 133 foreach ($private_cats as $cat_id) 134 { 135 $group_ids = array_diff($grant_groups, $granteds[$cat_id]); 136 foreach ($group_ids as $group_id) 105 foreach ($grant_groups as $group_id) 137 106 { 138 107 $inserts[] = array( … … 142 111 } 143 112 } 144 145 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $inserts); 113 114 mass_inserts( 115 GROUP_ACCESS_TABLE, 116 array('group_id','cat_id'), 117 $inserts, 118 array('ignore'=>true) 119 ); 146 120 } 147 121
Note: See TracChangeset
for help on using the changeset viewer.