Changeset 1641 for trunk/include/functions_user.inc.php
- Timestamp:
- Dec 8, 2006, 12:21:54 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_user.inc.php
r1640 r1641 273 273 calculate_permissions($userdata['id'], $userdata['status']); 274 274 275 update_user_cache_categorie ($userdata['id'], $userdata['forbidden_categories']);275 update_user_cache_categories($userdata['id'], $userdata['forbidden_categories']); 276 276 277 277 // Set need update are done … … 450 450 /** 451 451 * compute data of categories branches 452 *453 * was internal function of update_user_cache_categorie454 * move to global because function be redeclare when it's internal455 452 */ 456 453 function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level) … … 473 470 { 474 471 $cats[$cat_id]['max_date_last'] = $date; 475 $cats[$cat_id]['is_child_date_last'] = true;476 472 } 477 473 else … … 495 491 496 492 /** 497 * update data of user_cache_categorie 493 * update data of user_cache_categories 498 494 * 499 495 * @param int user_id 500 496 * @return null 501 497 */ 502 function update_user_cache_categorie ($user_id, $user_forbidden_categories)498 function update_user_cache_categories($user_id, $user_forbidden_categories) 503 499 { 504 500 // delete user cache 505 501 $query = ' 506 delete from'.USER_CACHE_CATEGORIES_TABLE.'507 whereuser_id = '.$user_id.'502 DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.' 503 WHERE user_id = '.$user_id.' 508 504 ;'; 509 505 pwg_query($query); 510 506 511 507 $query = ' 512 select 513 id cat_id, date_last, 514 nb_images, global_rank 515 from '.CATEGORIES_TABLE; 508 SELECT id cat_id, date_last max_date_last, nb_images count_images, global_rank 509 FROM '.CATEGORIES_TABLE; 516 510 if ($user_forbidden_categories != '') 517 511 { 518 512 $query.= ' 519 where id not in('.$user_forbidden_categories.')';513 WHERE id NOT IN ('.$user_forbidden_categories.')'; 520 514 } 521 515 $query.= ';'; … … 524 518 525 519 $cats = array(); 526 while ($row = mysql_fetch_array($result)) 527 { 520 while ($row = mysql_fetch_assoc($result)) 521 { 522 $row['user_id'] = $user_id; 523 $row['count_categories'] = 0; 528 524 $cats += array($row['cat_id'] => $row); 529 525 } … … 536 532 foreach ($cats as $id => $category) 537 533 { 538 // Update field539 $cats[$id]['user_id'] = $user_id;540 $cats[$id]['is_child_date_last'] = false;541 $cats[$id]['max_date_last'] = $cats[$id]['date_last'];542 $cats[$id]['count_images'] = $cats[$id]['nb_images'];543 $cats[$id]['count_categories'] = 0;544 545 534 // Compute 546 535 $level = substr_count($category['global_rank'], '.') + 1; … … 559 548 $level = 1; 560 549 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 561 562 foreach ($cats as $id => $category)563 {564 // Convert field565 $cats[$id]['is_child_date_last'] = boolean_to_string($cats[$id]['is_child_date_last']);566 }567 550 568 551 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); … … 572 555 array 573 556 ( 574 'user_id', 'cat_id', 575 'is_child_date_last', 'max_date_last', 576 'count_images', 'count_categories' 557 'user_id', 'cat_id', 558 'max_date_last', 'count_images', 'count_categories' 577 559 ), 578 560 $cats … … 801 783 global $conf, $user; 802 784 803 if ($remember_me )785 if ($remember_me and $conf['authorize_remembering']) 804 786 { 805 787 $key = calculate_auto_login_key($user_id);
Note: See TracChangeset
for help on using the changeset viewer.