ob_start("ob_gzhandler"); require_once("include/bittorrent.php"); function getagent($httpagent) { if (preg_match("/^Azureus ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches)) return "Azureus/$matches[1]"; elseif (preg_match("/BitTorrent\\/S-([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches)) return "Shadow's/$matches[1]"; elseif (preg_match("/BitTorrent\\/U-([0-9]+\\.[0-9]+\\.[0-9]+)/", $httpagent, $matches)) return "UPnP/$matches[1]"; elseif (preg_match("/^BitTorrent\\/T-(.+)$/", $httpagent, $matches)) return "BitTornado/$matches[1]"; elseif (preg_match("/^BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches)) return "BitTorrent/$matches[1]"; elseif (preg_match("/^Python-urllib\\/.+?, BitTorrent\\/([0-9]+\\.[0-9]+(\\.[0-9]+)*)/", $httpagent, $matches)) return "BitTorrent/$matches[1]"; elseif (ereg("^BitTorrent\\/BitSpirit$", $httpagent)) return "BitSpirit"; elseif (preg_match("/^BitTorrent\\/brst(.+)/", $httpagent, $matches)) return "Burst/$matches[1]"; elseif (preg_match("/^RAZA (.+)$/", $httpagent, $matches)) return "Shareaza/$matches[1]"; else return "---"; } function dltable($name, $arr, $torrent) { global $CURUSER; $s = "" . count($arr) . " $name\n"; if (!count($arr)) return $s; $s .= "\n"; $s .= "
| User/IP | " . "Connectable | ". "Uploaded | ". "Rate | ". "Downloaded | " . "Rate | " . "Ratio | " . "Complete | " . "Connected | " . "Idle | " . "Client | |||||||||
| $una[username] | \n"; else $s .= "$una[username] | \n"; } elseif ($CURUSER["id"] != $e["uid"]) { if ($una["class"] == "5" && $una["anonymous"] == "no") $s .= "$una[username] | \n"; elseif ($una["anonymous"] == "yes") $s .= "Anonymous | \n"; else $s .= "$una[username] | \n"; } if (get_user_class() <= UC_MODERATOR && $una["username"]) { if ($una["username"]) $s .= "$una[username] | \n"; else $s .= "" . ($mod ? $e["ip"] : preg_replace('/\.\d+$/', ".xxx", $e["ip"])) . " | \n"; } $secs = max(1, ($now - $e["st"]) - ($now - $e["la"])); $revived = $e["revived"] == "yes"; $s .= "" . ($e[connectable] == "yes" ? "Yes" : "No") . " | \n"; $s .= "" . mksize($e["uploaded"]) . " | \n"; $s .= "" . mksize($e["downloaded"]) . " | \n"; if ($e["seeder"] == "no") $s .= "" . number_format($ratio, 3) . " | \n"; } else if ($e["uploaded"]) $s .= "Inf. | \n"; else $s .= "--- | \n"; $s .= "" . sprintf("%.2f%%", 100 * (1 - ($e["to_go"] / $torrent["size"]))) . " | \n"; $s .= "" . mkprettytime($now - $e["st"]) . " | \n"; $s .= "" . mkprettytime($now - $e["la"]) . " | \n"; $s .= "" . htmlspecialchars(getagent($e["agent"])) . " | \n"; $s .= "
You can start seeding now. Note that the torrent won't be visible until you do that!
\n"); } elseif ($_GET["edited"]) { print("Go back to whence you came.
\n"); } elseif (isset($_GET["searched"])) { print("| Download | " . htmlspecialchars($row["filename"]) . " | |
Description ![]() | " . str_replace(array("\n", " "), array(" \n", " "), format_comment(htmlspecialchars($row["descr"]))) . " | |
Description ![]() | " . str_replace(array("\n", " "), array(" \n", " "), format_comment($nfo)) . " | |
| NFO | View NFO (" . mksize($row["nfosz"]) . ") |
| "; if (!isset($row["rating"])) { if ($minvotes > 1) { $s .= "none yet (needs at least $minvotes votes and has got "; if ($row["numratings"]) $s .= "only " . $row["numratings"]; else $s .= "none"; $s .= ")"; } else $s .= "No votes yet"; } else { $rpic = ratingpic($row["rating"]); if (!isset($rpic)) $s .= "invalid?"; else $s .= "$rpic (" . $row["rating"] . " out of 5 with " . $row["numratings"] . " vote(s) total)"; } $s .= "\n"; $s .= " | $spacer | "; if (!isset($CURUSER)) $s .= "(Log in to rate it)"; else { $ratings = array( 5 => "Kewl!", 4 => "Pretty good", 3 => "Decent", 2 => "Pretty bad", 1 => "Sucks!", ); 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 .= "(you rated this torrent as \"" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "\")"; else { $s .= "\n"; } } } $s .= " |
| Path | Size |
| " . $subrow["filename"] . " | " . mksize($subrow["size"]) . " |