Ignore:
Timestamp:
Oct 12, 2012, 10:00:16 PM (11 years ago)
Author:
rvelices
Message:
  • remove unsed code; shorten existing code and improve readability ...
File:
1 edited

Legend:

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

    r18164 r18629  
    288288  global $conf;
    289289
    290   $userdata = array();
    291 
    292290  // retrieve basic user data
    293291  $query = '
     
    348346
    349347  // then merge basic + additional user data
    350   $row = array_merge($row, $user_infos_row);
    351 
    352   foreach ($row as $key => $value)
    353   {
    354     if (!is_numeric($key))
    355     {
    356       // If the field is true or false, the variable is transformed into a
    357       // boolean value.
    358       if ($value == 'true' or $value == 'false')
    359       {
    360         $userdata[$key] = get_boolean($value);
    361       }
    362       else
    363       {
    364         $userdata[$key] = $value;
    365       }
    366     }
    367   }
     348  $userdata = array_merge($row, $user_infos_row);
     349
     350  foreach ($userdata as &$value)
     351  {
     352      // If the field is true or false, the variable is transformed into a boolean value.
     353      if ($value == 'true')
     354      {
     355        $value = true;
     356      }
     357      elseif ($value == 'false')
     358      {
     359        $value = false;
     360      }
     361  }
     362  unset($value);
    368363
    369364  if ($use_cache)
     
    644639  if ($ref_level <> 0)
    645640  {
    646     array_push($list_cat_id, $cat_id);
     641    $list_cat_id[] = $cat_id;
    647642  }
    648643}
     
    663658    if ($level > $ref_level)
    664659    {
    665       array_push($list_cat_id, $id);
     660      $list_cat_id[] = $id;
    666661    }
    667662    else
    668663    {
    669664      compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level);
    670       array_push($list_cat_id, $id);
     665      $list_cat_id[] = $id;
    671666    }
    672667    $ref_level = $level;
     
    830825  if (is_array($cache['default_user']) and $convert_str)
    831826  {
    832     $default_user = array();
    833     foreach ($cache['default_user'] as $name => $value)
    834     {
    835       // If the field is true or false, the variable is transformed into a
    836       // boolean value.
    837       if ($value == 'true' or $value == 'false')
    838       {
    839         $default_user[$name] = get_boolean($value);
    840       }
    841       else
    842       {
    843         $default_user[$name] = $value;
     827    $default_user = $cache['default_user'];
     828    foreach ($default_user as &$value)
     829    {
     830      // If the field is true or false, the variable is transformed into a boolean value.
     831      if ($value == 'true')
     832      {
     833        $value = true;
     834      }
     835      elseif ($value == 'false')
     836      {
     837        $value = false;
    844838      }
    845839    }
     
    985979          ));
    986980
    987       array_push($inserts, $insert);
     981      $inserts[] = $insert;
    988982    }
    989983
Note: See TracChangeset for help on using the changeset viewer.