[ Index ]
 

Code source de PHP NUKE 7.9

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

title

Body

[fermer]

/modules/Downloads/admin/ -> index.php (source)

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

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

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

   6  /*                                                                      */

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

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

   9  /*                                                                      */

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

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

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

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

  14  
  15  if (!defined('ADMIN_FILE')) {
  16      die ("Access Denied");
  17  }
  18  
  19  global $prefix, $db, $admin_file;
  20  $aid = substr("$aid", 0,25);
  21  $row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Downloads'"));
  22  $row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
  23  $admins = explode(",", $row['admins']);
  24  $auth_user = 0;
  25  for ($i=0; $i < sizeof($admins); $i++) {
  26      if ($row2['name'] == "$admins[$i]" AND !empty($row['admins'])) {
  27          $auth_user = 1;
  28      }
  29  }
  30  
  31  if ($row2['radminsuper'] == 1 || $auth_user == 1) {
  32  
  33      /*********************************************************/

  34      /* Downloads Modified Web Downloads                      */

  35      /*********************************************************/

  36  
  37  	function getparent($parentid,$title) {
  38          global $prefix, $db;
  39          $parentid = intval(trim($parentid));
  40          $row = $db->sql_fetchrow($db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories where cid='$parentid'"));
  41          $cid = intval($row['cid']);
  42          $ptitle = filter($row['title'], "nohtml");
  43          $pparentid = $row['parentid'];
  44          if ($ptitle=="$title") $title=$title;
  45          elseif (!empty($ptitle)) $title=$ptitle."/".$title;
  46          if ($pparentid!=0) {
  47              $title=getparent($pparentid,$title);
  48          }
  49          return $title;
  50      }
  51  
  52  	function downloads() {
  53          global $prefix, $db, $admin_file;
  54          include  ("header.php");
  55          GraphicAdmin();
  56          OpenTable();
  57          $ThemeSel = get_theme();
  58          if (file_exists("themes/$ThemeSel/images/down-logo.gif")) {
  59              echo "<center><a href=\"modules.php?name=Downloads\"><img src=\"themes/$ThemeSel/images/down-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  60          } else {
  61              echo "<center><a href=\"modules.php?name=Downloads\"><img src=\"modules/Downloads/images/down-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
  62          }
  63          $result = $db->sql_query("SELECT * from " . $prefix . "_downloads_downloads");
  64          $numrows = $db->sql_numrows($result);
  65          echo "<font class=\"content\">" . _THEREARE . " <b>$numrows</b> " . _DOWNLOADSINDB . "</font></center>";
  66          CloseTable();
  67          echo "<br>";
  68  
  69          /* Temporarily 'homeless' downloads functions (to be revised in ".$admin_file.".php breakup) */

  70          $result2 = $db->sql_query("SELECT * from " . $prefix . "_downloads_modrequest where brokendownload='1'");
  71          $totalbrokendownloads = $db->sql_numrows($result2);
  72          $result3 = $db->sql_query("SELECT * from " . $prefix . "_downloads_modrequest where brokendownload='0'");
  73          $totalmodrequests = $db->sql_numrows($result3);
  74  
  75          /* List Downloads waiting for validation */

  76          $result4 = $db->sql_query("SELECT lid, cid, sid, title, url, description, name, email, submitter, filesize, version, homepage from " . $prefix . "_downloads_newdownload order by lid");
  77          $numrows = $db->sql_numrows($result4);
  78          if ($numrows>0) {
  79              OpenTable();
  80              echo "<center><font class=\"content\"><b>" . _DOWNLOADSWAITINGVAL . "</b></font></center><br><br>";
  81              while($row4 = $db->sql_fetchrow($result4)) {
  82                  $lid = intval($row4['lid']);
  83                  $cid = intval($row4['cid']);
  84                  $sid = intval($row4['sid']);
  85                  $title = filter($row4['title'], "nohtml");
  86                  $url = filter($row4['url'], "nohtml");
  87                  $description = filter($row4['description']);
  88                  $name = filter($row4['name'], "nohtml");
  89                  $email = filter($row4['email'], "nohtml");
  90                  $submitter = $row4['submitter'];
  91                  $filesize = filter($row4['filesize'], "nohtml");
  92                  $version = filter($row4['version'], "nohtml");
  93                  $homepage = filter($row4['homepage'], "nohtml");
  94                  if ($submitter == "") {
  95                      $submitter = _NONE;
  96                  }
  97                  $homepage = ereg_replace("http://","",$homepage);
  98                  $homepage2 = urlencode($homepage);
  99                  $url2 = urlencode($url);
 100                  echo "<form action=\"".$admin_file.".php\" method=\"post\">"
 101                  ."<b>" . _DOWNLOADID . ": $lid</b><br><br>"
 102                  ."" . _SUBMITTER . ": <b>$submitter</b><br>"
 103                  ."" . _DOWNLOADNAME . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
 104                  ."" . _FILEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\">&nbsp;[ <a href=\"index.php?url=$url2\" target=\"_blank\">" . _CHECK . "</a> ]<br>"
 105                  ."" . _DESCRIPTION . ": <br><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br>"
 106                  ."" . _AUTHORNAME . ": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\">&nbsp;&nbsp;"
 107                  ."" . _AUTHOREMAIL . ": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\"><br>"
 108                  ."" . _FILESIZE . ": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"><br>"
 109                  ."" . _VERSION . ": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"><br>"
 110                  ."" . _HOMEPAGE . ": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://$homepage\"> [ <a href=\"index.php?url=http://$homepage2\">" . _VISIT . "</a> ]<br>";
 111                  echo "<input type=\"hidden\" name=\"new\" value=\"1\">";
 112                  echo "<input type=\"hidden\" name=\"hits\" value=\"0\">";
 113                  echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
 114                  echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
 115                  echo "" . _CATEGORY . ": <select name=\"cat\">";
 116                  $result5 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by title");
 117                  while ($row5 = $db->sql_fetchrow($result5)) {
 118                      $cid2 = intval($row5['cid']);
 119                      $ctitle2 = filter($row5['title'], "nohtml");
 120                      $parentid2 = $row5['parentid'];
 121                      if ($cid2==$cid) {
 122                          $sel = "selected";
 123                      } else {
 124                          $sel = "";
 125                      }
 126                      if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 127                      echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
 128                  }
 129  
 130                  echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
 131                  echo "</select><input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\"><input type=\"submit\" value=" . _ADD . "> [ <a href=\"".$admin_file.".php?op=DownloadsDelNew&amp;lid=$lid\">" . _DELETE . "</a> ]</form><br><hr noshade><br>";
 132              }
 133              CloseTable();
 134              echo "<br>";
 135          } else {
 136          }
 137  
 138          /* Add a New Main Category */

 139  
 140          OpenTable();
 141          echo "<center><font class=\"content\">[ <a href=\"".$admin_file.".php?op=DownloadsCleanVotes\">" . _CLEANDOWNLOADSDB . "</a> | "
 142          ."<a href=\"".$admin_file.".php?op=DownloadsListBrokenDownloads\">" . _BROKENDOWNLOADSREP . " ($totalbrokendownloads)</a> | "
 143          ."<a href=\"".$admin_file.".php?op=DownloadsListModRequests\">" . _DOWNLOADMODREQUEST . " ($totalmodrequests)</a> | "
 144          ."<a href=\"".$admin_file.".php?op=DownloadsDownloadCheck\">" . _VALIDATEDOWNLOADS . "</a> ]</font></center>";
 145          CloseTable();
 146          echo "<br>";
 147          OpenTable();
 148          echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 149          ."<font class=\"content\"><b>" . _ADDMAINCATEGORY . "</b><br><br>"
 150          ."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"><br>"
 151          ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\"></textarea><br>"
 152          ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddCat\">"
 153          ."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
 154          ."</form>";
 155          CloseTable();
 156          echo "<br>";
 157  
 158          // Add a New Sub-Category

 159          $result6 = $db->sql_query("SELECT * from " . $prefix . "_downloads_categories");
 160          $numrows = $db->sql_numrows($result6);
 161          if ($numrows>0) {
 162              OpenTable();
 163              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 164              ."<font class=\"content\"><b>" . _ADDSUBCATEGORY . "</b></font><br><br>"
 165              ."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\">&nbsp;" . _IN . "&nbsp;";
 166              $result7 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by parentid,title");
 167              echo "<select name=\"cid\">";
 168              while($row7 = $db->sql_fetchrow($result7)) {
 169                  $cid2 = intval($row7['cid']);
 170                  $ctitle2 = filter($row7['title'], "nohtml");
 171                  $parentid2 = intval($row7['parentid']);
 172                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 173                  echo "<option value=\"$cid2\">$ctitle2</option>";
 174              }
 175              echo "</select><br>"
 176              ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\"></textarea><br>"
 177              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddSubCat\">"
 178              ."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
 179              ."</form>";
 180              CloseTable();
 181              echo "<br>";
 182          } else {
 183          }
 184  
 185          // Add a New Download to Database

 186          $result8 = $db->sql_query("SELECT cid, title from " . $prefix . "_downloads_categories");
 187          $numrows = $db->sql_numrows($result8);
 188          if ($numrows>0) {
 189              OpenTable();
 190              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 191              ."<font class=\"content\"><b>" . _ADDNEWDOWNLOAD . "</b><br><br>"
 192              ."" . _DOWNLOADNAME . ": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
 193              ."" . _FILEURL . ": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\"><br>";
 194              $result9 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by title");
 195              echo "" . _CATEGORY . ": <select name=\"cat\">";
 196              while($row9 = $db->sql_fetchrow($result9)) {
 197                  $cid2 = intval($row9['cid']);
 198                  $ctitle2 = filter($row9['title'], "nohtml");
 199                  $parentid2 = intval($row9['parentid']);
 200                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 201                  echo "<option value=\"$cid2\">$ctitle2</option>";
 202              }
 203              echo "</select><br><br><br>"
 204              ."" . _DESCRIPTION255 . "<br><textarea name=\"description\" cols=\"70\" rows=\"15\"></textarea><br><br><br>"
 205              ."" . _AUTHORNAME . ": <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"><br><br>"
 206              ."" . _AUTHOREMAIL . ": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"><br><br>"
 207              ."" . _FILESIZE . ": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\"> (" . _INBYTES . ")<br><br>"
 208              ."" . _VERSION . ": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\"><br><br>"
 209              ."" . _HOMEPAGE . ": <input type=\"text\" name=\"homepage\" size=\"30\" maxlength=\"200\" value=\"http://\"><br><br>"
 210              ."" . _HITS . ": <input type=\"text\" name=\"hits\" size=\"12\" maxlength=\"11\"><br><br>"
 211              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsAddDownload\">"
 212              ."<input type=\"hidden\" name=\"new\" value=\"0\">"
 213              ."<input type=\"hidden\" name=\"lid\" value=\"0\">"
 214              ."<center><input type=\"submit\" value=\"" . _ADDURL . "\"><br>"
 215              ."</form>";
 216              CloseTable();
 217              echo "<br>";
 218          } else {
 219          }
 220  
 221          // Modify Category

 222          $result10 = $db->sql_query("SELECT * from " . $prefix . "_downloads_categories");
 223          $numrows = $db->sql_numrows($result10);
 224          if ($numrows>0) {
 225              OpenTable();
 226              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 227              ."<font class=\"content\"><b>" . _MODCATEGORY . "</b></font><br><br>";
 228              $result11 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by title");
 229              echo "" . _CATEGORY . ": <select name=\"cat\">";
 230              while($row11 = $db->sql_fetchrow($result11)) {
 231                  $cid2 = intval($row11['cid']);
 232                  $ctitle2 = filter($row11['title'], "nohtml");
 233                  $parentid2 = intval($row11['parentid']);
 234                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 235                  echo "<option value=\"$cid2\">$ctitle2</option>";
 236              }
 237              echo "</select>"
 238              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCat\">"
 239              ."<input type=\"submit\" value=\"" . _MODIFY . "\">"
 240              ."</form>";
 241              CloseTable();
 242              echo "<br>";
 243          } else {
 244          }
 245  
 246          // Modify Downloads

 247          $result12 = $db->sql_query("SELECT * from " . $prefix . "_downloads_downloads");
 248          $numrows = $db->sql_numrows($result12);
 249          if ($numrows>0) {
 250              OpenTable();
 251              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 252              ."<font class=\"content\"><b>" . _MODDOWNLOAD . "</b><br><br>"
 253              ."" . _DOWNLOADID . ": <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\">&nbsp;&nbsp;"
 254              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownload\">"
 255              ."<input type=\"submit\" value=\"" . _MODIFY . "\">"
 256              ."</form>";
 257              CloseTable();
 258              echo "<br>";
 259          } else {
 260          }
 261  
 262          // Transfer Categories

 263          $result13 = $db->sql_query("SELECT * from " . $prefix . "_downloads_downloads");
 264          $numrows = $db->sql_numrows($result13);
 265          if ($numrows>0) {
 266              OpenTable();
 267              echo "<form method=\"post\" action=\"".$admin_file.".php\">"
 268              ."<font class=\"option\"><b>" . _EZTRANSFERDOWNLOADS . "</b></font><br><br>"
 269              ."" . _CATEGORY . ": "
 270              ."<select name=\"cidfrom\">";
 271              $result14 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by parentid,title");
 272              while($row14 = $db->sql_fetchrow($result14)) {
 273                  $cid2 = intval($row14['cid']);
 274                  $ctitle2 = filter($row14['title'], "nohtml");
 275                  $parentid2 = intval($row14['parentid']);
 276                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 277                  echo "<option value=\"$cid2\">$ctitle2</option>";
 278              }
 279              echo "</select><br>"
 280              ."" . _IN . "&nbsp;" . _CATEGORY . ": ";
 281              $result15 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by parentid,title");
 282              echo "<select name=\"cidto\">";
 283              while($row15 = $db->sql_fetchrow($result15)) {
 284                  $cid2 = intval($row15['cid']);
 285                  $ctitle2 = filter($row15['title'], "nohtml");
 286                  $parentid2 = intval($row15['parentid']);
 287                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 288                  echo "<option value=\"$cid2\">$ctitle2</option>";
 289              }
 290              echo "</select><br>"
 291              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsTransfer\">"
 292              ."<input type=\"submit\" value=\"" . _EZTRANSFER . "\"><br>"
 293              ."</form>";
 294              CloseTable();
 295              echo "<br>";
 296          } else {
 297          }
 298  
 299          include  ("footer.php");
 300      }
 301  
 302  	function DownloadsTransfer($cidfrom, $cidto) {
 303          global $prefix, $db, $admin_file;
 304          $cidfrom = intval($cidfrom);
 305          $db->sql_query("update " . $prefix . "_downloads_downloads set cid='$cidto' where cid='$cidfrom'");
 306          Header("Location: ".$admin_file.".php?op=downloads");
 307      }
 308  
 309  	function DownloadsModDownload($lid) {
 310          global $prefix, $db, $sitename, $admin_file, $bgcolor1, $bgcolor2;
 311          include  ("header.php");
 312          GraphicAdmin();
 313          global $anonymous;
 314          $lid = intval($lid);
 315          $result = $db->sql_query("SELECT cid, sid, title, url, description, name, email, hits, filesize, version, homepage from " . $prefix . "_downloads_downloads where lid='$lid'");
 316          OpenTable();
 317          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
 318          CloseTable();
 319          echo "<br>";
 320          OpenTable();
 321          echo "<center><font class=\"content\"><b>" . _MODDOWNLOAD . "</b></font></center><br><br>";
 322          while($row = $db->sql_fetchrow($result)) {
 323              $cid = intval($row['cid']);
 324              $sid = intval($row['sid']);
 325              $title = filter($row['title'], "nohtml");
 326              $url = filter($row['url'], "nohtml");
 327              $description = filter($row['description']);
 328              $name = filter($row['name'], "nohtml");
 329              $email = filter($row['email'], "nohtml");
 330              $hits = intval($row['hits']);
 331              $filesize = filter($row['filesize'], "nohtml");
 332              $version = filter($row['version'], "nohtml");
 333              $homepage = filter($row['homepage'], "nohtml");
 334              $url2 = urlencode($url);
 335              $homepage2 = urlencode($homepage);
 336              echo "<form action=".$admin_file.".php method=post>"
 337              ."" . _DOWNLOADID . ": <b>$lid</b><br>"
 338              ."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
 339              ."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\">&nbsp;[ <a href=\"index.php?url=$url2\" target=\"_blank\">" . _CHECK . "</a> ]<br>"
 340              ."" . _DESCRIPTION . ":<br><textarea name=\"description\" cols=\"70\" rows=\"15\">$description</textarea><br>"
 341              ."" . _AUTHORNAME . ": <input type=\"text\" name=\"name\" size=\"50\" maxlength=\"100\" value=\"$name\"><br>"
 342              ."" . _AUTHOREMAIL . ": <input type=\"text\" name=\"email\" size=\"50\" maxlength=\"100\" value=\"$email\"><br>"
 343              ."" . _FILESIZE . ": <input type=\"text\" name=\"filesize\" size=\"12\" maxlength=\"11\" value=\"$filesize\"><br>"
 344              ."" . _VERSION . ": <input type=\"text\" name=\"version\" size=\"11\" maxlength=\"10\" value=\"$version\"><br>"
 345              ."" . _HOMEPAGE . ": <input type=\"text\" name=\"homepage\" size=\"50\" maxlength=\"200\" value=\"$homepage\">&nbsp;[ <a href=\"index.php?url=$homepage2\" target=\"_blank\">" . _VISIT . "</a> ]<br>"
 346              ."" . _HITS . ": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\"><br>";
 347              $result2 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_downloads_categories order by title");
 348              echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
 349              ."" . _CATEGORY . ": <select name=\"cat\">";
 350              while($row2 = $db->sql_fetchrow($result2)) {
 351                  $cid2 = intval($row2['cid']);
 352                  $ctitle2 = filter($row2['title'], "nohtml");
 353                  $parentid2 = intval($row2['parentid']);
 354                  if ($cid2==$cid) {
 355                      $sel = "selected";
 356                  } else {
 357                      $sel = "";
 358                  }
 359                  if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
 360                  echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
 361              }
 362  
 363              echo "</select>"
 364              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModDownloadS\">"
 365              ."<input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=DownloadsDelDownload&amp;lid=$lid\">" . _DELETE . "</a> ]</form><br>";
 366              CloseTable();
 367              echo "<br>";
 368              /* Modify or Add Editorial */

 369              $lid = intval($lid);
 370              $resulted2 = $db->sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle from " . $prefix . "_downloads_editorials where downloadid='$lid'");
 371              $recordexist = $db->sql_numrows($resulted2);
 372              OpenTable();
 373              /* if returns 'bad query' status 0 (add editorial) */

 374              if ($recordexist == 0) {
 375                  echo "<center><font class=\"content\"><b>" . _ADDEDITORIAL . "</b></font></center><br><br>"
 376                  ."<form action=\"".$admin_file.".php\" method=\"post\">"
 377                  ."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
 378                  ."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
 379                  ."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"70\" rows=\"15\">$editorialtext</textarea><br>"
 380                  ."</select><input type=\"hidden\" name=\"op\" value=\"DownloadsAddEditorial\"><input type=\"submit\" value=\"Add\">";
 381              } else {
 382                  /* if returns 'cool' then status 1 (modify editorial) */

 383                  while($row3 = $db->sql_fetchrow($resulted2)) {
 384                      $adminid = intval($row3['adminid']);
 385                      $editorialtimestamp = $row3['editorialtimestamp'];
 386                      $editorialtext = filter($row3['editorialtext']);
 387                      $editorialtitle = filter($row3['editorialtitle'], "nohtml");
 388                      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);
 389                      $editorialtime = strftime("%F",mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]));
 390                      $date_array = explode("-", $editorialtime);
 391                      $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 392                      $formatted_date = date("F j, Y", $timestamp);
 393                      echo "<center><font class=\"content\"><b>Modify Editorial</b></font></center><br><br>"
 394                      ."<form action=\"".$admin_file.".php\" method=\"post\">"
 395                      ."" . _AUTHOR . ": $adminid<br>"
 396                      ."" . _DATEWRITTEN . ": $formatted_date<br><br>"
 397                      ."<input type=\"hidden\" name=\"downloadid\" value=\"$lid\">"
 398                      ."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
 399                      ."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"70\" rows=\"15\">$editorialtext</textarea><br>"
 400                      ."</select><input type=\"hidden\" name=\"op\" value=\"DownloadsModEditorial\"><input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=DownloadsDelEditorial&amp;downloadid=$lid\">" . _DELETE . "</a> ]";
 401                  }
 402              }
 403              CloseTable();
 404              echo "<br>";
 405              OpenTable();
 406              /* Show Comments */

 407              $result4 = $db->sql_query("SELECT ratingdbid, ratinguser, ratingcomments, ratingtimestamp FROM " . $prefix . "_downloads_votedata WHERE ratinglid='$lid' AND ratingcomments != '' ORDER BY ratingtimestamp DESC");
 408              $totalcomments = $db->sql_numrows($result4);
 409              echo "<table valign=top width=100%>";
 410              echo "<tr><td colspan=7><b>Download Comments (total comments: $totalcomments)</b><br><br></td></tr>";
 411              echo "<tr><td width=20 colspan=1><b>User  </b></td><td colspan=5><b>Comment  </b></td><td><b><center>Delete</center></b></td><br></tr>";
 412              if ($totalcomments == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Comments<br></font></center></td></tr>";
 413              $x=0;
 414              $colorswitch=$bgcolor1;
 415              while($row4 = $db->sql_fetchrow($result4)) {
 416                  $ratingdbid = intval($row4['ratingdbid']);
 417                  $ratinguser = $row4['ratinguser'];
 418                  $ratingcomments = filter($row4['ratingcomments']);
 419                  $ratingtimestamp = $row4['ratingtimestamp'];
 420                  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);
 421                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 422                  $date_array = explode("-", $ratingtime);
 423                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 424                  $formatted_date = date("F j, Y", $timestamp);
 425                  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_file.".php?op=DownloadsDelComment&lid=$lid&rid=$ratingdbid>X</a></b></center></td><br></tr>";
 426                  $x++;
 427                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 428                  else $colorswitch=$bgcolor1;
 429              }
 430  
 431              // Show Registered Users Votes

 432              $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");
 433              $totalvotes = $db->sql_numrows($result5);
 434              echo "<tr><td colspan=7><br><br><b>Registered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 435              echo "<tr><td><b>User  </b></td><td><b>IP Address  </b></td><td><b>Rating  </b></td><td><b>User AVG Rating  </b></td><td><b>Total Ratings  </b></td><td><b>Date  </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
 436              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Registered User Votes<br></font></center></td></tr>";
 437              $x=0;
 438              $colorswitch=$bgcolor1;
 439              while($row5 = $db->sql_fetchrow($result5)) {
 440                  $ratingdbid = intval($row5['ratingdbid']);
 441                  $ratinguser = $row5['ratinguser'];
 442                  $rating = intval($row5['rating']);
 443                  $ratinghostname = $row5['ratinghostname'];
 444                  $ratingtimestamp = $row5['ratingtimestamp'];
 445                  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);
 446                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 447                  $date_array = explode("-", $ratingtime);
 448                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 449                  $formatted_date = date("F j, Y", $timestamp);
 450  
 451                  //Individual user information

 452                  $result6 = $db->sql_query("SELECT rating FROM " . $prefix . "_downloads_votedata WHERE ratinguser = '$ratinguser'");
 453                  $usertotalcomments = $db->sql_numrows($result6);
 454                  $useravgrating = 0;
 455                  while($row6 = $db->sql_fetchrow($result6))    $useravgrating = $useravgrating + $rating2;
 456                  $rating2 = intval($row6['rating']);
 457                  $useravgrating = $useravgrating / $usertotalcomments;
 458                  $useravgrating = number_format($useravgrating, 1);
 459                  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_file.".php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 460                  $x++;
 461                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 462                  else $colorswitch=$bgcolor1;
 463              }
 464  
 465              // Show Unregistered Users Votes

 466              $lid = intval($lid);
 467              $result7 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_downloads_votedata WHERE ratinglid='$lid' AND ratinguser = '$anonymous' ORDER BY ratingtimestamp DESC");
 468              $totalvotes = $db->sql_numrows($result7);
 469              echo "<tr><td colspan=7><b><br><br>Unregistered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 470              echo "<tr><td colspan=2><b>IP Address  </b></td><td colspan=3><b>Rating  </b></td><td><b>Date  </b></font></td><td><b><center>Delete</center></b></td><br></tr>";
 471              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Unregistered User Votes<br></font></center></td></tr>";
 472              $x=0;
 473              $colorswitch=$bgcolor1;
 474              while($row7 = $db->sql_fetchrow($result7)) {
 475                  $ratingdbid = intval($row7['ratingdbid']);
 476                  $rating = intval($row7['rating']);
 477                  $ratinghostname = $row7['ratinghostname'];
 478                  $ratingtimestamp = $row7['ratingtimestamp'];
 479                  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);
 480                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 481                  $date_array = explode("-", $ratingtime);
 482                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 483                  $formatted_date = date("F j, Y", $timestamp);
 484                  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_file.".php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 485                  $x++;
 486                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 487                  else $colorswitch=$bgcolor1;
 488              }
 489  
 490              // Show Outside Users Votes

 491              $result8 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_downloads_votedata WHERE ratinglid='$lid' AND ratinguser = 'outside' ORDER BY ratingtimestamp DESC");
 492              $totalvotes = $db->sql_numrows($result8);
 493              echo "<tr><td colspan=7><b><br><br>Outside User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
 494              echo "<tr><td colspan=2><b>IP Address  </b></td><td colspan=3><b>Rating  </b></td><td><b>Date  </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
 495              if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Votes from Outside $sitename<br></font></center></td></tr>";
 496              $x=0;
 497              $colorswitch=$bgcolor1;
 498              while($row8 = $db->sql_fetchrow($result8)) {
 499                  $ratingdbid = intval($row8['ratingdbid']);
 500                  $rating = intval($row8['rating']);
 501                  $ratinghostname = $row8['ratinghostname'];
 502                  $ratingtimestamp = $row8['ratingtimestamp'];
 503                  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);
 504                  $ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
 505                  $date_array = explode("-", $ratingtime);
 506                  $timestamp = mktime(0, 0, 0, $date_array['1'], $date_array['2'], $date_array['0']);
 507                  $formatted_date = date("F j, Y", $timestamp);
 508                  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_file.".php?op=DownloadsDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
 509                  $x++;
 510                  if ($colorswitch==$bgcolor1) $colorswitch=$bgcolor2;
 511                  else $colorswitch=$bgcolor1;
 512              }
 513  
 514              echo "<tr><td colspan=6><br></td></tr>";
 515              echo "</table>";
 516          }
 517          echo "</form>";
 518          CloseTable();
 519          echo "<br>";
 520          include  ("footer.php");
 521      }
 522  
 523  	function DownloadsDelComment($lid, $rid) {
 524          global $prefix, $db, $admin_file;
 525          $lid = intval($lid);
 526          $rid = intval($rid);
 527          $db->sql_query("UPDATE " . $prefix . "_downloads_votedata SET ratingcomments='' WHERE ratingdbid='$rid'");
 528          $db->sql_query("UPDATE " . $prefix . "_downloads_downloads SET totalcomments = (totalcomments - 1) WHERE lid='$lid'");
 529          Header("Location: ".$admin_file.".php?op=DownloadsModDownload&lid=$lid");
 530  
 531      }
 532  
 533  	function DownloadsDelVote($lid, $rid) {
 534          global $prefix, $db, $admin_file;
 535          $lid = intval($lid);
 536          $rid = intval($rid);
 537          $db->sql_query("delete from " . $prefix . "_downloads_votedata where ratingdbid='$rid'");
 538          $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM " . $prefix . "_downloads_votedata WHERE ratinglid='$lid'");
 539          $totalvotesDB = $db->sql_numrows($voteresult);
 540          include ("voteinclude.php");
 541          $db->sql_query("UPDATE " . $prefix . "_downloads_downloads SET downloadratingsummary='$finalrating',totalvotes='$totalvotesDB',totalcomments='$truecomments' WHERE lid='$lid'");
 542          Header("Location: ".$admin_file.".php?op=DownloadsModDownload&lid=$lid");
 543      }
 544  
 545  	function DownloadsListBrokenDownloads() {
 546          global $bgcolor1, $bgcolor2, $prefix, $db, $user_prefix, $admin_file;
 547          include  ("header.php");
 548          GraphicAdmin();
 549          OpenTable();
 550          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
 551          CloseTable();
 552          echo "<br>";
 553          OpenTable();
 554          $result = $db->sql_query("SELECT requestid, lid, modifysubmitter from " . $prefix . "_downloads_modrequest where brokendownload='1' order by requestid");
 555          $totalbrokendownloads = $db->sql_numrows($result);
 556          echo "<center><font class=\"content\"><b>" . _DUSERREPBROKEN . " ($totalbrokendownloads)</b></font></center><br><br><center>"
 557          ."" . _DIGNOREINFO . "<br>"
 558          ."" . _DDELETEINFO . "</center><br><br><br>"
 559          ."<table align=\"center\" width=\"450\">";
 560          if ($totalbrokendownloads==0) {
 561              echo "<center><font class=\"content\">" . _DNOREPORTEDBROKEN . "</font></center><br><br><br>";
 562          } else {
 563              $colorswitch = $bgcolor2;
 564              echo "<tr>"
 565              ."<td><b>" . _DOWNLOAD . "</b></td>"
 566              ."<td><b>" . _SUBMITTER . "</b></td>"
 567              ."<td><b>" . _DOWNLOADOWNER . "</b></td>"
 568              ."<td><b>" . _IGNORE . "</b></td>"
 569              ."<td><b>" . _DELETE . "</b></td>"
 570              ."<td><b>" . _EDIT . "</b></td>"
 571              ."</tr>";
 572              while($row = $db->sql_fetchrow($result)) {
 573                  $requestid = intval($row['requestid']);
 574                  $lid = intval($row['lid']);
 575                  $modifysubmitter = $row['modifysubmitter'];
 576                  $result2 = $db->sql_query("SELECT title, url, submitter from " . $prefix . "_downloads_downloads where lid='$lid'");
 577                  if ($modifysubmitter != '$anonymous') {
 578                      $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'"));
 579                      $email = filter($row3['user_email'], "nohtml");
 580                  }
 581                  $row2 = $db->sql_fetchrow($result2);
 582                  $title = filter($row2['title'], "nohtml");
 583                  $url = filter($row2['url'], "nohtml");
 584                  $owner = $row2['submitter'];
 585                  $row4 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'"));
 586                  $owneremail = filter($row4['user_email'], "nohtml");
 587                  $url = urlencode($url);
 588                  echo "<tr>"
 589                  ."<td bgcolor=\"$colorswitch\"><a href=\"index.php?url=$url\">$title</a>"
 590                  ."</td>";
 591                  if (empty($email)) {
 592                      echo "<td bgcolor=\"$colorswitch\">$modifysubmitter";
 593                  } else {
 594                      echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$email\">$modifysubmitter</a>";
 595                  }
 596                  echo "</td>";
 597                  if (empty($owneremail)) {
 598                      echo "<td bgcolor=\"$colorswitch\">$owner";
 599                  } else {
 600                      echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$owneremail\">$owner</a>";
 601                  }
 602                  echo "</td>"
 603                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=DownloadsIgnoreBrokenDownloads&amp;lid=$lid\">X</a></center>"
 604                  ."</td>"
 605                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=DownloadsDelBrokenDownloads&amp;lid=$lid\">X</a></center>"
 606                  ."</td>"
 607                  ."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=DownloadsModDownload&amp;lid=$lid\">X</a></center>"
 608                  ."</td>"
 609                  ."</tr>";
 610                  if ($colorswitch == $bgcolor2) {
 611                      $colorswitch = $bgcolor1;
 612                  } else {
 613                      $colorswitch = $bgcolor2;
 614                  }
 615              }
 616          }
 617          echo "</table>";
 618          CloseTable();
 619          include  ("footer.php");
 620      }
 621  
 622  	function DownloadsDelBrokenDownloads($lid) {
 623          global $prefix, $db, $admin_file;
 624          $lid = intval($lid);
 625          $db->sql_query("delete from " . $prefix . "_downloads_modrequest where lid='$lid'");
 626          $db->sql_query("delete from " . $prefix . "_downloads_downloads where lid='$lid'");
 627          Header("Location: ".$admin_file.".php?op=DownloadsListBrokenDownloads");
 628      }
 629  
 630  	function DownloadsIgnoreBrokenDownloads($lid) {
 631          global $prefix, $db, $admin_file;
 632          $lid = intval($lid);
 633          $db->sql_query("delete from " . $prefix . "_downloads_modrequest where lid='$lid' and brokendownload='1'");
 634          Header("Location: ".$admin_file.".php?op=DownloadsListBrokenDownloads");
 635      }
 636  
 637  	function DownloadsListModRequests() {
 638          global $bgcolor2, $prefix, $db, $user_prefix, $admin_file;
 639          $lid = intval($lid);
 640          include  ("header.php");
 641          GraphicAdmin();
 642          OpenTable();
 643          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
 644          CloseTable();
 645          echo "<br>";
 646          OpenTable();
 647          $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");
 648          $totalmodrequests = $db->sql_numrows($result);
 649          echo "<center><font class=\"content\"><b>" . _DUSERMODREQUEST . " ($totalmodrequests)</b></font></center><br><br><br>";
 650          echo "<table width=\"95%\"><tr><td>";
 651          while($row = $db->sql_fetchrow($result)) {
 652              $requestid = intval($row['requestid']);
 653              $lid = intval($row['lid']);
 654              $cid = intval($row['cid']);
 655              $sid = intval($row['sid']);
 656              $title = filter($row['title'], "nohtml");
 657              $url = filter($row['url'], "nohtml");
 658              $url = urlencode($url);
 659              $description = filter($row['description']);
 660              $xdescription = eregi_replace("<a href=\"http://", "<a href=\"index.php?url=http://", $description);
 661              $modifysubmitter = $row['modifysubmitter'];
 662              $name = $row['name'];
 663              $email = filter($row['email'], "nohtml");
 664              $filesize = filter($row['filesize'], "nohtml");
 665              $version = filter($row['version'], "nohtml");
 666              $homepage = filter($row['homepage'], "nohtml");
 667              $homepage = urlencode($homepage);
 668              $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'"));
 669              $origcid = intval($row2['cid']);
 670              $origsid = intval($row2['sid']);
 671              $origtitle = filter($row2['title'], "nohtml");
 672              $origurl = filter($row2['url'], "nohtml");
 673              $origurl = urlencode($origurl);
 674              $origdescription = filter($row2['description']);
 675              $xorigdescription = eregi_replace("<a href=\"http://", "<a href=\"index.php?url=http://", $origdescription);
 676              $origname = $row2['name'];
 677              $origemail = filter($row2['email'], "nohtml");
 678              $owner = $row2['submitter'];
 679              $origfilesize = filter($row2['filesize'], "nohtml");
 680              $origversion = filter($row2['version'], "nohtml");
 681              $orighomepage = filter($row2['homepage'], "nohtml");
 682              $orighomepage = urlencode($orighomepage);
 683              $result3 = $db->sql_query("SELECT title from " . $prefix . "_downloads_categories where cid='$cid'");
 684              $result5 = $db->sql_query("SELECT title from " . $prefix . "_downloads_categories where cid='$origcid'");
 685              $result7 = $db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'");
 686              $result8 = $db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'");
 687              $row3 = $db->sql_fetchrow($result3);
 688              $cidtitle = filter($row3['title'], "nohtml");
 689              $row5 = $db->sql_fetchrow($result5);
 690              $origcidtitle = filter($row5['title'], "nohtml");
 691              $row7 = $db->sql_fetchrow($result7);
 692              $modifysubmitteremail = filter($row7['user_email'], "nohtml");
 693              $row8 = $db->sql_fetchrow($result8);
 694              $owneremail = filter($row8['user_email'], "nohtml");
 695              if (empty($owner)) {
 696                  $owner="administration";
 697              }
 698              if (empty($origsidtitle)) {
 699                  $origsidtitle= "-----";
 700              }
 701              if (empty($sidtitle)) {
 702                  $sidtitle= "-----";
 703              }
 704              echo "<table border=\"1\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\" width=\"450\">"
 705              ."<tr>"
 706              ."<td>"
 707              ."<table width=\"100%\" bgcolor=\"$bgcolor2\">"
 708              ."<tr>"
 709              ."<td valign=\"top\" width=\"45%\"><b>" . _ORIGINAL . "</b></td>"
 710              ."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>" . _DESCRIPTION . ":<br>$xorigdescription</font></td>"
 711              ."</tr>"
 712              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _TITLE . ": $origtitle</td></tr>"
 713              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _URL . ": <a href=\"index.php?url=$origurl\">$origurl</a></td></tr>"
 714              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _CATEGORY . ": $origcidtitle</td></tr>"
 715              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _SUBCATEGORY . ": $origsidtitle</td></tr>"
 716              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _AUTHORNAME . ": $origname</td></tr>"
 717              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _AUTHOREMAIL . ": $origemail</td></tr>"
 718              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _FILESIZE . ": $origfilesize</td></tr>"
 719              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _VERSION . ": $origversion</td></tr>"
 720              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _HOMEPAGE . ": <a href=\"index.php?url=$orighomepage\" target=\"new\">$orighomepage</a></td></tr>"
 721              ."</table>"
 722              ."</td>"
 723              ."</tr>"
 724              ."<tr>"
 725              ."<td>"
 726              ."<table width=\"100%\">"
 727              ."<tr>"
 728              ."<td valign=\"top\" width=\"45%\"><b>" . _PROPOSED . "</b></td>"
 729              ."<td rowspan=\"10\" valign=\"top\" align=\"left\"><font class=\"tiny\"><br>" . _DESCRIPTION . ":<br>$xdescription</font></td>"
 730              ."</tr>"
 731              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _TITLE . ": $title</td></tr>"
 732              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _URL . ": <a href=\"index.php?url=$url\">$url</a></td></tr>"
 733              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _CATEGORY . ": $cidtitle</td></tr>"
 734              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _SUBCATEGORY . ": $sidtitle</td></tr>"
 735              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _AUTHORNAME . ": $name</td></tr>"
 736              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _AUTHOREMAIL . ": $email</td></tr>"
 737              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _FILESIZE . ": $filesize</td></tr>"
 738              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _VERSION . ": $version</td></tr>"
 739              ."<tr><td valign=\"top\" width=\"45%\"><font class=\"tiny\">" . _HOMEPAGE . ": <a href=\"index.php?url=$homepage\" target=\"new\">$homepage</a></td></tr>"
 740              ."</table>"
 741              ."</td>"
 742              ."</tr>"
 743              ."</table>"
 744              ."<table align=\"center\" width=\"450\">"
 745              ."<tr>";
 746              if (empty($modifysubmitteremail)) {
 747                  echo "<td align=\"left\"><font class=\"tiny\">" . _SUBMITTER . ":  $modifysubmitter</font></td>";
 748              } else {
 749                  echo "<td align=\"left\"><font class=\"tiny\">" . _SUBMITTER . ":  <a href=\"mailto:$modifysubmitteremail\">$modifysubmitter</a></font></td>";
 750              }
 751              if (empty($owneremail)) {
 752                  echo "<td align=\"center\"><font class=\"tiny\">" . _OWNER . ":  $owner</font></td>";
 753              } else {
 754                  echo "<td align=\"center\"><font class=\"tiny\">" . _OWNER . ": <a href=\"mailto:$owneremail\">$owner</a></font></td>";
 755              }
 756              echo "<td align=\"right\"><font class=\"tiny\">( <a href=\"".$admin_file.".php?op=DownloadsChangeModRequests&amp;requestid=$requestid\">" . _ACCEPT . "</a> / <a href=\"".$admin_file.".php?op=DownloadsChangeIgnoreRequests&amp;requestid=$requestid\">" . _IGNORE . "</a> )</font></td></tr></table><br><br>";
 757          }
 758          if ($totalmodrequests == 0) {
 759              echo "<center>" . _NOMODREQUESTS . "<br><br>"
 760              ."" . _GOBACK . "<br><br></center>";
 761          }
 762          echo "</td></tr></table>";
 763          CloseTable();
 764          include  ("footer.php");
 765      }
 766  
 767  	function DownloadsChangeModRequests($requestid) {
 768          global $prefix, $db, $admin_file;
 769          $requestid = intval($requestid);
 770          $result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description, name, email, filesize, version, homepage from " . $prefix . "_downloads_modrequest where requestid='$requestid'");
 771          while ($row = $db->sql_fetchrow($result)) {
 772              $requestid = intval($row['requestid']);
 773              $lid = intval($row['lid']);
 774              $cid = intval($row['cid']);
 775              $sid = intval($row['sid']);
 776              $title = filter($row['title'], "nohtml", 1);
 777              $url = filter($row['url'], "nohtml", 1);
 778              $description = filter($row['description'], "", 1);
 779              $name = filter($row['name'], "nohtml", 1);
 780              $email = filter($row['email'], "nohtml", 1);
 781              $filesize = filter($row['filesize'], "nohtml", 1);
 782              $version = filter($row['version'], "nohtml", 1);
 783              $homepage = filter($row['homepage'], "nohtml", 1);
 784              $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'");
 785              $db->sql_query("delete from " . $prefix . "_downloads_modrequest where requestid='$requestid'");
 786          }
 787          Header("Location: ".$admin_file.".php?op=DownloadsListModRequests");
 788      }
 789  
 790  	function DownloadsChangeIgnoreRequests($requestid) {
 791          global $prefix, $db, $admin_file;
 792          $requestid = intval($requestid);
 793          $db->sql_query("delete from " . $prefix . "_downloads_modrequest where requestid='$requestid'");
 794          Header("Location: ".$admin_file.".php?op=DownloadsListModRequests");
 795      }
 796  
 797  	function DownloadsCleanVotes() {
 798          global $prefix, $db, $admin_file;
 799          $lid = intval($lid);
 800          $result = $db->sql_query("SELECT distinct ratinglid FROM " . $prefix . "_downloads_votedata");
 801          while ($row = $db->sql_fetchrow($result)) {
 802              $lid = intval($row['ratinglid']);
 803              $voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM " . $prefix . "_downloads_votedata WHERE ratinglid='$lid'");
 804              $totalvotesDB = $db->sql_numrows($voteresult);
 805              include ("voteinclude.php");
 806              $db->sql_query("UPDATE " . $prefix . "_downloads_downloads SET downloadratingsummary='$finalrating',totalvotes='$totalvotesDB',totalcomments='$truecomments' WHERE lid='$lid'");
 807          }
 808          Header("Location: ".$admin_file.".php?op=downloads");
 809      }
 810  
 811  	function DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage) {
 812          global $prefix, $db, $admin_file;
 813          $cat = explode("-", $cat);
 814          if (empty($cat[1])) {
 815              $cat[1] = 0;
 816          }
 817          $title = filter($title, "nohtml", 1);
 818          $url = filter($url, "nohtml", 1);
 819          $description = filter($description, "", 1);
 820          $name = filter($name, "nohtml", 1);
 821          $email = filter($email, "nohtml", 1);
 822          $lid = intval($lid);
 823          $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'");
 824          $sql = "SELECT * FROM " . $prefix . "_downloads_modrequest where lid='$lid'";
 825          $result = $db->sql_query($sql);
 826          $numrows = $db->sql_numrows($result);
 827          if ($numrows>0) {
 828          $db->sql_query("delete from " . $prefix . "_downloads_modrequest where lid='$lid'");
 829          }
 830          Header("Location: ".$admin_file.".php?op=downloads");
 831      }
 832  
 833  	function DownloadsDelDownload($lid) {
 834          global $prefix, $db, $admin_file;
 835          $lid = intval($lid);
 836          $db->sql_query("delete from " . $prefix . "_downloads_downloads where lid='$lid'");
 837          $sql = "SELECT * FROM " . $prefix . "_downloads_modrequest where lid='$lid'";
 838          $result = $db->sql_query($sql);
 839          $numrows = $db->sql_numrows($result);
 840          if ($numrows>0) {
 841          $db->sql_query("delete from " . $prefix . "_downloads_modrequest where lid='$lid'");
 842          }
 843          Header("Location: ".$admin_file.".php?op=downloads");
 844      }
 845  
 846  	function DownloadsModCat($cat) {
 847          global $prefix, $db, $admin_file;
 848          include  ("header.php");
 849          GraphicAdmin();
 850          OpenTable();
 851          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
 852          CloseTable();
 853          echo "<br>";
 854          $cat = explode("-", $cat);
 855          if (empty($cat[1])) {
 856              $cat[1] = 0;
 857          }
 858          OpenTable();
 859          echo "<center><font class=\"content\"><b>" . _MODCATEGORY . "</b></font></center><br><br>";
 860          if ($cat[1]==0) {
 861              $row = $db->sql_fetchrow($db->sql_query("SELECT title, cdescription from " . $prefix . "_downloads_categories where cid='$cat[0]'"));
 862              $title = filter($row['title'], "nohtml");
 863              $cdescription = filter($row['cdescription']);
 864              echo "<form action=\"".$admin_file.".php\" method=\"get\">"
 865              ."" . _NAME . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"51\" maxlength=\"50\"><br>"
 866              ."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"70\" rows=\"15\">$cdescription</textarea><br>"
 867              ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
 868              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 869              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
 870              ."<table border=\"0\"><tr><td>"
 871              ."<input type=\"submit\" value=\"" . _SAVECHANGES . "\"></form></td><td>"
 872              ."<form action=\"".$admin_file.".php\" method=\"get\">"
 873              ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
 874              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 875              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
 876              ."<input type=\"submit\" value=\"" . _DELETE . "\"></form></td></tr></table>";
 877          } else {
 878              $row2 = $db->sql_fetchrow($db->sql_query("SELECT title from " . $prefix . "_downloads_categories where cid='$cat[0]'"));
 879              $ctitle = filter($row2['title'], "nohtml");
 880              $row3 = $db->sql_fetchrow($db->sql_query("SELECT title from " . $prefix . "_downloads_subcategories where sid='$cat[1]'"));
 881              $stitle = filter($row3['title'], "nohtml");
 882              echo "<form action=\"".$admin_file.".php\" method=\"get\">"
 883              ."" . _CATEGORY . ": $ctitle<br>"
 884              ."" . _SUBCATEGORY . ": <input type=\"text\" name=\"title\" value=\"$stitle\" size=\"51\" maxlength=\"50\"><br>"
 885              ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
 886              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 887              ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
 888              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsModCatS\">"
 889              ."<table border=\"0\"><tr><td>"
 890              ."<input type=\"submit\" value=\"" . _SAVECHANGES . "\"></form></td><td>"
 891              ."<form action=\"".$admin_file.".php\" method=\"get\">"
 892              ."<input type=\"hidden\" name=\"sub\" value=\"1\">"
 893              ."<input type=\"hidden\" name=\"cid\" value=\"$cat[0]\">"
 894              ."<input type=\"hidden\" name=\"sid\" value=\"$cat[1]\">"
 895              ."<input type=\"hidden\" name=\"op\" value=\"DownloadsDelCat\">"
 896              ."<input type=\"submit\" value=\"" . _DELETE . "\"></form></td></tr></table>";
 897          }
 898          CloseTable();
 899          include ("footer.php");
 900      }
 901  
 902  	function DownloadsModCatS($cid, $sid, $sub, $title, $cdescription) {
 903          global $prefix, $db, $admin_file;
 904          $cid = intval($cid);
 905          $sid = intval($sid);
 906          if ($sub==0) {
 907              $db->sql_query("update " . $prefix . "_downloads_categories set title='$title', cdescription='$cdescription' where cid='$cid'");
 908          } else {
 909              $db->sql_query("update " . $prefix . "_downloads_subcategories set title='$title' where sid='$sid'");
 910          }
 911          Header("Location: ".$admin_file.".php?op=downloads");
 912      }
 913  
 914  	function DownloadsDelCat($cid, $sid, $sub, $ok=0) {
 915          global $prefix, $db, $admin_file;
 916          $cid = intval($cid);
 917          if($ok==1) {
 918              if ($sub>0) {
 919                  $db->sql_query("delete from " . $prefix . "_downloads_categories where cid='$cid'");
 920                  $db->sql_query("delete from " . $prefix . "_downloads_downloads where cid='$cid'");
 921              } else {
 922                  $db->sql_query("delete from " . $prefix . "_downloads_downloads where cid='$cid'");
 923                  // suppression des liens de catégories filles

 924                  $result2 = $db->sql_query("SELECT cid from " . $prefix . "_downloads_categories where parentid='$cid'");
 925                  while ($row2 = $db->sql_fetchrow($result2)) {
 926                      $cid2 = intval($row2['cid']);
 927                      $db->sql_query("delete from " . $prefix . "_downloads_downloads where cid='$cid2'");
 928                  }
 929                  $db->sql_query("delete from " . $prefix . "_downloads_categories where parentid='$cid'");
 930                  $db->sql_query("delete from " . $prefix . "_downloads_categories where cid='$cid'");
 931              }
 932              Header("Location: ".$admin_file.".php?op=downloads");
 933          } else {
 934              $result = $db->sql_query("SELECT * from " . $prefix . "_downloads_categories where parentid='$cid'");
 935              $nbsubcat = $db->sql_numrows($result);
 936              $result3 = $db->sql_query("SELECT cid from " . $prefix . "_downloads_categories where parentid='$cid'");
 937              while ($row3 = $db->sql_fetchrow($result3)) {
 938                  $cid2 = intval($row3['cid']);
 939                  $result4 = $db->sql_query("SELECT * from " . $prefix . "_downloads_downloads where cid='$cid2'");
 940                  $nblink = $db->sql_numrows($result4);
 941              }
 942              include ("header.php");
 943              GraphicAdmin();
 944              OpenTable();
 945              echo "<br><center><font class=\"option\">";
 946              echo "<b>" . _EZTHEREIS . " $nbsubcat " . _EZSUBCAT . " " . _EZATTACHEDTOCAT . "</b><br>";
 947              echo "<b>" . _EZTHEREIS . " $nblink " . _downloads . " " . _EZATTACHEDTOCAT . "</b><br>";
 948              echo "<b>" . _DELEZDOWNLOADSCATWARNING . "</b><br><br>";
 949          }
 950          echo "[ <a href=\"".$admin_file.".php?op=DownloadsDelCat&amp;cid=$cid&amp;sid=$sid&amp;sub=$sub&amp;ok=1\">" . _YES . "</a> | <a href=\"".$admin_file.".php?op=Links\">" . _NO . "</a> ]<br><br>";
 951          CloseTable();
 952          include ("footer.php");
 953      }
 954  
 955  	function DownloadsDelNew($lid) {
 956          global $prefix, $db, $admin_file;
 957          $lid = intval($lid);
 958          $db->sql_query("delete from " . $prefix . "_downloads_newdownload where lid='$lid'");
 959          Header("Location: ".$admin_file.".php?op=downloads");
 960      }
 961  
 962  	function DownloadsAddCat($title, $cdescription) {
 963          global $prefix, $db, $admin_file;
 964          $result = $db->sql_query("SELECT cid from " . $prefix . "_downloads_categories where title='$title'");
 965          $numrows = $db->sql_numrows($result);
 966          if ($numrows>0) {
 967              include ("header.php");
 968              GraphicAdmin();
 969              OpenTable();
 970              echo "<br><center><font class=\"content\">"
 971              ."<b>" . _ERRORTHECATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
 972              ."" . _GOBACK . "<br><br>";
 973              CloseTable();
 974              include ("footer.php");
 975          } else {
 976              $title = filter($title, "nohtml", 1);
 977              $cdescription = filter($cdescription, "", 1);
 978              $db->sql_query("insert into " . $prefix . "_downloads_categories values (NULL, '$title', '$cdescription', '0')");
 979              Header("Location: ".$admin_file.".php?op=downloads");
 980          }
 981      }
 982  
 983  	function DownloadsAddSubCat($cid, $title, $cdescription) {
 984          global $prefix, $db, $admin_file;
 985          $cid = intval($cid);
 986          $result = $db->sql_query("SELECT cid from " . $prefix . "_downloads_categories where title='$title' AND cid='$cid'");
 987          $numrows = $db->sql_numrows($result);
 988          if ($numrows>0) {
 989              include ("header.php");
 990              GraphicAdmin();
 991              OpenTable();
 992              echo "<br><center>";
 993              echo "<font class=\"content\">"
 994              ."<b>" . _ERRORTHESUBCATEGORY . " $title " . _ALREADYEXIST . "</b><br><br>"
 995              ."" . _GOBACK . "<br><br>";
 996              include ("footer.php");
 997          } else {
 998              $title = filter($title, "nohtml", 1);
 999              $cdescription = filter($cdescription, "", 1);
1000              $db->sql_query("insert into " . $prefix . "_downloads_categories values (NULL, '$title', '$cdescription', '$cid')");
1001              Header("Location: ".$admin_file.".php?op=downloads");
1002          }
1003      }
1004  
1005  	function DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext) {
1006          global $aid, $prefix, $db, $admin_file;
1007          $editorialtitle = filter($editorialtitle, "nohtml", 1);
1008          $editorialtext = filter($editorialtext, "", 1);
1009          $db->sql_query("insert into " . $prefix . "_downloads_editorials values ('$downloadid', '$aid', now(), '$editorialtext', '$editorialtitle')");
1010          include ("header.php");
1011          GraphicAdmin();
1012          OpenTable();
1013          echo "<center><br>"
1014          ."<font class=option>"
1015          ."" . _EDITORIALADDED . "<br><br>"
1016          ."[ <a href=\"".$admin_file.".php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
1017          echo "$downloadid  $adminid, $editorialtitle, $editorialtext";
1018          CloseTable();
1019          include ("footer.php");
1020      }
1021  
1022  	function DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext) {
1023          global $prefix, $db, $admin_file;
1024          $editorialtitle = filter($editorialtitle, "nohtml", 1);
1025          $editorialtext = filter($editorialtext, "", 1);
1026          $db->sql_query("update " . $prefix . "_downloads_editorials set editorialtext='$editorialtext', editorialtitle='$editorialtitle' where downloadid='$downloadid'");
1027          include ("header.php");
1028          GraphicAdmin();
1029          OpenTable();
1030          echo "<br><center>"
1031          ."<font class=\"content\">"
1032          ."" . _EDITORIALMODIFIED . "<br><br>"
1033          ."[ <a href=\"".$admin_file.".php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
1034          CloseTable();
1035          include ("footer.php");
1036      }
1037  
1038  	function DownloadsDelEditorial($downloadid) {
1039          global $prefix, $db, $admin_file;
1040          $downloadid = intval($downloadid);
1041          $db->sql_query("delete from " . $prefix . "_downloads_editorials where downloadid='$downloadid'");
1042          include ("header.php");
1043          GraphicAdmin();
1044          OpenTable();
1045          echo "<br><center>"
1046          ."<font class=\"content\">"
1047          ."" . _EDITORIALREMOVED . "<br><br>"
1048          ."[ <a href=\"".$admin_file.".php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]<br><br>";
1049          CloseTable();
1050          include ("footer.php");
1051      }
1052  
1053  	function DownloadsDownloadCheck() {
1054          global $prefix, $db, $admin_file;
1055          $cid = intval($cid);
1056          include  ("header.php");
1057          GraphicAdmin();
1058          OpenTable();
1059          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1060          CloseTable();
1061          echo "<br>";
1062          OpenTable();
1063          echo "<center><font class=\"content\"><b>" . _DOWNLOADVALIDATION . "</b></font></center><br>"
1064          ."<table width=\"100%\" align=\"center\"><tr><td colspan=\"2\" align=\"center\">"
1065          ."<a href=\"".$admin_file.".php?op=DownloadsValidate&amp;cid=0&amp;sid=0\">" . _CHECKALLDOWNLOADS . "</a><br><br></td></tr>"
1066          ."<tr><td valign=\"top\"><center><b>" . _CHECKCATEGORIES . "</b><br>" . _INCLUDESUBCATEGORIES . "<br><br><font class=\"tiny\">";
1067          $result = $db->sql_query("SELECT cid, title from " . $prefix . "_downloads_categories order by title");
1068          while ($row = $db->sql_fetchrow($result)) {
1069              $cid = intval($row['cid']);
1070              $title = filter($row['title'], "nohtml");
1071              $transfertitle = str_replace (" ", "_", $title);
1072              echo "<a href=\"".$admin_file.".php?op=DownloadsValidate&amp;cid=$cid&amp;sid=0&amp;ttitle=$transfertitle\">$title</a><br>";
1073          }
1074          echo "</font></center></td></tr></table>";
1075          CloseTable();
1076          include  ("footer.php");
1077      }
1078  
1079  	function DownloadsValidate($cid, $sid, $ttitle) {
1080          global $bgcolor2, $prefix, $db, $admin_file;
1081          include  ("header.php");
1082          GraphicAdmin();
1083          OpenTable();
1084          echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1085          CloseTable();
1086          echo "<br>";
1087          OpenTable();
1088          $transfertitle = str_replace ("_", "", $ttitle);
1089          /* Check ALL Downloads */

1090          $cid = intval($cid);
1091          $sid = intval($sid);
1092          echo "<table width=100% border=0>";
1093          if ($cid==0 && $sid==0) {
1094              echo "<tr><td colspan=\"3\"><center><b>" . _CHECKALLDOWNLOADS . "</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1095              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_downloads_downloads order by title");
1096          }
1097          /* Check Categories & Subcategories */

1098          if ($cid!=0 && $sid==0) {
1099              echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1100              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_downloads_downloads where cid='$cid' order by title");
1101          }
1102          /* Check Only Subcategory */

1103          if ($cid==0 && $sid!=0) {
1104              echo "<tr><td colspan=\"3\"><center><b>" . _VALIDATINGSUBCAT . ": $transfertitle</b><br>" . _BEPATIENT . "</center><br><br></td></tr>";
1105              $result = $db->sql_query("SELECT lid, title, url from " . $prefix . "_downloads_downloads where sid='$sid' order by title");
1106          }
1107          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>";
1108          while($row = $db->sql_fetchrow($result)) {
1109              $lid = intval($row['lid']);
1110              $title = filter($row['title'], "nohtml");
1111              $vurl = parse_url($row['url']);
1112              $fp = fsockopen($vurl['host'], 80, $errno, $errstr, 15);
1113              if (!$fp){
1114                  echo "<tr><td align=\"center\"><b>&nbsp;&nbsp;" . _FAILED . "&nbsp;&nbsp;</b></td>"
1115                  ."<td>&nbsp;&nbsp;<a href=\"$url\" target=\"new\">$title</a>&nbsp;&nbsp;</td>"
1116                  ."<td align=\"center\"><font class=\"content\">&nbsp;&nbsp;[ <a href=\"".$admin_file.".php?op=DownloadsModDownload&amp;lid=$lid\">" . _EDIT . "</a> | <a href=\"".$admin_file.".php?op=DownloadsDelDownload&amp;lid=$lid\">" . _DELETE . "</a> ]&nbsp;&nbsp;</font>"
1117                  ."</td></tr>";
1118              }
1119              if ($fp){
1120                  echo "<tr><td align=\"center\">&nbsp;&nbsp;" . _OK . "&nbsp;&nbsp;</td>"
1121                  ."<td>&nbsp;&nbsp;<a href=\"$url\" target=\"new\">$title</a>&nbsp;&nbsp;</td>"
1122                  ."<td align=\"center\"><font class=\"content\">&nbsp;&nbsp;" . _NONE . "&nbsp;&nbsp;</font>"
1123                  ."</td></tr>";
1124              }
1125          }
1126          echo "</table>";
1127          CloseTable();
1128          include  ("footer.php");
1129      }
1130  
1131  	function DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter, $filesize, $version, $homepage, $hits) {
1132          global $prefix, $db, $admin_file;
1133          $result = $db->sql_query("SELECT url from " . $prefix . "_downloads_downloads where url='$url'");
1134          $numrows = $db->sql_numrows($result);
1135          if ($numrows>0) {
1136              include ("header.php");
1137              GraphicAdmin();
1138              OpenTable();
1139              echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1140              CloseTable();
1141              echo "<br>";
1142              OpenTable();
1143              echo "<br><center>"
1144              ."<font class=\"content\">"
1145              ."<b>" . _ERRORURLEXIST . "</b><br><br>"
1146              ."" . _GOBACK . "<br><br>";
1147              CloseTable();
1148              include ("footer.php");
1149          } else {
1150              /* Check if Title exist */

1151              if (empty($title)) {
1152                  include ("header.php");
1153                  GraphicAdmin();
1154                  OpenTable();
1155                  echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1156                  CloseTable();
1157                  echo "<br>";
1158                  OpenTable();
1159                  echo "<br><center>"
1160                  ."<font class=\"content\">"
1161                  ."<b>" . _ERRORNOTITLE . "</b><br><br>"
1162                  ."" . _GOBACK . "<br><br>";
1163                  CloseTable();
1164                  include ("footer.php");
1165              }
1166              /* Check if URL exist */

1167              if (empty($url)) {
1168                  include ("header.php");
1169                  GraphicAdmin();
1170                  OpenTable();
1171                  echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1172                  CloseTable();
1173                  echo "<br>";
1174                  OpenTable();
1175                  echo "<br><center>"
1176                  ."<font class=\"content\">"
1177                  ."<b>" . _ERRORNOURL . "</b><br><br>"
1178                  ."" . _GOBACK . "<br><br>";
1179                  CloseTable();
1180                  include ("footer.php");
1181              }
1182              // Check if Description exist

1183              if (empty($description)) {
1184                  include ("header.php");
1185                  GraphicAdmin();
1186                  OpenTable();
1187                  echo "<center><font class=\"title\"><b>" . _WEBDOWNLOADSADMIN . "</b></font></center>";
1188                  CloseTable();
1189                  echo "<br>";
1190                  OpenTable();
1191                  echo "<br><center>"
1192                  ."<font class=\"content\">"
1193                  ."<b>" . _ERRORNODESCRIPTION . "</b><br><br>"
1194                  ."" . _GOBACK . "<br><br>";
1195                  CloseTable();
1196                  include ("footer.php");
1197              }
1198              $cat = explode("-", $cat);
1199              if (empty($cat[1])) {
1200                  $cat[1] = 0;
1201              }
1202              $title = filter($title, "nohtml", 1);
1203              $url = filter($url, "nohtml", 1);
1204              $description = filter($description, "", 1);
1205              $name = filter($name, "nohtml");
1206              $email = filter($email, "nohtml");
1207              $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')");
1208              global $nukeurl, $sitename;
1209              include ("header.php");
1210              GraphicAdmin();
1211              OpenTable();
1212              echo "<br><center>";
1213              echo "<font class=\"content\">";
1214              echo "" . _NEWDOWNLOADADDED . "<br><br>";
1215              echo "[ <a href=\"".$admin_file.".php?op=downloads\">" . _WEBDOWNLOADSADMIN . "</a> ]</center><br><br>";
1216              CloseTable();
1217              if ($new==1) {
1218                  $db->sql_query("delete from " . $prefix . "_downloads_newdownload where lid='$lid'");
1219              }
1220              include ("footer.php");
1221          }
1222      }
1223  
1224      switch ($op) {
1225  
1226          case "downloads":
1227          downloads();
1228          break;
1229  
1230          case "DownloadsDelNew":
1231          DownloadsDelNew($lid);
1232          break;
1233  
1234          case "DownloadsAddCat":
1235          DownloadsAddCat($title, $cdescription);
1236          break;
1237  
1238          case "DownloadsAddSubCat":
1239          DownloadsAddSubCat($cid, $title, $cdescription);
1240          break;
1241  
1242          case "DownloadsAddDownload":
1243          DownloadsAddDownload($new, $lid, $title, $url, $cat, $description, $name, $email, $submitter, $filesize, $version, $homepage, $hits);
1244          break;
1245  
1246          case "DownloadsAddEditorial":
1247          DownloadsAddEditorial($downloadid, $editorialtitle, $editorialtext);
1248          break;
1249  
1250          case "DownloadsModEditorial":
1251          DownloadsModEditorial($downloadid, $editorialtitle, $editorialtext);
1252          break;
1253  
1254          case "DownloadsDownloadCheck":
1255          DownloadsDownloadCheck();
1256          break;
1257  
1258          case "DownloadsValidate":
1259          DownloadsValidate($cid, $sid, $ttitle);
1260          break;
1261  
1262          case "DownloadsDelEditorial":
1263          DownloadsDelEditorial($downloadid);
1264          break;
1265  
1266          case "DownloadsCleanVotes":
1267          DownloadsCleanVotes();
1268          break;
1269  
1270          case "DownloadsListBrokenDownloads":
1271          DownloadsListBrokenDownloads();
1272          break;
1273  
1274          case "DownloadsDelBrokenDownloads":
1275          DownloadsDelBrokenDownloads($lid);
1276          break;
1277  
1278          case "DownloadsIgnoreBrokenDownloads":
1279          DownloadsIgnoreBrokenDownloads($lid);
1280          break;
1281  
1282          case "DownloadsListModRequests":
1283          DownloadsListModRequests();
1284          break;
1285  
1286          case "DownloadsChangeModRequests":
1287          DownloadsChangeModRequests($requestid);
1288          break;
1289  
1290          case "DownloadsChangeIgnoreRequests":
1291          DownloadsChangeIgnoreRequests($requestid);
1292          break;
1293  
1294          case "DownloadsDelCat":
1295          DownloadsDelCat($cid, $sid, $sub, $ok);
1296          break;
1297  
1298          case "DownloadsModCat":
1299          DownloadsModCat($cat);
1300          break;
1301  
1302          case "DownloadsModCatS":
1303          DownloadsModCatS($cid, $sid, $sub, $title, $cdescription);
1304          break;
1305  
1306          case "DownloadsModDownload":
1307          DownloadsModDownload($lid);
1308          break;
1309  
1310          case "DownloadsModDownloadS":
1311          DownloadsModDownloadS($lid, $title, $url, $description, $name, $email, $hits, $cat, $filesize, $version, $homepage);
1312          break;
1313  
1314          case "DownloadsDelDownload":
1315          DownloadsDelDownload($lid);
1316          break;
1317  
1318          case "DownloadsDelVote":
1319          DownloadsDelVote($lid, $rid);
1320          break;
1321  
1322          case "DownloadsDelComment":
1323          DownloadsDelComment($lid, $rid);
1324          break;
1325  
1326          case "DownloadsTransfer":
1327          DownloadsTransfer($cidfrom,$cidto);
1328          break;
1329  
1330      }
1331  
1332  } else {
1333      include ("header.php");
1334      GraphicAdmin();
1335      OpenTable();
1336      echo "<center><b>"._ERROR."</b><br><br>You do not have administration permission for module \"$module_name\"</center>";
1337      CloseTable();
1338      include ("footer.php");
1339  }
1340  
1341  ?>


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