Changeset 18579 for trunk/include


Ignore:
Timestamp:
Oct 9, 2012, 9:47:22 PM (12 years ago)
Author:
rvelices
Message:

some code simplification

File:
1 edited

Legend:

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

    r13839 r18579  
    129129      $row['icon_ts'] = get_icon($row['max_date_last'], $child_date_last);
    130130    }
    131     array_push($cats, $row);
     131    $cats[] = $row;
    132132    if ($row['id']==@$page['category']['id']) //save the number of subcats for later optim
    133133      $page['category']['count_categories'] = $row['count_categories'];
     
    196196  else
    197197  {
    198     $names = array();
    199198    $query = '
    200199  SELECT id, name, permalink
     
    208207    foreach ($upper_ids as $cat_id)
    209208    {
    210       array_push( $cat['upper_names'], $names[$cat_id]);
     209      $cat['upper_names'][] = $names[$cat_id];
    211210    }
    212211  }
     
    220219{
    221220  global $conf, $page;
    222    
     221
    223222  return trigger_event('get_category_preferred_image_orders', array(
    224223    array(l10n('Default'),                        '',                     true),
     
    226225    array(l10n('Photo title, Z → A'),        'name DESC',            true),
    227226    array(l10n('Date created, new → old'),   'date_creation DESC',   true),
    228     array(l10n('Date created, old → new'),   'date_creation ASC',    true), 
     227    array(l10n('Date created, old → new'),   'date_creation ASC',    true),
    229228    array(l10n('Date posted, new → old'),    'date_available DESC',  true),
    230229    array(l10n('Date posted, old → new'),    'date_available ASC',   true),
     
    247246  foreach ($categories as $category)
    248247  {
    249     if (!empty($category['permalink']))
    250     {
    251       $category['name'] .= ' √';
    252     }
    253248    if ($fullname)
    254249    {
     
    284279                                    $fullname = true)
    285280{
    286   $result = pwg_query($query);
    287   $categories = array();
    288   if (!empty($result))
    289   {
    290     while ($row = pwg_db_fetch_assoc($result))
    291     {
    292       array_push($categories, $row);
    293     }
    294   }
     281  $categories = array_from_query($query);
    295282  usort($categories, 'global_rank_compare');
    296283  display_select_categories($categories, $selecteds, $blockname, $fullname);
     
    325312  $query.= '
    326313;';
    327   $result = pwg_query($query);
    328 
    329   $subcats = array();
    330   while ($row = pwg_db_fetch_assoc($result))
    331   {
    332     array_push($subcats, $row['id']);
    333   }
    334   return $subcats;
     314  return array_from_query($query, 'id');
    335315}
    336316
Note: See TracChangeset for help on using the changeset viewer.