Changeset 23430
- Timestamp:
- Jun 21, 2013, 4:48:43 PM (11 years ago)
- Location:
- trunk/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_perm.php
r19703 r23430 320 320 // | sending html code | 321 321 // +-----------------------------------------------------------------------+ 322 $template->assign(array('PWG_TOKEN' => get_pwg_token() ));322 $template->assign(array('PWG_TOKEN' => get_pwg_token(), 'INHERIT' => $conf['inheritance_by_default'])); 323 323 324 324 $template->assign_var_from_handle('ADMIN_CONTENT', 'cat_perm'); -
trunk/admin/site_update.php
r23428 r23430 323 323 while ($row = pwg_db_fetch_assoc($result)) 324 324 { 325 if (!is _array($granted_grps[$row['cat_id']]))325 if (!isset($granted_grps[$row['cat_id']])) 326 326 { 327 327 $granted_grps[$row['cat_id']]=array(); … … 334 334 ); 335 335 } 336 $insert_granted_grps=array(); 337 foreach ($category_ids as $ids) 336 } 337 $query = ' 338 SELECT * 339 FROM '.USER_ACCESS_TABLE.' 340 WHERE cat_id IN ('.$category_up.') 341 ;'; 342 $result = pwg_query($query); 343 if (!empty($result)) 344 { 345 $granted_users = array(); 346 while ($row = pwg_db_fetch_assoc($result)) 338 347 { 339 $parent_id=$db_categories[$ids]['parent']; 340 while (in_array($parent_id, $category_ids)) 348 if (!isset($granted_users[$row['cat_id']])) 341 349 { 342 $ parent_id= $db_categories[$parent_id]['parent'];350 $granted_users[$row['cat_id']]=array(); 343 351 } 344 if ($db_categories[$ids]['status']=='private' and !is_null($parent_id)) 352 array_push( 353 $granted_users, 354 array( 355 $row['cat_id'] => array_push($granted_users[$row['cat_id']],$row['user_id']) 356 ) 357 ); 358 } 359 } 360 $insert_granted_users=array(); 361 $insert_granted_grps=array(); 362 foreach ($category_ids as $ids) 363 { 364 $parent_id=$db_categories[$ids]['parent']; 365 while (in_array($parent_id, $category_ids)) 366 { 367 $parent_id= $db_categories[$parent_id]['parent']; 368 } 369 if ($db_categories[$ids]['status']=='private' and !is_null($parent_id)) 370 { 371 if (isset($granted_grps[$parent_id])) 345 372 { 346 373 foreach ($granted_grps[$parent_id] as $granted_grp) … … 353 380 ) 354 381 ); 355 356 382 } 357 383 } 358 } 359 360 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $insert_granted_grps); 361 } 362 363 $query = ' 364 SELECT * 365 FROM '.USER_ACCESS_TABLE.' 366 WHERE cat_id IN ('.$category_up.') 367 ;'; 368 $result = pwg_query($query); 369 if (!empty($result)) 370 { 371 372 $granted_users = array(); 373 while ($row = pwg_db_fetch_assoc($result)) 374 { 375 if (!is_array ($granted_users[$row['cat_id']])) 376 { 377 $granted_users[$row['cat_id']]=array(); 378 } 379 array_push( 380 $granted_users, 381 array( 382 $row['cat_id'] => array_push($granted_users[$row['cat_id']],$row['user_id']) 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)) 384 if (isset($granted_users[$parent_id])) 395 385 { 396 386 foreach ($granted_users[$parent_id] as $granted_user) … … 405 395 } 406 396 } 397 foreach (get_admins() as $granted_user) 398 { 399 array_push( 400 $insert_granted_users, 401 array( 402 'user_id' => $granted_user, 403 'cat_id' => $ids 404 ) 405 ); 406 } 407 407 } 408 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert_granted_users);409 408 } 410 } 409 mass_inserts(GROUP_ACCESS_TABLE, array('group_id','cat_id'), $insert_granted_grps); 410 $insert_granted_users=array_unique($insert_granted_users, SORT_REGULAR); 411 mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $insert_granted_users); 412 } 411 413 else 412 414 { -
trunk/admin/themes/default/template/cat_perm.tpl
r13593 r23430 151 151 <p style="margin:12px;text-align:left;"> 152 152 <input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit"> 153 <label id="applytoSubAction" style="display:none;"><input type="checkbox" name="apply_on_sub" >{'Apply to sub-albums'|@translate}</label>153 <label id="applytoSubAction" style="display:none;"><input type="checkbox" name="apply_on_sub" {if $INHERIT}checked="checked"{/if}>{'Apply to sub-albums'|@translate}</label> 154 154 </p> 155 155
Note: See TracChangeset
for help on using the changeset viewer.