Changeset 818 for trunk/admin/user_perm.php
- Timestamp:
- Aug 17, 2005, 5:25:32 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/user_perm.php
r817 r818 142 142 ); 143 143 144 145 // retrieve category ids authorized to the groups the user belongs to 146 $group_authorized = array(); 147 148 $query = ' 149 SELECT DISTINCT cat_id, c.uppercats, c.global_rank 150 FROM '.USER_GROUP_TABLE.' AS ug 151 INNER JOIN '.GROUP_ACCESS_TABLE.' AS ga 152 ON ug.group_id = ga.group_id 153 INNER JOIN '.CATEGORIES_TABLE.' AS c 154 ON c.id = ga.cat_id 155 WHERE ug.user_id = '.$page['user'].' 156 ;'; 157 $result = pwg_query($query); 158 159 if (mysql_num_rows($result) > 0) 160 { 161 $template->assign_block_vars('groups', array()); 162 163 $cats = array(); 164 while ($row = mysql_fetch_array($result)) 165 { 166 array_push($cats, $row); 167 array_push($group_authorized, $row['cat_id']); 168 } 169 usort($cats, 'global_rank_compare'); 170 171 foreach ($cats as $category) 172 { 173 $template->assign_block_vars( 174 'groups.category', 175 array( 176 'NAME' => get_cat_display_name_cache($category['uppercats'], '', false) 177 ) 178 ); 179 } 180 } 181 144 182 // only private categories are listed 145 183 $query_true = ' … … 147 185 FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_ACCESS_TABLE.' ON cat_id = id 148 186 WHERE status = \'private\' 149 AND user_id = '.$page['user'].' 187 AND user_id = '.$page['user']; 188 if (count($group_authorized) > 0) 189 { 190 $query_true.= ' 191 AND cat_id NOT IN ('.implode(',', $group_authorized).')'; 192 } 193 $query_true.= ' 150 194 ;'; 151 195 display_select_cat_wrapper($query_true,array(),'category_option_true'); … … 167 211 AND id NOT IN ('.implode(',', $authorized_ids).')'; 168 212 } 213 if (count($group_authorized) > 0) 214 { 215 $query_false.= ' 216 AND id NOT IN ('.implode(',', $group_authorized).')'; 217 } 169 218 $query_false.= ' 170 219 ;';
Note: See TracChangeset
for help on using the changeset viewer.