Ignore:
Timestamp:
Aug 31, 2004, 12:00:46 AM (20 years ago)
Author:
z0rglub
Message:

add rating feature

File:
1 edited

Legend:

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

    r503 r507  
    725725        }
    726726      }
     727      else if ($page['cat'] == 'best_rated')
     728      {
     729        $page['title'] = $conf['top_number'].' '.$lang['best_rated_cat'];
     730
     731        $page['where'] = ' WHERE average_rate IS NOT NULL';
     732       
     733        if (isset($forbidden))
     734        {
     735          $page['where'] = ' AND '.$forbidden;
     736        }
     737
     738        $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC';
     739
     740        // $page['cat_nb_images'] equals $conf['top_number'] unless there
     741        // are less rated items
     742        $query ='
     743SELECT COUNT(1) AS count
     744  FROM '.IMAGES_TABLE.'
     745  '.$page['where'].'
     746;';
     747        $row = mysql_fetch_array(mysql_query($query));
     748        if ($row['count'] < $conf['top_number'])
     749        {
     750          $page['cat_nb_images'] = $row['count'];
     751        }
     752        else
     753        {
     754          $page['cat_nb_images'] = $conf['top_number'];
     755        }
     756        unset($query);
     757         
     758
     759        if (isset($page['start'])
     760            and ($page['start']+$user['nb_image_page']>=$conf['top_number']))
     761        {
     762          $page['nb_image_page'] = $conf['top_number'] - $page['start'];
     763        }
     764      }
    727765
    728766      if (isset($query))
Note: See TracChangeset for help on using the changeset viewer.