Changeset 23428
- Timestamp:
- Jun 21, 2013, 4:09:02 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/site_update.php
r23376 r23428 267 267 array( 268 268 'id' => $insert['id'], 269 'parent' => $parent,269 'parent' => (isset($parent)) ? $parent : Null, 270 270 'status' => $insert['status'], 271 271 'visible' => $insert['visible'], … … 304 304 { 305 305 $category_ids[] = $category['id']; 306 $category_up[] = $category['id_uppercat']; 306 if (!empty($category['id_uppercat'])) 307 { 308 $category_up[] = $category['id_uppercat']; 309 } 307 310 } 308 311 $category_up=implode(',',array_unique($category_up)); … … 315 318 ;'; 316 319 $result = pwg_query($query); 317 $granted_grps = array(); 318 while ($row = pwg_db_fetch_assoc($result)) 320 if (!empty($result)) 319 321 { 320 if (is_null($granted_grps[$row['cat_id']])) 322 $granted_grps = array(); 323 while ($row = pwg_db_fetch_assoc($result)) 321 324 { 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 { 325 if (!is_array ($granted_grps[$row['cat_id']])) 326 { 327 $granted_grps[$row['cat_id']]=array(); 328 } 337 329 array_push( 338 $ insert_granted_grps,330 $granted_grps, 339 331 array( 340 'group_id' => $granted_grp, 341 'cat_id' => $ids 332 $row['cat_id'] => array_push($granted_grps[$row['cat_id']],$row['group_id']) 342 333 ) 343 334 ); 344 345 335 } 336 $insert_granted_grps=array(); 337 foreach ($category_ids as $ids) 338 { 339 $parent_id=$db_categories[$ids]['parent']; 340 while (in_array($parent_id, $category_ids)) 341 { 342 $parent_id= $db_categories[$parent_id]['parent']; 343 } 344 if ($db_categories[$ids]['status']=='private' and !is_null($parent_id)) 345 { 346 foreach ($granted_grps[$parent_id] as $granted_grp) 347 { 348 array_push( 349 $insert_granted_grps, 350 array( 351 'group_id' => $granted_grp, 352 'cat_id' => $ids 353 ) 354 ); 355 356 } 357 } 358 } 359 360 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $insert_granted_grps); 346 361 } 347 348 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $insert_granted_grps);349 362 350 363 $query = ' … … 354 367 ;'; 355 368 $result = pwg_query($query); 356 $granted_users = array(); 357 while ($row = pwg_db_fetch_assoc($result)) 369 if (!empty($result)) 358 370 { 359 if (is_null($granted_users[$row['cat_id']])) 371 372 $granted_users = array(); 373 while ($row = pwg_db_fetch_assoc($result)) 360 374 { 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 { 375 if (!is_array ($granted_users[$row['cat_id']])) 376 { 377 $granted_users[$row['cat_id']]=array(); 378 } 376 379 array_push( 377 $ insert_granted_users,380 $granted_users, 378 381 array( 379 'user_id' => $granted_user, 380 'cat_id' => $ids 382 $row['cat_id'] => array_push($granted_users[$row['cat_id']],$row['user_id']) 381 383 ) 382 384 ); 383 384 385 } 386 $insert_granted_users=array(); 387 foreach ($category_ids as $ids) 388 { 389 $parent_id=$db_categories[$ids]['parent']; 390 while (in_array($parent_id, $category_ids)) 391 { 392 $parent_id= $db_categories[$parent_id]['parent']; 393 } 394 if ($db_categories[$ids]['status']=='private' and !is_null($parent_id)) 395 { 396 foreach ($granted_users[$parent_id] as $granted_user) 397 { 398 array_push( 399 $insert_granted_users, 400 array( 401 'user_id' => $granted_user, 402 'cat_id' => $ids 403 ) 404 ); 405 } 406 } 407 } 408 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert_granted_users); 385 409 } 386 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert_granted_users);387 388 410 } 389 411 else
Note: See TracChangeset
for help on using the changeset viewer.