[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Top/ -> index.php (source)

   1  <?php
   2  
   3  /************************************************************************/

   4  /* PHP-NUKE: Web Portal System                                          */

   5  /* ===========================                                          */

   6  /*                                                                      */

   7  /* Copyright (c) 2005 by Francisco Burzi                                */

   8  /* http://phpnuke.org                                                   */

   9  /*                                                                      */

  10  /* This program is free software. You can redistribute it and/or modify */

  11  /* it under the terms of the GNU General Public License as published by */

  12  /* the Free Software Foundation; either version 2 of the License.       */

  13  /************************************************************************/

  14  
  15  if (!defined('MODULE_FILE')) {
  16      die ("You can't access this file directly...");
  17  }
  18  
  19  require_once ("mainfile.php");
  20  $module_name = basename(dirname(__FILE__));
  21  get_lang($module_name);
  22  
  23  include ("header.php");
  24  
  25  if ($multilingual == 1) {
  26      $queryalang = "WHERE (alanguage='$currentlang' OR alanguage='')"; /* top stories */
  27      $querya1lang = "WHERE (alanguage='$currentlang' OR alanguage='') AND"; /* top stories */
  28      $queryslang = "WHERE slanguage='$currentlang' "; /* top section articles */
  29      $queryplang = "WHERE planguage='$currentlang' "; /* top polls */
  30      $queryrlang = "WHERE rlanguage='$currentlang' "; /* top reviews */
  31  } else {
  32      $queryalang = "";
  33      $querya1lang = "WHERE";
  34      $queryslang = "";
  35      $queryplang = "";
  36      $queryrlang = "";
  37  }
  38  
  39  OpenTable();
  40  echo "<center><font class=\"title\"><b>"._TOPWELCOME." $sitename!</b></font></center>";
  41  CloseTable();
  42  echo "<br>\n\n";
  43  OpenTable();
  44  
  45  /* Top 10 read stories */

  46  global $prefix, $db;
  47  $result = $db->sql_query("SELECT sid, title, counter FROM ".$prefix."_stories $queryalang ORDER BY counter DESC LIMIT 0,$top");
  48  if ($db->sql_numrows($result) > 0) {
  49      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
  50      ."<font class=\"option\"><b>$top "._READSTORIES."</b></font><br><br><font class=\"content\">\n";
  51      $lugar=1;
  52      while ($row = $db->sql_fetchrow($result)) {
  53          $sid = intval($row['sid']);
  54          $title = filter($row['title'], "nohtml");
  55          $counter = intval($row['counter']);
  56          if($counter>0) {
  57              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a> - ($counter "._READS.")<br>\n";
  58              $lugar++;
  59          }
  60      }
  61      echo "</font></td></tr></table><br>\n";
  62  }
  63  
  64  /* Top 10 most voted stories */

  65  
  66  $result2 = $db->sql_query("SELECT sid, title, ratings FROM ".$prefix."_stories $querya1lang score!='0' ORDER BY ratings DESC LIMIT 0,$top");
  67  if ($db->sql_numrows($result2) > 0) {
  68      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
  69      ."<font class=\"option\"><b>$top "._MOSTVOTEDSTORIES."</b></font><br><br><font class=\"content\">\n";
  70      $lugar=1;
  71      while ($row2 = $db->sql_fetchrow($result2)) {
  72          $sid = intval($row2['sid']);
  73          $title = filter($row2['title'], "nohtml");
  74          $ratings = intval($row2['ratings']);
  75          if($ratings>0) {
  76              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a> - ($ratings "._LVOTES.")<br>\n";
  77              $lugar++;
  78          }
  79      }
  80      echo "</font></td></tr></table><br>\n";
  81  }
  82  
  83  /* Top 10 best rated stories */

  84  
  85  $result3 = $db->sql_query("SELECT sid, title, score, ratings FROM ".$prefix."_stories $querya1lang score!='0' ORDER BY ratings+score DESC LIMIT 0,$top");
  86  if ($db->sql_numrows($result3) > 0) {
  87      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
  88      ."<font class=\"option\"><b>$top "._BESTRATEDSTORIES."</b></font><br><br><font class=\"content\">\n";
  89      $lugar=1;
  90      while ($row3 = $db->sql_fetchrow($result3)) {
  91          $sid = intval($row3['sid']);
  92          $title = filter($row3['title'], "nohtml");
  93          $score = intval($row3['score']);
  94          $ratings = intval($row3['ratings']);
  95          if($score>0) {
  96              $rate = substr($score / $ratings, 0, 4);
  97              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a> - ($rate "._POINTS.")<br>\n";
  98              $lugar++;
  99          }
 100      }
 101      echo "</font></td></tr></table><br>\n";
 102  }
 103  
 104  /* Top 10 commented stories */

 105  
 106  if ($articlecomm == 1) {
 107      $result4 = $db->sql_query("SELECT sid, title, comments FROM ".$prefix."_stories $queryalang ORDER BY comments DESC LIMIT 0,$top");
 108      if ($db->sql_numrows($result4) > 0) {
 109          echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 110          ."<font class=\"option\"><b>$top "._COMMENTEDSTORIES."</b></font><br><br><font class=\"content\">\n";
 111          $lugar=1;
 112          while ($row4 = $db->sql_fetchrow($result4)) {
 113              $sid = intval($row4['sid']);
 114              $title = filter($row4['title'], "nohtml");
 115              $comments = intval($row4['comments']);
 116              if($comments>0) {
 117                  echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a> - ($comments "._COMMENTS.")<br>\n";
 118                  $lugar++;
 119              }
 120          }
 121          echo "</font></td></tr></table><br>\n";
 122      }
 123  }
 124  
 125  /* Top 10 categories */

 126  
 127  $result5 = $db->sql_query("SELECT catid, title, counter FROM ".$prefix."_stories_cat ORDER BY counter DESC LIMIT 0,$top");
 128  if ($db->sql_numrows($result5) > 0) {
 129      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 130      ."<font class=\"option\"><b>$top "._ACTIVECAT."</b></font><br><br><font class=\"content\">\n";
 131      $lugar=1;
 132      while ($row5 = $db->sql_fetchrow($result5)) {
 133          $catid = intval($row5['catid']);
 134          $title = filter($row5['title'], "nohtml");
 135          $counter = intval($row5['counter']);
 136          if($counter>0) {
 137              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=News&amp;file=categories&amp;op=newindex&amp;catid=$catid\">$title</a> - ($counter "._HITS.")<br>\n";
 138              $lugar++;
 139          }
 140      }
 141      echo "</font></td></tr></table><br>\n";
 142  }
 143  
 144  /* Top 10 users submitters */

 145  
 146  $result7 = $db->sql_query("SELECT username, counter FROM ".$user_prefix."_users WHERE counter > '0' ORDER BY counter DESC LIMIT 0,$top");
 147  if ($db->sql_numrows($result7) > 0) {
 148      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 149      ."<font class=\"option\"><b>$top "._NEWSSUBMITTERS."</b></font><br><br><font class=\"content\">\n";
 150      $lugar=1;
 151      while ($row7 = $db->sql_fetchrow($result7)) {
 152          $uname = filter($row7['username'], "nohtml");
 153          $counter = intval($row7['counter']);
 154          if($counter>0) {
 155              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$uname\">$uname</a> - ($counter "._NEWSSENT.")<br>\n";
 156              $lugar++;
 157          }
 158      }
 159      echo "</font></td></tr></table><br>\n";
 160  }
 161  
 162  /* Top 10 Polls */

 163  
 164  $result8 = $db->sql_query("select * from ".$prefix."_poll_desc $queryplang");
 165  if ($db->sql_numrows($result8)>0) {
 166      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 167      ."<font class=\"option\"><b>$top "._VOTEDPOLLS."</b></font><br><br><font class=\"content\">\n";
 168      $lugar = 1;
 169      $result9 = $db->sql_query("SELECT pollID, pollTitle, timeStamp, voters FROM ".$prefix."_poll_desc $queryplang order by voters DESC limit 0,$top");
 170      $counter = 0;
 171      while($row9 = $db->sql_fetchrow($result9)) {
 172          $resultArray[$counter] = array($row9['pollID'], $row9['pollTitle'], $row9['timeStamp'], $row9['voters']);
 173          $counter++;
 174      }
 175      for ($count = 0; $count < count($resultArray); $count++) {
 176          $id = $resultArray[$count][0];
 177          $pollTitle = $resultArray[$count][1];
 178          $voters = $resultArray[$count][3];
 179          for($i = 0; $i < 12; $i++) {
 180              $result10 = $db->sql_query("SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$id') AND (voteID='$i')");
 181              $row10 = $db->sql_fetchrow($result10);
 182              $optionCount = $row10['optionCount'];
 183              $sum = (int)$sum+$optionCount;
 184          }
 185          $pollTitle = filter($pollTitle, "nohtml");
 186          echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Surveys&amp;pollID=$id\">$pollTitle</a> - ($sum "._LVOTES.")<br>\n";
 187          $lugar++;
 188          $sum = 0;
 189      }
 190      echo "</font></td></tr></table><br>\n";
 191  }
 192  
 193  /* Top 10 authors */

 194  
 195  $result11 = $db->sql_query("SELECT aid, counter FROM ".$prefix."_authors ORDER BY counter DESC LIMIT 0,$top");
 196  if ($db->sql_numrows($result11) > 0) {
 197      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 198      ."<font class=\"option\"><b>$top "._MOSTACTIVEAUTHORS."</b></font><br><br><font class=\"content\">\n";
 199      $lugar=1;
 200      while ($row11 = $db->sql_fetchrow($result11)) {
 201          $aid = filter($row11['aid'], "nohtml");
 202          $counter = intval($row11['counter']);
 203          if($counter>0) {
 204              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Search&amp;query=&amp;author=$aid\">$aid</a> - ($counter "._NEWSPUBLISHED.")<br>\n";
 205              $lugar++;
 206          }
 207      }
 208      echo "</font></td></tr></table><br>\n";
 209  }
 210  
 211  /* Top 10 reviews */

 212  
 213  $result12 = $db->sql_query("SELECT id, title, hits FROM ".$prefix."_reviews $queryrlang ORDER BY hits DESC LIMIT 0,$top");
 214  if ($db->sql_numrows($result12) > 0) {
 215      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 216      ."<font class=\"option\"><b>$top "._READREVIEWS."</b></font><br><br><font class=\"content\">\n";
 217      $lugar=1;
 218      while ($row12 = $db->sql_fetchrow($result12)) {
 219          $id = intval($row12['id']);
 220          $title = filter($row12['title'], "nohtml");
 221          $hits = intval($row12['hits']);
 222          if($hits>0) {
 223              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Reviews&amp;op=showcontent&amp;id=$id\">$title</a> - ($hits "._READS.")<br>\n";
 224              $lugar++;
 225          }
 226      }
 227      echo "</font></td></tr></table><br>\n";
 228  }
 229  
 230  /* Top 10 downloads */

 231  
 232  $result13 = $db->sql_query("SELECT lid, cid, title, hits FROM ".$prefix."_downloads_downloads ORDER BY hits DESC LIMIT 0,$top");
 233  if ($db->sql_numrows($result13) > 0) {
 234      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 235      ."<font class=\"option\"><b>$top "._DOWNLOADEDFILES."</b></font><br><br><font class=\"content\">\n";
 236      $lugar=1;
 237      while ($row13 = $db->sql_fetchrow($result13)) {
 238          $lid = intval($row13['lid']);
 239          $cid = intval($row13['cid']);
 240          $title = filter($row13['title'], "nohtml");
 241          $hits = intval($row13['hits']);
 242          if($hits>0) {
 243              $row_res = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_downloads_categories WHERE cid='$cid'"));
 244              $ctitle = filter($row_res['title'], "nohtml");
 245              $utitle = ereg_replace(" ", "_", $title);
 246              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Downloads&amp;d_op=viewdownloaddetails&amp;lid=$lid&amp;ttitle=$utitle\">$title</a> ("._CATEGORY.": $ctitle) - ($hits "._LDOWNLOADS.")<br>\n";
 247              $lugar++;
 248          }
 249      }
 250      echo "</font></td></tr></table>\n\n";
 251  }
 252  
 253  /* Top 10 Pages in Content */

 254  
 255  $result14 = $db->sql_query("SELECT pid, title, counter FROM ".$prefix."_pages WHERE active='1' ORDER BY counter DESC LIMIT 0,$top");
 256  if ($db->sql_numrows($result14) > 0) {
 257      echo "<table border=\"0\" cellpadding=\"10\" width=\"100%\"><tr><td align=\"left\">\n"
 258      ."<font class=\"option\"><b>$top "._MOSTREADPAGES."</b></font><br><br><font class=\"content\">\n";
 259      $lugar=1;
 260      while ($row14 = $db->sql_fetchrow($result14)) {
 261          $pid = intval($row14['pid']);
 262          $title = filter($row14['title'], "nohtml");
 263          $counter = intval($row14['counter']);
 264          if($counter>0) {
 265              echo "<strong><big>&middot;</big></strong>&nbsp;$lugar: <a href=\"modules.php?name=Content&amp;pa=showpage&amp;pid=$pid\">$title</a> ($counter "._READS.")<br>\n";
 266              $lugar++;
 267          }
 268      }
 269      echo "</font></td></tr></table>\n\n";
 270  }
 271  
 272  CloseTable();
 273  include ("footer.php");
 274  
 275  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7