Changeset 1640
- Timestamp:
- Dec 8, 2006, 12:10:21 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r1624 r1640 449 449 450 450 /** 451 * update data of user_cache_categorie 452 * 453 * @param int user_id 454 * @return null 455 */ 456 function update_user_cache_categorie($user_id, $user_forbidden_categories) 457 { 458 function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) 459 { 460 $date = ''; 461 $count_images = 0; 462 $count_categories = 0; 463 do 464 { 465 $cat_id = array_pop($list_cat_id); 466 if (!is_null($cat_id)) 451 * compute data of categories branches 452 * 453 * was internal function of update_user_cache_categorie 454 * move to global because function be redeclare when it's internal 455 */ 456 function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) 457 { 458 $date = ''; 459 $count_images = 0; 460 $count_categories = 0; 461 do 462 { 463 $cat_id = array_pop($list_cat_id); 464 if (!is_null($cat_id)) 465 { 466 // Count images and categories 467 $cats[$cat_id]['count_images'] += $count_images; 468 $cats[$cat_id]['count_categories'] += $count_categories; 469 $count_images = $cats[$cat_id]['count_images']; 470 $count_categories = $cats[$cat_id]['count_categories'] + 1; 471 472 if ((empty($cats[$cat_id]['max_date_last'])) or ($cats[$cat_id]['max_date_last'] < $date)) 467 473 { 468 // Count images and categories 469 $cats[$cat_id]['count_images'] += $count_images; 470 $cats[$cat_id]['count_categories'] += $count_categories; 471 $count_images = $cats[$cat_id]['count_images']; 472 $count_categories = $cats[$cat_id]['count_categories'] + 1; 473 474 if ((empty($cats[$cat_id]['max_date_last'])) or ($cats[$cat_id]['max_date_last'] < $date)) 475 { 476 $cats[$cat_id]['max_date_last'] = $date; 477 $cats[$cat_id]['is_child_date_last'] = true; 478 } 479 else 480 { 481 $date = $cats[$cat_id]['max_date_last']; 482 } 483 $ref_level = substr_count($cats[$cat_id]['global_rank'], '.') + 1; 474 $cats[$cat_id]['max_date_last'] = $date; 475 $cats[$cat_id]['is_child_date_last'] = true; 484 476 } 485 477 else 486 478 { 487 $ ref_level = 0;479 $date = $cats[$cat_id]['max_date_last']; 488 480 } 489 } while ($level <= $ref_level); 490 491 // Last cat updating must be added to list for next branch 492 if ($ref_level <> 0) 493 { 494 array_push($list_cat_id, $cat_id); 495 } 496 } 497 481 $ref_level = substr_count($cats[$cat_id]['global_rank'], '.') + 1; 482 } 483 else 484 { 485 $ref_level = 0; 486 } 487 } while ($level <= $ref_level); 488 489 // Last cat updating must be added to list for next branch 490 if ($ref_level <> 0) 491 { 492 array_push($list_cat_id, $cat_id); 493 } 494 } 495 496 /** 497 * update data of user_cache_categorie 498 * 499 * @param int user_id 500 * @return null 501 */ 502 function update_user_cache_categorie($user_id, $user_forbidden_categories) 503 { 498 504 // delete user cache 499 505 $query = '
Note: See TracChangeset
for help on using the changeset viewer.