home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / admin / modules / download.php < prev    next >
PHP Script  |  2004-01-10  |  63KB  |  1,308 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. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14.  
  15. if (!eregi("admin.php", $_SERVER['PHP_SELF'])) { die ("Access Denied"); }
  16. global $prefix, $db;
  17. $aid = substr(trim($aid), 0,25);
  18. $row = $db->sql_fetchrow($db->sql_query("SELECT radmindownload, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
  19. if (($row['radmindownload'] == 1) OR ($row['radminsuper'] == 1)) {
  20.  
  21. /*********************************************************/
  22. /* Downloads Modified Web Downloads                      */
  23. /*********************************************************/
  24.  
  25. function getparent($parentid,$title) {
  26.     global $prefix,$db;
  27.     $parentid = intval(trim($parentid));
  28.     $row = $db->sql_fetchrow($db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories where cid='$parentid'"));
  29.     $cid = intval($row['cid']);
  30.     $ptitle = $row['title'];
  31.     $pparentid = $row['parentid'];
  32.     if ($ptitle!="") $title=$ptitle."/".$title;
  33.     if ($pparentid!=0) {
  34.     $title=getparent($pparentid,$title);
  35.     }
  36.     return $title;
  37. }
  38.  
  39. function downloads() {
  40.     global $prefix, $db;
  41.     include ("header.php");
  42.     GraphicAdmin();
  43.     OpenTable();
  44.     $ThemeSel = get_theme();
  45.     if (file_exists("themes/$ThemeSel/images/down-logo.gif")) {
  46.     echo "<center><a href=\"modules.php?name=$module_name\"><img src=\"themes/$ThemeSel/images/down-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  47.     } else {
  48.     echo "<center><a href=\"modules.php?name=$module_name\"><img src=\"modules/Downloads/images/down-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  49.     }
  50.     $result = $db->sql_query("SELECT * from ".$prefix."_downloads_downloads");
  51.     $numrows = $db->sql_numrows($result);
  52.     echo "<font class=\"content\">"._THEREARE." <b>$numrows</b> "._DOWNLOADSINDB."</font></center>";
  53.     CloseTable();
  54.     echo "<br>";
  55.     
  56. /* Temporarily 'homeless' downloads functions (to be revised in admin.php breakup) */
  57.  
  58.     $result2 = $db->sql_query("SELECT * from ".$prefix."_downloads_modrequest where brokendownload='1'");
  59.     $totalbrokendownloads = $db->sql_numrows($result2);
  60.     $result3 = $db->sql_query("SELECT * from ".$prefix."_downloads_modrequest where brokendownload='0'");
  61.     $totalmodrequests = $db->sql_numrows($result3);
  62.  
  63. /* List Downloads waiting for validation */
  64.  
  65.     $result4 = $db->sql_query("SELECT lid, cid, sid, title, url, description, name, email, submitter, filesize, version, homepage from ".$prefix."_downloads_newdownload order by lid");
  66.     $numrows = $db->sql_numrows($result4);
  67.     if ($numrows>0) {
  68.     OpenTable();
  69.     echo "<center><font class=\"content\"><b>"._DOWNLOADSWAITINGVAL."</b></font></center><br><br>";
  70.     while($row4 = $db->sql_fetchrow($result4)) {
  71.         $lid = intval($row4['lid']);
  72.         $cid = intval($row4['cid']);
  73.         $sid = intval($row4['sid']);
  74.         $title = $row4['title'];
  75.         $url = $row4['url'];
  76.         $description = stripslashes($row4['description']);
  77.         $name = trim($row4['name']);
  78.         $email = $row4['email'];
  79.         $submitter = $row4['submitter'];
  80.         $filesize = $row4['filesize'];
  81.         $version = $row4['version'];
  82.         $homepage = $row4['homepage'];
  83.         if ($submitter == "") {
  84.         $submitter = _NONE;
  85.         }
  86.             $homepage = ereg_replace("http://","",$homepage);
  87.         echo "<form action=\"admin.php\" method=\"post\">"
  88.         ."<b>"._DOWNLOADID.": $lid</b><br><br>"
  89.         .""._SUBMITTER.": <b>$submitter</b><br>"
  90.         .""._DOWNLOADNAME.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
  91.         .""._FILEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <a target=\"_blank\" href=\"$url\">"._CHECK."</a> ]<br>"
  92.         .""._DESCRIPTION.": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>"
  93.         .""._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\">  "
  94.         .""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"><br>"
  95.         .""._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"><br>"
  96.         .""._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"><br>"
  97.         .""._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://$homepage\"> [ <a href=\"http://$homepage\">"._VISIT."</a> ]<br>";
  98.         echo "<input type=\"hidden\" name=\"new\" value=\"1\">";
  99.         echo "<input type=\"hidden\" name=\"hits\" value=\"0\">";
  100.         echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
  101.         echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
  102.         echo ""._CATEGORY.": <select name=\"cat\">";
  103.     $result5 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by title");
  104.     while ($row5 = $db->sql_fetchrow($result5)) {
  105.         $cid2 = intval($row5['cid']);
  106.         $ctitle2 = $row5['title'];
  107.         $parentid2 = $row5['parentid'];
  108.         if ($cid2==$cid) {
  109.             $sel = "selected";
  110.         } else {
  111.             $sel = "";
  112.         }
  113.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  114.         echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
  115.     }
  116.  
  117.         echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
  118.         echo "</select><input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\"><input type=\"submit\" value="._ADD."> [ <a href=\"admin.php?op=DownloadsDelNew&lid=$lid\">"._DELETE."</a> ]</form><br><hr noshade><br>";
  119.     }
  120.     CloseTable();
  121.     echo "<br>";
  122.     } else {
  123.     }
  124.  
  125. /* Add a New Main Category */
  126.  
  127.     OpenTable();
  128.     echo "<center><font class=\"content\">[ <a href=\"admin.php?op=DownloadsCleanVotes\">"._CLEANDOWNLOADSDB."</a> | "
  129.     ."<a href=\"admin.php?op=DownloadsListBrokenDownloads\">"._BROKENDOWNLOADSREP." ($totalbrokendownloads)</a> | "
  130.     ."<a href=\"admin.php?op=DownloadsListModRequests\">"._DOWNLOADMODREQUEST." ($totalmodrequests)</a> | "
  131.     ."<a href=\"admin.php?op=DownloadsDownloadCheck\">"._VALIDATEDOWNLOADS."</a> ]</font></center>";
  132.     CloseTable();
  133.     echo "<br>";
  134.     OpenTable();
  135.     echo "<form method=\"post\" action=\"admin.php\">"
  136.     ."<font class=\"content\"><b>"._ADDMAINCATEGORY."</b><br><br>"
  137.     .""._NAME.": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"><br>"
  138.     .""._DESCRIPTION.":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\"></textarea><br>"
  139.     ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddCat\">"
  140.     ."<input type=\"submit\" value=\""._ADD."\"><br>"
  141.     ."</form>";
  142.     CloseTable();
  143.     echo "<br>";
  144.  
  145. // Add a New Sub-Category
  146.  
  147.     $result6 = $db->sql_query("SELECT * from ".$prefix."_downloads_categories");
  148.     $numrows = $db->sql_numrows($result6);
  149.     if ($numrows>0) {
  150.     OpenTable();
  151.     echo "<form method=\"post\" action=\"admin.php\">"
  152.         ."<font class=\"content\"><b>"._ADDSUBCATEGORY."</b></font><br><br>"
  153.         .""._NAME.": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"> "._IN." ";
  154.     $result7 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by parentid,title");
  155.     echo "<select name=\"cid\">";
  156.     while($row7 = $db->sql_fetchrow($result7)) {
  157.         $cid2 = intval($row7['cid']);
  158.         $ctitle2 = $row7['title'];
  159.         $parentid2 = intval($row7['parentid']);
  160.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  161.         echo "<option value=\"$cid2\">$ctitle2</option>";
  162.     }
  163.     echo "</select><br>"
  164.         .""._DESCRIPTION.":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\"></textarea><br>"
  165.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddSubCat\">"
  166.         ."<input type=\"submit\" value=\""._ADD."\"><br>"
  167.         ."</form>";
  168.     CloseTable();
  169.     echo "<br>";
  170.     } else {
  171.     }
  172.  
  173. // Add a New Download to Database
  174.  
  175.     $result8 = $db->sql_query("SELECT cid, title from ".$prefix."_downloads_categories");
  176.     $numrows = $db->sql_numrows($result8);
  177.     if ($numrows>0) {
  178.     OpenTable();
  179.     echo "<form method=\"post\" action=\"admin.php\">"
  180.         ."<font class=\"content\"><b>"._ADDNEWDOWNLOAD."</b><br><br>"
  181.         .""._DOWNLOADNAME.": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
  182.         .""._FILEURL.": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
  183.     $result9 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by title");
  184.     echo ""._CATEGORY.": <select name=\"cat\">";
  185.     while($row9 = $db->sql_fetchrow($result9)) {
  186.         $cid2 = intval($row9['cid']);
  187.         $ctitle2 = $row9['title'];
  188.         $parentid2 = intval($row9['parentid']);
  189.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  190.         echo "<option value=\"$cid2\">$ctitle2</option>";
  191.     }
  192.     echo "</select><br><br><br>"
  193.         .""._DESCRIPTION255."<br><textarea name=\"description\" cols=\"60\" rows=\"5\"></textarea><br><br><br>"
  194.         .""._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"><br><br>"
  195.         .""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
  196.         .""._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\"> ("._INBYTES.")<br><br>"
  197.         .""._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\"><br><br>"
  198.         .""._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://\"><br><br>"
  199.         .""._HITS.": <input type=\"text\" name=\"hits\" size=\"12\" maxlength=\"11\"><br><br>"
  200.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\">"
  201.             ."<input type=\"hidden\" name=\"new\" value=\"0\">"
  202.         ."<input type=\"hidden\" name=\"lid\" value=\"0\">"
  203.         ."<center><input type=\"submit\" value=\""._ADDURL."\"><br>"
  204.         ."</form>";
  205.     CloseTable();
  206.     echo "<br>";
  207.     } else {
  208.     }
  209.  
  210. // Modify Category
  211.  
  212.     $result10 = $db->sql_query("SELECT * from ".$prefix."_downloads_categories");
  213.     $numrows = $db->sql_numrows($result10);
  214.     if ($numrows>0) {
  215.     OpenTable();
  216.     echo "<form method=\"post\" action=\"admin.php\">"
  217.         ."<font class=\"content\"><b>"._MODCATEGORY."</b></font><br><br>";
  218.     $result11 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by title");
  219.     echo ""._CATEGORY.": <select name=\"cat\">";
  220.     while($row11 = $db->sql_fetchrow($result11)) {
  221.         $cid2 = intval($row11['cid']);
  222.         $ctitle2 = $row11['title'];
  223.         $parentid2 = intval($row11['parentid']);
  224.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  225.         echo "<option value=\"$cid2\">$ctitle2</option>";
  226.     }
  227.     echo "</select>"
  228.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCat\">"
  229.         ."<input type=\"submit\" value=\""._MODIFY."\">"
  230.         ."</form>";
  231.     CloseTable();
  232.     echo "<br>";
  233.     } else {
  234.     }
  235.  
  236. // Modify Downloads
  237.  
  238.     $result12 = $db->sql_query("SELECT * from ".$prefix."_downloads_downloads");
  239.     $numrows = $db->sql_numrows($result12);
  240.     if ($numrows>0) {
  241.     OpenTable();
  242.     echo "<form method=\"post\" action=\"admin.php\">"
  243.     ."<font class=\"content\"><b>"._MODDOWNLOAD."</b><br><br>"
  244.     .""._DOWNLOADID.": <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\">  "
  245.     ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownload\">"
  246.     ."<input type=\"submit\" value=\""._MODIFY."\">"
  247.     ."</form>";
  248.     CloseTable();
  249.     echo "<br>";
  250.     } else {
  251.     }
  252.  
  253. // Transfer Categories
  254.  
  255.     $result13 = $db->sql_query("SELECT * from ".$prefix."_downloads_downloads");
  256.     $numrows = $db->sql_numrows($result13);
  257.     if ($numrows>0) {
  258.     OpenTable();
  259.     echo "<form method=\"post\" action=\"admin.php\">"
  260.         ."<font class=\"option\"><b>"._EZTRANSFERDOWNLOADS."</b></font><br><br>"
  261.         .""._CATEGORY.": "
  262.         ."<select name=\"cidfrom\">";
  263.     $result14 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by parentid,title");
  264.     while($row14 = $db->sql_fetchrow($result14)) {
  265.         $cid2 = intval($row14['cid']);
  266.         $ctitle2 = $row14['title'];
  267.         $parentid2 = intval($row14['parentid']);
  268.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  269.         echo "<option value=\"$cid2\">$ctitle2</option>";
  270.     }
  271.     echo "</select><br>"
  272.         .""._IN." "._CATEGORY.": ";
  273.     $result15 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by parentid,title");
  274.     echo "<select name=\"cidto\">";
  275.     while($row15 = $db->sql_fetchrow($result15)) {
  276.         $cid2 = intval($row15['cid']);
  277.         $ctitle2 = $row15['title'];
  278.         $parentid2 = intval($row15['parentid']);
  279.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  280.         echo "<option value=\"$cid2\">$ctitle2</option>";
  281.     }
  282.     echo "</select><br>"
  283.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsTransfer\">"
  284.         ."<input type=\"submit\" value=\""._EZTRANSFER."\"><br>"
  285.         ."</form>";
  286.     CloseTable();
  287.     echo "<br>";
  288.     } else {
  289.     }
  290.  
  291.     include ("footer.php");
  292. }
  293.  
  294. function DownloadsTransfer($cidfrom,$cidto) {
  295.     global $prefix, $db;
  296.     $cidfrom = intval($cidfrom);
  297.     $db->sql_query("update ".$prefix."_downloads_downloads set cid='$cidto' where cid='$cidfrom'");
  298.     Header("Location: admin.php?op=downloads");
  299. }
  300.  
  301. function DownloadsModDownload($lid) {
  302.     global $prefix, $db, $sitename;
  303.     include ("header.php");
  304.     GraphicAdmin();
  305.     global $anonymous;
  306.     $lid = intval($lid);
  307.     $result = $db->sql_query("SELECT cid, sid, title, url, description, name, email, hits, filesize, version, homepage from ".$prefix."_downloads_downloads where lid='$lid'");
  308.     OpenTable();
  309.     echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
  310.     CloseTable();
  311.     echo "<br>";
  312.     OpenTable();
  313.     echo "<center><font class=\"content\"><b>"._MODDOWNLOAD."</b></font></center><br><br>";
  314.     while($row = $db->sql_fetchrow($result)) {
  315.         $cid = intval($row['cid']);
  316.         $sid = intval($row['sid']);
  317.         $title = $row['title'];
  318.         $url = $row['url'];
  319.         $description = stripslashes($row['description']);
  320.         $name = $row['name'];
  321.         $email = $row['email'];
  322.         $hits = intval($row['hits']);
  323.         $filesize = $row['filesize'];
  324.         $version = $row['version'];
  325.         $homepage = $row['homepage'];
  326.         echo "<form action=admin.php method=post>"
  327.         .""._DOWNLOADID.": <b>$lid</b><br>"
  328.         .""._PAGETITLE.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
  329.         .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <a href=\"$url\">"._CHECK."</a> ]<br>"
  330.         .""._DESCRIPTION.":<br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>"
  331.         .""._AUTHORNAME.": <input type=\"text\" name=\"name\" size=\"50\" maxlength=\"100\" value=\"$name\"><br>"
  332.         .""._AUTHOREMAIL.": <input type=\"text\" name=\"email\" size=\"50\" maxlength=\"100\" value=\"$email\"><br>"
  333.         .""._FILESIZE.": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"><br>"
  334.         .""._VERSION.": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"><br>"
  335.         .""._HOMEPAGE.": <input type=\"text\" name=\"homepage\" size=\"50\" maxlength=\"200\" value=\"$homepage\"> [ <a href=\"$homepage\">"._VISIT."</a> ]<br>"
  336.         .""._HITS.": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\"><br>";
  337.     $result2 = $db->sql_query("SELECT cid, title, parentid from ".$prefix."_downloads_categories order by title");
  338.     echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
  339.         .""._CATEGORY.": <select name=\"cat\">";
  340.     while($row2 = $db->sql_fetchrow($result2)) {
  341.         $cid2 = intval($row2['cid']);
  342.         $ctitle2 = $row2['title'];
  343.         $parentid2 = intval($row2['parentid']);
  344.         if ($cid2==$cid) {
  345.             $sel = "selected";
  346.         } else {
  347.             $sel = "";
  348.         }
  349.         if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
  350.         echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
  351.     }
  352.     
  353.     echo "</select>"
  354.     ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownloadS\">"
  355.     ."<input type=\"submit\" value=\""._MODIFY."\"> [ <a href=\"admin.php?op=DownloadsDelDownload&lid=$lid\">"._DELETE."</a> ]</form><br>";
  356.     CloseTable();
  357.     echo "<br>";    
  358.     /* Modify or Add Editorial */
  359.         
  360.         $lid = intval($lid);
  361.     $resulted2 = $db->sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle from ".$prefix."_downloads_editorials where downloadid='$lid'");
  362.         $recordexist = $db->sql_numrows($resulted2);
  363.     OpenTable();
  364.     /* if returns 'bad query' status 0 (add editorial) */
  365.         if ($recordexist == 0) {
  366.             echo "<center><font class=\"content\"><b>"._ADDEDITORIAL."</b></font></center><br><br>"
  367.             ."<form action=\"admin.php\" method=\"post\">"
  368.             ."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
  369.             .""._EDITORIALTITLE.":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
  370.             .""._EDITORIALTEXT.":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
  371.             ."</select><input type=\"hidden\" name=\"op\" value=\"DownloadsAddEditorial\"><input type=\"submit\" value=\""._ADD."\">";
  372.         } else {
  373.     /* if returns 'cool' then status 1 (modify editorial) */
  374.             while($row3 = $db->sql_fetchrow($resulted2)) {
  375.             $adminid = intval($row3['adminid']);
  376.             $editorialtimestamp = $row3['editorialtimestamp'];
  377.             $editorialtext = stripslashes($row3['editorialtext']);
  378.             $editorialtitle = stripslashes($row3['editorialtitle']);
  379.             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);
  380.         $editorialtime = strftime("%F",mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]));
  381.         $date_array = explode("-", $editorialtime); 
  382.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  383.                $formatted_date = date("F j, Y", $timestamp);             
  384.             echo "<center><font class=\"content\"><b>Modify Editorial</b></font></center><br><br>"
  385.                 ."<form action=\"admin.php\" method=\"post\">"
  386.                 .""._AUTHOR.": $adminid<br>"
  387.                 .""._DATEWRITTEN.": $formatted_date<br><br>"
  388.                 ."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
  389.                 .""._EDITORIALTITLE.":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
  390.                 .""._EDITORIALTEXT.":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
  391.                     ."</select><input type=\"hidden\" name=\"op\" value=\"DownloadsModEditorial\"><input type=\"submit\" value=\""._MODIFY."\"> [ <a href=\"admin.php?op=DownloadsDelEditorial&downloadid=$lid\">"._DELETE."</a> ]";
  392.                 }
  393.         } 
  394.     CloseTable();
  395.     echo "<br>";
  396.     OpenTable();
  397.     /* Show Comments */
  398.     $result4 = $db->sql_query("SELECT ratingdbid, ratinguser, ratingcomments, ratingtimestamp FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid' AND ratingcomments != '' ORDER BY ratingtimestamp DESC");
  399.     $totalcomments = $db->sql_numrows($result4);
  400.     echo "<table valign=top width=100%>";
  401.     echo "<tr><td colspan=7><b>"._DOWNLOADCOMMENTS." ("._DOWNLOADCOMMENTSTOTAL." $totalcomments)</b><br><br></td></tr>";
  402.     echo "<tr><td width=20 colspan=1><b>"._DOWNLOADCOMMENTSUSER."  </b></td><td colspan=5><b>"._DOWNLOADCOMMENTSUSERCOM."  </b></td><td><b><center>"._DOWNLOADCOMMENTSUSERDEL."</center></b></td><br></tr>";
  403.     if ($totalcomments == 0) echo "<tr><td colspan=7><center><font color=cccccc>"._DOWNLOADCOMMENTNOCOM."<br></font></center></td></tr>";
  404.     $x=0;
  405.     $colorswitch="dddddd";
  406.     while($row4 = $db->sql_fetchrow($result4)) {
  407.     $ratingdbid = intval($row4['ratingdbid']);
  408.     $ratinguser = $row4['ratinguser'];
  409.     $ratingcomments = stripslashes($row4['ratingcomments']);
  410.     $ratingtimestamp = $row4['ratingtimestamp'];
  411.         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);
  412.         $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
  413.         $date_array = explode("-", $ratingtime); 
  414.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  415.             $formatted_date = date("F j, Y", $timestamp);
  416.             echo "<tr><td valign=top bgcolor=$colorswitch>$ratinguser</td><td valign=top colspan=5 bgcolor=$colorswitch>$ratingcomments</td><td bgcolor=$colorswitch><center><b><a href=admin.php?op=DownloadsDelComment&lid=$lid&rid=$ratingdbid>X</a></b></center></td><br></tr>";                       
  417.         $x++;
  418.         if ($colorswitch=="dddddd") $colorswitch="ffffff";
  419.             else $colorswitch="dddddd";        
  420.         }    
  421.  
  422.             
  423.     // Show Registered Users Votes
  424.     $result5 = $db->sql_query("SELECT ratingdbid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid' AND ratinguser != 'outside' AND ratinguser != '$anonymous' ORDER BY ratingtimestamp DESC");
  425.     $totalvotes = $db->sql_numrows($result5);
  426.     echo "<tr><td colspan=7><br><br><b>"._DOWNLOADREGUSERVOTES." ("._DOWNLOADTOTALVOTES." $totalvotes)</b><br><br></td></tr>";
  427.     echo "<tr><td><b>"._DOWNLOADCOMMENTSUSER."  </b></td><td><b>"._DOWNLOADVOTESIPADDR."  </b></td><td><b>"._DOWNLOADVOTERATING."  </b></td><td><b>"._DOWNLOADVOTEAVGRATING."  </b></td><td><b>"._DOWNLOADVOTETOTALRATING."  </b></td><td><b>"._DOWNLOADVOTEDATE."  </b></td></font></b><td><b><center>"._DOWNLOADCOMMENTSUSERDEL."</center></b></td><br></tr>";
  428.     if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>"._DOWNLOADVOTEREGVOTES."<br></font></center></td></tr>";
  429.     $x=0;
  430.     $colorswitch="dddddd";
  431.     while($row5 = $db->sql_fetchrow($result5)) {
  432.     $ratingdbid = intval($row5['ratingdbid']);
  433.     $ratinguser = $row5['ratinguser'];
  434.     $rating = intval($row5['rating']);
  435.     $ratinghostname = $row5['ratinghostname'];
  436.     $ratingtimestamp = $row5['ratingtimestamp'];
  437.         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);
  438.         $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
  439.         $date_array = explode("-", $ratingtime); 
  440.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  441.             $formatted_date = date("F j, Y", $timestamp); 
  442.         
  443.         //Individual user information
  444.         $result6 = $db->sql_query("SELECT rating FROM ".$prefix."_downloads_votedata WHERE ratinguser = '$ratinguser'");
  445.             $usertotalcomments = $db->sql_numrows($result6);
  446.             $useravgrating = 0;
  447.             while($row6 = $db->sql_fetchrow($result6)) {
  448.         $rating2 = intval($row6['rating']);
  449.             $useravgrating = $useravgrating + $rating2;
  450.             $useravgrating = $useravgrating / $usertotalcomments;
  451.             $useravgrating = number_format($useravgrating, 1);
  452.             echo "<tr><td bgcolor=$colorswitch>$ratinguser</td><td bgcolor=$colorswitch>$ratinghostname</td><td bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$useravgrating</td><td bgcolor=$colorswitch>$usertotalcomments</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
  453.         $x++;
  454.         if ($colorswitch=="dddddd") $colorswitch="ffffff";
  455.             else $colorswitch="dddddd";        
  456.         }    
  457.         
  458.     // Show Unregistered Users Votes
  459.     $lid = intval($lid);
  460.     $result7 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid' AND ratinguser = '$anonymous' ORDER BY ratingtimestamp DESC");
  461.     $totalvotes = $db->sql_numrows($result7);
  462.     echo "<tr><td colspan=7><b><br><br>"._DOWNLOADUNREGUSERVOTES." ("._DOWNLOADTOTALVOTES." $totalvotes)</b><br><br></td></tr>";
  463.     echo "<tr><td colspan=2><b>"._DOWNLOADVOTESIPADDR."  </b></td><td colspan=3><b>"._DOWNLOADVOTERATING."  </b></td><td><b>"._DOWNLOADVOTEDATE."  </b></font></td><td><b><center>"._DOWNLOADCOMMENTSUSERDEL."</center></b></td><br></tr>";
  464.     if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>"._DOWNLOADVOTEUNREGVOTES."<br></font></center></td></tr>";
  465.     $x=0;
  466.     $colorswitch="dddddd";
  467.     while($row7 = $db->sql_fetchrow($result7)) {
  468.     $ratingdbid = intval($row7['ratingdbid']);
  469.     $rating = intval($row7['rating']);
  470.     $ratinghostname = $row7['ratinghostname'];
  471.     $ratingtimestamp = $row7['ratingtimestamp'];
  472.         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);
  473.         $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
  474.         $date_array = explode("-", $ratingtime); 
  475.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  476.         $formatted_date = date("F j, Y", $timestamp); 
  477.         echo "<td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";           
  478.         $x++;
  479.         if ($colorswitch=="dddddd") $colorswitch="ffffff";
  480.             else $colorswitch="dddddd";        
  481.         }  
  482.         
  483.     // Show Outside Users Votes
  484.     $result8 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid' AND ratinguser = 'outside' ORDER BY ratingtimestamp DESC");
  485.     $totalvotes = $db->sql_numrows($result8);
  486.     echo "<tr><td colspan=7><b><br><br>"._DOWNLOADUNOUTUSERVOTES." ("._DOWNLOADTOTALVOTES." $totalvotes)</b><br><br></td></tr>";
  487.     echo "<tr><td colspan=2><b>"._DOWNLOADVOTESIPADDR."  </b></td><td colspan=3><b>"._DOWNLOADVOTERATING."  </b></td><td><b>"._DOWNLOADVOTEDATE."  </b></td></font></b><td><b><center>"._DOWNLOADCOMMENTSUSERDEL."</center></b></td><br></tr>";
  488.     if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>"._DOWNLOADVOTEOUTVOTES." $sitename<br></font></center></td></tr>";
  489.     $x=0;
  490.     $colorswitch="dddddd"; 
  491.     while($row8 = $db->sql_fetchrow($result8)) {
  492.     $ratingdbid = intval($row8['ratingdbid']);
  493.     $rating = intval($row8['rating']);
  494.     $ratinghostname = $row8['ratinghostname'];
  495.     $ratingtimestamp = $row8['ratingtimestamp'];
  496.         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);
  497.         $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
  498.         $date_array = explode("-", $ratingtime); 
  499.         $timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]); 
  500.         $formatted_date = date("F j, Y", $timestamp); 
  501.         echo "<tr><td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date  </font></b></td><td bgcolor=$colorswitch><center><b><a href=admin.php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";           
  502.         $x++;
  503.         if ($colorswitch=="dddddd") $colorswitch="ffffff";
  504.             else $colorswitch="dddddd";
  505.         }
  506.  
  507.     echo "<tr><td colspan=6><br></td></tr>";        
  508.     echo "</table>";
  509.        }
  510.     
  511.     }
  512.     echo "</form>";
  513.     CloseTable();
  514.     echo "<br>";
  515.     include ("footer.php");
  516. }
  517.  
  518. function DownloadsDelComment($lid, $rid) {
  519.     global $prefix, $db;
  520.     $lid = intval($lid);
  521.     $rid = intval($rid);
  522.     $db->sql_query("UPDATE ".$prefix."_downloads_votedata SET ratingcomments='' WHERE ratingdbid='$rid'");
  523.     $db->sql_query("UPDATE ".$prefix."_downloads_downloads SET totalcomments = (totalcomments - 1) WHERE lid='$lid'");
  524.     Header("Location: admin.php?op=DownloadsModDownload&lid=$lid");
  525.     
  526. }
  527.  
  528. function DownloadsDelVote($lid, $rid) {
  529.     global $prefix, $db;
  530.     $lid = intval($lid);
  531.     $rid = intval($rid);
  532.     $db->sql_query("delete from ".$prefix."_downloads_votedata where ratingdbid='$rid'");
  533.     $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid'");
  534.     $totalvotesDB = $db->sql_numrows($voteresult);
  535.     include ("voteinclude.php");
  536.     $db->sql_query("UPDATE ".$prefix."_downloads_downloads SET downloadratingsummary='$finalrating',totalvotes='$totalvotesDB',totalcomments='$truecomments' WHERE lid='$lid'");
  537.     Header("Location: admin.php?op=DownloadsModDownload&lid=$lid");
  538. }
  539.  
  540. function DownloadsListBrokenDownloads() {
  541.     global $bgcolor1, $bgcolor2, $prefix, $db, $user_prefix;
  542.     include ("header.php");
  543.     GraphicAdmin();
  544.     OpenTable();
  545.     echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
  546.     CloseTable();
  547.     echo "<br>";
  548.     OpenTable();
  549.     $result = $db->sql_query("SELECT requestid, lid, modifysubmitter from ".$prefix."_downloads_modrequest where brokendownload='1' order by requestid");
  550.     $totalbrokendownloads = $db->sql_numrows($result);
  551.     echo "<center><font class=\"content\"><b>"._DUSERREPBROKEN." ($totalbrokendownloads)</b></font></center><br><br><center>"
  552.     .""._DIGNOREINFO."<br>"
  553.     .""._DDELETEINFO."</center><br><br><br>"
  554.     ."<table align=\"center\" width=\"450\">";
  555.     if ($totalbrokendownloads==0) {
  556.     echo "<center><font class=\"content\">"._DNOREPORTEDBROKEN."</font></center><br><br><br>";
  557.     } else {
  558.         $colorswitch = $bgcolor2;
  559.         echo "<tr>"
  560.             ."<td><b>"._DOWNLOAD."</b></td>"
  561.             ."<td><b>"._SUBMITTER."</b></td>"
  562.             ."<td><b>"._DOWNLOADOWNER."</b></td>"
  563.             ."<td><b>"._IGNORE."</b></td>"
  564.             ."<td><b>"._DELETE."</b></td>"
  565.             ."<td><b>"._EDIT."</b></td>"
  566.             ."</tr>";
  567.         while($row = $db->sql_fetchrow($result)) {
  568.         $requestid = intval($row['requestid']);
  569.         $lid = intval($row['lid']);
  570.         $modifysubmitter = $row['modifysubmitter'];
  571.         $result2 = $db->sql_query("SELECT title, url, submitter from ".$prefix."_downloads_downloads where lid='$lid'");
  572.         if ($modifysubmitter != '$anonymous') {
  573.         $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'"));
  574.         $email = stripslashes($row3['user_email']);
  575.         }
  576.     $row2 = $db->sql_fetchrow($result2);
  577.             $title = stripslashes($row2['title']);
  578.             $url = $row2['url'];
  579.             $owner = $row2['submitter'];
  580.             $row4 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'"));
  581.             $owneremail = stripslashes($row4['user_email']);
  582.             echo "<tr>"
  583.             ."<td bgcolor=\"$colorswitch\"><a href=\"$url\">$title</a>"
  584.             ."</td>";
  585.             if ($email=='') {
  586.         echo "<td bgcolor=\"$colorswitch\">$modifysubmitter";
  587.         } else {
  588.         echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$email\">$modifysubmitter</a>";
  589.         }
  590.             echo "</td>";
  591.             if ($owneremail=='') {
  592.         echo "<td bgcolor=\"$colorswitch\">$owner";
  593.         } else {
  594.         echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$owneremail\">$owner</a>";
  595.         }
  596.             echo "</td>"
  597.             ."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?op=DownloadsIgnoreBrokenDownloads&lid=$lid\">X</a></center>"
  598.             ."</td>"
  599.             ."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?op=DownloadsDelBrokenDownloads&lid=$lid\">X</a></center>"
  600.             ."</td>"
  601.             ."<td bgcolor=\"$colorswitch\"><center><a href=\"admin.php?op=DownloadsModDownload&lid=$lid\">X</a></center>"
  602.             ."</td>"
  603.         ."</tr>";
  604.             if ($colorswitch == $bgcolor2) {
  605.         $colorswitch = $bgcolor1;
  606.                } else {
  607.         $colorswitch = $bgcolor2;
  608.         }
  609.         }
  610.     }
  611.     echo "</table>";
  612.     CloseTable();
  613.     include ("footer.php");
  614. }
  615.  
  616. function DownloadsDelBrokenDownloads($lid) {
  617.     global $prefix, $db;
  618.     $lid = intval($lid);
  619.     $db->sql_query("delete from ".$prefix."_downloads_modrequest where lid='$lid'");
  620.     $db->sql_query("delete from ".$prefix."_downloads_downloads where lid='$lid'");
  621.     Header("Location: admin.php?op=DownloadsListBrokenDownloads");
  622. }
  623.  
  624. function DownloadsIgnoreBrokenDownloads($lid) {
  625.     global $prefix, $db;
  626.     $lid = intval($lid);
  627.     $db->sql_query("delete from ".$prefix."_downloads_modrequest where lid='$lid' and brokendownload='1'");
  628.     Header("Location: admin.php?op=DownloadsListBrokenDownloads");
  629. }
  630.  
  631. function DownloadsListModRequests() {
  632.     global $bgcolor2, $prefix, $db, $user_prefix;
  633.     include ("header.php");
  634.     GraphicAdmin();
  635.     OpenTable();
  636.     echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
  637.     CloseTable();
  638.     echo "<br>";
  639.     OpenTable();
  640.     $result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description, modifysubmitter, name, email, filesize, version, homepage from ".$prefix."_downloads_modrequest where brokendownload='0' order by requestid");
  641.     $totalmodrequests = $db->sql_numrows($result);
  642.     echo "<center><font class=\"content\"><b>"._DUSERMODREQUEST." ($totalmodrequests)</b></font></center><br><br><br>";
  643.     echo "<table width=\"95%\"><tr><td>";
  644.     while($row = $db->sql_fetchrow($result)) {
  645.         $requestid = intval($row['requestid']);
  646.         $lid = intval($row['lid']);
  647.         $cid = intval($row['cid']);
  648.         $sid = intval($row['sid']);
  649.         $title = stripslashes($row['title']);
  650.         $url = $row['url'];
  651.         $description = stripslashes($row['description']);
  652.         $modifysubmitter = $row['modifysubmitter'];
  653.         $name = $row['name'];
  654.         $email = stripslashes($row['email']);
  655.         $filesize = $row['filesize'];
  656.         $version = $row['version'];
  657.         $homepage = $row['homepage'];
  658.     $row2 = $db->sql_fetchrow($db->sql_query("SELECT cid, sid, title, url, description, name, email, submitter, filesize, version, homepage from ".$prefix."_downloads_downloads where lid='$lid'"));
  659.         $origcid = intval($row2['cid']);
  660.         $origsid = intval($row2['sid']);
  661.         $origtitle = stripslashes($row2['title']);
  662.         $origurl = $row2['url'];
  663.         $origdescription = stripslashes($row2['description']);
  664.         $origname = $row2['name'];
  665.         $origemail = stripslashes($row2['email']);
  666.         $owner = $row2['submitter'];
  667.         $origfilesize = $row2['filesize'];
  668.         $origversion = $row2['version'];
  669.         $orighomepage = $row2['homepage'];
  670.     $result3 = $db->sql_query("SELECT title from ".$prefix."_downloads_categories where cid='$cid'");
  671.     $result5 = $db->sql_query("SELECT title from ".$prefix."_downloads_categories where cid='$origcid'");
  672.     $result7 = $db->sql_query("SELECT user_email from ".$user_prefix."_users where username='$modifysubmitter'");
  673.     $result8 = $db->sql_query("SELECT user_email from ".$user_prefix."_users where username='$owner'");
  674.     $row3 = $db->sql_fetchrow($result3);
  675.         $cidtitle = stripslashes($row3['title']);
  676.     $row5 = $db->sql_fetchrow($result5);
  677.         $origcidtitle = stripslashes($row5['title']);
  678.     $row7 = $db->sql_fetchrow($result7);
  679.         $modifysubmitteremail = stripslashes($row7['user_email']);
  680.     $row8 = $db->sql_fetchrow($result8);
  681.         $owneremail = stripslashes($row8['user_email']);
  682.         if ($owner=="") {
  683.         $owner=""._DOWNOWNERNEW."";
  684.     }
  685.         if ($origsidtitle=="") {
  686.         $origsidtitle= "-----";
  687.     }
  688.         if ($sidtitle=="") {
  689.         $sidtitle= "-----";
  690.     }
  691.         echo "<table border=\"1\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\" width=\"450\">"
  692.             ."<tr>"
  693.             ."<td>"
  694.             ."<table width=\"100%\" bgcolor=\"$bgcolor2\">"
  695.             ."<tr>"
  696.             ."<td valign=\"top\" width=\"45%\"><b>"._ORIGINAL."</b></td>"
  697.             ."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>"._DESCRIPTION.":<br>$origdescription</font></td>"
  698.             ."</tr>"
  699.             ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._TITLE.": $origtitle</td></tr>"
  700.             ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._URL.": <a href=\"$origurl\">$origurl</a></td></tr>"
  701.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._CATEGORY.": $origcidtitle</td></tr>"
  702.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._SUBCATEGORY.": $origsidtitle</td></tr>"
  703.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._AUTHORNAME.": $origname</td></tr>"
  704.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._AUTHOREMAIL.": $origemail</td></tr>"
  705.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._FILESIZE.": $origfilesize</td></tr>"
  706.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._VERSION.": $origversion</td></tr>"
  707.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._HOMEPAGE.": <a href=\"$orighomepage\" target=\"new\">$orighomepage</a></td></tr>"
  708.             ."</table>"
  709.             ."</td>"
  710.             ."</tr>"
  711.             ."<tr>"
  712.             ."<td>"
  713.             ."<table width=\"100%\">"
  714.             ."<tr>"
  715.             ."<td valign=\"top\" width=\"45%\"><b>"._PROPOSED."</b></td>"
  716.             ."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>"._DESCRIPTION.":<br>$description</font></td>"
  717.             ."</tr>"
  718.             ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._TITLE.": $title</td></tr>"
  719.             ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._URL.": <a href=\"$url\">$url</a></td></tr>"
  720.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._CATEGORY.": $cidtitle</td></tr>"
  721.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._SUBCATEGORY.": $sidtitle</td></tr>"
  722.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._AUTHORNAME.": $name</td></tr>"
  723.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._AUTHOREMAIL.": $email</td></tr>"
  724.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._FILESIZE.": $filesize</td></tr>"
  725.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._VERSION.": $version</td></tr>"
  726.         ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">"._HOMEPAGE.": <a href=\"$homepage\" target=\"new\">$homepage</a></td></tr>"
  727.             ."</table>"
  728.             ."</td>"
  729.             ."</tr>"
  730.             ."</table>"
  731.             ."<table align=\"center\" width=\"450\">"
  732.             ."<tr>";
  733.         if ($modifysubmitteremail=="") {
  734.         echo "<td align=\"left\"><font class=\"tiny\">"._SUBMITTER.":  $modifysubmitter</font></td>";
  735.     } else {
  736.         echo "<td align=\"left\"><font class=\"tiny\">"._SUBMITTER.":  <a href=\"mailto:$modifysubmitteremail\">$modifysubmitter</a></font></td>";
  737.     }
  738.         if ($owneremail=="") {
  739.         echo "<td align=\"center\"><font class=\"tiny\">"._OWNER.":  $owner</font></td>";
  740.     } else {
  741.         echo "<td align=\"center\"><font class=\"tiny\">"._OWNER.": <a href=\"mailto:$owneremail\">$owner</a></font></td>";
  742.     }
  743.         echo "<td align=\"right\"><font class=\"tiny\">( <a href=\"admin.php?op=DownloadsChangeModRequests&requestid=$requestid\">"._ACCEPT."</a> / <a href=\"admin.php?op=DownloadsChangeIgnoreRequests&requestid=$requestid\">"._IGNORE."</a> )</font></td></tr></table><br><br>";
  744.     }
  745.     if ($totalmodrequests == 0) {
  746.     echo "<center>"._NOMODREQUESTS."<br><br>"
  747.         .""._GOBACK."<br><br></center>";
  748.     }
  749.     echo "</td></tr></table>";
  750.     CloseTable();
  751.     include ("footer.php");
  752. }
  753.  
  754. function DownloadsChangeModRequests($requestid) {
  755.     global $prefix, $db;
  756.     $requestid = intval($requestid);
  757.     $result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description, name, email, filesize, version, homepage from ".$prefix."_downloads_modrequest where requestid='$requestid'");
  758.     while ($row = $db->sql_fetchrow($result)) {
  759.         $requestid = intval($row['requestid']);
  760.         $lid = intval($row['lid']);
  761.         $cid = intval($row['cid']);
  762.         $sid = intval($row['sid']);
  763.         $title = stripslashes($row['title']);
  764.         $url = $row['url'];
  765.         $description = stripslashes($row['description']);
  766.         $name = $row['name'];
  767.         $email = stripslashes($row['email']);
  768.         $filesize = $row['filesize'];
  769.         $version = $row['version'];
  770.         $homepage = $row['homepage'];
  771.         $db->sql_query("UPDATE ".$prefix."_downloads_downloads SET cid='$cid', sid='$sid', title='$title', url='$url', description='$description', name='$name', email='$email', filesize='$filesize', version='$version', homepage='$homepage' WHERE lid='$lid'");
  772.     $db->sql_query("delete from ".$prefix."_downloads_modrequest where requestid='$requestid'");
  773.     }
  774.     Header("Location: admin.php?op=DownloadsListModRequests");
  775. }
  776.  
  777. function DownloadsChangeIgnoreRequests($requestid) {
  778.     global $prefix, $db;
  779.     $requestid = intval($requestid);
  780.     $db->sql_query("delete from ".$prefix."_downloads_modrequest where requestid='$requestid'");
  781.     Header("Location: admin.php?op=DownloadsListModRequests");
  782. }
  783.  
  784. function DownloadsCleanVotes() {
  785.     global $prefix, $db;
  786.     $lid = intval($lid);
  787.     $result = $db->sql_query("SELECT distinct ratinglid FROM ".$prefix."_downloads_votedata");
  788.     while ($row = $db->sql_fetchrow($result)) {
  789.     $lid = intval($row['ratinglid']);
  790.     $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM ".$prefix."_downloads_votedata WHERE ratinglid='$lid'");
  791.     $totalvotesDB = $db->sql_numrows($voteresult);
  792.     include ("voteinclude.php");
  793.         $db->sql_query("UPDATE ".$prefix."_downloads_downloads SET downloadratingsummary='$finalrating',totalvotes='$totalvotesDB',totalcomments='$truecomments' WHERE lid='$lid'");
  794.     }
  795.     Header("Location: admin.php?op=downloads");
  796. }
  797.  
  798. function DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage) {
  799.     global $prefix, $db;
  800.     $cat = explode("-", $cat);
  801.     if ($cat[1]=="") {
  802.         $cat[1] = 0;
  803.     }
  804.     $title = stripslashes(FixQuotes($title));
  805.     $url = stripslashes(FixQuotes($url));
  806.     $description = stripslashes(FixQuotes($description));
  807.     $name = stripslashes(FixQuotes($name));
  808.     $email = stripslashes(FixQuotes($email));
  809.     $lid = intval($lid);
  810.     $db->sql_query("update ".$prefix."_downloads_downloads set cid='$cat[0]', sid='$cat[1]', title='$title', url='$url', description='$description', name='$name', email='$email', hits='$hits', filesize='$filesize', version='$version', homepage='$homepage' where lid='$lid'");
  811.     Header("Location: admin.php?op=downloads");
  812. }
  813.  
  814. function DownloadsDelDownload($lid) {
  815.     global $prefix, $db;
  816.     $lid = intval($lid);
  817.     $db->sql_query("delete from ".$prefix."_downloads_downloads where lid='$lid'");
  818.     Header("Location: admin.php?op=downloads");
  819. }
  820.  
  821. function DownloadsModCat($cat) {
  822.     global $prefix, $db;
  823.     include ("header.php");
  824.     GraphicAdmin();
  825.     OpenTable();
  826.     echo "<center><font class=\"title\"><b>"._WEBDOWNLOADSADMIN."</b></font></center>";
  827.     CloseTable();
  828.     echo "<br>";
  829.     $cat = explode("-", $cat);
  830.     if ($cat[1]=="") {
  831.         $cat[1] = 0;
  832.     }
  833.     OpenTable();
  834.     echo "<center><font class=\"content\"><b>"._MODCATEGORY."</b></font></center><br><br>";
  835.     if ($cat[1]==0) {
  836.     $row = $db->sql_fetchrow($db->sql_query("SELECT title, cdescription from ".$prefix."_downloads_categories where cid='$cat[0]'"));
  837.     $title = stripslashes($row['title']);
  838.     $cdescription = stripslashes($row['cdescription']);
  839.     echo "<form action=\"admin.php\" method=\"get\">"
  840.         .""._NAME.": <input type=\"text\" name=\"title\" value=\"$title\" size=\"51\" maxlength=\"50\"><br>"
  841.         .""._DESCRIPTION.":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\">$cdescription</textarea><br>"
  842.         ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
  843.         ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
  844.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
  845.         ."<table border=\"0\"><tr><td>"
  846.         ."<input type=\"submit\" value=\""._SAVECHANGES."\"></form></td><td>"
  847.         ."<form action=\"admin.php\" method=\"get\">"
  848.         ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
  849.         ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
  850.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
  851.         ."<input type=\"submit\" value=\""._DELETE."\"></form></td></tr></table>";
  852.     } else {
  853.     $row2 = $db->sql_fetchrow($db->sql_query("SELECT title from ".$prefix."_downloads_categories where cid='$cat[0]'"));
  854.     $ctitle = stripslashes($row2['title']);
  855.     $row3 = $db->sql_fetchrow($db->sql_query("SELECT title from ".$prefix."_downloads_subcategories where sid='$cat[1]'"));
  856.     $stitle = stripslashes($row3['title']);
  857.     echo "<form action=\"admin.php\" method=\"get\">"
  858.         .""._CATEGORY.": $ctitle<br>"
  859.         .""._SUBCATEGORY.": <input type=\"text\" name=\"title\" value=\"$stitle\" size=\"51\" maxlength=\"50\"><br>"
  860.         ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
  861.         ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
  862.         ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
  863.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
  864.         ."<table border=\"0\"><tr><td>"
  865.         ."<input type=\"submit\" value=\""._SAVECHANGES."\"></form></td><td>"
  866.         ."<form action=\"admin.php\" method=\"get\">"
  867.         ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
  868.         ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
  869.         ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
  870.         ."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
  871.         ."<input type=\"submit\" value=\""._DELETE."\"></form></td></tr></table>";
  872.     }
  873.     CloseTable();
  874.     include("footer.php");
  875. }
  876.  
  877. function DownloadsModCatS($cid, $sid, $sub, $title, $cdescription) {
  878.     global $prefix, $db;
  879.     $cid = intval($cid);
  880.     $sid = intval($sid);
  881.     if ($sub==0) {
  882.     $db->sql_query("update ".$prefix."_downloads_categories set title='$title', cdescription='$cdescription' where cid='$cid'");
  883.     } else {
  884.     $db->sql_query("update ".$prefix."_downloads_subcategories set title='$title' where sid='$sid'");
  885.     }
  886.     Header("Location: admin.php?op=downloads");
  887. }
  888.  
  889. function DownloadsDelCat($cid, $sid, $sub, $ok=0) {
  890.     global $prefix, $db;
  891.     if($ok==1) {
  892.     if ($sub>0) {
  893.         $db->sql_query("delete from ".$prefix."_downloads_categories where cid='$cid'");
  894.         $db->sql_query("delete from ".$prefix."_downloads_downloads where cid='$cid'");
  895.     } else {
  896.         $db->sql_query("delete from ".$prefix."_downloads_downloads where cid='$cid'");
  897.         // suppression des liens de catΘgories filles
  898.         $result2 = $db->sql_query("SELECT cid from ".$prefix."_downloads_categories where parentid='$cid'");
  899.     while ($row2 = $db->sql_fetchrow($result2)) {
  900.     $cid2 = intval($row2['cid']);
  901.             $db->sql_query("delete from ".$prefix."_downloads_downloads where cid='$cid2'");
  902.         }
  903.         $db->sql_query("delete from ".$prefix."_downloads_categories where parentid='$cid'");
  904.         $db->sql_query("delete from ".$prefix."_downloads_categories where cid='$cid'");
  905.     }
  906.     Header("Location: admin.php?op=downloads");    
  907.     } else {
  908.     $result = $db->sql_query("SELECT * from ".$prefix."_downloads_categories where parentid='$cid'");
  909.     $nbsubcat = $db->sql_numrows($result);
  910.     $result3 = $db->sql_query("SELECT cid from ".$prefix."_downloads_categories where parentid='$cid'");
  911.     while ($row3 = $db->sql_fetchrow($result3)) {
  912.     $cid2 = intval($row3['cid']);
  913.         $result4 = $db->sql_query("SELECT * from ".$prefix."_downloads_downloads where cid='$cid2'");
  914.         $nblink = $db->sql_numrows($result4);
  915.     }
  916.  
  917.     include("header.php");
  918.     GraphicAdmin();
  919.     OpenTable();
  920.     echo "<br><center><font class=\"option\">";
  921.     echo "<b>"._EZTHEREIS." $nbsubcat "._EZSUBCAT." "._EZATTACHEDTOCAT."</b><br>";
  922.     echo "<b>"._EZTHEREIS." $nblink "._downloads." "._EZATTACHEDTOCAT."</b><br>";
  923.     echo "<b>"._DELEZDOWNLOADSCATWARNING."</b><br><br>";
  924.     }
  925.     echo "[ <a href=\"admin.php?op=DownloadsDelCat&cid=$cid&sid=$sid&sub=$sub&ok=1\">"._YES."</a> | <a href=\"admin.php?op=Links\">"._NO."</a> ]<br><br>";
  926.     CloseTable();
  927.     include("footer.php");    
  928. }
  929.  
  930. function DownloadsDelNew($lid) {
  931.     global $prefix, $db;
  932.     $lid = intval($lid);
  933.     $db->sql_query("delete from ".$prefix."_downloads_newdownload where lid='$lid'");
  934.     Header("Location: admin.php?op=downloads");
  935. }
  936.  
  937. function DownloadsAddCat($title, $cdescription) {
  938.     global $prefix, $db;
  939.     $result = $db->sql_query("SELECT cid from ".$prefix."_downloads_categories where title='$title'");
  940.     $numrows = $db->sql_numrows($result);
  941.     if ($numrows>0) {
  942.     include("header.php");
  943.     GraphicAdmin();
  944.     OpenTable();
  945.     echo "<br><center><font class=\"content\">"
  946.         ."<b>" . _ERRORTHECATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
  947.         ."" . _GOBACK . "<br><br>";
  948.     CloseTable();
  949.     include("footer.php");
  950.     } else {
  951.     $db->sql_query("insert into ".$prefix."_downloads_categories values (NULL, '$title', '$cdescription', '$parentid')");
  952.     Header("Location: admin.php?op=downloads");
  953.     }
  954. }
  955.  
  956. function DownloadsAddSubCat($cid, $title, $cdescription) {
  957.     global $prefix, $db;
  958.     $cid = intval($cid);
  959.     $result = $db->sql_query("SELECT cid from ".$prefix."_downloads_categories where title='$title' AND cid='$cid'");
  960.     $numrows = $db->sql_numrows($result);
  961.     if ($numrows>0) {
  962.     include("header.php");
  963.     GraphicAdmin();
  964.     OpenTable();
  965.     echo "<br><center>";
  966.     echo "<font class=\"content\">"
  967.         ."<b>" . _ERRORTHESUBCATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
  968.         ."" . _GOBACK . "<br><br>";
  969.     include("footer.php");
  970.     } else {
  971.     $db->sql_query("insert into ".$prefix."_downloads_categories values (NULL, '$title', '$cdescription', '$cid')");
  972.     Header("Location: admin.php?op=downloads");
  973.     }
  974. }
  975.  
  976. function DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext) {
  977.     global $aid, $prefix, $db;
  978.     $editorialtext = stripslashes(FixQuotes($editorialtext));
  979.     $db->sql_query("insert into ".$prefix."_downloads_editorials values ('$downloadid', '$aid', now(), '$editorialtext', '$editorialtitle')");
  980.     include("header.php");
  981.     GraphicAdmin();
  982.     OpenTable();
  983.     echo "<center><br>"
  984.     ."<font class=option>"
  985.     ."" . _EDITORIALADDED . "<br><br>"
  986.     ."[ <a href=\"admin.php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
  987.     echo "$downloadid  $adminid, $editorialtitle, $editorialtext";
  988.     CloseTable();
  989.     include("footer.php");
  990. }
  991.  
  992. function DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext) {
  993.     global $prefix, $db;
  994.     $editorialtext = stripslashes(FixQuotes($editorialtext));
  995.     $db->sql_query("update ".$prefix."_downloads_editorials set editorialtext='$editorialtext', editorialtitle='$editorialtitle' where downloadid='$downloadid'");
  996.     include("header.php");
  997.     GraphicAdmin();
  998.     OpenTable();
  999.     echo "<br><center>"
  1000.     ."<font class=\"content\">"
  1001.     ."" . _EDITORIALMODIFIED . "<br><br>"
  1002.     ."[ <a href=\"admin.php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
  1003.     CloseTable();
  1004.     include("footer.php");
  1005. }
  1006.  
  1007. function DownloadsDelEditorial($downloadid) {
  1008.     global $prefix, $db;
  1009.     $downloadid = intval($downloadid);
  1010.     $db->sql_query("delete from ".$prefix."_downloads_editorials where downloadid='$downloadid'");
  1011.     include("header.php");
  1012.     GraphicAdmin();
  1013.     OpenTable();
  1014.     echo "<br><center>"
  1015.     ."<font class=\"content\">"
  1016.     ."" . _EDITORIALREMOVED . "<br><br>"
  1017.     ."[ <a href=\"admin.php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
  1018.     CloseTable();
  1019.     include("footer.php");
  1020. }
  1021.  
  1022. function DownloadsDownloadCheck() {
  1023.     global $prefix, $db;
  1024.     $cid = intval($cid);
  1025.     include ("header.php");
  1026.     GraphicAdmin();
  1027.     OpenTable();
  1028.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1029.     CloseTable();
  1030.     echo "<br>";
  1031.     OpenTable();
  1032.     echo "<center><font class=\"content\"><b>" . _DOWNLOADVALIDATION . "</b></font></center><br>"
  1033.     ."<table width=\"100%\" align=\"center\"><tr><td colspan=\"2\" align=\"center\">"
  1034.     ."<a href=\"admin.php?op=DownloadsValidate&cid=0&sid=0\">" . _CHECKALLDOWNLOADS . "</a><br><br></td></tr>"
  1035.     ."<tr><td valign=\"top\"><center><b>" . _CHECKCATEGORIES . "</b><br>" . _INCLUDESUBCATEGORIES . "<br><br><font class=\"tiny\">";
  1036.     $result = $db->sql_query("SELECT cid, title from ".$prefix."_downloads_categories order by title");
  1037.     while ($row = $db->sql_fetchrow($result)) {
  1038.     $cid = intval($row['cid']);
  1039.     $title = $row['title'];
  1040.         $transfertitle = str_replace (" ", "_", $title);
  1041.         echo "<a href=\"admin.php?op=DownloadsValidate&cid=$cid&sid=0&ttitle=$transfertitle\">$title</a><br>";
  1042.     }
  1043.     echo "</font></center></td></tr></table>";
  1044.     CloseTable();
  1045.     include ("footer.php");
  1046. }
  1047.  
  1048. function DownloadsValidate($cid, $sid, $ttitle) {
  1049.     global $bgcolor2, $prefix, $db;
  1050.     include ("header.php");
  1051.     GraphicAdmin();
  1052.     OpenTable();
  1053.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1054.     CloseTable();
  1055.     echo "<br>";
  1056.     OpenTable();
  1057.     $transfertitle = str_replace ("_", "", $ttitle);
  1058.     /* Check ALL Downloads */
  1059.     $cid = intval($cid);
  1060.     $sid = intval($sid);
  1061.     echo "<table width=100% border=0>";
  1062.     if ($cid==0 && $sid==0) {
  1063.     echo "<tr><td colspan=\"3\"><center><b>" . _CHECKALLDOWNLOADS . "</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
  1064.     $result = $db->sql_query("SELECT lid, title, url, name, email, submitter from ".$prefix."_downloads_downloads order by title");
  1065.     }
  1066.     /* Check Categories & Subcategories */
  1067.     if ($cid!=0 && $sid==0) {
  1068.     echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
  1069.     $result2 = $db->sql_query("SELECT lid, title, url, name, email, submitter from ".$prefix."_downloads_downloads where cid='$cid' order by title");
  1070.     }
  1071.     /* Check Only Subcategory */
  1072.     if ($cid==0 && $sid!=0) {
  1073.        echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGSUBCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
  1074.        $result3 = $db->sql_query("SELECT lid, title, url, name, email, submitter from ".$prefix."_downloads_downloads where sid='$sid' order by title");
  1075.     }
  1076.     echo "<tr><td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _STATUS . "</b></td><td bgcolor=\"$bgcolor2\" width=\"100%\"><b>" . _DOWNLOADTITLE . "</b></td><td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _FUNCTIONS . "</b></td></tr>";
  1077.     while($row3 = $db->sql_fetchrow($result3)) {
  1078.     $lid = intval($row3['lid']);
  1079.     $title = stripslashes($row3['title']);
  1080.     $vurl = parse_url($row3['url']);
  1081.     $name = $row3['name'];
  1082.     $email = stripslashes($row3['email']);
  1083.     $submitter = $row3['submitter'];
  1084.     $fp = fsockopen($vurl['host'], 80, $errno, $errstr, 15);
  1085.         if (!$fp){
  1086.         echo "<tr><td align=\"center\"><b>  " . _FAILED . "  </b></td>"
  1087.         ."<td>  <a href=\"$url\" target=\"new\">$title</a>  </td>"
  1088.         ."<td align=\"center\"><font class=\"content\">  [ <a href=\"admin.php?op=DownloadsModDownload&lid=$lid\">" . _EDIT . "</a> | <a href=\"admin.php?op=DownloadsDelDownload&lid=$lid\">" . _DELETE . "</a> ]  </font>"
  1089.         ."</td></tr>";
  1090.         }
  1091.         if ($fp){
  1092.         echo "<tr><td align=\"center\">  " . _OK . "  </td>"
  1093.         ."<td>  <a href=\"$url\" target=\"new\">$title</a>  </td>"
  1094.         ."<td align=\"center\"><font class=\"content\">  " . _NONE . "  </font>"
  1095.         ."</td></tr>";
  1096.         }
  1097.     }
  1098.     echo "</table>";
  1099.     CloseTable();
  1100.     include ("footer.php");
  1101. }
  1102.  
  1103. function DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter, $filesize, $version, $homepage, $hits) {
  1104.     global $prefix, $db;
  1105.     $result = $db->sql_query("SELECT url from ".$prefix."_downloads_downloads where url='$url'");
  1106.     $numrows = $db->sql_numrows($result);
  1107.     if ($numrows>0) {
  1108.     include("header.php");
  1109.     GraphicAdmin();
  1110.     OpenTable();
  1111.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1112.     CloseTable();
  1113.     echo "<br>";
  1114.     OpenTable();
  1115.     echo "<br><center>"
  1116.         ."<font class=\"content\">"
  1117.         ."<b>" . _ERRORURLEXIST . "</b><br><br>"
  1118.         ."" . _GOBACK . "<br><br>";
  1119.     CloseTable();
  1120.     include("footer.php");
  1121.     } else {
  1122. /* Check if Title exist */
  1123.     if ($title=="") {
  1124.     include("header.php");
  1125.     GraphicAdmin();
  1126.     OpenTable();
  1127.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1128.     CloseTable();
  1129.     echo "<br>";
  1130.     OpenTable();
  1131.     echo "<br><center>"
  1132.         ."<font class=\"content\">"
  1133.         ."<b>" . _ERRORNOTITLE . "</b><br><br>"
  1134.         ."" . _GOBACK . "<br><br>";
  1135.     CloseTable();
  1136.     include("footer.php");
  1137.     }
  1138. /* Check if URL exist */
  1139.     if ($url=="") {
  1140.     include("header.php");
  1141.     GraphicAdmin();
  1142.     OpenTable();
  1143.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1144.     CloseTable();
  1145.     echo "<br>";
  1146.     OpenTable();
  1147.     echo "<br><center>"
  1148.         ."<font class=\"content\">"
  1149.         ."<b>" . _ERRORNOURL . "</b><br><br>"
  1150.         ."" . _GOBACK . "<br><br>";
  1151.     CloseTable();
  1152.     include("footer.php");
  1153.     }
  1154. // Check if Description exist
  1155.     if ($description=="") {
  1156.     include("header.php");
  1157.     GraphicAdmin();
  1158.     OpenTable();
  1159.     echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
  1160.     CloseTable();
  1161.     echo "<br>";
  1162.     OpenTable();
  1163.     echo "<br><center>"
  1164.         ."<font class=\"content\">"
  1165.         ."<b>" . _ERRORNODESCRIPTION . "</b><br><br>"
  1166.         ."" . _GOBACK . "<br><br>";
  1167.     CloseTable();
  1168.     include("footer.php");
  1169.     }
  1170.     $cat = explode("-", $cat);
  1171.     if ($cat[1]=="") {
  1172.     $cat[1] = 0;
  1173.     }
  1174.     $title = stripslashes(FixQuotes($title));
  1175.     $url = stripslashes(FixQuotes($url));
  1176.     $description = stripslashes(FixQuotes($description));
  1177.     $name = stripslashes(FixQuotes($name));
  1178.     $email = stripslashes(FixQuotes($email));
  1179.     $db->sql_query("insert into ".$prefix."_downloads_downloads values (NULL, '$cat[0]', '$cat[1]', '$title', '$url', '$description', now(), '$name', '$email', '$hits','$submitter',0,0,0, '$filesize', '$version', '$homepage')");
  1180.     global $nukeurl, $sitename;
  1181.     include("header.php");
  1182.     GraphicAdmin();
  1183.     OpenTable();
  1184.     echo "<br><center>";
  1185.     echo "<font class=\"content\">";
  1186.     echo "" . _NEWDOWNLOADADDED . "<br><br>";
  1187.     echo "[ <a href=\"admin.php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]</center><br><br>";
  1188.     CloseTable();
  1189.     if ($new==1) {
  1190.     $db->sql_query("delete from ".$prefix."_downloads_newdownload where lid='$lid'");
  1191.     }
  1192.     include("footer.php");
  1193.     }
  1194. }
  1195.  
  1196. switch ($op) {
  1197.             
  1198.     case "downloads":
  1199.     downloads();
  1200.     break;
  1201.  
  1202.     case "DownloadsDelNew":
  1203.     DownloadsDelNew($lid);
  1204.     break;
  1205.  
  1206.     case "DownloadsAddCat":
  1207.     DownloadsAddCat($title, $cdescription);
  1208.     break;
  1209.  
  1210.     case "DownloadsAddSubCat":
  1211.     DownloadsAddSubCat($cid, $title, $cdescription);
  1212.     break;
  1213.  
  1214.     case "DownloadsAddDownload":
  1215.     DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter, $filesize, $version, $homepage, $hits);
  1216.     break;
  1217.             
  1218.     case "DownloadsAddEditorial":
  1219.     DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext);
  1220.     break;            
  1221.             
  1222.     case "DownloadsModEditorial":
  1223.     DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext);
  1224.     break;    
  1225.             
  1226.     case "DownloadsDownloadCheck":
  1227.     DownloadsDownloadCheck();
  1228.     break;    
  1229.         
  1230.     case "DownloadsValidate":
  1231.     DownloadsValidate($cid, $sid, $ttitle);
  1232.     break;
  1233.  
  1234.     case "DownloadsDelEditorial":
  1235.     DownloadsDelEditorial($downloadid);
  1236.     break;                        
  1237.  
  1238.     case "DownloadsCleanVotes":
  1239.     DownloadsCleanVotes();
  1240.     break;    
  1241.         
  1242.     case "DownloadsListBrokenDownloads":
  1243.     DownloadsListBrokenDownloads();
  1244.     break;
  1245.  
  1246.     case "DownloadsDelBrokenDownloads":
  1247.     DownloadsDelBrokenDownloads($lid);
  1248.     break;
  1249.             
  1250.     case "DownloadsIgnoreBrokenDownloads":
  1251.     DownloadsIgnoreBrokenDownloads($lid);
  1252.     break;            
  1253.             
  1254.     case "DownloadsListModRequests":
  1255.     DownloadsListModRequests();
  1256.     break;        
  1257.             
  1258.     case "DownloadsChangeModRequests":
  1259.     DownloadsChangeModRequests($requestid);
  1260.     break;    
  1261.             
  1262.     case "DownloadsChangeIgnoreRequests":
  1263.     DownloadsChangeIgnoreRequests($requestid);
  1264.     break;
  1265.             
  1266.     case "DownloadsDelCat":
  1267.     DownloadsDelCat($cid, $sid, $sub, $ok);
  1268.     break;
  1269.  
  1270.     case "DownloadsModCat":
  1271.     DownloadsModCat($cat);
  1272.     break;
  1273.  
  1274.     case "DownloadsModCatS":
  1275.     DownloadsModCatS($cid, $sid, $sub, $title, $cdescription);
  1276.     break;
  1277.  
  1278.     case "DownloadsModDownload":
  1279.     DownloadsModDownload($lid);
  1280.     break;
  1281.  
  1282.     case "DownloadsModDownloadS":
  1283.     DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage);
  1284.     break;
  1285.  
  1286.     case "DownloadsDelDownload":
  1287.     DownloadsDelDownload($lid);
  1288.     break;
  1289.  
  1290.     case "DownloadsDelVote":
  1291.     DownloadsDelVote($lid, $rid);
  1292.     break;            
  1293.  
  1294.     case "DownloadsDelComment":
  1295.     DownloadsDelComment($lid, $rid);
  1296.     break;
  1297.  
  1298.     case "DownloadsTransfer":
  1299.     DownloadsTransfer($cidfrom,$cidto);
  1300.     break;
  1301.  
  1302. }
  1303.     
  1304. } else {
  1305.     echo "Access Denied";
  1306. }
  1307.  
  1308. ?>