$tleechs = "f.leechers+ifnull(x.leechers,0) as leechers"; $tcompletes = "f.finished+ifnull(x.completed,0) as finished"; $ttables = "{$TABLE_PREFIX}files f LEFT JOIN xbt_files x ON x.info_hash = f.bin_hash"; } else { $tseeds = "f.seeds as seeds"; $tleechs = "f.leechers as leechers"; $tcompletes = "f.finished as finished"; $ttables = "{$TABLE_PREFIX}files f"; } if (!$CURUSER || $CURUSER["view_torrents"] != "yes") { err_msg($language["ERROR"], $language["NOT_AUTHORIZED"] . " " . $language["MNU_TORRENT"] . "!<br />\n" . $language["SORRY"] . "..."); stdfoot(); exit; } $res = get_result("SELECT tag, f.screen1, f.screen2, f.screen3, f.image, u.warn, f.info_hash, f.filename, f.url, UNIX_TIMESTAMP(f.data) as data, f.size, f.comment, f.uploader, c.name as cat_name, {$tseeds}, {$tleechs}, {$tcompletes}, f.speed, f.external, f.announce_url,UNIX_TIMESTAMP(f.lastupdate) as lastupdate,UNIX_TIMESTAMP(f.lastsuccess) as lastsuccess, f.anonymous, u.username FROM {$ttables} LEFT JOIN {$TABLE_PREFIX}categories c ON c.id=f.category LEFT JOIN {$TABLE_PREFIX}users u ON u.id=f.uploader WHERE f.info_hash ='" . $id . "'", true, $btit_settings['cache_duration']); $res_m = getmoderstatusbyhash($id); if (count($res) < 1) { stderr($language["ERROR"], "Bad ID!", $GLOBALS["usepopup"]); } $row = $res[0]; $spacer = " "; $torrenttpl = new bTemplate(); // Snatchers hack by DT dec 2008 $sres = get_result("SELECT * FROM {$TABLE_PREFIX}history WHERE infohash = '{$id}' AND date IS NOT NULL ORDER BY date DESC LIMIT 10 ", true, $btit_settings['cache_duration']); $srow = count($sres); if (count($sres) > 0) { $snatchers = array(); } $plus = 0; foreach ($sres as $id => $srow) { $res = get_result("SELECT prefixcolor, suffixcolor, users.id, username, level FROM {$TABLE_PREFIX}users users INNER JOIN {$TABLE_PREFIX}users_level users_level ON users.id_level=users_level.id WHERE users.id='" . $srow["uid"] . "'", true, $btit_settings['cache_duration']);
} else { $tseeds = "f.seeds as seeds"; $tleechs = "f.leechers as leechers"; $tcompletes = "f.finished as finished"; $ttables = "{$TABLE_PREFIX}files f"; } $query = "SELECT f.gold, f.sticky, tag, f.image, f.screen1, f.screen2, f.screen3, f.info_hash, f.filename, f.visible, f.url, UNIX_TIMESTAMP(f.data) as data, f.size, f.comment, f.category as cat_name, {$tseeds}, {$tleechs}, {$tcompletes}, f.speed, f.uploader FROM {$ttables} WHERE f.info_hash ='" . AddSlashes($_GET["info_hash"]) . "'"; $res = do_sqlquery($query, true); $results = mysql_fetch_assoc($res); if (!$results || mysql_num_rows($res) == 0) { err_msg($language["ERROR"], $language["TORRENT_EDIT_ERROR"]); } else { if (!$CURUSER || $CURUSER["uid"] < 2 || $CURUSER["edit_torrents"] == "no" && $CURUSER["uid"] != $results["uploader"]) { stderr($language["ERROR"], $language["CANT_EDIT_TORR"]); } $moder_status = getmoderstatusbyhash(AddSlashes($_GET["info_hash"])); $torrenttpl = new bTemplate(); $torrenttpl->set("language", $language); $row = $res[0]; $torrenttpl->set("imageon", $GLOBALS["imageon"] == "true", TRUE); $torrenttpl->set("screenon", $GLOBALS["screenon"] == "true", TRUE); /* $s = "<select name=\"type\">\n<option value=\"0\">(".$language["CHOOSE_ONE"].")</option>\n"; $cats = genrelist(); foreach ($cats as $row) { $s .= "<option value=\"" . $row["id"] . "\""; if ($row["id"] == $results["cat_name"]) $s .= " \"selected\""; $s .= ">" . unesc($row["name"]) . "</option>\n"; }
echo $language["SHORT_S"]; ?> </td> <td align="center" width="30" class="header"> <?php echo $language["SHORT_L"]; ?> </td> <td align="center" width="40" class="header"> <?php echo $language["SHORT_C"]; ?> </td> </tr> <?php if ($row) { foreach ($row as $id => $data) { if (getmoderstatusbyhash($data['hash']) == 'ok') { echo "<tr>"; if (strlen($data["hash"]) > 0) { echo "\n\t<td align=\"center\" class=\"lista\" width=\"20\" style=\"text-align: center;\">"; echo "<a class=\"lasttor\" href=\"download.php?id=" . $data["hash"] . "&f=" . rawurlencode($data["filename"]) . ".torrent\"><img src='images/torrent.png' border='0' alt='" . $language["DOWNLOAD_TORRENT"] . "' title='" . $language["DOWNLOAD_TORRENT"] . "' /></a>"; echo "</td>"; echo "\n\t<td align=\"center\" class=\"lista\" width=\"20\" style=\"text-align: center;\"><a href=index.php?page=bookmark&do=add&torrent_id=" . $data["hash"] . "><img src=\"images/bookmark.png\" /></a></TD>"; $data["filename"] = unesc($data["filename"]); $filename = cut_string($data["filename"], intval($btit_settings["cut_name"])); // team $fteam = $data["team"]; if (isset($fteam) && !empty($fteam)) { $teamshit = "SELECT name, image, id FROM {$TABLE_PREFIX}teams where id=" . $fteam; $rim = do_sqlquery($teamshit) or err_msg($language["ERROR"], $language["CANT_DO_QUERY"] . (is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); $datat = mysqli_fetch_array($rim); $team = "<a href='index.php?page=modules&module=team&team=" . $datat["id"] . "'><img src=\"" . $datat["image"] . "\" border=\"0\" title=\"" . $datat["name"] . "\"></a>";
$prettynew = str_replace("day", "d", $pretty); } if (strpos($pretty, "hour") == true) { $prettynew = str_replace("hour", "h", $pretty); } if (strpos($pretty, "min") == true) { $prettynew = str_replace("min", "m", $pretty); } if (!$CURUSER || $CURUSER["id_level"] <= "2") { $name = "anonymous"; } $updown = mysqli_result($result, $i, "updown"); if ($updown == 'up') { $upd = "<img src=\"images/speed_up.png\">"; } else { $upd = "<img src=\"images/speed_down.png\">"; } if (getmoderstatusbyhash($hash_info) == 'ok') { echo "<tr><td>{$prettynew}</td><td>{$upd}</td>"; echo "<td><b><font face=\"Verdana\" size=\"1px\" color=\"#254117\"><a href=\"index.php?page=userdetails&id={$uid}\">" . $name . "</font></td>"; echo "<td align=left><b><font face=\"Verdana\" size=\"1px\" color=\"#254117\"><a href=\"index.php?page=torrent-details&id={$hash_info}\">" . $fname . "</a></font></td></tr>"; } ++$i; } } else { echo "<br>No up/downloads the last 48 hours<br><br>"; } echo "</b></center></td></tr></table>"; echo "<font size=0>Ago Legend: d=day, w=week, m=min, h=hour"; echo "<center><table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">"; echo "</table>";
unset($resuploaded); $utorrents = intval($CURUSER["torrentsperpage"]); if ($numtorrent > 0) { list($pagertop, $pagerbottom, $limit) = pager($utorrents == 0 ? 15 : $utorrents, $numtorrent, "index.php?page=usercp&uid={$uid}&", array("pagename" => "ucp_uploaded")); $usercptpl->set("pagertop", $pagertop); $resuploaded = get_result("SELECT f.filename, UNIX_TIMESTAMP(f.data) as added, f.size, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, f.info_hash as hash FROM {$ttables} WHERE uploader={$uid} ORDER BY data DESC {$limit}", true, $btit_settings['cache_duration']); } if ($resuploaded && count($resuploaded) > 0) { include "include/offset.php"; $usercptpl->set("RESULTS", true, true); $uptortpl = array(); $i = 0; foreach ($resuploaded as $id => $rest) { $uptortpl[$i]["filename"] = cut_string(unesc($rest["filename"]), intval($btit_settings["cut_name"])); $uptortpl[$i]["added"] = date("d/m/Y", $rest["added"] - $offset); $uptortpl[$i]["moder"] = getmoderdetails(getmoderstatusbyhash($rest['hash']), $rest['hash']); $uptortpl[$i]["size"] = makesize($rest["size"]); $uptortpl[$i]["seedcolor"] = linkcolor($rest["seeds"]); $uptortpl[$i]["seeds"] = $rest[seeds]; $uptortpl[$i]["leechcolor"] = linkcolor($rest["leechers"]); $uptortpl[$i]["leechers"] = $rest[leechers]; $uptortpl[$i]["completed"] = $rest["finished"] > 0 ? $rest["finished"] : "---"; $uptortpl[$i]["editlink"] = "index.php?page=edit&info_hash=" . $rest["hash"] . "&returnto=" . urlencode("index.php?page=torrents") . ""; $uptortpl[$i]["dellink"] = "index.php?page=delete&info_hash=" . $rest["hash"] . "&returnto=" . urlencode("index.php?page=torrents") . ""; $uptortpl[$i]["editimg"] = image_or_link("{$STYLEPATH}/images/edit.png", "", $language["EDIT"]); $uptortpl[$i]["delimg"] = image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]); $i++; } $usercptpl->set("uptor", $uptortpl); } else { $usercptpl->set("RESULTS", false, true);
if ($torlist['downloaded'] > 0) { $peerratio = number_format($torlist['uploaded'] / $torlist['downloaded'], 2); } else { $peerratio = '∞'; } $tortpl[$i]["peerratio"] = unesc($peerratio); $tortpl[$i]["seedscolor"] = linkcolor($torlist['seeds']); $tortpl[$i]["seeds"] = "<a href=\"javascript:poppeer('index.php?page=peers&id=" . $torlist['infohash'] . "')\">" . $torlist['seeds'] . "</a>"; $tortpl[$i]["leechcolor"] = linkcolor($torlist['leechers']); $tortpl[$i]["leechs"] = "<a href=\"javascript:poppeer('index.php?page=peers&id=" . $torlist['infohash'] . "')\">" . $torlist['leechers'] . "</a>"; $tortpl[$i]["completed"] = "<a href=\"javascript:poppeer('index.php?page=torrent_history.php&id=" . $torlist['infohash'] . "')\">" . $torlist['finished'] . "</a>"; $i++; $userdetailtpl->set("tortpl", $tortpl); } else { $tortpl[$i]["filename"] = "<a href=\"index.php?page=torrent-details&id=" . $torlist['infohash'] . "\" title=\"" . $language["VIEW_DETAILS"] . ": " . $torlist['filename'] . "\">" . $filename . "</a>"; getmoderdetails(getmoderstatusbyhash($torlist->infohash), $torlist->infohash); $tortpl[$i]["size"] = makesize($torlist['size']); $tortpl[$i]["status"] = unesc($torlist['status']); $tortpl[$i]["downloaded"] = makesize($torlist['downloaded']); $tortpl[$i]["uploaded"] = makesize($torlist['uploaded']); if ($torlist['downloaded'] > 0) { $peerratio = number_format($torlist['uploaded'] / $torlist['downloaded'], 2); } else { $peerratio = '∞'; } $tortpl[$i]["peerratio"] = unesc($peerratio); $tortpl[$i]["seedscolor"] = linkcolor($torlist['seeds']); $tortpl[$i]["seeds"] = "<a href=\"index.php?page=peers&id=" . $torlist['infohash'] . "\">" . $torlist['seeds'] . "</a>"; $tortpl[$i]["leechcolor"] = linkcolor($torlist['leechers']); $tortpl[$i]["leechs"] = "<a href=\"index.php?page=peers&id=" . $torlist['infohash'] . "\">" . $torlist['leechers'] . "</a>"; $tortpl[$i]["completed"] = "<a href=\"index.php?page=torrent_history&id=" . $torlist['infohash'] . "\">" . $torlist['finished'] . "</a>";
$torrenttpl->set("torrent_header_size", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=size&by=" . ($order == "size" && $by == "DESC" ? "ASC" : "DESC") . "\">" . $language["SIZE"] . "</a>" . ($order == "size" ? $mark : "")); $torrenttpl->set("uploader", $SHOW_UPLOADER, TRUE); $torrenttpl->set("torrent_header_uploader", $language["UPLOADER"]); $torrenttpl->set("torrent_header_seeds", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=5&by=" . ($order == "seeds" && $by == "DESC" ? "1" : "2") . "\">" . $language["SHORT_S"] . "</a>" . ($order == "seeds" ? $mark : "")); $torrenttpl->set("torrent_header_leechers", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=6&by=" . ($order == "leechers" && $by == "DESC" ? "1" : "2") . "\">" . $language["SHORT_L"] . "</a>" . ($order == "leechers" ? $mark : "")); $torrenttpl->set("torrent_header_complete", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=7&by=" . ($order == "finished" && $by == "ASC" ? "2" : "1") . "\">" . $language["SHORT_C"] . "</a>" . ($order == "finished" ? $mark : "")); $torrenttpl->set("torrent_header_downloaded", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=8&by=" . ($order == "dwned" && $by == "ASC" ? "2" : "1") . "\">" . $language["DOWNLOADED"] . "</a>" . ($order == "dwned" ? $mark : "")); $torrenttpl->set("torrent_header_speed", "<a href=\"{$scriptname}&{$addparam}" . (strlen($addparam) > 0 ? "&" : "") . "order=9&by=" . ($order == "speed" && $by == "ASC" ? "2" : "1") . "\">" . $language["SPEED"] . "</a>" . ($order == "speed" ? $mark : "")); $torrenttpl->set("torrent_header_average", $language["AVERAGE"]); $torrenttpl->set("XBTT", $XBTT_USE, TRUE); $torrenttpl->set("torrent_pagerbottom", $pagerbottom); $torrents = array(); $i = 0; if ($count > 0) { foreach ($results as $tid => $data) { if (getmoderstatusbyhash($data["hash"]) == 'ok') { /*Mod by losmi - visible mod*/ $ok_level = $data['visible']; $curr_l = getLevelVisible($CURUSER['id_level']); if ($CURUSER['username'] == $data['uploader'] || $curr_l >= $ok_level) { /*Mod by losmi - end visible mod*/ $torrenttpl->set("WT1", intval($CURUSER["WT"]) > 0, TRUE); /*Mod by losmi - sticky mod Start Operation #5*/ $sticky_color = get_result("SELECT * FROM {$TABLE_PREFIX}sticky ORDER BY id", true, $btit_settings['cache_duration']); if (count($sticky_color) > 0) { $st = mysql_fetch_assoc($sticky_color); $s_c = $st['color']; } else { /*Default value some green #bce1ac;*/ $s_c = '#bce1ac;';