function top5() {
$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
global $_language;
$_language->read_module('articles');
echo'<table cellspacing="0" cellpadding="0" width="100%"><tr><td align="center"><div class="top_5"><table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="49%" valign="top">';
if(empty($_GET['rubricID'])) $rub=""; else $rub="and rubricID='".$_GET['rubricID']."'";
// RATING
$ergebnis=safe_query("SELECT * FROM ".PREFIX."articles WHERE saved='1' $rub ORDER BY rating DESC LIMIT 0,5");
$top=$_language->module['top5_rating'];
eval ("\$top5_head = \"".gettemplate("top5_head")."\";");
echo $top5_head;
$n=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($n%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}
$title='<a href="index.php?site=articles&action=show&articlesID='.$ds['articlesID'].'">'.clearfromtags($ds['title']).'</a>';
$poster='<a href="index.php?site=profile&id='.$ds['poster'].'">'.getnickname($ds['poster']).'</a>';
$viewed='('.$ds['viewed'].')';
$ratings=array(0,0,0,0,0,0,0,0,0,0);
for($i=0; $i<$ds['rating']; $i++) {
$ratings[$i]=1;
}
$ratingpic='<img src="images/icons/rating_'.$ratings[0].'_start.gif" width="1" height="5" alt="" />';
foreach($ratings as $pic) {
$ratingpic.='<img src="images/icons/rating_'.$pic.'.gif" width="4" height="5" alt="" />';
}
echo'<tr>
<td align="center"><b>'.$n.'.</b></td>
<td align="center" style="white-space:nowrap;">'.$ratingpic.'</td>
<td>'.$title.'</td>
</tr>';
unset($ratingpic);
$n++;
}
echo'</table>';
echo'</td><td width="49%" valign="top">';
// POINTS
$ergebnis=safe_query("SELECT * FROM ".PREFIX."articles WHERE saved='1' $rub ORDER BY points DESC LIMIT 0,5");
$top=$_language->module['top5_points'];
eval ("\$top5_head = \"".gettemplate("top5_head")."\";");
echo $top5_head;
$n=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($n%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}
$title='<a href="index.php?site=articles&action=show&articlesID='.$ds['articlesID'].'">'.clearfromtags($ds['title']).'</a>';
$viewed='('.$ds['viewed'].')';
echo'<tr>
<td align="center"><b>'.$n.'.</b></td>
<td align="center">'.$ds['points'].'</td>
<td>'.$title.'</td>
</tr>';
$n++;
}
echo'</table></td></tr></table></div></td></tr></table>';
} |