Changeset 23376 for trunk/admin/site_update.php
- Timestamp:
- Jun 19, 2013, 10:39:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/site_update.php
r22979 r23376 267 267 array( 268 268 'id' => $insert['id'], 269 'parent' => $parent, 269 270 'status' => $insert['status'], 270 271 'visible' => $insert['visible'], … … 299 300 // add default permissions to categories 300 301 $category_ids = array(); 302 $category_up = array(); 301 303 foreach ($inserts as $category) 302 304 { 303 305 $category_ids[] = $category['id']; 306 $category_up[] = $category['id_uppercat']; 304 307 } 305 add_permission_on_category($category_ids, get_admins()); 308 $category_up=implode(',',array_unique($category_up)); 309 if ($conf['inheritance_by_default']) 310 { 311 $query = ' 312 SELECT * 313 FROM '.GROUP_ACCESS_TABLE.' 314 WHERE cat_id IN ('.$category_up.') 315 ;'; 316 $result = pwg_query($query); 317 $granted_grps = array(); 318 while ($row = pwg_db_fetch_assoc($result)) 319 { 320 if (is_null($granted_grps[$row['cat_id']])) 321 { 322 $granted_grps[$row['cat_id']]=array(); 323 } 324 array_push( 325 $granted_grps, 326 array( 327 $row['cat_id'] => array_push($granted_grps[$row['cat_id']],$row['group_id']) 328 ) 329 ); 330 } 331 $insert_granted_grps=array(); 332 foreach ($category_ids as $ids) 333 { 334 $parent=$db_categories[$ids]['parent']; 335 foreach ($granted_grps[$parent] as $granted_grp) 336 { 337 array_push( 338 $insert_granted_grps, 339 array( 340 'group_id' => $granted_grp, 341 'cat_id' => $ids 342 ) 343 ); 344 345 } 346 } 347 348 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $insert_granted_grps); 349 350 $query = ' 351 SELECT * 352 FROM '.USER_ACCESS_TABLE.' 353 WHERE cat_id IN ('.$category_up.') 354 ;'; 355 $result = pwg_query($query); 356 $granted_users = array(); 357 while ($row = pwg_db_fetch_assoc($result)) 358 { 359 if (is_null($granted_users[$row['cat_id']])) 360 { 361 $granted_users[$row['cat_id']]=array(); 362 } 363 array_push( 364 $granted_users, 365 array( 366 $row['cat_id'] => array_push($granted_users[$row['cat_id']],$row['user_id']) 367 ) 368 ); 369 } 370 $insert_granted_users=array(); 371 foreach ($category_ids as $ids) 372 { 373 $parent=$db_categories[$ids]['parent']; 374 foreach ($granted_users[$parent] as $granted_user) 375 { 376 array_push( 377 $insert_granted_users, 378 array( 379 'user_id' => $granted_user, 380 'cat_id' => $ids 381 ) 382 ); 383 384 } 385 } 386 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert_granted_users); 387 388 } 389 else 390 { 391 add_permission_on_category($category_ids, get_admins()); 392 } 306 393 } 307 394
Note: See TracChangeset
for help on using the changeset viewer.