Ignore:
Timestamp:
Dec 8, 2006, 12:21:54 AM (17 years ago)
Author:
rvelices
Message:
  • remove #user_cache_categories.is_child_date_last
  • optimize code in get_icon
  • correct css font-wigth:italic to font-style:italic
  • aditionnal check on $confauthorize_remembering before allowing auto_login
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r1640 r1641  
    273273        calculate_permissions($userdata['id'], $userdata['status']);
    274274
    275       update_user_cache_categorie($userdata['id'], $userdata['forbidden_categories']);
     275      update_user_cache_categories($userdata['id'], $userdata['forbidden_categories']);
    276276
    277277      // Set need update are done
     
    450450/**
    451451 * 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
    455452 */
    456453function compute_branch_cat_data(&$cats, &$list_cat_id, &$level, &$ref_level)
     
    473470      {
    474471        $cats[$cat_id]['max_date_last'] = $date;
    475         $cats[$cat_id]['is_child_date_last'] = true;
    476472      }
    477473      else
     
    495491
    496492/**
    497  * update data of user_cache_categorie
     493 * update data of user_cache_categories
    498494 *
    499495 * @param int user_id
    500496 * @return null
    501497 */
    502 function update_user_cache_categorie($user_id, $user_forbidden_categories)
     498function update_user_cache_categories($user_id, $user_forbidden_categories)
    503499{
    504500  // delete user cache
    505501  $query = '
    506   delete from '.USER_CACHE_CATEGORIES_TABLE.'
    507   where user_id = '.$user_id.'
     502DELETE FROM '.USER_CACHE_CATEGORIES_TABLE.'
     503  WHERE user_id = '.$user_id.'
    508504;';
    509505  pwg_query($query);
    510506
    511507  $query = '
    512     select
    513       id cat_id, date_last,
    514       nb_images, global_rank
    515     from '.CATEGORIES_TABLE;
     508SELECT id cat_id, date_last max_date_last, nb_images count_images, global_rank
     509  FROM '.CATEGORIES_TABLE;
    516510  if ($user_forbidden_categories != '')
    517511  {
    518512    $query.= '
    519     where id not in ('.$user_forbidden_categories.')';
     513    WHERE id NOT IN ('.$user_forbidden_categories.')';
    520514  }
    521515  $query.= ';';
     
    524518
    525519  $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;
    528524    $cats += array($row['cat_id'] => $row);
    529525  }
     
    536532  foreach ($cats as $id => $category)
    537533  {
    538     // Update field
    539     $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 
    545534    // Compute
    546535    $level = substr_count($category['global_rank'], '.') + 1;
     
    559548  $level = 1;
    560549  compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level);
    561 
    562   foreach ($cats as $id => $category)
    563   {
    564     // Convert field
    565     $cats[$id]['is_child_date_last'] = boolean_to_string($cats[$id]['is_child_date_last']);
    566   }
    567550
    568551  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     
    572555    array
    573556    (
    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'
    577559    ),
    578560    $cats
     
    801783  global $conf, $user;
    802784
    803   if ($remember_me)
     785  if ($remember_me and $conf['authorize_remembering'])
    804786  {
    805787    $key = calculate_auto_login_key($user_id);
Note: See TracChangeset for help on using the changeset viewer.