|
#1
|
|||
|
|||
Heath Bar ( Browse )
if your interest I will share this mod just adds a health bar inside your browse uploaded to site. example 0 seeders 0 leechers will seem like:
else: if interested as stated earlier I will share with you. DON"T PM Post answer below you might have to do some security checks also I have yet to make it secure as I like it. but if your skilled with php I would assume a small patch wouldn't hurt to secure once I share it idea is taken from TorrentTrader plus it looks need as well. Here: save as torrenttable_functions.php Code:
<?php function linkcolor($num) { if (!$num) return "red"; // if ($num == 1) // return "yellow"; return "green"; } function torrenttable($res, $variant = "index") { global $TBDEV, $CURUSER, $lang; $wait = 0; $htmlout = ''; if ($CURUSER["class"] < UC_VIP) { $gigs = $CURUSER["uploaded"] / (1024*1024*1024); $ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0); if ($ratio < 0.5 || $gigs < 5) $wait = 48; elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24; elseif ($ratio < 0.8 || $gigs < 8) $wait = 12; elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6; else $wait = 0; } $htmlout .= "<div style='margin-left: 0px;'> <table border='1' cellspacing='0' cellpadding='5'> <tr> <td class='colhead' align='center'>{$lang["torrenttable_type"]}</td> <td class='colhead' align='left'>{$lang["torrenttable_name"]}</td>"; if ($variant == "mytorrents") { $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_edit"]}</td>\n"; $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_visible"]}</td>\n"; } $htmlout .= "<td class='colhead' align='right'>{$lang["torrenttable_files"]}</td> <td class='colhead' align='center'>{$lang["torrenttable_size"]}</td> <td class='colhead' align='center'>{$lang["torrenttable_snatched"]}</td> <td class='colhead' align='right'>{$lang["torrenttable_seeders"]}</td> <td class='colhead' align='right'>{$lang["torrenttable_leechers"]}</td>"; $htmlout .= "<td class='colhead' align='center'>Health</td>\n"; if ($variant == 'index') $htmlout .= "<td class='colhead' align='center'>{$lang["torrenttable_uppedby"]}</td>\n"; $htmlout .= "</tr>\n"; while ($row = mysql_fetch_assoc($res)) { $id = $row["id"]; $htmlout .= "<tr>\n"; $htmlout .= "<td align='center' style='padding: 0px'>"; if (isset($row["cat_name"])) { $htmlout .= "<a style='color: #000000;' href='browse.php?cat={$row['category']}'>"; if (isset($row["cat_pic"]) && $row["cat_pic"] != "") $htmlout .= "<img border='0' src='{$TBDEV['pic_base_url']}caticons/{$row['cat_pic']}' alt='{$row['cat_name']}' />"; else { $htmlout .= $row["cat_name"]; } $htmlout .= "</a>"; } else { $htmlout .= "-"; } $htmlout .= "</td>\n"; $dispname = htmlspecialchars($row["name"]); $htmlout .= "<td align='left'><a style='color: #000000;' href='details.php?"; if ($variant == "mytorrents") $htmlout .= "returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&"; $htmlout .= "id=$id"; if ($variant == "index") $htmlout .= "&hit=1"; $htmlout .= "'><b>$dispname</b></a>\n"; if ($variant == "mytorrents") $htmlout .= "</td><td align='center'><a href='edit.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "&id={$row['id']}'>".$lang["torrenttable_edit"]."</a>\n"; $htmlout .= "</td>\n"; if ($variant == "mytorrents") { $htmlout .= "<td align='right'>"; if ($row["visible"] == "no") $htmlout .= "<b>".$lang["torrenttable_not_visible"]."</b>"; else $htmlout .= "".$lang["torrenttable_visible"].""; $htmlout .= "</td>\n"; } if ($row["type"] == "single") { $htmlout .= "<td align='right'>{$row["numfiles"]}</td>\n"; } else { if ($variant == "index") { $htmlout .= "<td align='right'><b><a href='filelist.php?id=$id'>" . $row["numfiles"] . "</a></b></td>\n"; } else { $htmlout .= "<td align='right'><b><a href='filelist.php?id=$id'>" . $row["numfiles"] . "</a></b></td>\n"; } } $htmlout .= "<td align='center'>" . str_replace(" ", "<br />", mksize($row["size"])) . "</td>\n"; if ($row["times_completed"] != 1) $_s = "".$lang["torrenttable_time_plural"].""; else $_s = "".$lang["torrenttable_time_singular"].""; $htmlout .= "<td align='center'>" . number_format($row["times_completed"]) . "<br />$_s</td>\n"; if ($row["seeders"]) { if ($variant == "index") { if ($row["leechers"]) $ratio = $row["seeders"] / $row["leechers"]; else $ratio = 1; $htmlout .= "<td align='right'><b><a href='peerlist.php?id=$id#seeders'> <font color='" .get_slr_color($ratio) . "'>{$row["seeders"]}</font></a></b></td>\n"; } else { $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["seeders"]) . "' href='peerlist.php?id=$id#seeders'>{$row["seeders"]}</a></b></td>\n"; } } else { $htmlout .= "<td align='right'><span class='" . linkcolor($row["seeders"]) . "'>" . $row["seeders"] . "</span></td>\n"; } if ($row["leechers"]) { if ($variant == "index") $htmlout .= "<td align='right'><b><a style='color: #000000;' href='peerlist.php?id=$id#leechers'>" . number_format($row["leechers"]) . "</a></b></td>\n"; else $htmlout .= "<td align='right'><b><a class='" . linkcolor($row["leechers"]) . "' href='peerlist.php?id=$id#leechers'>{$row["leechers"]}</a></b></td>\n"; } else $htmlout .= "<td align='right'>0</td>\n"; $htmlout .= "<td align='center'><img src='images/health/health_".health($row["leechers"], $row["seeders"]).".gif' alt='' /></td>"; if ($variant == "index") $htmlout .= "<td align='center'>" . (isset($row["username"]) ? ("<a style='color: #000000;' href='userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>(".$lang["torrenttable_unknown_uploader"].")</i>") . "</td>\n"; $htmlout .= "</tr>\n"; } $htmlout .= "</table></div>"; return $htmlout; } function commenttable($rows) { global $CURUSER, $TBDEV; $lang = load_language( 'torrenttable_functions' ); $htmlout = ''; $count = 0; $htmlout .= begin_main_frame(); $htmlout .= begin_frame(); foreach ($rows as $row) { $htmlout .= "<p style='color: #ffffff;' class='sub'>#{$row["id"]} {$lang["commenttable_by"]} "; if (isset($row["username"])) { $title = $row["title"]; if ($title == "") $title = get_user_class_name($row["class"]); else $title = htmlspecialchars($title); $htmlout .= "<a name='comm{$row["id"]}' href='userdetails.php?id={$row["user"]}'><b>" . htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" ? "<img src='{$TBDEV['pic_base_url']}star.gif' alt='".$lang["commenttable_donor_alt"]."' />" : "") . ($row["warned"] == "yes" ? "<img src=". "'{$TBDEV['pic_base_url']}warned.gif' alt='".$lang["commenttable_warned_alt"]."' />" : "") . " ($title)\n"; } else $htmlout .= "<a name='comm{$row["id"]}'><i>(".$lang["commenttable_orphaned"].")</i></a>\n"; $htmlout .= get_date( $row['added'],''); $htmlout .= ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href='comment.php?action=edit&cid={$row['id']}'>".$lang["commenttable_edit"]."</a>]" : "") . (get_user_class() >= UC_MODERATOR ? "- [<a href='comment.php?action=delete&cid={$row['id']}'>".$lang["commenttable_delete"]."</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? "- [<a href='comment.php?action=vieworiginal&cid={$row['id']}'>".$lang["commenttable_view_original"]."</a>]" : "") . "</p>\n"; $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : ""); if (!$avatar) $avatar = "{$TBDEV['pic_base_url']}default_avatar.gif"; $text = format_comment($row["text"]); if ($row["editedby"]) $text .= "<p><font size='1' class='small'>".$lang["commenttable_last_edited_by"]." <a href='userdetails.php?id={$row['editedby']}'><b>{$row['username']}</b></a> ".$lang["commenttable_last_edited_at"]." ".get_date($row['editedat'],'DATE')."</font></p>\n"; $htmlout .= begin_table2(true); $htmlout .= "<tr valign='top'>\n"; $htmlout .= "<td align='center' width='100' style='padding: 0px'><img width='{$row['av_w']}' height='{$row['av_h']}' src='{$avatar}' alt='' /></td>\n"; $htmlout .= "<td style='color: #ffffff;' class='text'>$text</td>\n"; $htmlout .= "</tr>\n"; $htmlout .= end_table(); } $htmlout .= end_frame(); $htmlout .= end_main_frame(); return $htmlout; } ?> save then move to bittorrent.php: add: Code:
function health($leechers, $seeders) { if (($leechers == 0 && $seeders == 0) || ($leechers > 0 && $seeders == 0)) return 0; elseif ($seeders > $leechers) return 10; $ratio = $seeders / $leechers * 100; if ($ratio > 0 && $ratio < 15) return 1; elseif ($ratio >= 15 && $ratio < 25) return 2; elseif ($ratio >= 25 && $ratio < 35) return 3; elseif ($ratio >= 35 && $ratio < 45) return 4; elseif ($ratio >= 45 && $ratio < 55) return 5; elseif ($ratio >= 55 && $ratio < 65) return 6; elseif ($ratio >= 65 && $ratio < 75) return 7; elseif ($ratio >= 75 && $ratio < 85) return 8; elseif ($ratio >= 85 && $ratio < 95) return 9; else return 10; } |
#2
|
|||
|
|||
Wow lol so easy to do any want to be coder can add
Pop over to u232 full mod there |
#3
|
|||
|
|||
nice advice though soz to disappoint you, the information suggested above is the full hack/mod for healthbar!
rootDIR: /var/www/html/include/ modifyFile: replace torrenttable_functions.php file with the one posted originally by us. modifyFile: now edit bittorrent.php and add health function posted by us above. !NOTICE! no health status bar, not added just yet.... New Output: 0 seeders 0 leechers 2 seeders 3 leechers + now as you can see it works 100% without any issues if there are it will be most likely PHP version or possibly sql_ext for queries. Bump: * create folders: images/health * unrar files * upload to dir_file:/var/www/html/images * now should show like example below when images uploaded / extracted from .rar |
Tags |
bar , browse , heath |
|
|