home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / downloads / index.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  110.7 KB  |  2,276 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* Based on Journey Links Hack                                          */
  11. /* Copyright (c) 2000 by James Knickelbein                              */
  12. /* Journey Milwaukee (http://www.journeymilwaukee.com)                  */
  13. /*                                                                      */
  14. /* This program is free software. You can redistribute it and/or modify */
  15. /* it under the terms of the GNU General Public License as published by */
  16. /* the Free Software Foundation; either version 2 of the License.       */
  17. /************************************************************************/
  18.  
  19. if (!eregi("modules.php", $PHP_SELF)) {
  20.     die ("You can't access this file directly...");
  21. }
  22.  
  23. require_once("mainfile.php");
  24. $module_name = basename(dirname(__FILE__));
  25. get_lang($module_name);
  26. $pagetitle = "- "._UDOWNLOADS."";
  27. require_once("modules/$module_name/d_config.php");
  28. $index = 1;
  29.  
  30. // ALTERED BY PALADIN - 170102 - Start
  31. function getparent($parentid,$title) {
  32.     global $prefix, $dbi;
  33.     $result = sql_query("select cid, title, parentid from ".$prefix."_downloads_categories where cid=$parentid", $dbi);
  34.     list($cid, $ptitle, $pparentid) = sql_fetch_row($result, $dbi);
  35.     if ($ptitle!="") $title=$ptitle."/".$title;
  36.     if ($pparentid!=0) {
  37.     $title=getparent($pparentid,$title);
  38.     }
  39.     return $title;
  40. }
  41.  
  42. function getparentlink($parentid,$title) {
  43.     global $prefix, $dbi, $module_name;
  44.     $result=sql_query("select cid, title, parentid from ".$prefix."_downloads_categories where cid=$parentid", $dbi);
  45.     list($cid, $ptitle, $pparentid) = sql_fetch_row($result, $dbi);
  46.     if ($ptitle!="") $title="<a href=modules.php?name=$module_name&d_op=viewdownload&cid=$cid>$ptitle</a>/".$title;
  47.     if ($pparentid!=0) {
  48.         $title=getparentlink($pparentid,$title);
  49.     }
  50.     return $title;
  51. }
  52. // ALTERED BY PALADIN - 170102 - End
  53.  
  54. function menu($maindownload) {
  55.     global $prefix, $dbi, $user_adddownload, $module_name;
  56.     OpenTable();
  57.     echo "<br><center><a href=\"modules.php?name=$module_name\"><img src=\"modules/$module_name/images/down-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  58.     echo "<form action=\"modules.php?name=$module_name&d_op=search&query=$query\" method=\"post\">"
  59.     ."<font class=\"content\"><input type=\"text\" size=\"25\" name=\"query\"> <input type=\"submit\" value=\""._SEARCH."\"></font>"
  60.     ."</form>";
  61.     echo "<font class=\"content\">[ ";
  62.     if ($maindownload>0) {
  63.     echo "<a href=\"modules.php?name=$module_name\">"._DOWNLOADSMAIN."</a> | ";
  64.     }
  65.     if ($user_adddownload == 1) {
  66.     echo "<a href=\"modules.php?name=$module_name&d_op=AddDownload\">"._ADDDOWNLOAD."</a>"
  67.         ." | ";
  68.     }
  69.     echo "<a href=\"modules.php?name=$module_name&d_op=NewDownloads\">"._NEW."</a>"
  70.     ." | <a href=\"modules.php?name=$module_name&d_op=MostPopular\">"._POPULAR."</a>"
  71.     ." | <a href=\"modules.php?name=$module_name&d_op=TopRated\">"._TOPRATED."</a> ]"
  72.     ."</font></center>";
  73.     CloseTable();
  74. }
  75.  
  76. function SearchForm() {
  77.     global $module_name;
  78.     echo "<form action=\"modules.php?name=$module_name&d_op=search&query=$query\" method=\"post\">"
  79.     ."<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">"
  80.     ."<tr><td><font class=\"content\"><input type=\"text\" size=\"25\" name=\"query\"> <input type=\"submit\" value=\""._SEARCH."\"></td></tr>"
  81.     ."</table>"
  82.     ."</form>";
  83. }
  84.  
  85. function downloadinfomenu($lid, $ttitle) {
  86.     global $module_name;
  87.     echo "<br><font class=\"content\">[ "
  88.     ."<a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$ttitle\">"._DOWNLOADCOMMENTS."</a>"
  89.     ." | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$ttitle\">"._ADDITIONALDET."</a>"
  90.     ." | <a href=\"modules.php?name=$module_name&d_op=viewdownloadeditorial&lid=$lid&ttitle=$ttitle\">"._EDITORREVIEW."</a>"
  91.     ." | <a href=\"modules.php?name=$module_name&d_op=modifydownloadrequest&lid=$lid\">"._MODIFY."</a>"
  92.     ." | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a> ]</font>";
  93. }
  94.  
  95. function index() {
  96.     global $prefix, $dbi, $show_links_num, $module_name;
  97.     include("header.php");
  98.     $maindownload = 0;
  99.     menu($maindownload);
  100.     echo "<br>";
  101.     OpenTable();
  102.     echo "<center><font class=\"title\"><b>"._DOWNLOADSMAINCAT."</b></font></center><br>";
  103.     echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
  104.     $result = sql_query("select cid, title, cdescription from ".$prefix."_downloads_categories where parentid=0 order by title", $dbi);
  105.     $count = 0;
  106.     while(list($cid, $title, $cdescription) = sql_fetch_row($result, $dbi)) {
  107.     if ($show_links_num == 1) {
  108.         $cresult = sql_query("select * from ".$prefix."_downloads_downloads where cid='$cid'", $dbi);
  109.         $cnumrows = sql_num_rows($cresult, $dbi);
  110.         $cnumm = "($cnumrows)";
  111.     } else {
  112.         $cnumm = "";
  113.     }
  114.     echo "<td><font class=\"option\"><strong><big>·</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid\"><b>$title</b></a>$cnumm</font>";
  115.     categorynewdownloadgraphic($cid);
  116.     if ($cdescription) {
  117.         echo "<br><font class=\"content\">$cdescription</font><br>";
  118.     } else {
  119.         echo "<br>";
  120.     }
  121.     $result2 = sql_query("select cid, title from ".$prefix."_downloads_categories where parentid=$cid order by title limit 0,3", $dbi);
  122.     $space = 0;
  123.     while(list($cid, $stitle) = sql_fetch_row($result2, $dbi)) {
  124.             if ($space>0) {
  125.         echo ", ";
  126.         }
  127.             if ($show_links_num == 1) {
  128.         $cresult2 = sql_query("select * from ".$prefix."_downloads_downloads where cid='$cid'", $dbi);
  129.             $cnumrows2 = sql_num_rows($cresult2, $dbi);
  130.         $cnum = " ($cnumrows2)";
  131.         } else {
  132.         $cnumrows2 = "";
  133.         }
  134.         echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid\">$stitle</a>$cnum</font>";
  135.         $space++;
  136.     }
  137.     if ($count<1) {
  138.         echo "</td><td>    </td>";
  139.         $dum = 1;
  140.     }
  141.     $count++;
  142.     if ($count==2) {
  143.         echo "</td></tr><tr>";
  144.         $count = 0;
  145.         $dum = 0;
  146.     }
  147.     }
  148.     if ($dum == 1) {
  149.     echo "</tr></table>";
  150.     } elseif ($dum == 0) {
  151.     echo "<td></td></tr></table>";
  152.     }
  153.     $result = sql_query("select * from ".$prefix."_downloads_downloads", $dbi);
  154.     $numrows = sql_num_rows($result, $dbi);
  155.     $result = sql_query("select * from ".$prefix."_downloads_categories", $dbi);
  156.     $catnum = sql_num_rows($result, $dbi);
  157.     echo "<center><font class=\"content\">"._THEREARE." <b>$numrows</b> "._DOWNLOADS." "._AND." <b>$catnum</b> "._CATEGORIES." "._INDB."</font></center>";
  158.     CloseTable();
  159.     include("footer.php");
  160. }
  161.  
  162. function AddDownload() {
  163.     global $prefix, $dbi, $cookie, $user, $downloads_anonadddownloadlock, $module_name;
  164.     include("header.php");
  165.     $maindownload = 1;
  166.     menu(1);
  167.     echo "<br>";
  168.     OpenTable();
  169.     echo "<center><font class=\"title\"><b>"._ADDADOWNLOAD."</b></font></center><br><br>";
  170.     if (is_user($user) || $downloads_anonadddownloadlock != 1) {
  171.         echo "<b>"._INSTRUCTIONS.":</b><br>"
  172.         ."<strong><big>·</big></strong> "._DSUBMITONCE."<br>"
  173.         ."<strong><big>·</big></strong> "._DPOSTPENDING."<br>"
  174.         ."<strong><big>·</big></strong> "._USERANDIP."<br>";
  175.         echo "<form method=\"post\" action=\"modules.php?name=$module_name&d_op=Add\">"
  176.             .""._DOWNLOADNAME.": <input type=\"text\" name=\"title\" size=\"40\" maxlength=\"100\"><br>"
  177.             .""._FILEURL.": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
  178.         $result = sql_query("select cid, title from ".$prefix."_downloads_categories order by title", $dbi);
  179.         echo ""._CATEGORY.": <select name=\"cat\">";
  180.         $result2=sql_query("select cid, title, parentid from ".$prefix."_downloads_categories order by parentid,title", $dbi);
  181.         while(list($cid2, $ctitle2, $parentid2) = sql_fetch_row($result2, $dbi)) {
  182.             if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  183.             echo "<option value=\"$cid2\">$ctitle2</option>";
  184.         }
  185.         echo "</select><br><br>"
  186.             .""._LDESCRIPTION."<br><textarea name=\"description\" cols=\"60\" rows=\"8\"></textarea><br><br>"
  187.             .""._AUTHORNAME.": <input type=\"text\" name=\"auth_name\" size=\"30\" maxlength=\"60\"><br>"
  188.             .""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br>"
  189.         .""._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\"> ("._INBYTES.")<br>"
  190.         .""._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\"><br>"
  191.             .""._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"50\" maxlength=\"200\" value=\"http://\"><br><br>"
  192.         ."<input type=\"hidden\" name=\"d_op\" value=\"Add\">"
  193.             ."<input type=\"submit\" value=\""._ADDTHISFILE."\"> "._GOBACK."<br><br>"
  194.             ."</form>";
  195.     } else {
  196.         echo "<center>"._DOWNLOADSNOTUSER1."<br>"
  197.         .""._DOWNLOADSNOTUSER2."<br><br>"
  198.             .""._DOWNLOADSNOTUSER3."<br>"
  199.             .""._DOWNLOADSNOTUSER4."<br>"
  200.             .""._DOWNLOADSNOTUSER5."<br>"
  201.             .""._DOWNLOADSNOTUSER6."<br>"
  202.             .""._DOWNLOADSNOTUSER7."<br><br>"
  203.             .""._DOWNLOADSNOTUSER8."";
  204.     }
  205.     CloseTable();
  206.     include("footer.php");
  207. }
  208.  
  209. function Add($title, $url, $auth_name, $cat, $description, $email, $filesize, $version, $homepage) {
  210.     global $prefix, $dbi, $user;
  211.     $result = sql_query("select url from ".$prefix."_downloads_downloads where url='$url'", $dbi);
  212.     $numrows = sql_num_rows($result, $dbi);
  213.     if ($numrows>0) {
  214.     include("header.php");
  215.     menu(1);
  216.     echo "<br>";
  217.     OpenTable();
  218.     echo "<center><b>"._DOWNLOADALREADYEXT."</b><br><br>"
  219.         .""._GOBACK."";
  220.     CloseTable();
  221.     include("footer.php");
  222.     } else {
  223.     if(is_user($user)) {
  224.         $user2 = base64_decode($user);
  225.         $cookie = explode(":", $user2);
  226.         cookiedecode($user);
  227.         $submitter = $cookie[1];    
  228.     }
  229. // Check if Title exist
  230.     if ($title=="") {
  231.     include("header.php");
  232.     menu(1);
  233.     echo "<br>";
  234.     OpenTable();
  235.     echo "<center><b>"._DOWNLOADNOTITLE."</b><br><br>"
  236.         .""._GOBACK."";
  237.     CloseTable();
  238.     include("footer.php");
  239.     }
  240. // Check if URL exist
  241.     if ($url=="") {
  242.     include("header.php");
  243.     menu(1);
  244.     echo "<br>";
  245.     OpenTable();
  246.     echo "<center><b>"._DOWNLOADNOURL."</b><br><br>"
  247.         .""._GOBACK."";
  248.     CloseTable();
  249.     include("footer.php");
  250.     }
  251. // Check if Description exist
  252.     if ($description=="") {
  253.     include("header.php");
  254.     menu(1);
  255.     echo "<br>";
  256.     OpenTable();
  257.     echo "<center><b>"._DOWNLOADNODESC."</b><br><br>"
  258.         .""._GOBACK."";
  259.     CloseTable();
  260.     include("footer.php");
  261.     }
  262.     $cat = explode("-", $cat);
  263.     if ($cat[1]=="") {
  264.     $cat[1] = 0;
  265.     }
  266.     $title = stripslashes(FixQuotes($title));
  267.     $url = stripslashes(FixQuotes($url));
  268.     $description = stripslashes(FixQuotes($description));
  269.     $auth_name = stripslashes(FixQuotes($auth_name));
  270.     $email = stripslashes(FixQuotes($email));
  271.     $filesize = ereg_replace("\.","",$filesize);
  272.     $filesize = ereg_replace("\,","",$filesize);
  273.     sql_query("insert into ".$prefix."_downloads_newdownload values (NULL, '$cat[0]', '$cat[1]', '$title', '$url', '$description', '$auth_name', '$email', '$submitter', '$filesize', '$version', '$homepage')", $dbi);
  274.     include("header.php");
  275.     menu(1);
  276.     echo "<br>";
  277.     OpenTable();
  278.     echo "<center><b>"._DOWNLOADRECEIVED."</b><br>";
  279.     if ($email == "") {
  280.     echo _CHECKFORIT;
  281.     }
  282.     CloseTable();
  283.     include("footer.php");
  284.     }
  285. }
  286.  
  287. function NewDownloads($newdownloadshowdays) {
  288.     global $prefix, $dbi, $module_name;
  289.     include("header.php");
  290.     menu(1);
  291.     echo "<br>";
  292.     OpenTable();
  293.     echo "<center><font class=\"option\"><b>"._NEWDOWNLOADS."</b></font></center><br>";
  294.     $counter = 0;
  295.     $allweekdownloads = 0;
  296.     while ($counter <= 7-1){
  297.     $newdownloaddayRaw = (time()-(86400 * $counter));
  298.     $newdownloadday = date("d-M-Y", $newdownloaddayRaw);
  299.     $newdownloadView = date("F d, Y", $newdownloaddayRaw);
  300.     $newdownloadDB = Date("Y-m-d", $newdownloaddayRaw);
  301.     $result = sql_query("select * FROM ".$prefix."_downloads_downloads WHERE date LIKE '%$newdownloadDB%'", $dbi);
  302.     $totaldownloads = sql_num_rows($result, $dbi); 
  303.     $counter++;
  304.     $allweekdownloads = $allweekdownloads + $totaldownloads;
  305.     }
  306.     $counter = 0;
  307.     while ($counter <=30-1){
  308.         $newdownloaddayRaw = (time()-(86400 * $counter));
  309.         $newdownloadDB = Date("Y-m-d", $newdownloaddayRaw);
  310.         $result = sql_query("select * FROM ".$prefix."_downloads_downloads WHERE date LIKE '%$newdownloadDB%'", $dbi);
  311.         $totaldownloads = sql_num_rows($result, $dbi);
  312.         $allmonthdownloads = $allmonthdownloads + $totaldownloads;
  313.         $counter++;
  314.     }    
  315.     echo "<center><b>"._TOTALNEWDOWNLOADS.":</b> "._LASTWEEK." - $allweekdownloads \ "._LAST30DAYS." - $allmonthdownloads<br>"
  316.     .""._SHOW.": <a href=\"modules.php?name=$module_name&d_op=NewDownloads&newdownloadshowdays=7\">"._1WEEK."</a> - <a href=\"modules.php?name=$module_name&d_op=NewDownloads&newdownloadshowdays=14\">"._2WEEKS."</a> - <a href=\"modules.php?name=$module_name&d_op=NewDownloads&newdownloadshowdays=30\">"._30DAYS."</a>"
  317.     ."</center><br>";
  318.     /* List Last VARIABLE Days of Downloads */
  319.     if (!isset($newdownloadshowdays)) {
  320.     $newdownloadshowdays = 7;
  321.     }
  322.     echo "<br><center><b>"._DTOTALFORLAST." $newdownloadshowdays "._DAYS.":</b><br><br>";
  323.     $counter = 0;
  324.     $allweekdownloads = 0;
  325.     while ($counter <= $newdownloadshowdays-1) {
  326.     $newdownloaddayRaw = (time()-(86400 * $counter));
  327.     $newdownloadday = date("d-M-Y", $newdownloaddayRaw);
  328.     $newdownloadView = date("F d, Y", $newdownloaddayRaw);
  329.     $newdownloadDB = Date("Y-m-d", $newdownloaddayRaw);
  330.     $result = sql_query("select * FROM ".$prefix."_downloads_downloads WHERE date LIKE '%$newdownloadDB%'", $dbi);
  331.     $totaldownloads = sql_num_rows($result, $dbi); 
  332.     $counter++;
  333.     $allweekdownloads = $allweekdownloads + $totaldownloads;
  334.     echo "<strong><big>·</big></strong> <a href=\"modules.php?name=$module_name&d_op=NewDownloadsDate&selectdate=$newdownloaddayRaw\">$newdownloadView</a> ($totaldownloads)<br>";
  335.     }
  336.     $counter = 0;
  337.     $allmonthdownloads = 0;
  338.     echo "</center>";
  339.     CloseTable();
  340.     include("footer.php");
  341. }
  342.  
  343. function NewDownloadsDate($selectdate) {
  344.     global $prefix, $dbi, $module_name;
  345.     $dateDB = (date("d-M-Y", $selectdate));
  346.     $dateView = (date("F d, Y", $selectdate));
  347.     include("header.php");
  348.     menu(1);
  349.     echo "<br>";
  350.     OpenTable();
  351.     $newdownloadDB = Date("Y-m-d", $selectdate);
  352.     $result = sql_query("select * FROM ".$prefix."_downloads_downloads WHERE date LIKE '%$newdownloadDB%'", $dbi);
  353.     $totaldownloads = sql_num_rows($result, $dbi); 
  354.     echo "<font class=\"option\"><b>$dateView - $totaldownloads "._NEWDOWNLOADS."</b></font>"
  355.     ."<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">";
  356.     $result = sql_query("select lid, cid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads where date LIKE '%$newdownloadDB%' order by title ASC", $dbi);
  357.     while(list($lid, $cid, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = sql_fetch_row($result, $dbi)) {
  358.     $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  359.     $title = stripslashes($title); $description = stripslashes($description);
  360.         global $prefix, $dbi, $admin;
  361.     if (is_admin($admin)) {
  362.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  363.     } else {
  364.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  365.     }
  366.     echo "<a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";
  367.     newdownloadgraphic($datetime, $time);
  368.     popgraphic($hits);
  369.     detecteditorial($lid, $transfertitle, 1);
  370.     echo "<br><b>"._DESCRIPTION.":</b> $description<br>";
  371.     setlocale ("LC_TIME", "$locale");
  372.     /* INSERT code for *editor review* here */
  373.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  374.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  375.     $datetime = ucfirst($datetime);
  376.     echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  377.     echo "<b>"._ADDEDON.":</b> <b>$datetime</b> <b>"._UDOWNLOADS.":</b> $hits";
  378.         $transfertitle = str_replace (" ", "_", $title);
  379.         /* voting & comments stats */
  380.         if ($totalvotes == 1) {
  381.         $votestring = _VOTE;
  382.         } else {
  383.         $votestring = _VOTES;
  384.     }
  385.         if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  386.         echo " <b>"._RATING.":</b> $downloadratingsummary ($totalvotes $votestring)";
  387.     }
  388.         if ($homepage == "") {
  389.         echo "<br>";
  390.     } else {
  391.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  392.     }
  393.     echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  394.         echo " | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a>";
  395.     echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  396.     
  397.         if ($totalcomments != 0) {
  398.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle\">"._SCOMMENTS." ($totalcomments)</a>";
  399.     }
  400.     detecteditorial($lid, $transfertitle, 0);
  401.     echo "<br>";
  402.     $result2=sql_query("select title from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  403.     list($ctitle) = sql_fetch_row($result2, $dbi);
  404.     $ctitle=getparent($cid,$ctitle);
  405.     echo ""._CATEGORY.": $ctitle";
  406.     echo "<br><br>";
  407.     }
  408.     echo "</font></td></tr></table>";
  409.     CloseTable();    
  410.     include("footer.php");
  411. }
  412.  
  413. function TopRated($ratenum, $ratetype) {            
  414.     global $prefix, $dbi, $admin, $module_name;
  415.     include("header.php");
  416.     include("modules/$module_name/d_config.php");
  417.     menu(1);
  418.     echo "<br>";
  419.     OpenTable();
  420.     echo "<table border=\"0\" width=\"100%\"><tr><td align=\"center\">";
  421.     if ($ratenum != "" && $ratetype != "") {
  422.         $topdownloads = $ratenum;
  423.         if ($ratetype == "percent") {
  424.         $topdownloadspercentrigger = 1;
  425.     }
  426.     }
  427.     if ($topdownloadspercentrigger == 1) {
  428.         $topdownloadspercent = $topdownloads;
  429.         $result = sql_query("select * from ".$prefix."_downloads_downloads where downloadratingsummary != 0", $dbi);
  430.         $totalrateddownloads = sql_num_rows($result, $dbi);
  431.         $topdownloads = $topdownloads / 100;
  432.         $topdownloads = $totalrateddownloads * $topdownloads;
  433.         $topdownloads = round($topdownloads);
  434.     }
  435.     if ($topdownloadspercentrigger == 1) { 
  436.     echo "<center><font class=\"option\"><b>"._DBESTRATED." $topdownloadspercent% ("._OF." $totalrateddownloads "._TRATEDDOWNLOADS.")</b></font></center><br>";
  437.     } else {
  438.     echo "<center><font class=\"option\"><b>"._DBESTRATED." $topdownloads </b></font></center><br>";
  439.     }
  440.     echo "</td></tr>"
  441.     ."<tr><td><center>"._NOTE." $downloadvotemin "._TVOTESREQ."<br>"
  442.     .""._SHOWTOP.":  [ <a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=10&ratetype=num\">10</a> - "
  443.     ."<a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=25&ratetype=num\">25</a> - "
  444.         ."<a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=50&ratetype=num\">50</a> | "
  445.         ."<a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=1&ratetype=percent\">1%</a> - "
  446.         ."<a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=5&ratetype=percent\">5%</a> - "
  447.         ."<a href=\"modules.php?name=$module_name&d_op=TopRated&ratenum=10&ratetype=percent\">10%</a> ]</center><br><br></td></tr>";
  448.     $result = sql_query("select lid, cid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads where downloadratingsummary != 0 and totalvotes >= $downloadvotemin order by downloadratingsummary DESC limit 0,$topdownloads ", $dbi);
  449.     echo "<tr><td>";
  450.     while(list($lid, $cid, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = sql_fetch_row($result, $dbi)) {
  451.     $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  452.     $title = stripslashes($title);
  453.     $description = stripslashes($description);
  454.         global $prefix, $dbi, $admin;
  455.     if (is_admin($admin)) {
  456.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  457.     } else {
  458.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  459.     }
  460.         echo "<a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";
  461.     newdownloadgraphic($datetime, $time);
  462.     popgraphic($hits);
  463.     detecteditorial($lid, $transfertitle, 1);
  464.     echo "<br>";
  465.     echo "<b>"._DESCRIPTION.":</b> $description<br>";
  466.     setlocale ("LC_TIME", "$locale");
  467.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  468.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  469.     $datetime = ucfirst($datetime);
  470.     echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  471.     echo "<b>"._ADDEDON.":</b> $datetime <b>"._UDOWNLOADS.":</b> $hits";
  472.     $transfertitle = str_replace (" ", "_", $title);
  473.     /* voting & comments stats */
  474.         if ($totalvotes == 1) {
  475.         $votestring = _VOTE;
  476.         } else {
  477.         $votestring = _VOTES;
  478.     }
  479.     if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  480.         echo " <b>"._RATING.":</b> <b>$downloadratingsummary</b> ($totalvotes $votestring)";
  481.     }
  482.         if ($homepage == "") {
  483.         echo "<br>";
  484.     } else {
  485.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  486.     }
  487.     echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  488.     echo " | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a>";
  489.     echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  490.     if ($totalcomments != 0) {
  491.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle\">"._SCOMMENTS." ($totalcomments)</a>";
  492.     }
  493.     detecteditorial($lid, $transfertitle, 0);
  494.     echo "<br>";
  495.     $result2=sql_query("select title from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  496.     list($ctitle) = sql_fetch_row($result2, $dbi);
  497.     $ctitle=getparent($cid,$ctitle);
  498.     echo ""._CATEGORY.": $ctitle";
  499.     echo "<br><br>";
  500.     }
  501.     echo "</font></td></tr></table>";
  502.     CloseTable();
  503.     include("footer.php");
  504. }
  505.  
  506. function MostPopular($ratenum, $ratetype) {
  507.     global $prefix, $dbi, $admin, $module_name;
  508.     include("header.php");
  509.     include("modules/$module_name/d_config.php");
  510.     menu(1);
  511.     echo "<br>";
  512.     OpenTable(); 
  513.     echo "<table border=\"0\" width=\"100%\"><tr><td align=\"center\">";
  514.     if ($ratenum != "" && $ratetype != "") {
  515.         $mostpopdownloads = $ratenum;
  516.         if ($ratetype == "percent") $mostpopdownloadspercentrigger = 1;
  517.     }
  518.     if ($mostpopdownloadspercentrigger == 1) {
  519.         $topdownloadspercent = $mostpopdownloads;
  520.         $result = sql_query("select * from ".$prefix."_downloads_downloads", $dbi);
  521.         $totalmostpopdownloads = sql_num_rows($result, $dbi);
  522.         $mostpopdownloads = $mostpopdownloads / 100;
  523.         $mostpopdownloads = $totalmostpopdownloads * $mostpopdownloads;
  524.         $mostpopdownloads = round($mostpopdownloads);
  525.     }    
  526.     if ($mostpopdownloadspercentrigger == 1) {
  527.     echo "<center><font class=\"option\"><b>"._MOSTPOPULAR." $topdownloadspercent% ("._OFALL." $totalmostpopdownloads "._DOWNLOADS.")</b></font></center>";
  528.     } else {
  529.     echo "<center><font class=\"option\"><b>"._MOSTPOPULAR." $mostpopdownloads</b></font></center>";
  530.     }
  531.     echo "<tr><td><center>"._SHOWTOP.": [ <a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=10&ratetype=num\">10</a> - "
  532.     ."<a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=25&ratetype=num\">25</a> - "
  533.         ."<a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=50&ratetype=num\">50</a> | "
  534.         ."<a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=1&ratetype=percent\">1%</a> - "
  535.         ."<a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=5&ratetype=percent\">5%</a> - "
  536.         ."<a href=\"modules.php?name=$module_name&d_op=MostPopular&ratenum=10&ratetype=percent\">10%</a> ]</center><br><br></td></tr>";
  537.     $result = sql_query("select lid, cid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads order by hits DESC limit 0,$mostpopdownloads ", $dbi);
  538.     echo "<tr><td>";
  539.     while(list($lid, $cid, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = sql_fetch_row($result, $dbi)) {
  540.     $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  541.     $title = stripslashes($title);
  542.     $description = stripslashes($description);
  543.         global $prefix, $dbi, $admin;
  544.     if (is_admin($admin)) {
  545.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  546.     } else {
  547.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  548.     }
  549.         echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";
  550.     newdownloadgraphic($datetime, $time);
  551.     popgraphic($hits);
  552.     detecteditorial($lid, $transfertitle, 1);
  553.     echo "<br>";
  554.     echo "<b>"._DESCRIPTION.":</b> $description<br>";
  555.     setlocale ("LC_TIME", "$locale");
  556.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  557.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  558.     $datetime = ucfirst($datetime);
  559.     echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  560.     echo "<b>"._ADDEDON.":</b> $datetime <b>"._UDOWNLOADS.":</b> <b>$hits</b>";
  561.     $transfertitle = str_replace (" ", "_", $title);
  562.     /* voting & comments stats */
  563.         if ($totalvotes == 1) {
  564.         $votestring = _VOTE;
  565.         } else {
  566.         $votestring = _VOTES;
  567.     }
  568.     if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  569.         echo " <b>"._RATING.":</b> $downloadratingsummary ($totalvotes $votestring)";
  570.     }
  571.         if ($homepage == "") {
  572.         echo "<br>";
  573.     } else {
  574.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  575.     }
  576.     echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  577.     echo " | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a>";
  578.     echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  579.     if ($totalcomments != 0) {
  580.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle\">"._SCOMMENTS." ($totalcomments)</a>";
  581.     }
  582.     detecteditorial($lid, $transfertitle, 0);
  583.     echo "<br>";
  584.     $result2=sql_query("select title from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  585.     list($ctitle) = sql_fetch_row($result2, $dbi);
  586.     $ctitle=getparent($cid,$ctitle);
  587.     echo ""._CATEGORY.": $ctitle";
  588.     echo "<br><br>";
  589.     }
  590.     echo "</font></td></tr></table>";
  591.     CloseTable();
  592.     include("footer.php");
  593. }
  594.  
  595. function viewdownload($cid, $min, $orderby, $show) {
  596.     global $prefix, $dbi, $admin, $perpage, $module_name;
  597.     include("header.php");
  598.     if (!isset($min)) $min=0;
  599.     if (!isset($max)) $max=$min+$perpage;
  600.     if(isset($orderby)) {
  601.     $orderby = convertorderbyin($orderby);
  602.     } else {
  603.     $orderby = "title ASC";
  604.     }
  605.     if ($show!="") {
  606.     $perpage = $show;
  607.     } else {
  608.     $show=$perpage;
  609.     }
  610.     menu(1);
  611.     echo "<br>";
  612.     OpenTable();
  613.     $result = sql_query("select title,parentid from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  614.     list($title,$parentid)=sql_fetch_row($result, $dbi);
  615.     $title=getparentlink($parentid,$title);
  616.     $title="<a href=modules.php?name=$module_name>"._MAIN."</a>/$title";
  617.     echo "<center><font class=\"option\"><b>"._CATEGORY.": $title</b></font></center><br>";
  618.     echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
  619.     $result2 = sql_query("select cid, title, cdescription from ".$prefix."_downloads_categories where parentid=$cid order by title", $dbi);
  620.     $count = 0;
  621.     while(list($cid2, $title2, $cdescription2) = sql_fetch_row($result2, $dbi)) {
  622.         $cresult = sql_query("select * from ".$prefix."_downloads_downloads where cid=$cid2", $dbi);
  623.         $cnumrows = sql_num_rows($cresult, $dbi);
  624.     echo "<td><font class=\"option\"><strong><big>â•–</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid2\"><b>$title2</b></a></font> ($cnumrows)";
  625.     categorynewdownloadgraphic($cid2);
  626.     if ($cdescription2) {
  627.         echo "<font class=\"content\">$cdescription2</font><br>";
  628.     } else {
  629.         echo "<br>";
  630.     }
  631.     $result3 = sql_query("select cid, title from ".$prefix."_downloads_categories where parentid=$cid2 order by title limit 0,3", $dbi);
  632.     $space = 0;
  633.     while(list($cid3, $title3) = sql_fetch_row($result3, $dbi)) {
  634.             if ($space>0) {
  635.         echo ", ";
  636.         }
  637.             $cresult2 = sql_query("select * from ".$prefix."_downloads_downloads where cid=$cid3", $dbi);
  638.             $cnumrows2 = sql_num_rows($cresult2, $dbi);
  639.         echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid3\">$title3</a> ($cnumrows2)</font>";
  640.         $space++;
  641.     }
  642.     if ($count<1) {
  643.         echo "</td><td>    </td>";
  644.         $dum = 1;
  645.     }
  646.     $count++;
  647.     if ($count==2) {
  648.         echo "</td></tr><tr>";
  649.         $count = 0;
  650.         $dum = 0;
  651.     }
  652.     }
  653.     if ($dum == 1) {
  654.     echo "</tr></table>";
  655.     } elseif ($dum == 0) {
  656.     echo "<td></td></tr></table>";
  657.     }
  658.  
  659.     echo "<hr noshade size=\"1\">";
  660.     $orderbyTrans = convertorderbytrans($orderby);
  661.     echo "<center><font class=\"content\">"._SORTDOWNLOADSBY.": "
  662.         .""._TITLE." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=titleA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=titleD\">D</a>) "
  663.         .""._DATE." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=dateA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=dateD\">D</a>) "
  664.         .""._RATING." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=ratingA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=ratingD\">D</a>) "
  665.         .""._POPULARITY." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=hitsA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&orderby=hitsD\">D</a>)"
  666.     ."<br><b>"._RESSORTED.": $orderbyTrans</b></font></center><br><br>";    
  667.     $result=sql_query("select lid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads where cid=$cid order by $orderby limit $min,$perpage ", $dbi);
  668.     $fullcountresult=sql_query("select lid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments from ".$prefix."_downloads_downloads where cid=$cid", $dbi);
  669.     $totalselecteddownloads = sql_num_rows($fullcountresult, $dbi);
  670.     echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">";
  671.     $x=0;
  672.     while(list($lid, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage)=sql_fetch_row($result, $dbi)) {
  673.     $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  674.     $title = stripslashes($title);
  675.     $description = stripslashes($description);
  676.         global $prefix, $dbi, $admin;
  677.     if (is_admin($admin)) {
  678.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  679.     } else {
  680.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  681.     }
  682.         echo "<a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";    
  683.     newdownloadgraphic($datetime, $time);
  684.     popgraphic($hits);
  685.     /* INSERT code for *editor review* here */
  686.     detecteditorial($lid, $transfertitle, 1);
  687.     echo "<br>";
  688.     echo "<b>"._DESCRIPTION.":</b> $description<br>";
  689.     setlocale ("LC_TIME", "$locale");
  690.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  691.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  692.     $datetime = ucfirst($datetime);
  693.     echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  694.     echo "<b>"._ADDEDON.":</b> $datetime <b>"._UDOWNLOADS.":</b> $hits";
  695.         $transfertitle = str_replace (" ", "_", $title);
  696.         /* voting & comments stats */
  697.         if ($totalvotes == 1) {
  698.         $votestring = _VOTE;
  699.         } else {
  700.         $votestring = _VOTES;
  701.     }
  702.         if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  703.         echo " <b>"._RATING.":</b> $downloadratingsummary ($totalvotes $votestring)";
  704.     }
  705.         if ($homepage == "") {
  706.         echo "<br>";
  707.     } else {
  708.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  709.     }
  710.     echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  711.         echo " | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a>";
  712.     echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  713.         if ($totalcomments != 0) {
  714.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle\">"._SCOMMENTS." ($totalcomments)</a>";
  715.     }
  716.         detecteditorial($lid, $transfertitle, 0);
  717.     echo "<br><br>";    
  718.     $x++;
  719.     }
  720.     echo "</font>";
  721.     $orderby = convertorderbyout($orderby);
  722.     /* Calculates how many pages exist. Which page one should be on, etc... */
  723.     $downloadpagesint = ($totalselecteddownloads / $perpage);            
  724.     $downloadpageremainder = ($totalselecteddownloads % $perpage);        
  725.     if ($downloadpageremainder != 0) {                     
  726.         $downloadpages = ceil($downloadpagesint);                
  727.         if ($totalselecteddownloads < $perpage) {
  728.             $downloadpageremainder = 0;
  729.         }
  730.     } else {
  731.         $downloadpages = $downloadpagesint;
  732.     }
  733.     /* Page Numbering */
  734.     if ($downloadpages!=1 && $downloadpages!=0) {
  735.         echo "<br><br>";
  736.           echo ""._SELECTPAGE.": ";
  737.          $prev=$min-$perpage;
  738.          if ($prev>=0) {
  739.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&min=$prev&orderby=$orderby&show=$show\">";
  740.             echo " << "._PREVIOUS."</a> ]</b> ";
  741.       }            
  742.         $counter = 1;
  743.      $currentpage = ($max / $perpage);
  744.            while ($counter<=$downloadpages ) {
  745.               $cpage = $counter;
  746.               $mintemp = ($perpage * $counter) - $perpage;
  747.               if ($counter == $currentpage) {
  748.         echo "<b>$counter</b> ";
  749.         } else {
  750.         echo "<a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&min=$mintemp&orderby=$orderby&show=$show\">$counter</a> ";
  751.         }
  752.                $counter++;
  753.            }          
  754.          $next=$min+$perpage;
  755.          if ($x>=$perpage) {
  756.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid&min=$max&orderby=$orderby&show=$show\">";
  757.             echo " "._NEXT." >></a> ]</b> ";
  758.          }
  759.     }
  760.     echo "</td></tr></table>";
  761.     CloseTable();
  762.     include("footer.php");
  763. }
  764.  
  765. function viewsdownload($sid, $min, $orderby, $show) {
  766.     global $prefix, $dbi, $admin, $module_name;
  767.     include("modules/$module_name/d_config.php");
  768.     include("header.php");
  769.     menu(1);
  770.     if (!isset($min)) $min=0;
  771.     if (!isset($max)) $max=$min+$perpage;
  772.     if(isset($orderby)) {
  773.     $orderby = convertorderbyin($orderby);
  774.     } else { 
  775.     $orderby = "title ASC";
  776.     }
  777.     if ($show!="") {
  778.     $perpage = $show;
  779.     } else {
  780.     $show=$perpage;
  781.     }
  782.     echo "<br>";
  783.     OpenTable();
  784.     $result = sql_query("select title,parentid from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  785.     list($title,$parentid)=sql_fetch_row($result, $dbi);
  786.     $title=getparentlink($parentid,$title);
  787.     $title="<a href=modules.php?name=$module_name>"._MAIN."</a>/$title";
  788.     echo "<center><font class=\"option\"><b>"._CATEGORY.": $title</b></font></center><br>";
  789.     echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>";
  790.     $result2 = sql_query("select cid, title, cdescription from ".$prefix."_downloads_categories where parentid=$cid order by title", $dbi);
  791.     $count = 0;
  792.     while(list($cid2, $title2, $cdescription2) = sql_fetch_row($result2, $dbi)) {
  793.     echo "<td><font class=\"option\"><strong><big>â•–</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid2\"><b>$title2</b></a></font>";
  794.     categorynewdownloadgraphic($cid2);
  795.     if ($cdescription2) {
  796.         echo "<font class=\"content\">$cdescription2</font><br>";
  797.     } else {
  798.         echo "<br>";
  799.     }
  800.     $result3 = sql_query("select cid, title from ".$prefix."_downloads_categories where parentid=$cid2 order by title limit 0,3", $dbi);
  801.     $space = 0;
  802.     while(list($cid3, $title3) = sql_fetch_row($result3, $dbi)) {
  803.             if ($space>0) {
  804.         echo ", ";
  805.         }
  806.         echo "<font class=\"content\"><a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid3\">$title3</a></font>";
  807.         $space++;
  808.     }
  809.     if ($count<1) {
  810.         echo "</td><td>    </td>";
  811.         $dum = 1;
  812.     }
  813.     $count++;
  814.     if ($count==2) {
  815.         echo "</td></tr><tr>";
  816.         $count = 0;
  817.         $dum = 0;
  818.     }
  819.     }
  820.     if ($dum == 1) {
  821.     echo "</tr></table>";
  822.     } elseif ($dum == 0) {
  823.     echo "<td></td></tr></table>";
  824.     }
  825.  
  826.     echo "<hr noshade size=\"1\">";
  827.     $orderbyTrans = convertorderbytrans($orderby);
  828.     echo "<br><center><font class=\"content\">"._SORTDOWNLOADSBY.": "
  829.     .""._TITLE." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=titleA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=titleD\">D</a>)"
  830.     ." "._DATE." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=dateA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=dateD\">D</a>)"
  831.     ." "._RATING." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=ratingA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=ratingD\">D</a>)"
  832.         ." "._POPULARITY." (<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=hitsA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&orderby=hitsD\">D</a>)"
  833.     ."<br><b>"._RESSORTED.": $orderbyTrans</b></font></center><br><br>";
  834.     $result=sql_query("select lid, url, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads where sid=$sid order by $orderby limit $min,$perpage", $dbi);
  835.     $fullcountresult=sql_query("select lid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments from ".$prefix."_downloads_downloads where sid=$sid", $dbi);
  836.     $totalselecteddownloads = sql_num_rows($fullcountresult, $dbi);
  837.     echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">";
  838.     $x=0;
  839.     while(list($lid, $url, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage)=sql_fetch_row($result, $dbi)) {
  840.     $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  841.     $title = stripslashes($title); $description = stripslashes($description);
  842.         global $prefix, $dbi, $admin;
  843.     if (is_admin($admin)) {
  844.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  845.     } else {
  846.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  847.     }
  848.         echo "<a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";
  849.     newdownloadgraphic($datetime, $time);
  850.     popgraphic($hits);
  851.         /* code for *editor review* insert here    */
  852.     detecteditorial($lid, $transfertitle, 1);
  853.     echo "<br><b>"._DESCRIPTION.":</b> $description<br>";
  854.     setlocale ("LC_TIME", "$locale");
  855.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  856.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  857.     $datetime = ucfirst($datetime);
  858.     echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  859.     echo "<b>"._ADDEDON.":</b> $datetime <b>"._UDOWNLOADS.":</b> $hits";
  860.         $transfertitle = str_replace (" ", "_", $title);
  861.         /* voting & comments stats */
  862.         if ($totalvotes == 1) {
  863.         $votestring = _VOTE;
  864.     } else {
  865.         $votestring = _VOTES;
  866.     }
  867.         if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  868.         echo " <b>"._RATING.":</b> $downloadratingsummary ($totalvotes $votestring)";
  869.         }
  870.         if ($homepage == "") {
  871.         echo "<br>";
  872.     } else {
  873.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  874.     }
  875.     echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  876.     echo " | <a href=\"modules.php?name=$module_name&d_op=brokendownload&lid=$lid\">"._REPORTBROKEN."</a>";
  877.     echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  878.         if ($totalcomments != 0) {
  879.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle\">"._SCOMMENTS." ($totalcomments)</a>";
  880.     }
  881.     detecteditorial($lid, $transfertitle, 0);
  882.     echo "<br><br>";
  883.     $x++;
  884.     }
  885.     echo "</font>";
  886.     $orderby = convertorderbyout($orderby);
  887.     /* Calculates how many pages exist.  Which page one should be on, etc... */
  888.     $downloadpagesint = ($totalselecteddownloads / $perpage);            
  889.     $downloadpageremainder = ($totalselecteddownloads % $perpage);        
  890.     if ($downloadpageremainder != 0) {                     
  891.     $downloadpages = ceil($downloadpagesint);                
  892.         if ($totalselecteddownloads < $perpage) {
  893.             $downloadpageremainder = 0;
  894.         }
  895.     } else {
  896.         $downloadpages = $downloadpagesint;
  897.     }        
  898.     /* Page Numbering */
  899.     if ($downloadpages!=1 && $downloadpages!=0) {
  900.     echo "<br><br>"
  901.             .""._SELECTPAGE.": ";
  902.         $prev=$min-$perpage;
  903.         if ($prev>=0) {
  904.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&min=$prev&orderby=$orderby&show=$show\">"
  905.             ." << "._PREVIOUS."</a> ]</b> ";
  906.           }     
  907.         $counter = 1;
  908.         $currentpage = ($max / $perpage);
  909.         while ($counter<=$downloadpages ) {
  910.             $cpage = $counter;
  911.             $mintemp = ($perpage * $counter) - $perpage;
  912.             if ($counter == $currentpage) {
  913.         echo "<b>$counter</b> ";
  914.         } else {
  915.         echo "<a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&min=$mintemp&orderby=$orderby&show=$show\">$counter</a> ";
  916.         }
  917.             $counter++;     
  918.         }        
  919.         $next=$min+$perpage;
  920.         if ($x>=$perpage) {
  921.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=viewdownload&sid=$sid&min=$max&orderby=$orderby&show=$show\">"
  922.             ." "._NEXT." >></a> ]</b> ";
  923.         }
  924.     }
  925.     echo "</td></tr></table>";
  926.     CloseTable();
  927.     include("footer.php");
  928. }
  929.  
  930. function newdownloadgraphic($datetime, $time) {
  931.     global $module_name;
  932.     echo " ";
  933.     setlocale ("LC_TIME", "$locale");
  934.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);  
  935.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  936.     $datetime = ucfirst($datetime);           
  937.     $startdate = time();
  938.     $count = 0;
  939.     while ($count <= 7) {
  940.     $daysold = date("d-M-Y", $startdate);
  941.         if ("$daysold" == "$datetime") {
  942.             if ($count<=1) {
  943.         echo "<img src=\"modules/$module_name/images/new_1.gif\" alt=\""._NEWTODAY."\">";
  944.         }
  945.             if ($count<=3 && $count>1) {
  946.         echo "<img src=\"modules/$module_name/images/new_3.gif\" alt=\""._NEWLAST3DAYS."\">";
  947.         }
  948.             if ($count<=7 && $count>3) {
  949.         echo "<img src=\"modules/$module_name/images/new_7.gif\" alt=\""._NEWTHISWEEK."\">";
  950.         }
  951.     }
  952.         $count++;
  953.         $startdate = (time()-(86400 * $count));
  954.     }
  955. }
  956.  
  957. function categorynewdownloadgraphic($cat) {
  958.     global $prefix, $dbi, $module_name;
  959.     $newresult = sql_query("select date from ".$prefix."_downloads_downloads where cid=$cat order by date desc limit 1", $dbi);
  960.     list($time)=sql_fetch_row($newresult, $dbi);
  961.     echo " ";
  962.     setlocale ("LC_TIME", "$locale");
  963.     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);  
  964.     $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  965.     $datetime = ucfirst($datetime);           
  966.     $startdate = time();
  967.     $count = 0;
  968.     while ($count <= 7) {
  969.     $daysold = date("d-M-Y", $startdate);
  970.         if ("$daysold" == "$datetime") {
  971.             if ($count<=1) {
  972.         echo "<img src=\"modules/$module_name/images/new_1.gif\" alt=\""._DCATNEWTODAY."\">";
  973.         }
  974.             if ($count<=3 && $count>1) {
  975.         echo "<img src=\"modules/$module_name/images/new_3.gif\" alt=\""._DCATLAST3DAYS."\">";
  976.         }
  977.             if ($count<=7 && $count>3) {
  978.         echo "<img src=\"modules/$module_name/images/new_7.gif\" alt=\""._DCATTHISWEEK."\">";
  979.         }
  980.     }
  981.         $count++;
  982.         $startdate = (time()-(86400 * $count));
  983.     }
  984. }
  985.  
  986. function popgraphic($hits) {
  987.     global $module_name;
  988.     include("modules/$module_name/d_config.php");
  989.     if ($hits>=$popular) {
  990.     echo " <img src=\"modules/$module_name/images/popular.gif\" alt=\""._POPULAR."\">";
  991.     }
  992. }
  993.  
  994. function convertorderbyin($orderby) {
  995.     if ($orderby == "titleA")    $orderby = "title ASC"; 
  996.     if ($orderby == "dateA")    $orderby = "date ASC";
  997.     if ($orderby == "hitsA")    $orderby = "hits ASC";
  998.     if ($orderby == "ratingA")    $orderby = "downloadratingsummary ASC";
  999.     if ($orderby == "titleD")    $orderby = "title DESC"; 
  1000.     if ($orderby == "dateD")    $orderby = "date DESC";
  1001.     if ($orderby == "hitsD")    $orderby = "hits DESC";
  1002.     if ($orderby == "ratingD")    $orderby = "downloadratingsummary DESC";
  1003.     return $orderby;
  1004. }
  1005.  
  1006. function convertorderbytrans($orderby) {
  1007.     if ($orderby == "hits ASC")            $orderbyTrans = ""._POPULARITY1."";
  1008.     if ($orderby == "hits DESC")        $orderbyTrans = ""._POPULARITY2."";
  1009.     if ($orderby == "title ASC")        $orderbyTrans = ""._TITLEAZ."";
  1010.     if ($orderby == "title DESC")        $orderbyTrans = ""._TITLEZA."";
  1011.     if ($orderby == "date ASC")            $orderbyTrans = ""._DDATE1."";
  1012.     if ($orderby == "date DESC")        $orderbyTrans = ""._DDATE2."";
  1013.     if ($orderby == "downloadratingsummary ASC")    $orderbyTrans = ""._RATING1."";
  1014.     if ($orderby == "downloadratingsummary DESC")    $orderbyTrans = ""._RATING2."";
  1015.     return $orderbyTrans;
  1016. }
  1017.  
  1018. function convertorderbyout($orderby) {
  1019.     if ($orderby == "title ASC")        $orderby = "titleA";
  1020.     if ($orderby == "date ASC")            $orderby = "dateA";
  1021.     if ($orderby == "hits ASC")            $orderby = "hitsA";
  1022.     if ($orderby == "downloadratingsummary ASC")    $orderby = "ratingA";
  1023.     if ($orderby == "title DESC")        $orderby = "titleD";
  1024.     if ($orderby == "date DESC")        $orderby = "dateD";
  1025.     if ($orderby == "hits DESC")        $orderby = "hitsD";
  1026.     if ($orderby == "downloadratingsummary DESC")    $orderby = "ratingD";
  1027.     return $orderby;
  1028. }
  1029.  
  1030. function getit($lid) {
  1031.     global $prefix, $dbi;
  1032.     sql_query("update ".$prefix."_downloads_downloads set hits=hits+1 where lid=$lid", $dbi);
  1033.     $result = sql_query("select url from ".$prefix."_downloads_downloads where lid=$lid", $dbi);
  1034.     list($url) = sql_fetch_row($result, $dbi);
  1035.     Header("Location: $url");
  1036. }
  1037.  
  1038. function search($query, $min, $orderby, $show) {
  1039.     global $prefix, $dbi, $admin, $bgcolor2, $module_name;
  1040.     include("modules/$module_name/d_config.php");
  1041.     if (!isset($min)) $min=0;
  1042.     if (!isset($max)) $max=$min+$downloadsresults;
  1043.     if(isset($orderby)) {
  1044.     $orderby = convertorderbyin($orderby);
  1045.     } else {
  1046.     $orderby = "title ASC";
  1047.     }
  1048.     if ($show!="") {
  1049.     $downloadsresults = $show;
  1050.     } else {
  1051.     $show=$downloadsresults;     
  1052.     }
  1053.     $query = addslashes($query);
  1054.     $result = sql_query("select lid, cid, title, url, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage from ".$prefix."_downloads_downloads where title LIKE '%$query%' OR description LIKE '%$query%' ORDER BY $orderby LIMIT $min,$downloadsresults", $dbi);
  1055.     $fullcountresult = sql_query("select lid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments from ".$prefix."_downloads_downloads where title LIKE '%$query%' OR description LIKE '%$query%' ", $dbi);
  1056.     $totalselecteddownloads = sql_num_rows($fullcountresult, $dbi);
  1057.     $nrows  = sql_num_rows($result, $dbi);
  1058.     $x=0;
  1059.     $the_query = stripslashes($query);
  1060.     $the_query = str_replace("\'", "'", $the_query);
  1061.     include("header.php");
  1062.     menu(1);
  1063.     echo "<br>";
  1064.     OpenTable();
  1065.     if ($query != "") {
  1066.         if ($nrows>0) {
  1067.         echo "<font class=\"option\">"._SEARCHRESULTS4.": <b>$the_query</b></font><br><br>"
  1068.             ."<table width=\"100%\" bgcolor=\"$bgcolor2\"><tr><td><font class=\"option\"><b>"._USUBCATEGORIES."</b></font></td></tr></table>";
  1069.  
  1070.         $result2 = sql_query("select cid, title from ".$prefix."_downloads_categories where title LIKE '%$query%' ORDER BY title DESC", $dbi);
  1071.         while(list($cid, $stitle) = sql_fetch_row($result2, $dbi)) {
  1072.             $res = sql_query("select * from ".$prefix."_downloads_downloads where cid=$cid", $dbi);
  1073.             $numrows = sql_num_rows($res, $dbi);
  1074.             $result3 = sql_query("select cid,title,parentid from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  1075.             list($cid3,$title3,$parentid3) = sql_fetch_row($result3, $dbi);
  1076.             if ($parentid3>0) $title3 = getparent($parentid3,$title3);
  1077.             $title3 = ereg_replace($query, "<b>$query</b>", $title3);
  1078.             echo "<strong><big>â•–</big></strong> <a href=\"modules.php?name=$module_name&d_op=viewdownload&cid=$cid\">$title3</a> ($numrows)<br>";
  1079.         }
  1080.     echo "<br><table width=\"100%\" bgcolor=\"$bgcolor2\"><tr><td><font class=\"option\"><b>"._UDOWNLOADS."</b></font></td></tr></table>";
  1081.         $orderbyTrans = convertorderbytrans($orderby);
  1082.         echo "<center><font class=\"content\">"._SORTDOWNLOADSBY.": "
  1083.             .""._TITLE." (<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=titleA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=titleD\">D</a>) "
  1084.             .""._DATE." (<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=dateA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=dateD\">D</a>) "
  1085.             .""._RATING." (<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=ratingA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=ratingD\">D</a>) "
  1086.             .""._POPULARITY." (<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=hitsA\">A</a>\<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&orderby=hitsD\">D</a>)"
  1087.             ."<br>"._RESSORTED.": $orderbyTrans</center><br><br><br>";
  1088.         while(list($lid, $cid, $title, $url, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = sql_fetch_row($result, $dbi)) {
  1089.         $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal);
  1090.         $title = stripslashes($title); $description = stripslashes($description);        
  1091.         $transfertitle = str_replace (" ", "_", $title);
  1092.         $title = ereg_replace($query, "<b>$query</b>", $title);
  1093.             global $prefix, $dbi, $admin;
  1094.         if (is_admin($admin)) {
  1095.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\""._EDIT."\"></a>  ";
  1096.         } else {
  1097.         echo "<img src=\"modules/$module_name/images/lwin.gif\" border=\"0\" alt=\"\">  ";
  1098.         }
  1099.         echo "<a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">$title</a>";
  1100.         newdownloadgraphic($datetime, $time);      
  1101.             popgraphic($hits);
  1102.         detecteditorial($lid, $transfertitle, 1);
  1103.         echo "<br>";        
  1104.         $description = ereg_replace($query, "<b>$query</b>", $description);
  1105.         echo "<b>"._DESCRIPTION.":</b> $description<br>";
  1106.         setlocale ("LC_TIME", "$locale");
  1107.         ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
  1108.         $datetime = strftime(""._LINKSDATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
  1109.         $datetime = ucfirst($datetime);
  1110.         echo "<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."<br>";
  1111.         echo "<b>"._ADDEDON.":</b> $datetime <b>"._UDOWNLOADS.":</b> $hits";
  1112.             /* voting & comments stats */
  1113.             if ($totalvotes == 1) {
  1114.         $votestring = _VOTE;
  1115.         } else {
  1116.         $votestring = _VOTES;
  1117.         }
  1118.             if ($downloadratingsummary!="0" || $downloadratingsummary!="0.0") {
  1119.         echo " <b>"._RATING.":</b> $downloadratingsummary ($totalvotes $votestring)";
  1120.         }
  1121.             if ($homepage == "") {
  1122.         echo "<br>";
  1123.         } else {
  1124.         echo "<br><a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> | ";
  1125.         }
  1126.             echo "<a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$transfertitle\">"._RATERESOURCE."</a>";
  1127.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloaddetails&lid=$lid&ttitle=$transfertitle\">"._DETAILS."</a>";
  1128.             if ($totalcomments != 0) {
  1129.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadcomments&lid=$lid&ttitle=$transfertitle>"._SCOMMENTS." ($totalcomments)</a>";
  1130.         }
  1131.         detecteditorial($lid, $transfertitle, 0);
  1132.         echo "<br>";
  1133.         $result3 = sql_query("select cid,title,parentid from ".$prefix."_downloads_categories where cid=$cid", $dbi);
  1134.         list($cid3,$title3,$parentid3) = sql_fetch_row($result3, $dbi);
  1135.         if ($parentid3>0) $title3 = getparent($parentid3,$title3);
  1136.         echo ""._CATEGORY.": $title3<br><br>";
  1137.         $x++;
  1138.     }
  1139.     echo "</font>";
  1140.         $orderby = convertorderbyout($orderby);
  1141.     } else {
  1142.     echo "<br><br><center><font class=\"option\"><b>"._NOMATCHES."</b></font><br><br>"._GOBACK."<br></center>";
  1143.     }
  1144.     /* Calculates how many pages exist.  Which page one should be on, etc... */
  1145.     $downloadpagesint = ($totalselecteddownloads / $downloadsresults);            
  1146.     $downloadpageremainder = ($totalselecteddownloads % $downloadsresults);        
  1147.     if ($downloadpageremainder != 0) {                     
  1148.         $downloadpages = ceil($downloadpagesint);                
  1149.         if ($totalselecteddownloads < $downloadsresults) {
  1150.             $downloadpageremainder = 0;
  1151.     }
  1152.     } else {
  1153.         $downloadpages = $downloadpagesint;
  1154.     }        
  1155.     /* Page Numbering */
  1156.     if ($downloadpages!=1 && $downloadpages!=0) {
  1157.     echo "<br><br>"
  1158.         .""._SELECTPAGE.": ";
  1159.     $prev=$min-$downloadsresults;
  1160.     if ($prev>=0) {
  1161.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&min=$prev&orderby=$orderby&show=$show\">"
  1162.             ." << "._PREVIOUS."</a> ]</b> ";
  1163.           }
  1164.     $counter = 1;
  1165.         $currentpage = ($max / $downloadsresults);
  1166.         while ($counter<=$downloadpages ) {
  1167.             $cpage = $counter;
  1168.             $mintemp = ($perpage * $counter) - $downloadsresults;
  1169.             if ($counter == $currentpage) {
  1170.         echo "<b>$counter</b> ";
  1171.         } else {
  1172.         echo "<a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&min=$mintemp&orderby=$orderby&show=$show\">$counter</a> ";
  1173.         }
  1174.             $counter++;     
  1175.         }        
  1176.         $next=$min+$downloadsresults;
  1177.         if ($x>=$perpage) {
  1178.             echo "  <b>[ <a href=\"modules.php?name=$module_name&d_op=search&query=$the_query&min=$max&orderby=$orderby&show=$show\">"
  1179.             ." "._NEXT." >></a> ]</b>";
  1180.         }
  1181.     }
  1182.     echo "<br><br><center><font class=\"content\">"
  1183.     .""._TRY2SEARCH." \"$the_query\" "._INOTHERSENGINES."<br>"
  1184.     ."<a target=\"_blank\" href=\"http://www.altavista.com/cgi-bin/query?pg=q&sc=on&hl=on&act=2006&par=0&q=$the_query&kl=XX&stype=stext\">Alta Vista</a> - "
  1185.     ."<a target=\"_blank\" href=\"http://www.hotbot.com/?MT=$the_query&DU=days&SW=web\">HotBot</a> - "
  1186.     ."<a target=\"_blank\" href=\"http://www.infoseek.com/Titles?qt=$the_query\">Infoseek</a> - "
  1187.     ."<a target=\"_blank\" href=\"http://www.dejanews.com/dnquery.xp?QRY=$the_query\">Deja News</a> - "
  1188.     ."<a target=\"_blank\" href=\"http://www.lycos.com/cgi-bin/pursuit?query=$the_query&maxhits=20\">Lycos</a> - "
  1189.     ."<a target=\"_blank\" href=\"http://search.yahoo.com/bin/search?p=$the_query\">Yahoo</a>"
  1190.     ."<br>"
  1191.     ."<a target=\"_blank\" href=\"http://es.linuxstart.com/cgi-bin/sqlsearch.cgi?pos=1&query=$the_query&language=&advanced=&urlonly=&withid=\">LinuxStart</a> - "
  1192.     ."<a target=\"_blank\" href=\"http://search.1stlinuxsearch.com/compass?scope=$the_query&ui=sr\">1stLinuxSearch</a> - "
  1193.     ."<a target=\"_blank\" href=\"http://www.google.com/search?q=$the_query\">Google</a> - "
  1194.     ."<a target=\"_blank\" href=\"http://www.linuxdownloads.com/cgi-bin/search.cgi?query=$the_query&engine=Downloads\">LinuxDownloads</a> - "
  1195.     ."<a target=\"_blank\" href=\"http://www.freshmeat.net/modules.php?name=Search&query=$the_query\">Freshmeat</a> - "
  1196.     ."<a target=\"_blank\" href=\"http://www.justlinux.com/bin/search.pl?key=$the_query\">JustLinux</a>"
  1197.     ."</font>";
  1198.     } else {
  1199.     echo "<center><font class=\"option\"><b>"._NOMATCHES."</b></font></center><br><br>";
  1200.     }
  1201.     CloseTable();
  1202.     include("footer.php");
  1203. }
  1204.  
  1205. function viewdownloadeditorial($lid, $ttitle) {
  1206.     global $prefix, $dbi, $admin, $module_name;
  1207.     include("header.php");
  1208.     include("modules/$module_name/d_config.php");
  1209.     menu(1);
  1210.  
  1211.     $result=sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle FROM ".$prefix."_downloads_editorials WHERE downloadid = $lid", $dbi);
  1212.     $recordexist = sql_num_rows($result, $dbi);
  1213.     
  1214.     $transfertitle = ereg_replace ("_", " ", $ttitle);
  1215.     $displaytitle = $transfertitle;
  1216.     echo "<br>";
  1217.     OpenTable();
  1218.     echo "<center><font class=\"option\"><b>"._DOWNLOADPROFILE.": $displaytitle</b></font><br>";
  1219.     downloadinfomenu($lid, $ttitle); 
  1220.     if ($recordexist != 0) {     
  1221.     while(list($adminid, $editorialtimestamp, $editorialtext, $editorialtitle)=sql_fetch_row($result, $dbi)) {
  1222.             $editorialtitle = stripslashes($editorialtitle); $editorialtext = stripslashes($editorialtext);
  1223.             ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $editorialtimestamp, $editorialtime);
  1224.         $editorialtime = strftime("%F",mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]));
  1225.         $date_array = explode("-", $editorialtime); 
  1226.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  1227.                $formatted_date = date("F j, Y", $timestamp);
  1228.         echo "<br><br>";
  1229.            OpenTable2();
  1230.         echo "<center><font class=\"option\"><b>'$editorialtitle'</b></font></center>"
  1231.         ."<center><font class=\"tiny\">"._EDITORIALBY." $adminid - $formatted_date</font></center><br><br>"
  1232.         ."$editorialtext";
  1233.         CloseTable2();
  1234.         }
  1235.     } else {
  1236.         echo "<br><br><center><font class=\"option\"><b>"._NOEDITORIAL."</b></font></center>";
  1237.     }
  1238.     echo "<br><br><center>";
  1239.     downloadfooter($lid,$ttitle);
  1240.     echo "</center>";
  1241.     CloseTable();
  1242.     include("footer.php");
  1243. }
  1244.  
  1245. function detecteditorial($lid, $ttitle, $img) {
  1246.     global $prefix, $dbi, $module_name;
  1247.     $resulted2 = sql_query("select adminid from ".$prefix."_downloads_editorials where downloadid=$lid", $dbi);
  1248.     $recordexist = sql_num_rows($resulted2, $dbi);
  1249.     if ($recordexist != 0) {
  1250.     if ($img == 1) {
  1251.         echo "  <a href=\"modules.php?name=$module_name&d_op=viewdownloadeditorial&lid=$lid&ttitle=$ttitle\"><img src=\"modules/$module_name/images/cool.gif\" alt=\""._EDITORIAL."\" border=\"0\"></a>";
  1252.     } else {
  1253.         echo " | <a href=\"modules.php?name=$module_name&d_op=viewdownloadeditorial&lid=$lid&ttitle=$ttitle\">"._EDITORIAL."</a>";
  1254.     }
  1255.     }
  1256. }
  1257.  
  1258. function viewdownloadcomments($lid, $ttitle) {
  1259.     global $prefix, $dbi, $admin, $bgcolor2, $module_name;
  1260.     include("header.php");
  1261.     include("modules/$module_name/d_config.php");
  1262.     menu(1);
  1263.     echo "<br>";
  1264.     $result=sql_query("SELECT ratinguser, rating, ratingcomments, ratingtimestamp FROM ".$prefix."_downloads_votedata WHERE ratinglid = $lid AND ratingcomments != '' ORDER BY ratingtimestamp DESC", $dbi);
  1265.     $totalcomments = sql_num_rows($result, $dbi);
  1266.     $transfertitle = ereg_replace ("_", " ", $ttitle);
  1267.     $displaytitle = $transfertitle;
  1268.     OpenTable();
  1269.     echo "<center><font class=\"option\"><b>"._DOWNLOADPROFILE.": $displaytitle</b></font><br><br>";
  1270.     downloadinfomenu($lid, $ttitle); 
  1271.     echo "<br><br><br>"._TOTALOF." $totalcomments "._COMMENTS."</font></center><br>"
  1272.     ."<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"450\">";
  1273.     $x=0;
  1274.     while(list($ratinguser, $rating, $ratingcomments, $ratingtimestamp)=sql_fetch_row($result, $dbi)) {
  1275.         $ratingcomments = stripslashes($ratingcomments);
  1276.         ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
  1277.     $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
  1278.     $date_array = explode("-", $ratingtime); 
  1279.     $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  1280.         $formatted_date = date("F j, Y", $timestamp); 
  1281.     /* Individual user information */
  1282.     $result2=sql_query("SELECT rating FROM ".$prefix."_downloads_votedata WHERE ratinguser = '$ratinguser'", $dbi);
  1283.         $usertotalcomments = sql_num_rows($result2, $dbi);
  1284.         $useravgrating = 0;
  1285.         while(list($rating2)=sql_fetch_row($result2, $dbi))    $useravgrating = $useravgrating + $rating2;
  1286.         $useravgrating = $useravgrating / $usertotalcomments;
  1287.         $useravgrating = number_format($useravgrating, 1);
  1288.         echo "<tr><td bgcolor=\"$bgcolor2\">"
  1289.             ."<font class=\"content\"><b> "._USER.": </b><a href=\"$nukeurl/modules.php?name=Your_Account&op=userinfo&uname=$ratinguser\">$ratinguser</a></font>"
  1290.         ."</td>"
  1291.         ."<td bgcolor=\"$bgcolor2\">"
  1292.         ."<font class=\"content\"><b>"._RATING.": </b>$rating</font>"
  1293.         ."</td>"
  1294.         ."<td bgcolor=\"$bgcolor2\" align=\"right\">"
  1295.             ."<font class=\"content\">$formatted_date</font>"
  1296.         ."</td>"
  1297.         ."</tr>"
  1298.         ."<tr>"
  1299.         ."<td valign=\"top\">"
  1300.         ."<font class=\"tiny\">"._USERAVGRATING.": $useravgrating</font>"
  1301.         ."</td>"
  1302.         ."<td valign=\"top\" colspan=\"2\">"
  1303.         ."<font class=\"tiny\">"._NUMRATINGS.": $usertotalcomments</font>"
  1304.         ."</td>"
  1305.         ."</tr>"
  1306.             ."<tr>"
  1307.         ."<td colspan=\"3\">"
  1308.         ."<font class=\"content\">";
  1309.         if (is_admin($admin)) {
  1310.         echo "<a href=\"admin.php?op=DownloadsModDownload&lid=$lid\"><img src=\"modules/$module_name/images/editicon.gif\" border=\"0\" alt=\""._EDITTHISDOWNLOAD."\"></a>";
  1311.         }    
  1312.     echo " $ratingcomments</font>"
  1313.         ."<br><br><br></td></tr>";        
  1314.     $x++;
  1315.     }
  1316.     echo "</table><br><br><center>";
  1317.     downloadfooter($lid,$ttitle);
  1318.     echo "</center>";
  1319.     CloseTable();
  1320.     include("footer.php");
  1321. }
  1322.  
  1323. function viewdownloaddetails($lid, $ttitle) {
  1324.     global $prefix, $dbi, $admin, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $module_name;
  1325.     include("header.php");
  1326.     include("modules/$module_name/d_config.php");
  1327.     menu(1);
  1328.     $voteresult = sql_query("select rating, ratinguser, ratingcomments FROM ".$prefix."_downloads_votedata WHERE ratinglid = $lid", $dbi);
  1329.     $totalvotesDB = sql_num_rows($voteresult, $dbi);
  1330.     $anonvotes = 0;
  1331.     $anonvoteval = 0;
  1332.     $outsidevotes = 0;
  1333.     $outsidevoteeval = 0;
  1334.     $regvoteval = 0;    
  1335.     $topanon = 0;
  1336.     $bottomanon = 11;
  1337.     $topreg = 0;
  1338.     $bottomreg = 11;
  1339.     $topoutside = 0;
  1340.     $bottomoutside = 11;    
  1341.     $avv = array(0,0,0,0,0,0,0,0,0,0,0);
  1342.     $rvv = array(0,0,0,0,0,0,0,0,0,0,0);
  1343.     $ovv = array(0,0,0,0,0,0,0,0,0,0,0);
  1344.     $truecomments = $totalvotesDB;
  1345.     while(list($ratingDB, $ratinguserDB, $ratingcommentsDB)=sql_fetch_row($voteresult, $dbi)) {
  1346.      if ($ratingcommentsDB=="") $truecomments--;
  1347.         if ($ratinguserDB==$anonymous) {
  1348.         $anonvotes++;
  1349.         $anonvoteval += $ratingDB;
  1350.     }
  1351.     if ($useoutsidevoting == 1) {
  1352.         if ($ratinguserDB=='outside') {
  1353.         $outsidevotes++;
  1354.             $outsidevoteval += $ratingDB;
  1355.         }
  1356.     } else { 
  1357.         $outsidevotes = 0;
  1358.     }
  1359.     if ($ratinguserDB!=$anonymous && $ratinguserDB!="outside") {
  1360.         $regvoteval += $ratingDB;
  1361.     }
  1362.     if ($ratinguserDB!=$anonymous && $ratinguserDB!="outside") {
  1363.         if ($ratingDB > $topreg) $topreg = $ratingDB;
  1364.         if ($ratingDB < $bottomreg) $bottomreg = $ratingDB;
  1365.         for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $rvv[$rcounter]++;    
  1366.     }
  1367.     if ($ratinguserDB==$anonymous) {
  1368.         if ($ratingDB > $topanon) $topanon = $ratingDB;
  1369.         if ($ratingDB < $bottomanon) $bottomanon = $ratingDB;
  1370.         for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $avv[$rcounter]++;    
  1371.     }
  1372.     if ($ratinguserDB=="outside") {
  1373.         if ($ratingDB > $topoutside) $topoutside = $ratingDB;
  1374.         if ($ratingDB < $bottomoutside) $bottomoutside = $ratingDB;
  1375.         for ($rcounter=1; $rcounter<11; $rcounter++) if ($ratingDB==$rcounter) $ovv[$rcounter]++;    
  1376.     }             
  1377.     }
  1378.     $regvotes = $totalvotesDB - $anonvotes - $outsidevotes;     
  1379.     if ($totalvotesDB == 0) {
  1380.     $finalrating = 0;
  1381.     } else if ($anonvotes == 0 && $regvotes == 0) {
  1382.     /* Figure Outside Only Vote */
  1383.     $finalrating = $outsidevoteval / $outsidevotes;
  1384.     $finalrating = number_format($finalrating, $detailvotedecimal); 
  1385.     $avgOU = $outsidevoteval / $totalvotesDB;
  1386.     $avgOU = number_format($avgOU, $detailvotedecimal);                  
  1387.     } else if ($outsidevotes == 0 && $regvotes == 0) {
  1388.      /* Figure Anon Only Vote */
  1389.     $finalrating = $anonvoteval / $anonvotes;                  
  1390.     $finalrating = number_format($finalrating, $detailvotedecimal); 
  1391.     $avgAU = $anonvoteval / $totalvotesDB;
  1392.     $avgAU = number_format($avgAU, $detailvotedecimal);                  
  1393.     } else if ($outsidevotes == 0 && $anonvotes == 0) {
  1394.     /* Figure Reg Only Vote */
  1395.     $finalrating = $regvoteval / $regvotes;                  
  1396.     $finalrating = number_format($finalrating, $detailvotedecimal); 
  1397.     $avgRU = $regvoteval / $totalvotesDB;
  1398.     $avgRU = number_format($avgRU, $detailvotedecimal);                  
  1399.     } else if ($regvotes == 0 && $useoutsidevoting == 1 && $outsidevotes != 0 && $anonvotes != 0 ) {
  1400.      /* Figure Reg and Anon Mix */
  1401.      $avgAU = $anonvoteval / $anonvotes;
  1402.     $avgOU = $outsidevoteval / $outsidevotes;              
  1403.     if ($anonweight > $outsideweight ) {
  1404.         /* Anon is 'standard weight' */
  1405.         $newimpact = $anonweight / $outsideweight;
  1406.         $impactAU = $anonvotes;
  1407.         $impactOU = $outsidevotes / $newimpact;
  1408.         $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU));
  1409.         $finalrating = number_format($finalrating, $detailvotedecimal); 
  1410.     } else {
  1411.         /* Outside is 'standard weight' */
  1412.         $newimpact = $outsideweight / $anonweight;
  1413.         $impactOU = $outsidevotes;
  1414.         $impactAU = $anonvotes / $newimpact;
  1415.         $finalrating = ((($avgOU * $impactOU) + ($avgAU * $impactAU)) / ($impactAU + $impactOU));
  1416.         $finalrating = number_format($finalrating, $detailvotedecimal); 
  1417.     }                            
  1418.     } else {
  1419.          /* REG User vs. Anonymous vs. Outside User Weight Calutions */
  1420.          $impact = $anonweight;
  1421.          $outsideimpact = $outsideweight;
  1422.          if ($regvotes == 0) {
  1423.         $avgRU = 0;
  1424.     } else {
  1425.         $avgRU = $regvoteval / $regvotes;
  1426.     }
  1427.     if ($anonvotes == 0) {
  1428.         $avgAU = 0;
  1429.     } else {
  1430.         $avgAU = $anonvoteval / $anonvotes;
  1431.     }
  1432.     if ($outsidevotes == 0 ) {
  1433.         $avgOU = 0;
  1434.     } else {
  1435.         $avgOU = $outsidevoteval / $outsidevotes;
  1436.     }
  1437.     $impactRU = $regvotes;
  1438.     $impactAU = $anonvotes / $impact;
  1439.     $impactOU = $outsidevotes / $outsideimpact;
  1440.     $finalrating = (($avgRU * $impactRU) + ($avgAU * $impactAU) + ($avgOU * $impactOU)) / ($impactRU + $impactAU + $impactOU);
  1441.     $finalrating = number_format($finalrating, $detailvotedecimal); 
  1442.     }
  1443.     if ($avgOU == 0 || $avgOU == "") {
  1444.     $avgOU = "";
  1445.     } else {
  1446.     $avgOU = number_format($avgOU, $detailvotedecimal);
  1447.     }
  1448.     if ($avgRU == 0 || $avgRU == "") {
  1449.     $avgRU = "";
  1450.     } else {
  1451.     $avgRU = number_format($avgRU, $detailvotedecimal);
  1452.     }
  1453.     if ($avgAU == 0 || $avgAU == "") {
  1454.     $avgAU = "";
  1455.     } else {
  1456.     $avgAU = number_format($avgAU, $detailvotedecimal);
  1457.     }
  1458.     if ($topanon == 0) $topanon = "";
  1459.     if ($bottomanon == 11) $bottomanon = "";
  1460.     if ($topreg == 0) $topreg = "";
  1461.     if ($bottomreg == 11) $bottomreg = "";
  1462.     if ($topoutside == 0) $topoutside = "";
  1463.     if ($bottomoutside == 11) $bottomoutside = "";    
  1464.     $totalchartheight = 70;
  1465.     $chartunits = $totalchartheight / 10;
  1466.     $avvper        = array(0,0,0,0,0,0,0,0,0,0,0);
  1467.     $rvvper         = array(0,0,0,0,0,0,0,0,0,0,0);
  1468.     $ovvper         = array(0,0,0,0,0,0,0,0,0,0,0);
  1469.     $avvpercent     = array(0,0,0,0,0,0,0,0,0,0,0);
  1470.     $rvvpercent     = array(0,0,0,0,0,0,0,0,0,0,0);
  1471.     $ovvpercent     = array(0,0,0,0,0,0,0,0,0,0,0);
  1472.     $avvchartheight    = array(0,0,0,0,0,0,0,0,0,0,0);
  1473.     $rvvchartheight    = array(0,0,0,0,0,0,0,0,0,0,0);
  1474.     $ovvchartheight    = array(0,0,0,0,0,0,0,0,0,0,0);
  1475.     $avvmultiplier = 0;
  1476.     $rvvmultiplier = 0;
  1477.     $ovvmultiplier = 0;
  1478.     for ($rcounter=1; $rcounter<11; $rcounter++) {
  1479.         if ($anonvotes != 0) $avvper[$rcounter] = $avv[$rcounter] / $anonvotes;
  1480.         if ($regvotes != 0) $rvvper[$rcounter] = $rvv[$rcounter] / $regvotes;
  1481.         if ($outsidevotes != 0) $ovvper[$rcounter] = $ovv[$rcounter] / $outsidevotes;
  1482.         $avvpercent[$rcounter] = number_format($avvper[$rcounter] * 100, 1);
  1483.         $rvvpercent[$rcounter] = number_format($rvvper[$rcounter] * 100, 1);
  1484.         $ovvpercent[$rcounter] = number_format($ovvper[$rcounter] * 100, 1);
  1485.         if ($avv[$rcounter] > $avvmultiplier) $avvmultiplier = $avv[$rcounter];
  1486.         if ($rvv[$rcounter] > $rvvmultiplier) $rvvmultiplier = $rvv[$rcounter];
  1487.         if ($ovv[$rcounter] > $ovvmultiplier) $ovvmultiplier = $ovv[$rcounter];
  1488.     }
  1489.     if ($avvmultiplier != 0) $avvmultiplier = 10 / $avvmultiplier;
  1490.     if ($rvvmultiplier != 0) $rvvmultiplier = 10 / $rvvmultiplier;
  1491.     if ($ovvmultiplier != 0) $ovvmultiplier = 10 / $ovvmultiplier;
  1492.     for ($rcounter=1; $rcounter<11; $rcounter++) {
  1493.         $avvchartheight[$rcounter] = ($avv[$rcounter] * $avvmultiplier) * $chartunits;
  1494.         $rvvchartheight[$rcounter] = ($rvv[$rcounter] * $rvvmultiplier) * $chartunits;
  1495.         $ovvchartheight[$rcounter] = ($ovv[$rcounter] * $ovvmultiplier) * $chartunits;        
  1496.         if ($avvchartheight[$rcounter]==0) $avvchartheight[$rcounter]=1;
  1497.         if ($rvvchartheight[$rcounter]==0) $rvvchartheight[$rcounter]=1;
  1498.         if ($ovvchartheight[$rcounter]==0) $ovvchartheight[$rcounter]=1;        
  1499.     }
  1500.     $transfertitle = ereg_replace ("_", " ", $ttitle);
  1501.     $displaytitle = $transfertitle;
  1502.     $res = sql_query("select name, email, description, filesize, version, homepage from ".$prefix."_downloads_downloads where lid='$lid'", $dbi);
  1503.     list($auth_name, $email, $description, $filesize, $version, $homepage) = sql_fetch_row($res, $dbi);
  1504.     echo "<br>";
  1505.     OpenTable();
  1506.     echo "<center><font class=\"option\"><b>"._DOWNLOADPROFILE.": $displaytitle</b></font><br><br>";
  1507.     downloadinfomenu($lid, $ttitle); 
  1508.     echo "<br><br>"._DOWNLOADRATINGDET."<br>"
  1509.         .""._TOTALVOTES." $totalvotesDB<br>"
  1510.         .""._OVERALLRATING.": $finalrating<br><br>"
  1511.     ."<font class=\"content\">$description<br>";
  1512.     if ($auth_name == "") {
  1513.     $auth_name = "<i>"._UNKNOWN."</i>";
  1514.     } else {
  1515.     if ($email == "") {
  1516.         $auth_name = "$auth_name";
  1517.     } else {
  1518.         $email = ereg_replace("@"," <i>at</i> ",$email);
  1519.         $email = ereg_replace("\."," <i>dot</i> ",$email);
  1520.         $auth_name = "$auth_name ($email)";
  1521.     }
  1522.     }
  1523.     echo "<br><b>"._AUTHOR.":</b> $auth_name<br>"
  1524.     ."<b>"._VERSION.":</b> $version <b>"._FILESIZE.":</b> ".CoolSize($filesize)."</font><br><br>"
  1525.     ."[ <b><a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">"._DOWNLOADNOW."</a></b> ";
  1526.     if (($homepage == "") OR ($homepage == "http://")) {
  1527.     echo "]<br><br>";
  1528.     } else {
  1529.     echo "| <a href=\"$homepage\" target=\"new\">"._HOMEPAGE."</a> ]<br><br>";
  1530.     }
  1531.     echo "<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"455\">"
  1532.     ."<tr><td colspan=\"2\" bgcolor=\"$bgcolor2\">"
  1533.     ."<font class=\"content\"><b>"._REGISTEREDUSERS."</b></font>"
  1534.     ."</td></tr>"
  1535.     ."<tr>"
  1536.     ."<td bgcolor=\"$bgcolor1\">"
  1537.         ."<font class=\"content\">"._NUMBEROFRATINGS.": $regvotes</font>"
  1538.     ."</td>"
  1539.     ."<td rowspan=\"5\" width=\"200\">";
  1540.     if ($regvotes==0) {
  1541.     echo "<center><font class=\"content\">"._NOREGUSERSVOTES."</font></center>";
  1542.     } else { 
  1543.            echo "<table border=\"1\" width=\"200\">"
  1544.             ."<tr>"
  1545.         ."<td valign=\"top\" align=\"center\" colspan=\"10\" bgcolor=\"$bgcolor2\"><font class=\"content\">"._BREAKDOWNBYVAL."</font></td>"
  1546.         ."</tr>"
  1547.         ."<tr>"
  1548.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[1] "._LVOTES." ($rvvpercent[1]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[1]\"></td>"
  1549.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[2] "._LVOTES." ($rvvpercent[2]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[2]\"></td>"
  1550.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[3] "._LVOTES." ($rvvpercent[3]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[3]\"></td>"
  1551.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[4] "._LVOTES." ($rvvpercent[4]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[4]\"></td>"
  1552.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[5] "._LVOTES." ($rvvpercent[5]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[5]\"></td>"
  1553.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[6] "._LVOTES." ($rvvpercent[6]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[6]\"></td>"
  1554.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[7] "._LVOTES." ($rvvpercent[7]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[7]\"></td>"
  1555.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[8] "._LVOTES." ($rvvpercent[8]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[8]\"></td>"
  1556.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[9] "._LVOTES." ($rvvpercent[9]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[9]\"></td>"
  1557.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$rvv[10] "._LVOTES." ($rvvpercent[10]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$rvvchartheight[10]\"></td>"
  1558.         ."</tr>"
  1559.         ."<tr><td colspan=\"10\" bgcolor=\"$bgcolor2\">"
  1560.         ."<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"200\"><tr>"
  1561.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">1</font></td>"
  1562.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">2</font></td>"
  1563.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">3</font></td>"
  1564.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">4</font></td>"
  1565.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">5</font></td>"
  1566.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">6</font></td>"
  1567.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">7</font></td>"
  1568.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">8</font></td>"
  1569.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">9</font></td>"
  1570.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">10</font></td>"
  1571.         ."</tr></table>"
  1572.         ."</td></tr></table>";
  1573.     }
  1574.     echo "</td>"
  1575.     ."</tr>"
  1576.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._DOWNLOADRATING.": $avgRU</font></td></tr>"
  1577.     ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._HIGHRATING.": $topreg</font></td></tr>"
  1578.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._LOWRATING.": $bottomreg</font></td></tr>"
  1579.     ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._NUMOFCOMMENTS.": $truecomments</font></td></tr>"
  1580.     ."<tr><td></td></tr>"
  1581.     ."<tr><td valign=\"top\" colspan=\"2\"><font class=\"tiny\"><br><br>"._WEIGHNOTE." $anonweight "._TO." 1.</font></td></tr>"
  1582.         ."<tr><td colspan=\"2\" bgcolor=\"$bgcolor2\"><font class=\"content\"><b>"._UNREGISTEREDUSERS."</b></font></td></tr>"
  1583.     ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._NUMBEROFRATINGS.": $anonvotes</font></td>"
  1584.     ."<td rowspan=\"5\" width=\"200\">";
  1585.     if ($anonvotes==0) {
  1586.     echo "<center><font class=\"content\">"._NOUNREGUSERSVOTES."</font></center>";
  1587.     } else { 
  1588.         echo "<table border=\"1\" width=\"200\">"
  1589.             ."<tr>"
  1590.         ."<td valign=\"top\" align=\"center\" colspan=\"10\" bgcolor=\"$bgcolor2\"><font class=\"content\">"._BREAKDOWNBYVAL."</font></td>"
  1591.         ."</tr>"
  1592.         ."<tr>"
  1593.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[1] "._LVOTES." ($avvpercent[1]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[1]\"></td>"
  1594.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[2] "._LVOTES." ($avvpercent[2]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[2]\"></td>"
  1595.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[3] "._LVOTES." ($avvpercent[3]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[3]\"></td>"
  1596.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[4] "._LVOTES." ($avvpercent[4]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[4]\"></td>"
  1597.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[5] "._LVOTES." ($avvpercent[5]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[5]\"></td>"
  1598.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[6] "._LVOTES." ($avvpercent[6]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[6]\"></td>"
  1599.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[7] "._LVOTES." ($avvpercent[7]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[7]\"></td>"
  1600.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[8] "._LVOTES." ($avvpercent[8]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[8]\"></td>"
  1601.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[9] "._LVOTES." ($avvpercent[9]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[9]\"></td>"
  1602.         ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$avv[10] "._LVOTES." ($avvpercent[10]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$avvchartheight[10]\"></td>"
  1603.         ."</tr>"
  1604.         ."<tr><td colspan=\"10\" bgcolor=\"$bgcolor2\">"
  1605.         ."<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"200\"><tr>"
  1606.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">1</font></td>"
  1607.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">2</font></td>"
  1608.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">3</font></td>"
  1609.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">4</font></td>"
  1610.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">5</font></td>"
  1611.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">6</font></td>"
  1612.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">7</font></td>"
  1613.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">8</font></td>"
  1614.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">9</font></td>"
  1615.         ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">10</font></td>"
  1616.         ."</tr></table>"
  1617.         ."</td></tr></table>";
  1618.     }
  1619.     echo "</td>"
  1620.     ."</tr>"
  1621.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._DOWNLOADRATING.": $avgAU</font></td></tr>"
  1622.     ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._HIGHRATING.": $topanon</font></td></tr>"
  1623.     ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._LOWRATING.": $bottomanon</font></td></tr>"
  1624.     ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\"> </font></td></tr>";
  1625.     if ($useoutsidevoting == 1) {
  1626.     echo "<tr><td valign=top colspan=\"2\"><font class=\"tiny\"><br><br>"._WEIGHOUTNOTE." $outsideweight "._TO." 1.</font></td></tr>"
  1627.         ."<tr><td colspan=\"2\" bgcolor=\"$bgcolor2\"><font class=\"content\"><b>"._OUTSIDEVOTERS."</b></font></td></tr>"
  1628.         ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._NUMBEROFRATINGS.": $outsidevotes</font></td>"
  1629.         ."<td rowspan=\"5\" width=\"200\">";
  1630.         if ($outsidevotes==0) {
  1631.         echo "<center><font class=\"content\">"._NOOUTSIDEVOTES."</font></center>";
  1632.     } else { 
  1633.         echo "<table border=\"1\" width=\"200\">"
  1634.             ."<tr>"
  1635.           ."<td valign=\"top\" align=\"center\" colspan=\"10\" bgcolor=\"$bgcolor2\"><font class=\"content\">"._BREAKDOWNBYVAL."</font></td>"
  1636.           ."</tr>"
  1637.           ."<tr>"
  1638.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[1] "._LVOTES." ($ovvpercent[1]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[1]\"></td>"
  1639.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[2] "._LVOTES." ($ovvpercent[2]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[2]\"></td>"
  1640.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[3] "._LVOTES." ($ovvpercent[3]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[3]\"></td>"
  1641.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[4] "._LVOTES." ($ovvpercent[4]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[4]\"></td>"
  1642.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[5] "._LVOTES." ($ovvpercent[5]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[5]\"></td>"
  1643.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[6] "._LVOTES." ($ovvpercent[6]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[6]\"></td>"
  1644.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[7] "._LVOTES." ($ovvpercent[7]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[7]\"></td>"
  1645.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[8] "._LVOTES." ($ovvpercent[8]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[8]\"></td>"
  1646.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[9] "._LVOTES." ($ovvpercent[9]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[9]\"></td>"
  1647.           ."<td bgcolor=\"$bgcolor1\" valign=\"bottom\"><img border=\"0\" alt=\"$ovv[10] "._LVOTES." ($ovvpercent[10]% "._LTOTALVOTES.")\" src=\"images/blackpixel.gif\" width=\"15\" height=\"$ovvchartheight[10]\"></td>"
  1648.           ."</tr>"
  1649.           ."<tr><td colspan=\"10\" bgcolor=\"$bgcolor2\">"
  1650.           ."<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"200\"><tr>"
  1651.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">1</font></td>"
  1652.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">2</font></td>"
  1653.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">3</font></td>"
  1654.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">4</font></td>"
  1655.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">5</font></td>"
  1656.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">6</font></td>"
  1657.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">7</font></td>"
  1658.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">8</font></td>"
  1659.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">9</font></td>"
  1660.           ."<td width=\"10%\" valign=\"bottom\" align=\"center\"><font class=\"content\">10</font></td>"
  1661.           ."</tr></table>"
  1662.           ."</td></tr></table>";
  1663.       }
  1664.     echo "</td>"
  1665.         ."</tr>"
  1666.         ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._DOWNLOADRATING.": $avgOU</font></td></tr>"
  1667.         ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\">"._HIGHRATING.": $topoutside</font></td></tr>"
  1668.         ."<tr><td bgcolor=\"$bgcolor2\"><font class=\"content\">"._LOWRATING.": $bottomoutside</font></td></tr>"
  1669.         ."<tr><td bgcolor=\"$bgcolor1\"><font class=\"content\"> </font></td></tr>";
  1670.     }
  1671.     echo "</table><br><br><center>";
  1672.     downloadfooter($lid,$ttitle);
  1673.     echo "</center>";
  1674.     CloseTable();    
  1675.     include("footer.php");
  1676. }
  1677.  
  1678. function downloadfooter($lid,$ttitle) {
  1679.     global $module_name;
  1680.     echo "<font class=\"content\">[ <a href=\"modules.php?name=$module_name&d_op=getit&lid=$lid\">"._DOWNLOADNOW."</a> | <a href=\"modules.php?name=$module_name&d_op=ratedownload&lid=$lid&ttitle=$ttitle\">"._RATETHISSITE."</a> ]</font><br><br>";
  1681.     downloadfooterchild($lid);
  1682. }
  1683.  
  1684. function downloadfooterchild($lid) {
  1685.     global $module_name;
  1686.     include("modules/$module_name/d_config.php");
  1687.     if ($useoutsidevoting = 1) { 
  1688.     echo "<br><font class=\"content\">"._ISTHISYOURSITE." <a href=\"modules.php?name=$module_name&d_op=outsidedownloadsetup&lid=$lid\">"._ALLOWTORATE."</a></font>";
  1689.     }
  1690. }
  1691.  
  1692. function outsidedownloadsetup($lid) {
  1693.     global $module_name, $sitename, $nukeurl;
  1694.     include("header.php");
  1695.     include("modules/$module_name/d_config.php");
  1696.     menu(1);
  1697.     echo "<br>";
  1698.     OpenTable();
  1699.     echo "<center><font class=\"option\"><b>"._PROMOTEYOURSITE."</b></font></center><br><br>
  1700.  
  1701.     "._PROMOTE01."<br><br>
  1702.     
  1703.     <b>1) "._TEXTLINK."</b><br><br>
  1704.     
  1705.     "._PROMOTE02."<br><br>
  1706.     <center><a href=\"$nukeurl/modules.php?name=$module_name&d_op=ratedownload&lid=$lid\">"._RATETHISSITE." @ $sitename</a></center><br><br>
  1707.     <center>"._HTMLCODE1."</center><br>
  1708.     <center><i><a href=\"$nukeurl/modules.php?name=$module_name&d_op=ratedownload&lid=$lid\">"._RATETHISSITE."</a></i></center>
  1709.     <br><br>
  1710.     "._THENUMBER." \"$lid\" "._IDREFER."<br><br>
  1711.     
  1712.     <b>2) "._BUTTONLINK."</b><br><br>
  1713.     
  1714.     "._PROMOTE03."<br><br>
  1715.     
  1716.     <center>
  1717.     <form action=\"modules.php?name=$module_name\" method=\"post\">\n
  1718.     <input type=\"hidden\" name=\"lid\" value=\"$lid\">\n
  1719.     <input type=\"hidden\" name=\"d_op\" value=\"ratedownload\">\n
  1720.     <input type=\"submit\" value=\""._RATEIT."\">\n
  1721.     </form>\n
  1722.     </center>
  1723.     
  1724.     <center>"._HTMLCODE2."</center><br><br>
  1725.     
  1726.     <table border=\"0\" align=\"center\"><tr><td align=\"left\"><i>
  1727.     <form action=\"$nukeurl/modules.php?name=$module_name\" method=\"post\"><br>\n
  1728.       <input type=\"hidden\" name=\"lid\" value=\"$lid\"><br>\n
  1729.       <input type=\"hidden\" name=\"d_op\" value=\"ratedownload\"><br>\n
  1730.       <input type=\"submit\" value=\""._RATEIT."\"><br>\n
  1731.     </form>\n
  1732.     </i></td></tr></table>
  1733.  
  1734.     <br><br>
  1735.     
  1736.     <b>3) "._REMOTEFORM."</b><br><br>
  1737.      
  1738.     "._PROMOTE04."
  1739.  
  1740.     <center>
  1741.     <form method=\"post\" action=\"$nukeurl/modules.php?name=$module_name\">
  1742.     <table align=\"center\" border=\"0\" width=\"175\" cellspacing=\"0\" cellpadding=\"0\">
  1743.     <tr><td align=\"center\"><b>"._VOTE4THISSITE."</b></a></td></tr>
  1744.     <tr><td>
  1745.     <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
  1746.     <tr><td valign=\"top\">
  1747.         <select name=\"rating\">
  1748.         <option selected>--</option>
  1749.     <option>10</option>
  1750.     <option>9</option>
  1751.     <option>8</option>
  1752.     <option>7</option>
  1753.     <option>6</option>
  1754.     <option>5</option>
  1755.     <option>4</option>    
  1756.     <option>3</option>
  1757.     <option>2</option>
  1758.     <option>1</option>
  1759.     </select>
  1760.     </td><td valign=\"top\">
  1761.     <input type=\"hidden\" name=\"ratinglid\" value=\"$lid\">
  1762.         <input type=\"hidden\" name=\"ratinguser\" value=\"outside\">
  1763.         <input type=\"hidden\" name=\"op value=\"addrating\">
  1764.     <input type=\"submit\" value=\""._DOWNLOADVOTE."\">
  1765.     </td></tr></table>
  1766.     </td></tr></table></form>
  1767.  
  1768.     <br>"._HTMLCODE3."<br><br></center>
  1769.  
  1770.     <blockquote><i>
  1771.     <form method=\"post\" action=\"$nukeurl/modules.php?name=$module_name\"><br>
  1772.     <table align=\"center\" border=\"0\" width=\"175\" cellspacing=\"0\" cellpadding=\"0\"><br>
  1773.         <tr><td align=\"center\"><b>"._VOTE4THISSITE."</b></a></td></tr><br>
  1774.         <tr><td><br>
  1775.         <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><br>
  1776.         <tr><td valign=\"top\"><br>
  1777.             <select name=\"rating\"><br>
  1778.             <option selected>--</option><br>
  1779.         <option>10</option><br>
  1780.         <option>9</option><br>
  1781.         <option>8</option><br>
  1782.         <option>7</option><br>
  1783.         <option>6</option><br>
  1784.         <option>5</option><br>
  1785.         <option>4</option><br>    
  1786.         <option>3</option><br>
  1787.         <option>2</option><br>
  1788.         <option>1</option><br>
  1789.         </select><br>
  1790.         </td><td valign=\"top\"><br>
  1791.         <input type=\"hidden\" name=\"ratinglid\" value=\"$lid\"><br>
  1792.             <input type=\"hidden\" name=\"ratinguser\" value=\"outside\"><br>
  1793.             <input type=\"hidden\" name=\"d_op\" value=\"addrating\"><br>
  1794.         <input type=\"submit\" value=\""._DOWNLOADVOTE."\"><br>
  1795.         </td></tr></table><br>
  1796.     </td></tr></table><br>
  1797.     </form><br>
  1798.     </i></blockquote>
  1799.     <br><br><center>
  1800.     "._PROMOTE05."<br><br>
  1801.     - $sitename "._STAFF."
  1802.     <br><br></center>";
  1803.     CloseTable();
  1804.     include("footer.php");
  1805. }
  1806.  
  1807. function brokendownload($lid) {
  1808.     global $prefix, $dbi, $user, $cookie, $module_name;
  1809.     include("header.php");
  1810.     include("modules/$module_name/d_config.php");
  1811.     if(is_user($user)) {
  1812.         $user2 = base64_decode($user);
  1813.        $cookie = explode(":", $user2);
  1814.     cookiedecode($user);
  1815.     $ratinguser = $cookie[1];
  1816.     } else { 
  1817.     $ratinguser = "$anonymous";
  1818.     }
  1819.     menu(1);
  1820.     echo "<br>";
  1821.     OpenTable();
  1822.     echo "<center><font class=\"option\"><b>"._REPORTBROKEN."</b></font><br><br><br><font class=\"content\">";
  1823.     echo "<form action=\"modules.php?name=$module_name\" method=\"post\">";
  1824.     echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
  1825.     echo "<input type=\"hidden\" name=\"modifysubmitter\" value=\"$ratinguser\">";
  1826.     echo ""._THANKSBROKEN."<br>"._SECURITYBROKEN."<br><br>"; 
  1827.     echo "<input type=\"hidden\" name=\"d_op\" value=\"brokendownloadS\"><input type=\"submit\" value=\""._REPORTBROKEN."\"></center></form>";
  1828.     CloseTable();
  1829.     include("footer.php");    
  1830. }
  1831.  
  1832. function brokendownloadS($lid, $modifysubmitter) {
  1833.     global $prefix, $dbi, $user, $anonymous, $cookie, $module_name;
  1834.     include("modules/$module_name/d_config.php");
  1835.     if(is_user($user)) {
  1836.     $user2 = base64_decode($user);
  1837.        $cookie = explode(":", $user2);
  1838.     cookiedecode($user);
  1839.     $ratinguser = $cookie[1];
  1840.     } else { 
  1841.     $ratinguser = "$anonymous";
  1842.     }
  1843.     sql_query("insert into ".$prefix."_downloads_modrequest values (NULL, $lid, 0, 0, '', '', '', '$ratinguser', 1, '$auth_name', '$email', '$filesize', '$version', '$homepage')", $dbi);
  1844.     include("header.php");
  1845.     menu(1);
  1846.     echo "<br>";
  1847.     OpenTable();
  1848.     echo "<br><center>"._THANKSFORINFO."<br><br>"._LOOKTOREQUEST."</center><br>";
  1849.     CloseTable();
  1850.     include("footer.php");
  1851. }
  1852.  
  1853. function modifydownloadrequest($lid) {
  1854.     global $prefix, $dbi, $user, $module_name;
  1855.     include("header.php");
  1856.     if(is_user($user)) {
  1857.         $user2 = base64_decode($user);
  1858.        $cookie = explode(":", $user2);
  1859.     cookiedecode($user);
  1860.     $ratinguser = $cookie[1];
  1861.     } else {
  1862.     $ratinguser = "$anonymous";
  1863.     }
  1864.     menu(1);
  1865.     echo "<br>";
  1866.     OpenTable();
  1867.     $blocknow = 0;
  1868.     if ($blockunregmodify == 1 && $ratinguser=="$anonymous") { 
  1869.     echo "<br><br><center>"._DONLYREGUSERSMODIFY."</center>";
  1870.     $blocknow = 1;
  1871.     }
  1872.     if ($blocknow != 1) {
  1873.         $result = sql_query("select cid, title, url, description, name, email, filesize, version, homepage from ".$prefix."_downloads_downloads where lid=$lid", $dbi);
  1874.         echo "<center><font class=\"option\"><b>"._REQUESTDOWNLOADMOD."</b></font><br><font class=\"content\">";
  1875.         while(list($cid, $title, $url, $description, $auth_name, $email, $filesize, $version, $homepage) = sql_fetch_row($result, $dbi)) {
  1876.             $title = stripslashes($title);
  1877.         $description = stripslashes($description);
  1878.             echo "<form action=\"modules.php?name=$module_name\" method=\"post\">"
  1879.             .""._DOWNLOADID.": <b>$lid</b></center><br><br><br>"
  1880.             .""._DOWNLOADNAME.":<br><input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br><br>"
  1881.             .""._URL.":<br><input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"><br><br>"
  1882.             .""._DESCRIPTION.": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br><br>";
  1883.         $result2=sql_query("select cid, title from ".$prefix."_downloads_categories order by title", $dbi);
  1884.         echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
  1885.         ."<input type=\"hidden\" name=\"modifysubmitter\" value=\"$ratinguser\">"
  1886.         .""._CATEGORY.": <select name=\"cat\">";
  1887.  
  1888.     $result2=sql_query("select cid, title, parentid from ".$prefix."_downloads_categories order by title", $dbi);
  1889.     while(list($cid2, $ctitle2, $parentid2) = sql_fetch_row($result2, $dbi)) {
  1890.         if ($cid2==$cid) {
  1891.             $sel = "selected";
  1892.         } else {
  1893.             $sel = "";
  1894.         }
  1895.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  1896.         echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
  1897.     }
  1898.         echo "</select><br><br>"
  1899.         .""._AUTHORNAME.":<br><input type=\"text\" name=\"auth_name\" value=\"$auth_name\" size=\"30\" maxlength=\"80\"><br><br>"
  1900.         .""._AUTHOREMAIL.":<br><input type=\"text\" name=\"email\" value=\"$email\" size=\"30\" maxlength=\"80\"><br><br>"
  1901.         .""._FILESIZE.": ("._INBYTES.")<br><input type=\"text\" name=\"filesize\" value=\"$filesize\" size=\"12\" maxlength=\"11\"><br><br>"
  1902.         .""._VERSION.":<br><input type=\"text\" name=\"version\" value=\"$version\" size=\"11\" maxlength=\"10\"><br><br>"
  1903.         .""._HOMEPAGE.":<br><input type=\"text\" name=\"homepage\" value=\"$homepage\" size=\"50\" maxlength=\"200\"><br><br>"
  1904.         ."<input type=\"hidden\" name=\"d_op\" value=\"modifydownloadrequestS\">"
  1905.         ."<input type=\"submit\" value=\""._SENDREQUEST."\"></form>";
  1906.         }
  1907.     }
  1908.     CloseTable();
  1909.     include("footer.php");
  1910. }
  1911.  
  1912. function modifydownloadrequestS($lid, $cat, $title, $url, $description, $modifysubmitter, $auth_name, $email, $filesize, $version, $homepage) {
  1913.     global $prefix, $dbi, $user, $module_name;
  1914.     include("modules/$module_name/d_config.php");
  1915.     if(is_user($user)) {
  1916.     $user2 = base64_decode($user);
  1917.     $cookie = explode(":", $user2);
  1918.     cookiedecode($user);
  1919.     $ratinguser = $cookie[1];
  1920.     } else {
  1921.     $ratinguser = "$anonymous";
  1922.     }
  1923.     $blocknow = 0;
  1924.     if ($blockunregmodify == 1 && $ratinguser=="$anonymous") { 
  1925.     include("header.php");
  1926.     menu(1);
  1927.     echo "<br>";
  1928.     OpenTable();
  1929.     echo "<center><font class=\"content\">"._DONLYREGUSERSMODIFY."</font></center>";
  1930.     $blocknow = 1;
  1931.     CloseTable();
  1932.     include("footer.php");
  1933.     }
  1934.     if ($blocknow != 1) {
  1935.         $cat = explode("-", $cat);
  1936.         if ($cat[1]=="") {
  1937.             $cat[1] = 0;
  1938.         }
  1939.         $title = stripslashes(FixQuotes($title));
  1940.         $url = stripslashes(FixQuotes($url));
  1941.         $description = stripslashes(FixQuotes($description));
  1942.         sql_query("insert into ".$prefix."_downloads_modrequest values (NULL, $lid, $cat[0], $cat[1], '$title', '$url', '$description', '$ratinguser', 0, '$auth_name', '$email', '$filesize', '$version', '$homepage')", $dbi);
  1943.         include("header.php");
  1944.     menu(1);
  1945.     echo "<br>";
  1946.     OpenTable();
  1947.         echo "<center><font class=\"content\">"._THANKSFORINFO." "._LOOKTOREQUEST."</font></center>";
  1948.         CloseTable();
  1949.     include("footer.php");
  1950.     }
  1951. }
  1952.  
  1953. function rateinfo($lid) {
  1954.     global $prefix, $dbi;                            
  1955.     sql_query("update ".$prefix."_downloads_downloads set hits=hits+1 where lid=$lid", $dbi);
  1956.     $result = sql_query("select url from ".$prefix."_downloads_downloads where lid=$lid", $dbi);
  1957.     list($url) = sql_fetch_row($result, $dbi);
  1958.     Header("Location: $url");                            
  1959. }
  1960.  
  1961. function addrating($ratinglid, $ratinguser, $rating, $ratinghost_name, $ratingcomments) {    
  1962.     global $prefix, $dbi, $cookie, $user, $module_name;
  1963.     $passtest = "yes";
  1964.     include("header.php");
  1965.     include("modules/$module_name/d_config.php");
  1966.     completevoteheader();
  1967.     if(is_user($user)) {
  1968.     $user2 = base64_decode($user);
  1969.        $cookie = explode(":", $user2);
  1970.     cookiedecode($user);
  1971.     $ratinguser = $cookie[1];
  1972.     } else if ($ratinguser=="outside") {
  1973.     $ratinguser = "outside";
  1974.     } else {
  1975.     $ratinguser = "$anonymous";
  1976.     }
  1977.     $results3 = sql_query("SELECT title FROM ".$prefix."_downloads_downloads WHERE lid=$ratinglid", $dbi);
  1978.     while(list($title)=sql_fetch_row($results3, $dbi)) $ttitle = $title;
  1979.     /* Make sure only 1 anonymous from an IP in a single day. */
  1980.     $ip = getenv("REMOTE_HOST");
  1981.     if (empty($ip)) {
  1982.        $ip = getenv("REMOTE_ADDR");
  1983.     }
  1984.     /* Check if Rating is Null */
  1985.     if ($rating=="--") {
  1986.     $error = "nullerror";
  1987.         completevote($error);
  1988.     $passtest = "no";
  1989.     }
  1990.     /* Check if Download POSTER is voting (UNLESS Anonymous users allowed to post) */
  1991.     if ($ratinguser != $anonymous && $ratinguser != "outside") {
  1992.         $result=sql_query("select submitter from ".$prefix."_downloads_downloads where lid=$ratinglid", $dbi);
  1993.         while(list($ratinguserDB)=sql_fetch_row($result, $dbi)) {
  1994.             if ($ratinguserDB==$ratinguser) {
  1995.             $error = "postervote";
  1996.                 completevote($error);
  1997.         $passtest = "no";
  1998.             }
  1999.        }
  2000.     }
  2001.     /* Check if REG user is trying to vote twice. */
  2002.     if ($ratinguser!=$anonymous && $ratinguser != "outside") {
  2003.         $result=sql_query("select ratinguser from ".$prefix."_downloads_votedata where ratinglid=$ratinglid", $dbi);
  2004.         while(list($ratinguserDB)=sql_fetch_row($result, $dbi)) {
  2005.             if ($ratinguserDB==$ratinguser) {
  2006.                 $error = "regflood";
  2007.                 completevote($error);
  2008.         $passtest = "no";
  2009.         }
  2010.         }
  2011.     }
  2012.     /* Check if ANONYMOUS user is trying to vote more than once per day. */
  2013.     if ($ratinguser==$anonymous){
  2014.         $yesterdaytimestamp = (time()-(86400 * $anonwaitdays));
  2015.         $ytsDB = Date("Y-m-d H:i:s", $yesterdaytimestamp);
  2016.         $result=sql_query("select * FROM ".$prefix."_downloads_votedata WHERE ratinglid=$ratinglid AND ratinguser='$anonymous' AND ratinghostname = '$ip' AND TO_DAYS(NOW()) - TO_DAYS(ratingtimestamp) < $anonwaitdays", $dbi);
  2017.         $anonvotecount = sql_num_rows($result, $dbi); 
  2018.         if ($anonvotecount >= 1) {
  2019.             $error = "anonflood";
  2020.             completevote($error);
  2021.             $passtest = "no";
  2022.         }
  2023.     }
  2024.     /* Check if OUTSIDE user is trying to vote more than once per day. */
  2025.     if ($ratinguser=="outside"){
  2026.         $yesterdaytimestamp = (time()-(86400 * $outsidewaitdays));
  2027.         $ytsDB = Date("Y-m-d H:i:s", $yesterdaytimestamp);
  2028.         $result=sql_query("select * FROM ".$prefix."_downloads_votedata WHERE ratinglid=$ratinglid AND ratinguser='outside' AND ratinghostname = '$ip' AND TO_DAYS(NOW()) - TO_DAYS(ratingtimestamp) < $outsidewaitdays", $dbi);
  2029.         $outsidevotecount = sql_num_rows($result, $dbi); 
  2030.         if ($outsidevotecount >= 1) {
  2031.             $error = "outsideflood";
  2032.             completevote($error);
  2033.             $passtest = "no";
  2034.         }
  2035.     }
  2036.     /* Passed Tests */
  2037.     if ($passtest == "yes") {
  2038.         $comment = stripslashes(FixQuotes($comment));
  2039.         /* All is well.  Add to Line Item Rate to DB. */
  2040.      sql_query("INSERT into ".$prefix."_downloads_votedata values (NULL,'$ratinglid', '$ratinguser', '$rating', '$ip', '$ratingcomments', now())", $dbi);    
  2041.     /* All is well.  Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. */
  2042.     /* NOTE: If weight is modified, ALL downloads need to be refreshed with new weight. */
  2043.     /*     Running a SQL statement with your modded calc for ALL downloads will accomplish this. */
  2044.         $voteresult = sql_query("select rating, ratinguser, ratingcomments FROM ".$prefix."_downloads_votedata WHERE ratinglid = $ratinglid", $dbi);
  2045.     $totalvotesDB = sql_num_rows($voteresult, $dbi);
  2046.     include ("modules/$module_name/voteinclude.php");     
  2047.         sql_query("UPDATE ".$prefix."_downloads_downloads SET downloadratingsummary=$finalrating,totalvotes=$totalvotesDB,totalcomments=$truecomments WHERE lid = $ratinglid", $dbi);
  2048.         $error = "none";
  2049.         completevote($error);
  2050.     }
  2051.     completevotefooter($ratinglid, $ttitle, $ratinguser);
  2052.     include("footer.php");
  2053. }
  2054.  
  2055. function completevoteheader(){
  2056.     menu(1);
  2057.     echo "<br>";
  2058.     OpenTable();
  2059. }
  2060.  
  2061. function completevotefooter($lid, $ttitle, $ratinguser) {
  2062.     global $prefix, $dbi, $module_name;
  2063.     include("modules/$module_name/d_config.php");
  2064.     $result = sql_query("select url FROM ".$prefix."_downloads_downloads WHERE lid=$lid", $dbi);
  2065.     list($url)=sql_fetch_row($result, $dbi);
  2066.     echo "<font class=\"content\">"._THANKSTOTAKETIME." $sitename. "._DLETSDECIDE."</font><br><br><br>";
  2067.     if ($ratinguser=="outside") {
  2068.     echo "<center><font class=\"content\">".WEAPPREACIATE." $sitename!<br><a href=\"$url\">"._RETURNTO." $ttitle</a></font><center><br><br>";
  2069.         $result=sql_query("select title FROM ".$prefix."_downloads_downloads where lid=$lid", $dbi);
  2070.         list($title)=sql_fetch_row($result, $dbi);
  2071.         $ttitle = ereg_replace (" ", "_", $title);
  2072.     }
  2073.     echo "<center>";
  2074.     downloadinfomenu($lid,$ttitle);
  2075.     echo "</center>";
  2076.     CloseTable();
  2077. }
  2078.  
  2079. function completevote($error) {
  2080.     global $module_name;
  2081.     include("modules/$module_name/d_config.php");
  2082.     if ($error == "none") echo "<center><font class=\"content\"><b>"._COMPLETEVOTE1."</b></font></center>";
  2083.     if ($error == "anonflood") echo "<center><font class=\"option\"><b>"._COMPLETEVOTE2."</b></font></center><br>";
  2084.     if ($error == "regflood") echo "<center><font class=\"option\"><b>"._COMPLETEVOTE3."</b></font></center><br>";
  2085.     if ($error == "postervote") echo "<center><font class=\"option\"><b>"._COMPLETEVOTE4."</b></font></center><br>";
  2086.     if ($error == "nullerror") echo "<center><font class=\"option\"><b>"._COMPLETEVOTE5."</b></font></center><br>";
  2087.     if ($error == "outsideflood") echo "<center><font class=\"option\"><b>"._COMPLETEVOTE6."</b></font></center><br>";
  2088. }
  2089.  
  2090. function ratedownload($lid, $user, $ttitle) {
  2091.     global $prefix, $dbi, $cookie, $datetime, $module_name;
  2092.     include("header.php");
  2093.     menu(1);
  2094.     echo "<br>";
  2095.     OpenTable();
  2096.     $transfertitle = ereg_replace ("_", " ", $ttitle);
  2097.     $displaytitle = $transfertitle;
  2098.     $ip = getenv("REMOTE_HOST");
  2099.     if (empty($ip)) {
  2100.        $ip = getenv("REMOTE_ADDR");
  2101.     }
  2102.     echo "<b>$displaytitle</b>"
  2103.     ."<ul><font class=\"content\">"
  2104.     ."<li>"._RATENOTE1.""
  2105.     ."<li>"._RATENOTE2.""
  2106.     ."<li>"._RATENOTE3.""
  2107.     ."<li>"._DRATENOTE4.""
  2108.     ."<li>"._RATENOTE5."";
  2109.     if(is_user($user)) {
  2110.         $user2 = base64_decode($user);
  2111.        $cookie = explode(":", $user2);
  2112.     echo "<li>"._YOUAREREGGED.""
  2113.         ."<li>"._FEELFREE2ADD."";
  2114.     cookiedecode($user);
  2115.     $auth_name = $cookie[1];
  2116.     } else {
  2117.     echo "<li>"._YOUARENOTREGGED.""
  2118.         ."<li>"._IFYOUWEREREG."";
  2119.     $auth_name = "$anonymous";
  2120.     }
  2121.     echo "</ul>"
  2122.         ."<form method=\"post\" action=\"modules.php?name=$module_name\">"
  2123.         ."<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">"
  2124.         ."<tr><td width=\"25\" nowrap></td>"
  2125.         ."<tr><td width=\"25\" nowrap></td><td width=\"550\">"
  2126.         ."<input type=\"hidden\" name=\"ratinglid\" value=\"$lid\">"
  2127.         ."<input type=\"hidden\" name=\"ratinguser\" value=\"$auth_name\">"
  2128.         ."<input type=\"hidden\" name=\"ratinghost_name\" value=\"$ip\">"
  2129.         ."<font class=content>"._RATETHISSITE.""
  2130.         ."<select name=\"rating\">"
  2131.         ."<option>--</option>"
  2132.         ."<option>10</option>"
  2133.         ."<option>9</option>"
  2134.     ."<option>8</option>"
  2135.         ."<option>7</option>"
  2136.         ."<option>6</option>"
  2137.         ."<option>5</option>"
  2138.         ."<option>4</option>"
  2139.         ."<option>3</option>"
  2140.         ."<option>2</option>"
  2141.         ."<option>1</option>"
  2142.         ."</select></font>"
  2143.     ."<font class=\"content\"><input type=\"submit\" value=\""._RATETHISSITE."\"></font>"
  2144.         ."<br><br>";
  2145.     if(is_user($user)) {
  2146.     echo "<b>"._SCOMMENTS.":</b><br><textarea wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"ratingcomments\"></textarea>"
  2147.          ."<br><br><br>"
  2148.              ."</font></td>";
  2149.     } else {
  2150.     echo"<input type=\"hidden\" name=\"ratingcomments\" value=\"\">";
  2151.     }
  2152.     echo "</tr></table></form>";
  2153.     echo "<center>";
  2154.     downloadfooterchild($lid);
  2155.     echo "</center>";
  2156.     CloseTable();
  2157.     include("footer.php");
  2158. }
  2159.  
  2160. function CoolSize($size) {
  2161.     $mb = 1024*1024;
  2162.     if ( $size > $mb ) {
  2163.         $mysize = sprintf ("%01.2f",$size/$mb) . " MB";
  2164.     } elseif ( $size >= 1024 ) {
  2165.         $mysize = sprintf ("%01.2f",$size/1024) . " Kb";
  2166.     } else {
  2167.         $mysize = $size . " bytes";
  2168.     }
  2169.     return $mysize;
  2170. }
  2171.  
  2172. if (isset($ratinglid) && isset ($ratinguser) && isset ($rating)) {
  2173.     $ret = addrating($ratinglid, $ratinguser, $rating, $ratinghost_name, $ratingcomments);
  2174. }
  2175.  
  2176. switch($d_op) {
  2177.  
  2178.     case "menu":
  2179.     menu($maindownload);
  2180.     break;
  2181.  
  2182.     case "AddDownload":
  2183.     AddDownload();
  2184.     break;
  2185.  
  2186.     case "NewDownloads":
  2187.     NewDownloads($newdownloadshowdays);
  2188.     break;
  2189.     
  2190.     case "NewDownloadsDate":
  2191.     NewDownloadsDate($selectdate);
  2192.     break;
  2193.  
  2194.     case "CoolSize":
  2195.     CoolSize($size);
  2196.     break;
  2197.  
  2198.     case "TopRated":
  2199.     TopRated($ratenum, $ratetype);
  2200.     break;
  2201.     
  2202.     case "MostPopular":
  2203.     MostPopular($ratenum, $ratetype);
  2204.     break;
  2205.  
  2206.     case "viewdownload":
  2207.     viewdownload($cid, $min, $orderby, $show);
  2208.     break;
  2209.  
  2210.     case "viewsdownload":
  2211.     viewsdownload($sid, $min, $orderby, $show);
  2212.     break;
  2213.  
  2214.     case "brokendownload":
  2215.     brokendownload($lid);
  2216.     break;
  2217.     
  2218.     case "modifydownloadrequest":    
  2219.     modifydownloadrequest($lid);
  2220.     break;
  2221.     
  2222.     case "modifydownloadrequestS":    
  2223.     modifydownloadrequestS($lid, $cat, $title, $url, $description, $modifysubmitter, $auth_name, $email, $filesize, $version, $homepage);
  2224.     break;
  2225.    
  2226.     case "brokendownloadS":
  2227.     brokendownloadS($lid, $modifysubmitter);
  2228.     break;
  2229.     
  2230.     case "getit":
  2231.     getit($lid);
  2232.     break;
  2233.  
  2234.     case "Add":
  2235.     Add($title, $url, $auth_name, $cat, $description, $email, $filesize, $version, $homepage);
  2236.     break;
  2237.  
  2238.     case "search":
  2239.     search($query, $min, $orderby, $show);
  2240.     break;
  2241.  
  2242.     case "rateinfo":
  2243.     rateinfo($lid, $user, $title);
  2244.     break;
  2245.  
  2246.     case "ratedownload":
  2247.     ratedownload($lid, $user, $ttitle);
  2248.     break;    
  2249.     
  2250.     case "addrating":
  2251.     addrating($ratinglid, $ratinguser, $rating, $ratinghost_name, $ratingcomments, $user);
  2252.     break;
  2253.  
  2254.     case "viewdownloadcomments":
  2255.     viewdownloadcomments($lid, $ttitle);
  2256.     break;
  2257.     
  2258.     case "outsidedownloadsetup":
  2259.     outsidedownloadsetup($lid);
  2260.     break;
  2261.     
  2262.     case "viewdownloadeditorial":
  2263.     viewdownloadeditorial($lid, $ttitle);
  2264.     break;
  2265.  
  2266.     case "viewdownloaddetails":                                
  2267.     viewdownloaddetails($lid, $ttitle);                        
  2268.     break;    
  2269.     
  2270.     default:
  2271.     index();
  2272.     break;
  2273.  
  2274. }
  2275.  
  2276. ?>