Changeset 4883 for branches/2.0/include/ws_functions.inc.php
- Timestamp:
- Feb 13, 2010, 12:04:07 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/ws_functions.inc.php
r4684 r4883 366 366 global $user,$conf; 367 367 368 $where = array(); 368 $where = array('1=1'); 369 $join_type = 'INNER'; 370 $join_user = $user['id']; 369 371 370 372 if (!$params['recursive']) … … 387 389 $where[] = 'status = "public"'; 388 390 $where[] = 'visible = "true"'; 389 $where[]= 'user_id='.$conf['guest_id']; 390 } 391 else 392 { 393 $where[]= 'user_id='.$user['id']; 391 392 $join_user = $conf['guest_id']; 393 } 394 elseif (is_admin()) 395 { 396 // in this very specific case, we don't want to hide empty 397 // categories. Function calculate_permissions will only return 398 // categories that are either locked or private and not permitted 399 // 400 // calculate_permissions does not consider empty categories as forbidden 401 $forbidden_categories = calculate_permissions($user['id'], $user['status']); 402 $where[]= 'id NOT IN ('.$forbidden_categories.')'; 403 $join_type = 'LEFT'; 394 404 } 395 405 … … 399 409 date_last, max_date_last, count_categories AS nb_categories 400 410 FROM '.CATEGORIES_TABLE.' 401 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id411 '.$join_type.' JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id=cat_id AND user_id='.$join_user.' 402 412 WHERE '. implode(' 403 413 AND ', $where);
Note: See TracChangeset
for help on using the changeset viewer.