Просмотр файла forum/top.php

Размер файла: 3.31Kb
  1. <?php
  2. require_once ("../includes/start.php");
  3. require_once ("../includes/functions.php");
  4. require_once ("../includes/header.php");
  5. include_once ("../themes/".$config['themes']."/index.php");
  6. include_once ("../includes/db.php");
  7.  
  8. echo "<img src='../images/img/partners.gif' alt=''> Топ популярных тем<br><br>\n";
  9.  
  10. function pages($start, $total, $page, $onpage){
  11. if ($start != 0) echo '<a href="'.$page.'?start='.($start - $onpage).'">&lt;-Назад</a> ';
  12. else echo '&lt;-Назад';
  13. echo ' | ';
  14. if ($total > $start + $onpage)
  15. echo ' <a href="'.$page.'?start='.($start + $onpage).'">Далее-&gt;</a>';
  16. else echo 'Далее-&gt;';
  17. if($total>0){
  18. $ba = ceil($total/$onpage);
  19. $ba2 = $ba*$onpage-$onpage;
  20. echo '<br>Страницы:';
  21. $asd = $start-($onpage*3);
  22. $asd2 = $start+($onpage*4);
  23. if($asd<$total && $asd>0) echo ' <a href="'.$page.'?start=0">1</a> ... ';
  24. for($i=$asd; $i<$asd2;){
  25. if($i<$total && $i>=0){
  26. $ii = floor(1+$i/$onpage);
  27. if ($start==$i) echo ' <b>['.$ii.']</b>';
  28. else echo ' <a href="'.$page.'?start='.$i.'">'.$ii.'</a>';}
  29. $i=$i+$onpage;}
  30. if($asd2<$total) echo ' ... <a href="'.$page.'?start='.$ba2.'">'.$ba.'</a>';
  31. }}
  32. $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `theme`"),0);
  33.  
  34. $start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
  35. if($start > $total) $start = 0;
  36. if ($total < $start + 10) $end = $total;
  37. else $end = $start + 10;
  38.  
  39. $tops = mysql_query("SELECT * FROM `theme` ORDER BY `posts` DESC LIMIT $start, 10");
  40. if(mysql_num_rows($tops) != '0'){
  41. while($top = mysql_fetch_array($tops)){
  42. $timedat = $top['time']+$config['timeclocks']*3600;
  43. $timedat = date("d.m.Y / H:i",$timedat);
  44.  
  45. echo "<div class=b>";
  46. if($top['locked'] == '1'){echo "<img src='img/zt.gif' alt=''> ";
  47. }else{
  48. if($top['status'] == '0'){echo "<img src='img/t.gif' alt=''> ";}
  49. elseif($top['status'] == '1'){echo "<img src='img/bt.gif' alt=''> ";}}
  50. echo "<a href='".$config['home']."/forum/posts/".$top['id']."'><b>".$top['name']."</b></a> [".$top['posts']."]";
  51. echo "<a href='".$config['home']."/forum/posts/".$top['id']."/".strts($top['id'],$config['forumpost'])."'> <small>&gt;&gt;</small></a></div>\n";
  52. $date = file(BASEDIR."local/profil/$top[author].prof");
  53. $filename = "".BASEDIR."local/profil/$top[author].prof";
  54. if (file_exists($filename)) {
  55. $date = explode(":||:",$date[0]);
  56. echo "Создал: <a href='../pages/anketa.php?uz=".$top['author']."'>";
  57. if ($date[65]) {echo "".$date['65']."</a><br>";
  58. }else{echo "".$top['author']."</a><br>";}
  59. }else{echo "Создал: ".$top['author']."<br>";}
  60. echo "Кратко: ".$top['description']." <br>\n";
  61. echo "Последний: ";
  62. $ldate = file(BASEDIR."local/profil/".$top['last'].".prof");
  63. $ldate = explode(":||:",$ldate[0]);
  64. if ($ldate[65]) {echo "".$ldate['65']." ";
  65. }else{echo "".$top['last']." ";}
  66. echo "($timedat)<br>\n";
  67. }}else{ echo "<br> <img src='../images/img/close.gif' alt=''> Темы еще не созданны!<br>\n";}
  68. echo "<hr>\n";
  69. pages($start, $total, 'top.php', 10);
  70. echo "<hr>\n";
  71. echo "<img src='../images/img/reload.gif' alt=''> <a href='index.php'>К форумам</a><br>";
  72. echo "<img src='../images/img/homepage.gif' alt=''> <a href='../index.php?".SID."'>На главную</a><br>";
  73.  
  74. echo '<a href="http://7je.ru">ByForum 1.5 DEMO</a>';
  75.  
  76. include_once ("../themes/".$config['themes']."/foot.php");
  77. ?>