<?php

/*
// +--------------------------------------------------------------------------+
// | Project:    NVTracker - NetVision BitTorrent Tracker                     |
// +--------------------------------------------------------------------------+
// | This file is part of NVTracker. NVTracker is based on BTSource,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | NVTracker is free software; you can redistribute it and/or modify        |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | NVTracker is distributed in the hope that it will be useful,             |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with NVTracker; if not, write to the Free Software Foundation,     |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// | Obige Zeilen dürfen nicht entfernt werden!    Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/

ob_start("ob_gzhandler");

require_once("include/bittorrent.php");

hit_start();

function dltable($name, $arr, $torrent)
{
    global $CURUSER;

    $s = "<b>" . count($arr) . " $name</b>\n";
    if (!count($arr))
        return $s;

    $s .= "\n";
    $s .= "<table width=\"100%\" class=\"tableinborder\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n";
    $s .= "<tr><td class=\"tablecat\">Benutzer/IP</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Erreichbar</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Hochgeladen</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Rate</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Runtergeladen</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Rate</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Ratio</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Fertig</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Verbunden</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Unt&auml;tig</td>" . "<td class=\"tablecat\" style=\"text-align:center\">Client</td></tr>\n";

    $mod = get_user_class() >= UC_MODERATOR;
    $now = time();
    foreach ($arr as $e) {
        // user/ip/port
        // check if anyone has this ip
        ($unr = mysql_query("SELECT username, privacy, class, donor, enabled, warned, webseed, adsl, vdsl, added, anon FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
        $una = mysql_fetch_array($unr);
        $tdclass = $CURUSER && $e["userid"] == $CURUSER["id"] ? " class=\"inposttable\"": " class=\"tableb\"";
        if ($una["privacy"] == "strong") continue;
        $s .= "<tr>\n";

        if ($una["username"])
// BEGIN: Anonymous Torrent Liste by truenoir
          if($una["anon"]=="no"||get_user_class()>=UC_MODERATOR) {
            $s .= "<td$tdclass nowrap=\"nowrap\"><a href=\"userdetails.php?id=$e[userid]\"><font class=\"" . get_class_color($una["class"]) . "\"><b>$una[username]</b></font></a>&nbsp;" . get_user_icons($una) . ($mod?"<br/>$e[ip]":"")."</td>\n";
          }
          else
          {
            $s .= "<td$tdclass nowrap=\"nowrap\"><b>Anonym*</b></td>\n";
          }
// END: Anonymous Torrent Liste by truenoir
        else
            $s .= "<td$tdclass>" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . "</td>\n";

        $revived = $e["revived"] == "yes";
        $s .= "<td$tdclass style=\"text-align:center\">" . ($e[connectable] == "yes" ? "Ja" : "<font color=\"red\">Nein</font>") . "</td>\n";
        $s .= "<td$tdclass style=\"text-align:right\">" . mksize($e["uploaded"]) . "</td>\n";
        $s .= "<td$tdclass style=\"text-align:right\" nowrap=\"nowrap\">" . mksize($e["uploaded"] / max(1, $e["uploadtime"])) . "/s</td>\n";
        $s .= "<td$tdclass style=\"text-align:right\">" . mksize($e["downloaded"]) . "</td>\n";
        $s .= "<td$tdclass style=\"text-align:right\" nowrap=\"nowrap\">" . mksize($e["downloaded"] / max(1, $e["downloadtime"])) . "/s</td>\n";
if ($row["multi"] == "2") echo '<center><img src=pic/multi2.gif></center>';
    if ($row["multi"] == "5") echo '<center><img src=pic/multi5.gif></center>';
    if ($row["multi"] == "10") echo '<center><img src=pic/multi10.gif></center>';
        if ($e["downloaded"]) {
            $ratio = floor(($e["uploaded"] / $e["downloaded"]) * 1000) / 1000;
            $s .= "<td$tdclass style=\"text-align:right\"><font color=\"" . get_ratio_color($ratio) . "\">" . number_format($ratio, 3) . "</font></td>\n";
        } else {
            if ($e["uploaded"])
                $s .= "<td$tdclass style=\"text-align:right\">Inf.</td>\n";
            else
                $s .= "<td$tdclass style=\"text-align:right\">---</td>\n";
        }

        $s .= "<td$tdclass style=\"text-align:right\"><div title=\"" . sprintf("%.2f%%", 100 * (1 - ($e["to_go"] / $torrent["size"]))) . "\"style=\"border:1px solid black;padding:0px;width:40px;height:10px;\"><div style=\"border:none;width:" . sprintf("%.2f", 40 * (1 - ($e["to_go"] / $torrent["size"]))) . "px;height:10px;background-image:url(" . $GLOBALS["PIC_BASE_URL"] . "ryg-verlauf-small.png);background-repeat:no-repeat;\"></div></div></td>\n";
        $s .= "<td$tdclass nowrap style=\"text-align:right\">" . mkprettytime($now - $e["st"]) . "</td>\n";
        $s .= "<td$tdclass style=\"text-align:right\">" . mkprettytime($now - $e["la"]) . "</td>\n";
        $s .= "<td$tdclass style=\"text-align:left\">" . htmlspecialchars(getagent($e["agent"], $e["peer_id"])) . "</td>\n";
        $s .= "</tr>\n";
    }
    $s .= "</table>\n";
    return $s;
}

// BEGIN: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir
function get_traffics($trres,$torrsize,$owner)
{
  global $GLOBALS;

  if(mysql_num_rows($trres)>0)
  {
    $ret="<table width=\"100%\" class=\"tableinborder\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n";
    $ret.="<tr><td class=\"tablecat\">User</td><td class=\"tablecat\" colspan=\"2\">Download</td><td class=\"tablecat\">Upload</td><td class=\"tablecat\">FR</td></tr>\n";
    while($r=mysql_fetch_assoc($trres))
    {
      $dnrat=number_format($r["downloaded"]*100/$torrsize, 1);
      if($r["downloaded"]>0)
      {
        $uprat=number_format($r["uploaded"]/$r["downloaded"], 3);
        $uprat="<font color=\"" . get_ratio_color($uprat) . "\">$uprat</font>";
      }elseif($r["uploaded"]>0)
        $uprat="Inf.";
      else
        $uprat="---";
      $tolow=($r["downloaded"]<$torrsize&&$owner!=$r["username"]);
      $ret.="<tr><td class=\"tableb\"><a href=\"userdetails.php?id=$r[userid]\"><font class=\"".get_class_color($r["class"])."\">$r[username]</font></a> ".(isset($r["enabled"]) && $r["enabled"] == "no"?"<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "disabled.png\" alt=\"Deaktiviert\" title=\"Dieser Benutzer ist deaktiviert\" border=0>":"")." ".(isset($r["warned"]) && $r["warned"] == "yes"? "<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "warned.gif\" alt=\"Verwarnt\" title=\"Dieser Benutzer wurde verwarnt\" border=0>":"")." ".($owner===$r["username"]?"(Masterseeder)":"")."</td><td class=\"tablea\">".($tolow ? "<span style=\"color:red\">" : "").mksize($r["downloaded"]).($tolow ? "</span>" : "")."</td><td class=\"tableb\">".($tolow ? "<span style=\"color:red\">" : "")."$dnrat %".($tolow ? "</span>" : "")."</td><td class=\"tablea\">".mksize($r["uploaded"])."</td><td class=\"tableb\">$uprat</td></tr>\n";
    }
    $ret.="</table>\n";
  }
  else
    $ret="<b>Bisher ist noch kein Traffic für diesen Torrent verzeichnet worden<b>";
  return($ret);
}
// END: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir

dbconn(false);

loggedinorreturn();

hit_count();

$id = $_GET["id"];
$id = 0 + $id;
if (!isset($id) || !$id)
    die();

// BEGIN: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir
if(get_user_class()>=UC_MODERATOR)
  $trres=mysql_query("select traffic.*,users.username,users.enabled,users.warned,users.class from traffic,users where traffic.userid=users.id and torrentid='$id' order by traffic.downloaded, users.username");
// END: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir

$t_query = "SELECT torrents.seedspeed, torrents.Release1, torrents.Release2, torrents.Release3, torrents.Release4, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, ";
$t_query .= "torrents.filename, LENGTH(torrents.nfo) AS nfosz, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(";
$t_query .= "torrents.last_action) AS lastseed, torrents.numratings, torrents.numratings_audio, torrents.numratings_video, torrents.vip, torrents.name, torrents.team, torrents.highlight, torrents.multi, torrents.freeleech, IF(torrents.numratings";
$t_query .= " < " . $GLOBALS["MINVOTES"] . ", NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating,IF(torrents.numratings_video < " . $GLOBALS["MINVOTES"] . ", NULL, ROUND(torrents.ratingsum_video / torrents.numratings_video, 1)) AS rating_video,IF(torrents.numratings_audio < " . $GLOBALS["MINVOTES"] . ", NULL, ROUND(torrents.ratingsum_audio / torrents.numratings_audio, 1)) AS rating_audio, ";
$t_query .= "torrents.owner, torrents.gu_agent, torrents.save_as, torrents.descr, torrents.language, torrents.visible, torrents.size, torrents.activated, ";
$t_query .= "torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, ";
$t_query .= "torrents.type,torrents.nuked, torrents.nukedr,torrents.numfiles, torrents.numpics, categories.name AS cat_name, users.username, users.anon, users.class, users.webseed, users.adsl, users.vdsl, torrents.free, torrents.infourl,torrents.yout, torrents.poster FROM ";
$t_query .= "torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON ";
$t_query .= "torrents.owner = users.id WHERE torrents.id = $id";

$res = mysql_query($t_query) or sqlerr();
$row = mysql_fetch_array($res);

$owned = $moderator = 0;
if ($CURUSER["id"] == $row["owner"])
    $owned = 1;
// We limit access for the GU team on torrents of users below UC_UPLOADER
elseif (get_user_class() >= UC_MODERATOR || ($row["activated"] == "no" && get_user_class() == UC_GUTEAM && $row["class"] < UC_UPLOADER))
    $owned = $moderator = 1;

if ($row["vip"] =="yes" && get_user_class() < UC_VIP)
stderr("VIP Status nötig", "Du must Vip sein, um diesen torrent saugen zu können!");

if (!$row || ($row["banned"] == "yes" && !$moderator))
    stderr("Fehler", "Es existiert kein Torrent mit der ID $id.");

if (!$owned && $row["activated"] != "yes")
    stderr("Fehler", "Es existiert kein Torrent mit der ID $id.");

if ($_GET["hit"]) {
    mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
    if ($_GET["tocomm"])
        header("Location: details.php?id=$id&page=0&" . SID . "#startcomments");
    elseif ($_GET["filelist"])
        header("Location: details.php?id=$id&filelist=1&" . SID . "#filelist");
    elseif ($_GET["toseeders"])
        header("Location: details.php?id=$id&dllist=1&" . SID . "#seeders");
    elseif ($_GET["todlers"])
        header("Location: details.php?id=$id&dllist=1&" . SID . "#leechers");
    elseif ($_GET["tosnatchers"])
        header("Location: details.php?id=$id&snatcher=1&" . SID . "#snatcher");
    else
        header("Location: details.php?id=$id&" . SID);
    hit_end();
    exit();
}

if ($_GET["activate"] && $moderator && $row["activated"] != "yes") {
    mysql_query("UPDATE users SET gus = gus + 1  WHERE id = " . $row["owner"]);
    mysql_query("UPDATE users SET aktgus = aktgus + 1  WHERE id = " .$row["owner"]);
    mysql_query("UPDATE `torrents` SET `activated`='yes',`added`=NOW() WHERE `id`=" . $row["id"]);
    sendPersonalMessage(0, $row["owner"], "Dein Torrent wurde von einem Moderator freigeschaltet!", "Dein Torrent \"[url=$DEFAULTBASEURL/details.php?id=" . $row["id"] . "]" . $row["name"] . "[/url]\" wurde von [url=$DEFAULTBASEURL/userdetails.php?id=" . $CURUSER["id"] . "]" . $CURUSER["username"] . "[/url] freigeschaltet. Du musst nun die Torrent-Datei erneut vom Tracker herunterladen, und kannst dann mit dem Seeden beginnen.\n\nBei Fragen lies bitte zuerst das [url=$DEFAULBASEURL/faq.php]FAQ[/url]!", PM_FOLDERID_SYSTEM);
    if (get_cur_wait_time($row["owner"]))
        mysql_query("INSERT INTO `nowait` (user_id,torrent_id,status,grantor,msg) VALUES (" . $row["owner"] . "," . $row["id"] . ",'granted'," . $CURUSER["id"] . ",'Automatische Wartezeitaufhebung durch Torrent-Freischaltung')");
    write_log("torrentgranted", "Der Torrent <a href=\"details.php?id=" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</a> wurde von '<a href=\"userdetails.php?id=$CURUSER[id]\">$CURUSER[username]</a>' freigeschaltet.");
    stderr("Torrent freigeschaltet", "Der Torrent wurde freigeschaltet, und ist nun über die Torrent-Suche auffindbar. Ebenso kann der Besitzer nun beginnen, den Torrent zu seeden. Eine Persönliche Nachricht wurde an den Uploader versendet, die ihn über die Freischaltung informiert.");
}
if ($_GET["agenttakeover"] == "acquire" && $row["gu_agent"] == 0 && $moderator && $row["activated"] != "yes") {
    $row["gu_agent"] = $CURUSER["id"];
    mysql_query("UPDATE `torrents` SET `gu_agent`=".$CURUSER["id"]." WHERE `id`=".$row["id"]);
}
if ($_GET["agenttakeover"] == "release" && $row["gu_agent"] == $CURUSER["id"] && $moderator && $row["activated"] != "yes") {
    $row["gu_agent"] = 0;
    mysql_query("UPDATE `torrents` SET `gu_agent`=0 WHERE `id`=".$row["id"]);
}

if (!isset($_GET["page"])) {
    stdhead("Details zu Torrent \"" . $row["name"] . "\"");

    $spacer = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

    if (!$_GET["snatcher"])
        $snatchersmax = "LIMIT 10";
    else
        $snatchersmax = "";

    $res = mysql_query("SELECT DISTINCT(user_id) as id, username, class, anon, peers.id as peerid FROM completed,users LEFT JOIN peers ON peers.userid=users.id AND peers.torrent=$id AND peers.seeder='yes' WHERE completed.user_id=users.id AND completed.torrent_id=$id ORDER BY complete_time DESC $snatchersmax");

    $last10users = "";
    while ($arr = mysql_fetch_assoc($res)) {
        if ($last10users) $last10users .= ", ";
// BEGIN: Anonymous Torrent Liste by truenoir
        if($arr["anon"]=="yes"&&get_user_class()<UC_MODERATOR)
          $last10users .= ($arr["peerid"] > 0?"<b>":"")."Anonym*".($arr["peerid"] > 0?"</b>":"");
        else
        {
          $arr["username"] = "<font class=\"" . get_class_color($arr["class"]) . "\">" . $arr["username"] . "</font>";
          if ($arr["peerid"] > 0) {
              $arr["username"] = "<b>" . $arr["username"] . "</b>";
          }
          $last10users .= "<a href=\"userdetails.php?id=" . $arr["id"] . "\">" . $arr["username"] . "</a>";
        }
// END: Anonymous Torrent Liste by truenoir

    }

    if ($last10users == "")
        $last10users = "Diesen Torrent hat noch niemand fertiggestellt.";
    else
        $last10users .= "<br/><br/>(Fettgedruckte User seeden noch)";

    if ($_GET["edited"]) {
        begin_frame("Erfolgreich bearbeitet!", false, "650px");
        echo "<p>Der Torrent wurde erfolgreich geändert. Die Änderungen sind sofort für andere sichtbar.</p>";
        if (isset($_GET["returnto"]))
            echo "<p><b>Gehe dorthin zur&uuml;ck, von <a href=\"" . htmlspecialchars($_GET["returnto"]) . "\">wo Du gekommen bist</a>.</b></p>\n";
        end_frame();
    } elseif (isset($_GET["searched"])) {
        begin_frame("Suche", false, "650px");
        echo "<p>Deine Suche nach \"" . htmlspecialchars($_GET["searched"]) . "\" hat ein einzelnes Ergebnis zur&uuml;ckgegeben:</p>\n";
        end_frame();
    } elseif ($_GET["rated"]) {
        begin_frame("Bewertung hinzugef&uuml;gt!", false, "650px");
        echo "<p>Deine Bewertung wurde gespeichert. Du kannst nun die Ergebnisse ansehen.</p>\n";
        end_frame();
     } 

elseif ($_GET["thanks"]) {
        begin_frame("Danke hinzugef&uuml;gt!", false, "650px");
        echo "<p>Dein Dank wurde gespeichert.</p>\n";
        end_frame();

    }

    $s = $row["name"];

// BEGIN: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir
if(get_user_class()>=UC_MODERATOR&&$trres)
{
  if(!$_GET["aclist"])
    $trlist=mysql_numrows($trres)." User sind/waren aktiv";
  else
    $trlist=get_traffics($trres,$row["size"],$row["username"]);
}
// END: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir

    ?>
<table cellpadding="4" cellspacing="1" border="0" style="width:650px" class="tableinborder">
<tr>
<?
$r = mysql_query("SELECT name FROM torrents WHERE id=$id") or sqlerr();
$a = mysql_fetch_assoc($r) or die("Puke");
?>
<td class="tabletitle" colspan="10" width="100%" style="text-align:center"><img src="./pic/viewmag.png" alt="" style="vertical-align: left;"><b>Details zu <?=$a["name"]?> <?php if ($row["class"] < UC_UPLOADER) echo '<font color="red">(Gast-Upload)</font>';
?>

<?php
if ($row[free] == yes) {
echo ' <img src=pic/oupic.gif> ';
}
?>

<?php
if ($row[webseed] == yes) {
echo ' <img src=pic/ws.gif> ';
}

?>

<?php
if ($row[adsl] == yes) {
echo ' <img src=pic/adslbig.gif> ';
}
?>

<?php
if ($row[vdsl] == yes) {
echo ' <img src=pic/vdslbig.gif> ';
}
?>
</b>
</td>
</tr>



<center>
<tr><td width="100%" class="tablea" align="center">
<center>
<?
$res13 = mysql_query("SELECT id, seeders, leechers, name, size, added, seedspeed FROM torrents WHERE id > $id ORDER BY id ") or sqlerr();
$row13 = mysql_fetch_array($res13);
$idsv = $row13["id"];
if ($idsv >= 1) {
$name = $row13['name'];
$name = str_replace('_', ' ' , $name);
$name = str_replace('.', ' ' , $name);
$name = substr($name, 0, 35). "...";

?>
<a href="details.php?id=<?=$idsv?>" onMouseover="ddrivetip('___________________<font color=darkorange><b>Titel</b></font>____________________<br><br>&nbsp;<b><font color=black><?=$name?><?=$string?></font></b><br>___________________________________________<br><br> &nbsp;<font color=darkorange><b>Seeder</b></font> = <font color=#00CD00><b><?=$row13['seeders']?></b></font>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=darkorange><b>Leecher</b></font> = <font color=red><b><?=$row13['leechers']?></b></font><br>___________________________________________<br><br><font color=darkorange><b>&nbsp;Größe</font><font color=#00CD00> <?=mksize($row13["size"])?></font>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=darkorange>SeedSpeed</font><font color=#00CD00> <?=$row13["seedspeed"]?></font> </b><br>___________________________________________<br><br>&nbsp;<font color=black>Hochgeladen am:</font><font color=red> <?=$row13["added"]?></font><br> ','#333333')"; onMouseout="hideddrivetip()"><img src=pic/previousS.png
border=0></a>
<?
}

?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?

$res12 = mysql_query("SELECT id, seeders, leechers, name, size, added, seedspeed FROM torrents WHERE id < $id ORDER BY id desc") or sqlerr();
$row12 = mysql_fetch_array($res12);
$idsz = $row12["id"];
if ($idsz >= 1)
$name1 = $row12['name'];
$name1 = str_replace('_', ' ' , $name1);
$name1 = str_replace('.', ' ' , $name1);
$name1 = substr($name1, 0, 35). "...";

?>
<a href="details.php?id=<?=$idsz?>" onMouseover="ddrivetip('___________________<font color=darkorange><b>Titel</b></font>____________________<br><br>&nbsp;<b><font color=black><?=$name1?></font></b><br>___________________________________________<br><br> &nbsp;<font color=darkorange><b>Seeder</b></font> = <font color=#00CD00><b><?=$row12['seeders']?></b></font>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=darkorange><b>Leecher</b></font> = <font color=red><b><?=$row12['leechers']?></b></font><br>___________________________________________<br><br> &nbsp;<font color=darkorange><b>Größe</font><font color=#00CD00> <?=mksize($row12["size"])?></font>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=darkorange>SeedSpeed</font><font color=#00CD00> <?=$row12["seedspeed"]?></font> </b><br>___________________________________________<br><br>&nbsp;<font color=black>Hochgeladen am:</font><font color=red> <?=$row12["added"]?></font><br> ','#333333')"; onMouseout="hideddrivetip()"><img src=pic/nextS.png
border=0></a>
<?
?>
</center>
<?php

    print("<table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tableinborder\">\n");

    $url = "edit.php?id=" . $row["id"];
    if (isset($_GET["returnto"])) {
        $addthis = "&amp;returnto=" . urlencode($_GET["returnto"]);
        $url .= $addthis;
        $keepget .= $addthis;
    }
    $editlink = "a href=\"$url\" class=\"sublink\"";

    $waittime = get_wait_time($CURUSER["id"], $id);

    if ($row["activated"] != "yes") {
        if ($moderator) {
            echo "<tr><td class=\"tableb\" width=\"1%\">Freischalten</td><td class=\"tableb\" width=\"99%\" style=\"text-align:left\">";
            if ($row["gu_agent"] > 0) {
                $gu_agent = mysql_fetch_assoc(mysql_query("SELECT `username` FROM `users` WHERE `id`=".$row["gu_agent"]));
                echo "<font color=\"red\">Dieser Gast-Upload wird bereits von <b><a href=\"userdetails.php?id=".$row["gu_agent"]."\">".htmlspecialchars($gu_agent["username"])."</a></b> bearbeitet. ";
                if ($row["gu_agent"] == $CURUSER["id"]) {
                    echo "(<a class=\"index\" href=\"details.php?id=" . $row["id"] . "&amp;agenttakeover=release\">Bearbeitung abgeben</a>)";
                }
                echo "<br>";
            } else {
                echo "<a class=\"index\" href=\"details.php?id=" . $row["id"] . "&amp;agenttakeover=acquire\">Bearbeitung dieses Gastuploads übernehmen</a><br>";
            }
            echo "<a class=\"index\" href=\"details.php?id=" . $row["id"] . "&amp;activate=1\">Torrent freischalten</a></td></tr>";
        } else {
            echo "<tr><td class=\"tableb\" width=\"1%\">Freischalten</td><td class=\"tableb\" width=\"99%\" style=\"text-align:left\">Dieser Torrent muss erst von einem Moderator freigeschaltet werden, bevor er sichtbar wird.</td></tr>";
        }
    } elseif ($waittime) {
       print("<tr><td class=\"tableb\" width=\"1%\">Herunterladen</td><td class=\"tableb\" width=\"99%\" style=\"text-align:left\">Dieser Torrent kann erst nach Ablauf der Wartezeit heruntergeladen werden.</td></tr>");
    } else {
        if ($GLOBALS["DOWNLOAD_METHOD"] == DOWNLOAD_REWRITE)
            $download_url = "download/" . $id . "/" . rawurlencode($row["filename"]);
        else
            $download_url = "download.php?torrent=" . $id;

        print("<tr><td class=\"tableb\" width=\"1%\">Herunterladen</td><td class=\"tableb\" width=\"99%\" style=\"text-align:left\"><a class=\"index\" href=\"$download_url\">" . htmlspecialchars($row["filename"]) . "</a></td></tr>");


if (get_user_class() >= UC_UPLOADER) {
tr("Werbetorrent Für Bitreactor etc.", "<a href=downloaddump.php?torrent=$row[id]" . ">" . htmlspecialchars($row["filename"]) . "</a> <b>DIESER TORRENT IST OHNE PASSKEY VERSEHEN BENUTZE IHN UM WERBUNG FÜR Army of Hell ZUMACHEN</b>", 1);
    }

    if ($waittime) {
        if ($row["activated"] != "no" && $owned)
            tr("Wartezeitaufhebung", "Du benötigst eine Wartezeitaufhebung für diesen Torrent. Diese wird beim Freischalten des Torrents jedoch automatisch erteilt.", 1);
        else {
            if ($waittime > 2)
                tr("Wartezeitaufhebung", "<form action=\"requestnowait.php\" method=\"post\">Antragsgrund: <input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"text\" size=\"60\" maxlength=\"2000\" name=\"msg\"> <input type=\"submit\" value=\"Beantragen\"></form><br><a href=\"faq.php#dlf\">Bitte beachte die Regeln zur Wartezeitaufhebung!</a>", 1);
            elseif ($waittime)
                tr("Wartezeitaufhebung", "Du musst noch min. 3 Stunden Wartezeit übrig haben, um eine Aufhebung beantragen zu können. (<a href=\"faq.php#dlf\">Hilfe</a>)", 1);
        } 
    } 
        if ($CURUSER["wgeturl"] == "yes") {
            $wget_url = "wget --header='Cookie: uid=" . $CURUSER["id"] . "; pass=" . $CURUSER["passhash"] . "' '" . $BASEURL . "/" . $download_url . "' -O '" . htmlspecialchars($row["filename"]) . "'";
            print("<tr><td class=\"tableb\" width=\"1%\">wget-Kommando</td><td class=\"tableb\" width=\"99%\" style=\"text-align:left\"><input type=\"text\" readonly=\"readonly\" size=\"80\" value=\"" . htmlspecialchars($wget_url) . "\"></td></tr>");
        }
    }

    tr("Hash-Wert", preg_replace_callback('/./s', "hex_esc", hash_pad($row["info_hash"])));

    if ($waittime) {
        if ($row["activated"] != "yes" && $owned)
            tr("Wartezeitaufhebung", "Du benötigst eine Wartezeitaufhebung für diesen Torrent. Diese wird beim Freischalten des Torrents jedoch automatisch erteilt.", 1);
        else {
            if ($waittime > 2)
                tr("Wartezeitaufhebung", "<form action=\"requestnowait.php\" method=\"post\">Antragsgrund: <input type=\"hidden\" name=\"id\" value=\"$id\"><input type=\"text\" size=\"60\" maxlength=\"2000\" name=\"msg\"> <input type=\"submit\" value=\"Beantragen\"></form><br><a href=\"faq.php#dlf\">Bitte beachte die Regeln zur Wartezeitaufhebung!</a>", 1);
            elseif ($waittime)
                tr("Wartezeitaufhebung", "Du musst noch min. 3 Stunden Wartezeit übrig haben, um eine Aufhebung beantragen zu können. (<a href=\"faq.php#dlf\">Hilfe</a>)", 1);
        }
    }

    if (!empty($row["infourl"]))
tr("Infolink", "<b><a href=\"".$row["infourl"]."\">" . htmlspecialchars($row["infourl"]) . "</a></b>", 1);

   if (!empty($row["yout"]))

tr("YouTube Trailer", "<b><a href=\"".$row["yout"]."\">" . htmlspecialchars($row["yout"]) . "</a></b>", 1);



if (!empty($row["poster"]))
tr("Poster", "<a href=\"".$row["poster"]."\" rel=\"lightbox\" target=\"_blank\"><img src='".$row["poster"]."' style=\"max-width:350px;\" border=0></a>", 1);
    if (!empty($row["descr"])) {
        if ($row["numpics"] > 0) {
            $img_prev = "[center]";
            for ($I = 1; $I <= $row["numpics"]; $I++)
            $img_prev .= "[url=" . $DEFAULTBASEURL . "/" . $GLOBALS["BITBUCKET_DIR"] . "/f-$id-$I.jpg][img=" . $DEFAULTBASEURL . "/" . $GLOBALS["BITBUCKET_DIR"] . "/t-$id-$I.jpg][/url] ";
            $img_prev .= "[/center]\n\n";
            $row["descr"] = $row["descr"] . $img_prev;
        } 
        tr("Beschreibung", format_comment($row["descr"]), 1);
    } 



// BEGIN: Groups Edition by truenoir
    if ($row["team"] > 0)
    {
      $grp=mysql_fetch_assoc(mysql_query("select * from teams where id=$row[team]"));
      tr("Group", ($grp["banner"]?"<img src=\"$grp[banner]\" border=0><br>":"")."<b>$grp[name]</b>", 1);
    }
// END: Groups Edition by truenoir

    if ($row["visible"] == "no")
        tr("Sichtbar", "<b>Nein</b> (Tot)", 1);

    if ($moderator)
        tr("Gebannt", $row["banned"]);

    if ($row["language"] == "na"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/na.gif' border='0'></td></tr>");

    }
    if ($row["language"] == "deutsch"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/de.gif' border='0'></td></tr>");

    }
    if ($row["language"] == "englisch"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/en.gif' border='0'></td></tr>");

    }
    if ($row["language"] == "französisch"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/fr.gif' border='0'></td></tr>");

    }
    if ($row["language"] == "japanisch"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/jp.gif' border='0'></td></tr>");

    }
    if ($row["language"] == "multi"){

    print("<tr><td class=tableb width=1%>Sprache</td><td class=tablea align=left width=99%><img src='pic/multi.gif' border='0'></td></tr>");

    }

    if (isset($row["cat_name"]))
        tr("Typ", $row["cat_name"]);
    else
        tr("Typ", "(nicht ausgewählt)");

    tr("Kategorie",$row["Release1"]);
    tr("Typen",$row["Release2"]);
    tr("VideoSRC",$row["Release3"]);
    tr("SoundSRC",$row["Release4"]);

$ha = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND webseed='yes'  AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='yes')");
$ha2 = mysql_num_rows($ha);
$ha4 = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND webseed='yes'  AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='no')");
$ha6 = mysql_num_rows($ha4);
$ha8 = $ha2 + $ha6;

if ($ha2 != "0")
print("<tr><td class=\"tableb\" width=1%>Webseed</td><td class=tablea align=left width=99%><font color=green> Im Seed: ". $ha2 ." | Am Leechen: ". $ha6 ." | Gesamt: ". $ha8 ."</font></td></tr>");


if ($ha2 == "0 ")
print("<tr><td class=\"tableb\" width=1%>Webseed</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");

$ha10 = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND vdsl='yes' AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='yes')");
$ha11 = mysql_num_rows($ha10);
$ha12 = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND vdsl='yes' AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='no')");
$ha13 = mysql_num_rows($ha12);
$ha14 = $ha11 + $ha13;
if ($ha11 != "0")
print("<tr><td class=\"tableb\" width=1%>VDSL</td><td class=tablea align=left width=99%><font color=green> Im Seed: ". $ha11 ." | Am Leechen: ". $ha13 ." | Gesamt: ". $ha14."</font></td></tr>");


if ($ha11 == "0 ")
print("<tr><td class=\"tableb\" width=1%>VDSL</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");

$ha5 = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND adsl='yes' AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='yes')");
$ha3 = mysql_num_rows($ha5);
$ha7 = mysql_query("SELECT * FROM users WHERE id IN (SELECT userid FROM traffic WHERE torrentid = $row[id]) AND adsl='yes' AND id IN (SELECT userid FROM peers WHERE `torrent` = $row[id] AND seeder ='no')");
$ha9 = mysql_num_rows($ha7);
$ha1 = $ha3 + $ha9;
if ($ha3 != "0")
print("<tr><td class=\"tableb\" width=1%>ADSL</td><td class=tablea align=left width=99%><font color=green> Im Seed: ". $ha3 ." | Am Leechen: ". $ha9 ." | Gesamt: ". $ha1."</font></td></tr>");


if ($ha3 == "0 ")
print("<tr><td class=\"tableb\" width=1%>ADSL</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");
if ($row["nuked"] == "no") {
        tr("Hat Dieser Torrent ein Fehler?", "<font color=red><center><br>Nein</font>", 1);
    }
    elseif ($row["nuked"] == "unnuked") {
        tr("Hat Dieser Torrent ein Fehler?", "<font color=red>Unnuked</font>&nbsp;Grund:&nbsp;<font color=red>" .$row["nukedr"]. "</font>", 1);
    }
    else {
        tr("Hat Dieser Torrent ein Fehler?", "<font color=red><center><br>Ja</font>&nbsp;Welchen?:&nbsp;<font color=red>" .$row["nukedr"]. "</font>", 1);
    }
if ($row["free"] == "yes")
{
print("<tr><td class=\"tableb\" width=1%>OnlyUpload</td><td class=tablea align=left width=99%><font color=green>Ja</font></td></tr>");
}
if ($row["free"] == "no")
{
print("<tr><td class=\"tableb\" width=1%>OnlyUpload</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");
}

if ($row["highlight"] == "yes")
{
print("<tr><td class=\"tableb\" width=1%>Kino Highlight</td><td class=tablea align=left width=99%><font color=green>Ja</font></td></tr>");
}
if ($row["highlight"] == "no")
{
print("<tr><td class=\"tableb\" width=1%>Kino Highlight</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");
}

if ($row["freeleech"] == "yes")
{
print("<tr><td class=\"tableb\" width=1%>Freeleech</td><td class=tablea align=left width=99%><font color=green>Ja</font></td></tr>");
}
if ($row["freeleech"] == "no")
{
print("<tr><td class=\"tableb\" width=1%>Freeleech</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");
}

if ($row["multi"] > 0)
{
print("<tr><td class=\"tableb\" width=1%>Multi-Torrent</td><td class=tablea align=left width=99%><font color=green>".$row["multi"]."x</font></td></tr>");
}
if ($row["multi"] == 0)
{
print("<tr><td class=\"tableb\" width=1%>Multi-Torrent</td><td class=tablea align=left width=99%><font color=red>Nein</font></td></tr>");
}

$speedres = mysql_query("SELECT ROUND(AVG((downloaded - downloadoffset) / (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`started`)))/1024, 2) AS dlspeed, ROUND(AVG((uploaded - uploadoffset) / (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`started`)))/1024, 2) AS ulspeed FROM peers WHERE torrent=$id");
$speed = mysql_fetch_assoc($speedres);
if ($speed["dlspeed"] == 0) $speed["dlspeed"] = "0";
if ($speed["ulspeed"] == 0) $speed["ulspeed"] = "0";
$torrent_info["dlspeed"] = $speed["dlspeed"];
$torrent_info["ulspeed"] = $speed["ulspeed"];
$torrent_info["leechers"] = $row["leechers"];
$torrent_info["seeders"] = $row["seeders"];
?>
<tr><td class=tableb width=1%>&Oslash; DLgeschw.</td><td class=tablea align=left width=99%><?=$torrent_info["dlspeed"]?> KB/s (<?php echo $torrent_info["dlspeed"] * ($torrent_info["leechers"] + $torrent_info["seeders"]);
?> KB/s gesamt)</td></tr>
<tr><td class=tableb width=1%>&Oslash; UPgeschw.</td><td class=tablea align=left width=99%><?=$torrent_info["ulspeed"]?> KB/s (<?php echo $torrent_info["ulspeed"] * ($torrent_info["leechers"] + $torrent_info["seeders"]);
?> KB/s gesamt)</td></tr><?

$distres = mysql_query("SELECT ROUND(AVG((" . $row["size"] . " - `to_go`) / " . $row["size"] . " * 100),2) AS `dist` FROM `peers` WHERE torrent=$id");
$dist = mysql_fetch_assoc($distres);
$torrent_info["dist"] = $dist["dist"];
?>
<tr><td class=tableb width=1%>&Oslash; Verteilung:</td><td class=tablea align=left width=99%><div style="border:1px solid white;padding:0px;width:300px;height:15px;"><div style="border:none;width:<?=300 * $torrent_info["dist"] / 100?>px;height:15px;background-image:url(<?=$GLOBALS["PIC_BASE_URL"]?>ryg-verlauf.png);background-repeat:no-repeat;"></div></div></td></tr>
<?

    tr("Größe", mksize($row["size"]) . " (" . number_format($row["size"]) . " Bytes)");
    tr("Seed Speed",$row["seedspeed"]);
    tr("Fertiggestellt", $row["times_completed"] . " mal");
    tr("Aufrufe", $row["views"]);
    tr("Hits", $row["hits"]);
    tr("Hinzugefügt", $row["added"]);
    tr("Letzter&nbsp;Seeder", "Letzte Aktivität ist " . mkprettytime($row["lastseed"]) . " her");
    //Anfang Rating Hack
$s = "";
        $s .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=embedded>";
        if (!isset($row["rating"])) {
            if ($minvotes > 3) {
                $s .= "none yet (needs at least $minvotes votes and has got ";
                if ($row["numratings"])
                    $s .= "only " . $row["numratings"];
                else
                    $s .= "none";
                $s .= ")";
            }
            else
                $s .= "Noch keine Bewertungen";
        }
        else {
            $rpic = ratingpic($row["rating"]);
            if (!isset($rpic))
                $s .= "invalid?";
            else
                $s .= "$rpic (<font color=#ff0532>" . $row["rating"] . "</font> von max. <font color=#ff0532>5</font> mit <font color=#ff0532>" . $row["numratings"] . "</font> Vote(s) insgesammt)";
        }
        $s .= "\n";
        $s .= "</td><td class=embedded>$spacer</td><td valign=\"top\" class=embedded>";
        if (!isset($CURUSER))
            $s .= "(<a href=\"login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">Log in</a> to rate it)";
        else {
            $ratings = array(
                    5 => "Sehr Gut!!",
                    4 => "Gut",
                    3 => "Ist O.K",
                    2 => "Gerade so",
                    1 => "Schlecht!!",
            );
            if (!$owned || $moderator) {
                $xres = mysql_query("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);
                $xrow = mysql_fetch_array($xres);
                if ($xrow)
                    $s .= "( Allge. Quali von dir bewertet mit: <font color=#ff0532>" . $xrow["rating"] . "</font> )";
                else {
                    $s .= "<form method=\"post\" action=\"takerate.php\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
                    $s .= "<select name=\"rating\">\n";
                    $s .= "<option value=\"0\">(Auswahl)</option>\n";
                    foreach ($ratings as $k => $v) {
                        $s .= "<option value=\"$k\">$k - $v</option>\n";
                    }
                    $s .= "</select>\n";
                    $s .= "<input type=\"submit\" value=\"Bewerten!\" />";
                    $s .= "</form>\n";
                }



            }
        }
        $s .= "</td></tr></table>";
        tr("Allg. Bewertung", $s, 1);
//Ende Rating Hack

		if (  // wenn torrent was mit video zu tun hat, dann.....
		       $row["cat_name"] == "Filme/DVDR"
		    || $row["cat_name"] == "Filme/X-VCD"
		    || $row["cat_name"] == "Filme XVID/AVI"
		    || $row["cat_name"] == "Anime"
                     || $row["cat_name"] == "Comedy"
		    || $row["cat_name"] == "Doku / Magazin"
                     || $row["cat_name"] == "Movies/(M)VCD"
                     || $row["cat_name"] == "Movies/(R)SVCD"
                     || $row["cat_name"] == "Movies/DivX"
                     || $row["cat_name"] == "Movies/DVD-R"
                     || $row["cat_name"] == "Movies/ONE-SVCD"
                     || $row["cat_name"] == "Movies/MP4"
                     || $row["cat_name"] == "Movies/DVD-Spezial"
                     || $row["cat_name"] == "Movies/Sonstiges"
                     || $row["cat_name"] == "Movies/SVCD"
                     || $row["cat_name"] == "Movies/XviD"
                     || $row["cat_name"] == "Musik - Video´s"
                     || $row["cat_name"] == "PC/Games"
                     || $row["cat_name"] == "PlayStation3"
                     || $row["cat_name"] == "PS2/Games"
                     || $row["cat_name"] == "PSP/Games"
                     || $row["cat_name"] == "RatDVD"
                     || $row["cat_name"] == "Samples"
                     || $row["cat_name"] == "Serien"
                     || $row["cat_name"] == "xBox"
		    || $row["cat_name"] == "TV-Rip"
		    || $row["cat_name"] == "Serien"
		    || $row["cat_name"] == "HDTV"
		    || $row["cat_name"] == "XXX"
		   )
		{
		 // :::: BEGIN of Video rating ::::

		$s = "";
		$s .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=embedded>";
		if (!isset($row["rating_video"])) {
			if ($minvotes > 1) {
				$s .= "none yet (needs at least $minvotes votes and has got ";
				if ($row["numratings_video"])
					$s .= "only " . $row["numratings_video"];
				else
					$s .= "none";
				$s .= ")";
			}
			else
				$s .= "Noch keine Bewertungen";
		}
		else {
			$rpic = ratingpic($row["rating_video"]);
			if (!isset($rpic))
				$s .= "invalid?";
			else
				$s .= "$rpic (<font color=#ff0532>" . $row["rating_video"] . "</font> von max. <font color=#ff0532>5</font> mit <font color=#ff0532>" . $row["numratings_video"] . "</font> Vote(s) insgesammt)";
		}
		$s .= "\n";
		$s .= "</td><td class=embedded>$spacer</td><td valign=\"top\" class=embedded>";
		if (!isset($CURUSER))
			$s .= "(<a href=\"login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">Log in</a> to rate it)";
		else {
			$ratings = array(
                                          5 => "Sehr Gut!!",
                                          4 => "Gut",
                                          3 => "Ist O.K",
                                          2 => "Gerade so",
                                          1 => "Schlecht!",
                         );
			if (!$owned || $moderator) {
				$xres = mysql_query("SELECT rating_video, added_video FROM ratings_video WHERE torrent = $id AND user = " . $CURUSER["id"]);


$xrow = mysql_fetch_array($xres);
				if ($xrow["rating_video"] != 0)
					$s .= "( Video Quali von dir bewertet mit: <font color=#ff0532>" . $xrow["rating_video"] . "</font> )";
				else {
					$s .= "<form method=\"post\" action=\"takerate.php\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
					$s .= "<select name=\"rating_video\">\n";
					$s .= "<option value=\"0\">(Auswahl)</option>\n";
					foreach ($ratings as $k => $v) {
						$s .= "<option value=\"$k\">$k - $v</option>\n";
					}
					$s .= "</select>\n";
					$s .= "<input type=\"submit\" value=\"Bewerten!\" />";
				$s .= "</form>\n";
			}
		}
	}
	$s .= "</td></tr></table>";

	tr(" Video Bewertung", $s, 1);
	             }

// :::: END of Video rating ::::


		if (  // wenn torrent was mit AUDIO zu tun hat, dann.....
		       $row["cat_name"] == "Filme/DVDR"
		    || $row["cat_name"] == "Filme/X-VCD"
		    || $row["cat_name"] == "Filme XVID/AVI"
		    || $row["cat_name"] == "Filme/X-VCD"
		    || $row["cat_name"] == "Filme XVID/AVI"
		    || $row["cat_name"] == "Anime"
                     || $row["cat_name"] == "Comedy"
		    || $row["cat_name"] == "Doku / Magazin"
                     || $row["cat_name"] == "Movies/(M)VCD"
                     || $row["cat_name"] == "Movies/(R)SVCD"
                     || $row["cat_name"] == "Movies/DivX"
                     || $row["cat_name"] == "Movies/DVD-R"
                     || $row["cat_name"] == "Movies/ONE-SVCD"
                     || $row["cat_name"] == "Movies/MP4"
                     || $row["cat_name"] == "Movies/DVD-Spezial"
                     || $row["cat_name"] == "Movies/Sonstiges"
                     || $row["cat_name"] == "Movies/SVCD"
                     || $row["cat_name"] == "Movies/XviD"
                     || $row["cat_name"] == "Musik - Video´s"
                     || $row["cat_name"] == "PC/Games"
                     || $row["cat_name"] == "PlayStation3"
                     || $row["cat_name"] == "PS2/Games"
                     || $row["cat_name"] == "PSP/Games"
                     || $row["cat_name"] == "RatDVD"
                     || $row["cat_name"] == "Samples"
                     || $row["cat_name"] == "Serien"
                     || $row["cat_name"] == "xBox"
		    || $row["cat_name"] == "TV-Rip"
		    || $row["cat_name"] == "Serien"
		    || $row["cat_name"] == "HDTV"
		    || $row["cat_name"] == "XXX"
		    || $row["cat_name"] == "Musik"
                     || $row["cat_name"] == "Musik/Audio MP3"
                     || $row["cat_name"] == "Hörspiel/Hörbuch"
                     || $row["cat_name"] == "Handy"
		   )
		{
		 // :::: BEGIN of Audio rating ::::

		$s = "";
		$s .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=embedded>";
		if (!isset($row["rating_audio"])) {
			if ($minvotes > 1) {
				$s .= "none yet (needs at least $minvotes votes and has got ";
				if ($row["numratings_audio"])
					$s .= "only " . $row["numratings_audio"];
				else
					$s .= "none";
				$s .= ")";
			}
			else
				$s .= "Noch keine Bewertungen";
		}
		else {
			$rpic = ratingpic($row["rating_audio"]);
			if (!isset($rpic))
				$s .= "invalid?";
			else
				$s .= "$rpic (<font color=#ff0532>" . $row["rating_audio"] . "</font> von max. <font color=#ff0532>5</font> mit <font color=#ff0532>" . $row["numratings_audio"] . "</font> Vote(s) insgesammt)";
		}
		$s .= "\n";
		$s .= "</td><td class=embedded>$spacer</td><td valign=\"top\" class=embedded>";
		if (!isset($CURUSER))
			$s .= "(<a href=\"login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">Log in</a> to rate it)";
		else {
			$ratings = array(
                                          5 => "Sehr Gut!!",
                                          4 => "Gut",
                                          3 => "Ist O.K",
                                          2 => "Gerade so",
                                          1 => "Schlecht!",
                         );
			if (!$owned || $moderator) {
				$xres = mysql_query("SELECT rating_audio, added_audio FROM ratings_audio WHERE torrent = $id AND user = " . $CURUSER["id"]);
				$xrow = mysql_fetch_array($xres);
				if ($xrow["rating_audio"] != 0)
					$s .= "( Audio Quali von dir bewertet mit:<font color=#ff0532> " . $xrow["rating_audio"] . "</font> )";
				else {
					$s .= "<form method=\"post\" action=\"takerate.php\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
					$s .= "<select name=\"rating_audio\">\n";
					$s .= "<option value=\"0\">(Auswahl)</option>\n";
					foreach ($ratings as $k => $v) {
						$s .= "<option value=\"$k\">$k - $v</option>\n";
					}
					$s .= "</select>\n";
					$s .= "<input type=\"submit\" value=\"Bewerten!\" />";
				$s .= "</form>\n";
			}
		}
	}
	$s .= "</td></tr></table>";

	tr("Audio Bewertung ", $s, 1);
	             }

    //tr("Reseed Anfrage", "Klick <a href=takereseed.php?reseedid=$id><b><font color=#ff0532>hier</font></b></a>.", 1);

    tr("Report<br />Torrent", "Klick <a href=report.php?typ=torrent&id=$id><b><font color=#ff0532>hier</font></b></a> Um dem Team diesen Torrent zu melden da er gegen die Regeln verstösst", 1);

$ws = mysql_query("SELECT warned, webseed, adsl, vdsl, added FROM users WHERE id=$row[owner] LIMIT 1") or die;
$uws = mysql_fetch_array($ws);

// BEGIN: Anonymous Torrent Liste by truenoir
$uprow = (isset($row["username"]) ? ($row["anon"]=="yes"&&$row["class"]>=UC_MODERATOR&&get_user_class()<UC_MODERATOR?"<b>Anonym*</b>":("<a href=\"userdetails.php?id=" . $row["owner"] . "\"><b>" . htmlspecialchars($row["username"]) . "</b></a> ".get_user_icons($uws)."")) : "<i>Unbekannt</i>");
// END: Anonymous Torrent Liste by truenoir

    if ($owned)
        $uprow .= " $spacer<$editlink><b>[Diesen Torrent bearbeiten]</b></a>";

    tr("Hochgeladen&nbsp;von", $uprow, 1);

    if (!$_GET["snatcher"]) {
        tr("<a name=\"snatcher\"></a>Letzte 10<br /><a href=\"details.php?id=$id&amp;snatcher=1$keepget#snatcher\" class=\"sublink\">[Alle anzeigen]</a>", $last10users, 1);
    } else {
        tr("<a name=\"snatcher\"></a>Fertiggestellt<br />(Benutzer)<br /><a href=\"details.php?id=$id$keepget#snatcher\" class=\"sublink\">[Liste verbergen]</a>", $last10users, 1);
    }

    $keepget = "";

    if (!$_GET["dllist"]) {
        tr("Peers<br /><a href=\"details.php?id=$id&amp;dllist=1$keepget#seeders\" class=\"sublink\">[Liste anzeigen]</a> <font color=#ff0532>", $row["seeders"] . "</font> Seeder, <font color=#ff0532>" . $row["leechers"] . "</font> Leecher = <font color=#ff0532>" . ($row["seeders"] + $row["leechers"]) . "</font> Peer(s) gesamt", 1);
    } else {
        $downloaders = array();
        $seeders = array();
        $subres = mysql_query("SELECT peer_id, seeder, ip, port, traffic.uploaded AS uploaded, traffic.downloaded AS downloaded, traffic.downloadtime AS downloadtime, traffic.uploadtime AS uploadtime, to_go, UNIX_TIMESTAMP(started) AS st, connectable, agent, UNIX_TIMESTAMP(last_action) AS la, peers.userid FROM peers LEFT JOIN traffic ON peers.userid=traffic.userid AND peers.torrent=traffic.torrentid WHERE torrent = $id") or sqlerr();
        while ($subrow = mysql_fetch_array($subres)) {
            if ($subrow["seeder"] == "yes")
                $seeders[] = $subrow;
            else
                $downloaders[] = $subrow;
        }

        function leech_sort($a, $b)
        {
            if (isset($_GET["usort"])) return seed_sort($a, $b);
            $x = $a["to_go"];
            $y = $b["to_go"];
            if ($x == $y)
                return 0;
            if ($x < $y)
                return -1;
            return 1;
        }

        function seed_sort($a, $b)
        {
            $x = $a["uploaded"];
            $y = $b["uploaded"];
            if ($x == $y)
                return 0;
            if ($x < $y)
                return 1;
            return -1;
        }

        usort($seeders, "seed_sort");
        usort($downloaders, "leech_sort");

        tr("<a name=\"seeders\">Seeder</a><br /><a href=\"details.php?id=$id$keepget\" class=\"sublink\">[Liste verbergen]</a>", dltable("Seeder", $seeders, $row), 1);
        tr("<a name=\"leechers\">Leecher</a><br /><a href=\"details.php?id=$id$keepget\" class=\"sublink\">[Liste verbergen]</a>", dltable("Leecher", $downloaders, $row), 1);
    }

        if (!$_GET["filelist"])
            tr("Anzahl Dateien<br /><a href=\"details.php?id=$id&amp;filelist=1$keepget#filelist\" class=\"sublink\">[Liste anzeigen]</a>", $row["numfiles"] . " Dateien", 1);
        else {
            tr("Anzahl Dateien", $row["numfiles"] . " Dateien", 1);

            $s = "<table class=tableinborder border=0 cellspacing=1 cellpadding=4>\n";

            $subres = mysql_query("SELECT * FROM files WHERE torrent = $id ORDER BY id");
            $s .= "<tr><td class=tablecat>Pfad</td><td class=tablecat align=right>Größe</td></tr>\n";
            while ($subrow = mysql_fetch_array($subres)) {
                $s .= "<tr><td class=\"tablea\">" . $subrow["filename"] . "</td><td class=\"tableb\" align=\"right\">" . mksize($subrow["size"]) . "</td></tr>\n";
            }

            $s .= "</table>\n";
            tr("<a name=\"filelist\">Dateiliste</a><br /><a href=\"details.php?id=$id$keepget\" class=\"sublink\">[Liste verbergen]</a>", $s, 1);
        }

    // BEGIN: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir
    if(get_user_class()>=UC_MODERATOR&&$trlist)
    {
      if(!$_GET["aclist"])
         tr("Aktivitäten<br /><a href=\"details.php?id=$id&amp;aclist=1$keepget#acusers\" class=\"sublink\">[Liste anzeigen]</a>",$trlist,1);
      else
         tr("<a name=\"acusers\">Aktivitäten</a><br /><a href=\"details.php?id=$id$keepget\" class=\"sublink\">[Liste verbergen]</a>",$trlist,1);
    }
// END: Zeige alle Benutzer, die auf diesem Torrent sind/waren an by truenoir
/// Deluxebits Promite by Force ///ANFANG///
if(get_user_class()>=UC_MODERATOR){


$torrentid = $_GET["id"];
         $deluxebits_sql = mysql_query("SELECT * FROM deluxebits where torrentid=$torrentid");
   $deluxebits_all = mysql_numrows($deluxebits_sql);
   if ($deluxebits_all) {
   while($rows_t = mysql_fetch_array($deluxebits_sql)) {
   $deluxebits_userid = $rows_t["userid"];
   $user_sql = mysql_query("SELECT * FROM users where id=$deluxebits_userid");
   $rows_a = mysql_fetch_array($user_sql);
   $username_t = $rows_a["username"];
   $deluxebitsby =  $deluxebitsby."<a href='userdetails.php?id=$deluxebits_userid'>$username_t</a>, ";
   }
   $t_userid = $CURUSER["id"];
   $tsql = mysql_query("SELECT COUNT(*) FROM deluxebits where torrentid=$torrentid and userid=$t_userid");
   $trows = mysql_fetch_array($tsql);
   $t_ab = $trows[0];
   if ($t_ab == "0") {
   $deluxebitsby = $deluxebitsby." <form action=\"deluxebits.php\" method=\"post\">
<img src=pic/deluxebits.jpg>
<br/>
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   else {
   $deluxebitsby = $deluxebitsby." <form action=\"deluxebits.php\" method=\"post\">
<img src=pic/deluxebits.jpg>
<br/>
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   }
   else {
   $deluxebitsby = "Noch keiner Promotet
   <form action=\"deluxebits.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>
   ";
   }
       tr("Deluxebits:",$deluxebitsby,1);

}
///  Deluxebits Promite by Force ///ENDE///
/// Saugstube Promite by Force ///ANFANG///
if(get_user_class()>=UC_MODERATOR){

$torrentid = $_GET["id"];
         $saugstube_sql = mysql_query("SELECT * FROM saugstube where torrentid=$torrentid");
   $saugstube_all = mysql_numrows($saugstube_sql);
   if ($saugstube_all) {
   while($rows_t = mysql_fetch_array($saugstube_sql)) {
   $saugstube_userid = $rows_t["userid"];
   $user_sql = mysql_query("SELECT * FROM users where id=$saugstube_userid");
   $rows_a = mysql_fetch_array($user_sql);
   $username_t = $rows_a["username"];
   $saugstubeby =  $saugstubeby."<a href='userdetails.php?id=$saugstube_userid'>$username_t</a>, ";
   }
   $t_userid = $CURUSER["id"];
   $tsql = mysql_query("SELECT COUNT(*) FROM saugstube where torrentid=$torrentid and userid=$t_userid");
   $trows = mysql_fetch_array($tsql);
   $t_ab = $trows[0];
   if ($t_ab == "0") {
   $saugstubeby = $saugstubeby." <form action=\"saugstube.php\" method=\"post\">
<img src=pic/saugstube.jpg>
<br/>
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   else {
   $saugstubeby = $saugstubeby." <form action=\"saugstube.php\" method=\"post\">
<img src=pic/saugstube.jpg>
<br/>
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   }
   else {
   $saugstubeby = "Noch keiner Promotet
   <form action=\"saugstube.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>
   ";
   }
       tr("Saugstube:",$saugstubeby,1);

}
///  Saugstube Promite by Force ///ENDE///
/// Bitreactor Promite by Force ///ANFANG///
if(get_user_class()>=UC_MODERATOR){

$torrentid = $_GET["id"];
         $bitreactor_sql = mysql_query("SELECT * FROM bitreactor where torrentid=$torrentid");
   $bitreactor_all = mysql_numrows($bitreactor_sql);
   if ($bitreactor_all) {
   while($rows_t = mysql_fetch_array($bitreactor_sql)) {
   $bitreactor_userid = $rows_t["userid"];
   $user_sql = mysql_query("SELECT * FROM users where id=$bitreactor_userid");
   $rows_a = mysql_fetch_array($user_sql);
   $username_t = $rows_a["username"];
   $bitreactorby =  $bitreactorby."<a href='userdetails.php?id=$bitreactor_userid'>$username_t</a>, ";
   }
   $t_userid = $CURUSER["id"];
   $tsql = mysql_query("SELECT COUNT(*) FROM bitreactor where torrentid=$torrentid and userid=$t_userid");
   $trows = mysql_fetch_array($tsql);
   $t_ab = $trows[0];
   if ($t_ab == "0") {
   $bitreactorby = $bitreactorby." <form action=\"bitreactor.php\" method=\"post\">
<img src=pic/bitreactor.jpg>
<br/>
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   else {
   $bitreactorby = $bitreactorby." <form action=\"bitreactor.php\" method=\"post\">
<img src=pic/bitreactor.jpg>
<br/>
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   }
   else {
   $bitreactorby = "Noch keiner Promotet
   <form action=\"bitreactor.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Promoten!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>
   ";
   }
       tr("Bitreactor:",$bitreactorby,1);
}
///  Bitreactor Promite by Force ///ENDE///

/// RESEED HACK By gotthummer ///
    $torrentid = $_GET["id"];
    $reseed_sql = mysql_query("SELECT * FROM reseed where torrentid=$torrentid");
   $reseed_all = mysql_numrows($reseed_sql);
   if ($reseed_all) {
   while($rows_t = mysql_fetch_array($reseed_sql)) {
   $reseed_userid = $rows_t["userid"];
   $user_sql = mysql_query("SELECT * FROM users where id=$reseed_userid");
   $rows_a = mysql_fetch_array($user_sql);
   $username_t = $rows_a["username"];
   if ($rows_a["anon"] == "no"||get_user_class()>=UC_MODERATOR) {

   $reseedby =  $reseedby."<a href='userdetails.php?id=$reseed_userid'>$username_t</a>, ";
   }
   else
   {
   $reseedby =  $reseedby."Anonym*, ";
   }
   }
   $t_userid = $CURUSER["id"];
   $tsql = mysql_query("SELECT COUNT(*) FROM reseed where torrentid=$torrentid and userid=$t_userid");
   $trows = mysql_fetch_array($tsql);
   $t_ab = $trows[0];
   if ($t_ab == "0") {
   $reseedby = $reseedby." <form action=\"reseed.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Reseed!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   else {
   $reseedby = $reseedby." <form action=\"reseed.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Reseed!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   }
   else {
   $reseedby = "Noch keine Reseedanfrage
   <form action=\"reseed.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Reseed!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>
   ";
   }
       tr("Reseed:",$reseedby,1);

/// RESEED HACK END ///

    $torrentid = $_GET["id"];
         $thanks_sql = mysql_query("SELECT * FROM thanks where torrentid=$torrentid");
   $thanks_all = mysql_numrows($thanks_sql);
   if ($thanks_all) {
   while($rows_t = mysql_fetch_array($thanks_sql)) {
   $thanks_userid = $rows_t["userid"];
   $user_sql = mysql_query("SELECT * FROM users where id=$thanks_userid");
   $rows_a = mysql_fetch_array($user_sql);
   $username_t = $rows_a["username"];
   if ($rows_a["anon"] == "no"||get_user_class()>=UC_MODERATOR) {

   $thanksby =  $thanksby."<a href='userdetails.php?id=$thanks_userid'>$username_t</a>, ";
   }
   else
   {
   $thanksby =  $thanksby."Anonym*, ";
   }
   }
   $t_userid = $CURUSER["id"];
   $tsql = mysql_query("SELECT COUNT(*) FROM thanks where torrentid=$torrentid and userid=$t_userid");
   $trows = mysql_fetch_array($tsql);
   $t_ab = $trows[0];
   if ($t_ab == "0") {
   $thanksby = $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Dankeschön!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   else {
   $thanksby = $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Dankeschön!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>";
   }
   }
   else {
   $thanksby = "Noch keiner bedankt
   <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Dankeschön!\">
<input type=\"hidden\" name=\"torrentid\" value=\"$torrentid\">
</form>
   ";
   }
       tr("Danke:",$thanksby,1);

    print("</table></td></tr></table><br>\n");

    ////// Advanced Snatch liste by binnett69 for NV source modded by bliZZarD
$res3 = mysql_query("select count(completed.id) from completed inner join users on completed.user_id = users.id inner join

torrents on completed.torrent_id = torrents.id where completed.torrent_id =" . $_GET[id]) or die(mysql_error());
$row = mysql_fetch_array($res3);

$count = $row[0];
$perpage = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?id=" . $_GET[id] . "&" );

$res2 = mysql_query("select name from torrents where id = $_GET[id]");
$arr2 = mysql_fetch_assoc($res2);
$dt = gmtime() - 180;
$dt = sqlesc(get_date_time($dt));


begin_frame("<width=\"15\" height=\"15\" alt=\"\" style=\"vertical-align: middle;\">Snatcher Liste für <a href=viewsnatches.php?id=$_GET[id]><b>$arr2[name]</b></a></h3>\n");
print("<p class=tablecat align=center><font color=red>Mitglieder die dieses Torrent gedownloadet haben</font></p>");



print("<table border=3 cellspacing=0 cellpadding=0 align=center class=tableb width=92%>\n");
print("<tr><td class=tabletitle align=left>Mitglied</td><td class=tabletitle align=left>Hochgeladen</td><td class=tabletitle

align=left>Runtergeladen</td><td class=tabletitle align=left>Ratio</td><td class=tabletitle align=left>PM Mitglied</td><td class=tabletitle

align=left><font color=red>Melde Mitglied</font></td><td class=tabletitle align=left>On/Off</td><td class=tablea

align=left>Seedet</td></tr>");

$res = mysql_query("select users.id, users.username, users.uploaded, users.downloaded, completed.user_id from completed inner

join users on completed.user_id = users.id inner join torrents on completed.torrent_id = torrents.id where

completed.torrent_id =" . $_GET[id] . " ORDER BY completed.id desc $limit");
while ($arr = mysql_fetch_assoc($res))
{


$res2 = mysql_query("SELECT id,donor,title,enabled,warned,last_access FROM users WHERE id=$arr[user_id]") or sqlerr(__FILE__,

__LINE__);
$arr2 = mysql_fetch_assoc($res2);

$res3 = mysql_query("SELECT * FROM peers WHERE torrent=$_GET[id] AND userid=$arr[user_id]");
$arr3 = mysql_fetch_assoc($res3);

$res4 = mysql_query("SELECT userid,torrentid,downloaded,uploaded FROM traffic WHERE torrentid=$_GET[id] AND

userid=$arr[user_id]") or sqlerr(__FILE__, __LINE__);
$arr4 = mysql_fetch_assoc($res4);

if ($arr["downloaded"] > 0)
{
      $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 2);
      $ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
   }
   else
      if ($arr["uploaded"] > 0)
        $ratio = "Inf.";
else
 $ratio = "---";
if ($arr4["downloaded"] > 0)
{
      $ratio4 = number_format($arr4["uploaded"] / $arr4["downloaded"], 2);
      $ratio4 = "<font color=" . get_ratio_color($ratio4) . ">$ratio4</font>";
   }
   else
      if ($arr4["uploaded"] > 0)
        $ratio4 = "Inf.";
else
 $ratio4 = "---";

$uploaded4 =mksize($arr4["uploaded"]);
$downloaded4 = mksize($arr4["downloaded"]);
$uploaded =mksize($arr["uploaded"]);
$downloaded = mksize($arr["downloaded"]);



$rt_uploaded = 0;
$rt_downloaded = 0;
$rt_uploaded += $ars["uploaded"];
$rt_downloaded += $ars["downloaded"];



$supload =mksize($ars["uploaded"]);
$sdownload = mksize($ars["downloaded"]);

print("<tr><td><a href=userdetails.php?id=$arr[id]><b>$arr[username]". get_user_icons($arr2, true) ."</b></a></td><td

align=left><b>Torrent: $uploaded4</b><br>Gesamt: $uploaded</td><td align=left><b>Torrent: $downloaded4</b><br>Total:

$downloaded</td><td align=left><b>Torrent: $ratio4</b><br>Gesamt: $ratio</td><td><form method=get action=messages.php

style=display:inline><input type=hidden name=action value=send><input type=hidden name=receiver value=" . $arr[user_id] .

"><input type=submit value=PM style=height: 23px></form><form method=post action=report.php?user=$arr[user_id]></td><td

align=left><input type=submit value=\"Report\" style='height: 23px'></form></td><td

align=center>".("'".$arr2['last_access']."'">$dt?"<img src=".$GLOBALS["PIC_BASE_URL"]."button_online.gif border=0

alt=\"Online\">":"<img src=".$GLOBALS["PIC_BASE_URL"]."button_offline.gif border=0 alt=\"Offline\">" )."</td>"."
<td align=center>" . ($arr3["seeder"] == "yes" ? "<b><font color=green>Ja</font>" : "<font color=red>Nein</font></b>") .

"</td></tr>\n");

}
print("</table>\n");



end_frame();



///// Advanced Snatch liste by binnett69 for NV source modded by bliZZarD

    begin_frame("<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "comments.png\" width=\"22\" height=\"22\" alt=\"\" style=\"vertical-align: middle;\"> Kommentare", false, "750px;");
} else {
    stdhead("Kommentare zu Torrent \"" . $row["name"] . "\"");
    begin_frame("<img src=\"" . $GLOBALS["PIC_BASE_URL"] . "comments.png\" width=\"22\" height=\"22\" alt=\"\" style=\"vertical-align: middle;\"> Kommentare zu <a href=\"details.php?id=$id\">" . $row["name"] . "</a>", false, "750px;");
}

print("<a name=\"startcomments\"></a>\n");

$commentbar = "<table class=\"tableinborder\" border=\"0\" cellpadding=\"4\" cellspacing=\"1\" width=\"100%\">"
 . "<tr><td class=\"tablea\" colspan=\"10\" width=\"100%\" style=\"text-align: center\">"
 . "<b><a class=\"index\" href=\"comment.php?action=add&amp;tid=$id\">"
 . "Kommentar hinzufügen</a></b></td></tr></table><br>";

$subres = mysql_query("SELECT COUNT(*) FROM comments WHERE torrent = $id");
$subrow = mysql_fetch_array($subres);
$count = $subrow[0];

if (!$count) {

    ?>
<table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder">
<tr>
<td class="tabletitle" colspan="10" width="100%" style="text-align:center"><b>Bisher noch keine Kommentare</b></td>
</tr></table><br>
<?php
} else {
    list($pagertop, $pagerbottom, $limit) = pager(20, $count, "details.php?id=$id&", array(lastpagedefault => 1));

    $subres = mysql_query("SELECT comments.id, text, user, comments.added, editedby, editedat, avatar, warned, " . "username, title, class, anon, donor FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = " . "$id ORDER BY comments.id $limit") or sqlerr(__FILE__, __LINE__);
    $allrows = array();

    while ($subrow = mysql_fetch_array($subres))
    $allrows[] = $subrow;

    print($commentbar);
    print($pagertop);

    commenttable($allrows);

    print($pagerbottom);
}

print($commentbar);
end_frame();

stdfoot();

hit_end();

?>