本文整理汇总了PHP中get_ratio_color函数的典型用法代码示例。如果您正苦于以下问题:PHP get_ratio_color函数的具体用法?PHP get_ratio_color怎么用?PHP get_ratio_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_ratio_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commenttable
function commenttable($rows, $redaktor = "comment")
{
global $CURUSER, $avatar_max_width;
$count = 0;
foreach ($rows as $row) {
if ($row["downloaded"] > 0) {
$ratio = $row['uploaded'] / $row['downloaded'];
$ratio = number_format($ratio, 2);
} elseif ($row["uploaded"] > 0) {
$ratio = "Inf.";
} else {
$ratio = "---";
}
if (strtotime($row["last_access"]) > gmtime() - 600) {
$online = "online";
$online_text = "В сети";
} else {
$online = "offline";
$online_text = "Не в сети";
}
print "<table class=maibaugrand width=100% border=1 cellspacing=0 cellpadding=3>";
print "<tr><td class=colhead align=\"left\" colspan=\"2\" height=\"24\">";
if (isset($row["username"])) {
$title = $row["title"];
if ($title == "") {
$title = get_user_class_name($row["class"]);
} else {
$title = htmlspecialchars_uni($title);
}
print ":: <img src=\"pic/buttons/button_" . $online . ".gif\" alt=\"" . $online_text . "\" title=\"" . $online_text . "\" style=\"position: relative; top: 2px;\" border=\"0\" height=\"14\">" . " <a name=comm" . $row["id"] . " href=userdetails.php?id=" . $row["user"] . " class=altlink_white><b>" . get_user_class_color($row["class"], htmlspecialchars_uni($row["username"])) . "</b></a> ::" . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=\"/pic/warned.gif\" alt=\"Warned\">" : "") . " {$title} ::\n" . " <img src=\"pic/upl.gif\" alt=\"upload\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["uploaded"]) . " :: <img src=\"pic/down.gif\" alt=\"download\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["downloaded"]) . " :: <font color=\"" . get_ratio_color($ratio) . "\">{$ratio}</font> :: ";
} else {
print "<a name=\"comm" . $row["id"] . "\"><i>[Anonymous]</i></a>\n";
}
$avatar = $CURUSER["avatars"] == "yes" ? htmlspecialchars_uni($row["avatar"]) : "";
if (!$avatar) {
$avatar = "pic/default_avatar.gif";
}
if (md5($row['text']) == $row['text_hash']) {
$text = $row['text_parsed'];
} else {
$text = format_comment($row['text']);
sql_query('INSERT INTO comments_parsed (cid, text_hash, text_parsed) VALUES (' . implode(', ', array_map('sqlesc', array($row['id'], md5($row['text']), $text))) . ')') or sqlerr(__FILE__, __LINE__);
}
if ($row["editedby"]) {
//$res = mysql_fetch_assoc(sql_query("SELECT * FROM users WHERE id = $row[editedby]")) or sqlerr(__FILE__,__LINE__);
$text .= "<p><font size=1 class=small>Последний раз редактировалось <a href=userdetails.php?id={$row['editedby']}><b>{$row['editedbyname']}</b></a> в {$row['editedat']}</font></p>\n";
}
print "</td></tr>";
print "<tr valign=top>\n";
print "<td style=\"padding: 0px; width: 5%;\" align=\"center\"><img src={$avatar} width=\"{$avatar_max_width}\"> </td>\n";
print "<td width=100% class=text>";
//print("<span style=\"float: right\"><a href=\"#top\"><img title=\"Top\" src=\"pic/top.gif\" alt=\"Top\" border=\"0\" width=\"15\" height=\"13\"></a></span>");
print "{$text}</td>\n";
print "</tr>\n";
print "<tr><td class=colhead align=\"center\" colspan=\"2\">";
print "<div style=\"float: left; width: auto;\">" . ($CURUSER ? " [<a href=\"" . $redaktor . ".php?action=quote&cid={$row['id']}\" class=\"altlink_white\">Цитата</a>]" : "") . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? " [<a href=" . $redaktor . ".php?action=edit&cid={$row['id']} class=\"altlink_white\">Изменить</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=delete&cid={$row['id']}\" class=\"altlink_white\">Удалить</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=vieworiginal&cid={$row['id']}\" class=\"altlink_white\">Оригинал</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " IP: " . ($row["ip"] ? "<a href=\"usersearch.php?ip={$row['ip']}\" class=\"altlink_white\">" . $row["ip"] . "</a>" : "Неизвестен") : "") . "</div>";
print "<div align=\"right\"><!--<font size=1 class=small>-->Комментарий добавлен: " . $row["added"] . " GMT<!--</font>--></td></tr>";
print "</table><br>";
}
}
示例2: maketable
function maketable($res)
{
global $pic_base_url;
$ret = "<table class='main' border='1' cellspacing='0' cellpadding='5'>" . "<tr><td class='colhead' align='center'>Type</td><td class='colhead'>Name</td><td class='colhead' align='center'>TTL</td><td class='colhead' align='center'>Size</td><td class='colhead' align='right'>Se.</td><td class='colhead' align='right'>Le.</td><td class='colhead' align='center'>Upl.</td>\n" . "<td class='colhead' align='center'>Downl.</td><td class='colhead' align='center'>Ratio</td></tr>\n";
while ($arr = mysql_fetch_assoc($res)) {
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color='" . get_ratio_color($ratio) . "'>{$ratio}</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "Inf.";
} else {
$ratio = "---";
}
}
$catimage = "{$pic_base_url}caticons/{$arr['image']}";
$catname = htmlspecialchars($arr["catname"]);
$catimage = "<img src=\"" . htmlspecialchars($catimage) . "\" title=\"{$catname}\" alt=\"{$catname}\" width='42' height='42' />";
$ttl = 28 * 24 - floor((time() - $arr["added"]) / 3600);
if ($ttl == 1) {
$ttl .= "<br />hour";
} else {
$ttl .= "<br />hours";
}
$size = str_replace(" ", "<br />", mksize($arr["size"]));
$uploaded = str_replace(" ", "<br />", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "<br />", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= "<tr><td style='padding: 0px'>{$catimage}</td>\n" . "<td><a href='details.php?id={$arr['torrent']}&hit=1'><b>" . htmlspecialchars($arr["torrentname"]) . "</b></a></td><td align='center'>{$ttl}</td><td align='center'>{$size}</td><td align='right'>{$seeders}</td><td align='right'>{$leechers}</td><td align='center'>{$uploaded}</td>\n" . "<td align='center'>{$downloaded}</td><td align='center'>{$ratio}</td></tr>\n";
}
$ret .= "</table>\n";
return $ret;
}
示例3: maketable
function maketable($res)
{
global $tracker_lang, $use_ttl, $ttl_days;
$ret = "<table class=main border=1 cellspacing=0 cellpadding=5>" . "<tr><td class=colhead align=left>" . $tracker_lang['type'] . "</td><td class=colhead>" . $tracker_lang['name'] . "</td>" . ($use_ttl ? "<td class=colhead align=center>" . $tracker_lang['ttl'] . "</td>" : "") . "<td class=colhead align=center>" . $tracker_lang['size'] . "</td><td class=colhead align=right>" . $tracker_lang['details_seeding'] . "</td><td class=colhead align=right>" . $tracker_lang['details_leeching'] . "</td><td class=colhead align=center>" . $tracker_lang['uploaded'] . "</td>\n" . "<td class=colhead align=center>" . $tracker_lang['downloaded'] . "</td><td class=colhead align=center>" . $tracker_lang['ratio'] . "</td></tr>\n";
while ($arr = mysql_fetch_assoc($res)) {
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "Inf.";
} else {
$ratio = "---";
}
}
$catid = $arr["catid"];
$catimage = htmlspecialchars_uni($arr["image"]);
$catname = htmlspecialchars_uni($arr["catname"]);
$ttl = $ttl_days * 24 - floor((gmtime() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600);
if ($ttl == 1) {
$ttl .= " час";
} else {
$ttl .= " часов";
}
$size = str_replace(" ", "<br />", mksize($arr["size"]));
$uploaded = str_replace(" ", "<br />", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "<br />", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= "<tr><td style='padding: 0px'><a href=\"browse.php?cat={$catid}\"><img src=\"pic/cats/{$catimage}\" alt=\"{$catname}\" border=\"0\" /></a></td>\n" . "<td><a href=details.php?id={$arr['torrent']}&hit=1><b>" . $arr["torrentname"] . "</b></a></td>" . ($use_ttl ? "<td align=center>{$ttl}</td>" : "") . "<td align=center>{$size}</td><td align=right>{$seeders}</td><td align=right>{$leechers}</td><td align=center>{$uploaded}</td>\n" . "<td align=center>{$downloaded}</td><td align=center>{$ratio}</td></tr>\n";
}
$ret .= "</table>\n";
return $ret;
}
示例4: maketable
function maketable($res)
{
global $INSTALLER09, $lang;
$htmlout = '';
$htmlout .= "<table class='main' border='1' cellspacing='0' cellpadding='5'>" . "<tr><td class='colhead' align='center'>{$lang['userdetails_type']}</td><td class='colhead'>{$lang['userdetails_name']}</td><td class='colhead' align='center'>{$lang['userdetails_size']}</td><td class='colhead' align='right'>{$lang['userdetails_se']}</td><td class='colhead' align='right'>{$lang['userdetails_le']}</td><td class='colhead' align='center'>{$lang['userdetails_upl']}</td>\n" . "<td class='colhead' align='center'>{$lang['userdetails_downl']}</td><td class='colhead' align='center'>{$lang['userdetails_ratio']}</td></tr>\n";
foreach ($res as $arr) {
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color='" . get_ratio_color($ratio) . "'>{$ratio}</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "{$lang['userdetails_inf']}";
} else {
$ratio = "---";
}
}
$catimage = "{$INSTALLER09['pic_base_url']}caticons/{$arr['image']}";
$catname = htmlspecialchars($arr["catname"]);
$catimage = "<img src=\"" . htmlspecialchars($catimage) . "\" title=\"{$catname}\" alt=\"{$catname}\" width='42' height='42' />";
$size = str_replace(" ", "<br />", mksize($arr["size"]));
$uploaded = str_replace(" ", "<br />", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "<br />", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$htmlout .= "<tr><td style='padding: 0px'>{$catimage}</td>\n" . "<td><a href='details.php?id={$arr['torrent']}&hit=1'><b>" . htmlspecialchars($arr["torrentname"]) . "</b></a></td><td align='center'>{$size}</td><td align='right'>{$seeders}</td><td align='right'>{$leechers}</td><td align='center'>{$uploaded}</td>\n" . "<td align='center'>{$downloaded}</td><td align='center'>{$ratio}</td></tr>\n";
}
$htmlout .= "</table>\n";
return $htmlout;
}
示例5: maketable
function maketable($res)
{
global $INSTALLER09, $lang, $CURUSER;
$htmlout = '';
$htmlout .= "<table class='table table-bordered'>\n\t" . "<tr><td class='text-center'>{$lang['userdetails_type']}</td>\n <td class='text-center'>{$lang['userdetails_name']}</td>\n <td class='text-center'>{$lang['userdetails_size']}</td>\n <td class='text-center'>{$lang['userdetails_se']}</td>\n <td class='text-center'>{$lang['userdetails_le']}</td>\n <td class='text-center'>{$lang['userdetails_upl']}</td>\n" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td class='text-center'>{$lang['userdetails_downl']}</td>") . "\n <td class='text-center'>{$lang['userdetails_ratio']}</td></tr>\n";
foreach ($res as $arr) {
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color='" . get_ratio_color($ratio) . "'>{$ratio}</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "{$lang['userdetails_inf']}";
} else {
$ratio = "---";
}
}
$catimage = "{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/{$arr['image']}";
$catname = " " . htmlsafechars($arr["catname"]);
$catimage = "<img src=\"" . htmlsafechars($catimage) . "\" title=\"{$catname}\" alt=\"{$catname}\" width='42' height='42' />";
$size = str_replace(" ", "<br />", mksize($arr["size"]));
$uploaded = str_replace(" ", "<br />", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "<br />", mksize($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$XBT_or_PHP = XBT_TRACKER == true ? $arr['fid'] : $arr['torrent'];
$htmlout .= "<tr><td style='padding: 0px'>{$catimage}</td>\n" . "<td><a href='details.php?id=" . (int) $XBT_or_PHP . "&hit=1'><b>" . htmlsafechars($arr['torrentname']) . "</b></a></td><td align='center'>{$size}</td><td align='right'>{$seeders}</td><td align='right'>{$leechers}</td><td align='center'>{$uploaded}</td>\n" . "" . ($INSTALLER09['ratio_free'] ? "" : "<td align='center'>{$downloaded}</td>") . "<td align='center'>{$ratio}</td></tr>\n";
}
$htmlout .= "</table>\n";
return $htmlout;
}
示例6: dltable
function dltable($name, $arr, $torrent)
{
global $CURUSER, $lang;
$htmlout = '';
if (!count($arr)) {
return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
}
$htmlout = "\n";
$htmlout .= "<table width='100%' class='main' border='1' cellspacing='0' cellpadding='5'>\n";
$htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='center'>{$lang['peerslist_connectable']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_connected']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
$now = time();
//$moderator = (isset($CURUSER) && get_user_class() >= UC_MODERATOR);
//$mod = get_user_class() >= UC_MODERATOR;
foreach ($arr as $e) {
// user/ip/port
// check if anyone has this ip
//($unr = mysql_query("SELECT username, privacy FROM users WHERE id=$e[userid] ORDER BY last_access DESC LIMIT 1")) or die;
//$una = mysql_fetch_assoc($unr);
if ($e["privacy"] == "strong") {
continue;
}
$htmlout .= "<tr>\n";
if ($e["username"]) {
$htmlout .= "<td><a href='userdetails.php?id={$e['userid']}'><b>{$e['username']}</b></a></td>\n";
} else {
$htmlout .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\\.\\d+$/', ".xxx", $e["ip"])) . "</td>\n";
}
$secs = max(1, $now - $e["st"] - ($now - $e["la"]));
//$revived = $e["revived"] == "yes";
$htmlout .= "<td align='center'>" . ($e['connectable'] == "yes" ? "{$lang['peerslist_yes']}" : "<font color='red'>{$lang['peerslist_no']}</font>") . "</td>\n";
$htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</span></td>\n";
$htmlout .= "<td align='right'>" . mksize($e["downloaded"]) . "</td>\n";
if ($e["seeder"] == "no") {
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</span></td>\n";
} else {
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</span></td>\n";
}
if ($e["downloaded"]) {
$ratio = floor($e["uploaded"] / $e["downloaded"] * 1000) / 1000;
$htmlout .= "<td align=\"right\"><font color='" . get_ratio_color($ratio) . "'>" . number_format($ratio, 3) . "</font></td>\n";
} else {
if ($e["uploaded"]) {
$htmlout .= "<td align='right'>{$lang['peerslist_inf']}</td>\n";
} else {
$htmlout .= "<td align='right'>---</td>\n";
}
}
$htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</td>\n";
$htmlout .= "<td align='right'>" . mkprettytime($now - $e["st"]) . "</td>\n";
$htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
$htmlout .= "<td align='left'>" . htmlspecialchars(getagent($e["agent"], $e['peer_id'])) . "</td>\n";
$htmlout .= "</tr>\n";
}
$htmlout .= "</table>\n";
return $htmlout;
}
示例7: dltable
function dltable($name, $arr, $torrent)
{
global $CURUSER, $lang;
$htmlout = '';
if (!count($arr)) {
return $htmlout = "<div align='left'><b>{$lang['peerslist_no']} {$name} {$lang['peerslist_data_available']}</b></div>\n";
}
$htmlout = "\n";
$htmlout .= "<table width='100%' class='main' border='1' cellspacing='0' cellpadding='5'>\n";
$htmlout .= "<tr><td colspan='11' class='colhead'>" . count($arr) . " {$name}</td></tr>" . "<tr><td class='colhead'>{$lang['peerslist_user_ip']}</td>" . "<td class='colhead' align='center'>{$lang['peerslist_connectable']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_uploaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_downloaded']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_rate']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_ratio']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_complete']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_connected']}</td>" . "<td class='colhead' align='right'>{$lang['peerslist_idle']}</td>" . "<td class='colhead' align='left'>{$lang['peerslist_client']}</td></tr>\n";
$now = time();
$mod = $CURUSER['class'] >= UC_MODERATOR;
foreach ($arr as $e) {
if ($e["privacy"] == "strong") {
continue;
}
$htmlout .= "<tr>\n";
if ($e['username']) {
if (($e['tanonymous'] == 'yes' && $e['owner'] == $e['userid'] || $e['anonymous'] == 'yes' && $CURUSER['id'] != $e['userid']) && $CURUSER['class'] < UC_MODERATOR) {
$htmlout .= "<td><b>Anonymous</b></td>\n";
} else {
$htmlout .= "<td><a href='userdetails.php?id=" . $e['userid'] . "'><b>" . $e['username'] . "</b></a></td>\n";
}
} else {
$htmlout .= "<td>" . ($mod ? $e["ip"] : preg_replace('/\\.\\d+$/', ".xxx", $e["ip"])) . "</td>\n";
}
$secs = max(1, $now - $e["st"] - ($now - $e["la"]));
$htmlout .= "<td align='center'>" . ($e['connectable'] == "yes" ? "{$lang['peerslist_yes']}" : "<font color='red'>{$lang['peerslist_no']}</font>") . "</td>\n";
$htmlout .= "<td align='right'>" . mksize($e["uploaded"]) . "</td>\n";
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</span></td>\n";
$htmlout .= "<td align='right'>" . mksize($e["downloaded"]) . "</td>\n";
if ($e["seeder"] == "no") {
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</span></td>\n";
} else {
$htmlout .= "<td align='right'><span style=\"white-space: nowrap;\">" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e['st'])) . "/s</span></td>\n";
}
if ($e["downloaded"]) {
$ratio = floor($e["uploaded"] / $e["downloaded"] * 1000) / 1000;
$htmlout .= "<td align=\"right\"><font color='" . get_ratio_color($ratio) . "'>" . number_format($ratio, 3) . "</font></td>\n";
} else {
if ($e["uploaded"]) {
$htmlout .= "<td align='right'>{$lang['peerslist_inf']}</td>\n";
} else {
$htmlout .= "<td align='right'>---</td>\n";
}
}
$htmlout .= "<td align='right'>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</td>\n";
$htmlout .= "<td align='right'>" . mkprettytime($now - $e["st"]) . "</td>\n";
$htmlout .= "<td align='right'>" . mkprettytime($now - $e["la"]) . "</td>\n";
$htmlout .= "<td align='left'>" . htmlspecialchars(getagent($e["agent"], $e['peer_id'])) . "</td>\n";
$htmlout .= "</tr>\n";
}
$htmlout .= "</table>\n";
return $htmlout;
}
示例8: snatchtable_staff
function snatchtable_staff($res)
{
global $INSTALLER09, $lang, $CURUSER, $id;
$htmlout_snatch = '';
$count2 = 0;
// $htmlout_snatch .= "<tr><td class='one' align='right' valign='top'><b>{$lang['userdetails_snatched']}</b></td><td class='one'>";
$htmlout_snatch .= "<table border='1' cellspacing='0' cellpadding='5' align='center'><tr><td class='colhead' align='center'>{$lang['userdetails_s_cat']}</td><td class='colhead' align='left'>{$lang['userdetails_s_torr']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_s_sl']}</td><td class='colhead' align='center'>{$lang['userdetails_s_up']}" . ($INSTALLER09['ratio_free'] ? "" : "{$lang['userdetails_s_down']}") . "</td><td class='colhead' align='center'>{$lang['userdetails_s_tsize']}</td>" . "<td class='colhead' align='center'>{$lang['userdetails_ratio']}</td><td class='colhead' align='center'>{$lang['userdetails_client']}</td></tr>";
while ($arr = mysqli_fetch_assoc($res)) {
//=======change colors
$count2 = ++$count2 % 2;
$class = $count2 == 0 ? 'one' : 'two';
//=== speed color red fast green slow ;)
if ($arr["upspeed"] > 0) {
$ul_speed = $arr["upspeed"] > 0 ? mksize($arr["upspeed"]) : ($arr["seedtime"] > 0 ? mksize($arr["uploaded"] / ($arr["seedtime"] + $arr["leechtime"])) : mksize(0));
} else {
$ul_speed = mksize($arr["uploaded"] / ($arr['l_a'] - $arr['s'] + 1));
}
if ($arr["downspeed"] > 0) {
$dl_speed = $arr["downspeed"] > 0 ? mksize($arr["downspeed"]) : ($arr["leechtime"] > 0 ? mksize($arr["downloaded"] / $arr["leechtime"]) : mksize(0));
} else {
$dl_speed = mksize($arr["downloaded"] / ($arr['c'] - $arr['s'] + 1));
}
switch (true) {
case $dl_speed > 600:
$dlc = 'red';
break;
case $dl_speed > 300:
$dlc = 'orange';
break;
case $dl_speed > 200:
$dlc = 'yellow';
break;
case $dl_speed < 100:
$dlc = 'Chartreuse';
break;
}
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color='" . get_ratio_color($ratio) . "'><b>{$lang['userdetails_s_ratio']}</b><br />{$ratio}</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = $lang['userdetails_inf'];
} else {
$ratio = "N/A";
}
}
if (XBT_TRACKER === false) {
$htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['complete_date'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['torrentid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['complete_date'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br />" : "<font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['start_date'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['last_action'], 0, 1) . "</font>" . get_date($arr['complete_date'], 0, 1) . " " . ($arr['complete_date'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . $lang['userdetails_s_finished'] . get_date($arr['complete_date'], 0, 1) . "" . ($arr['complete_date'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? $lang['userdetails_s_tseed'] . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : $lang['userdetails_s_tseedn']) . "</font><font color='lightgreen'> [ {$lang['userdetails_s_uspeed']} " . $ul_speed . " ] </font>" . ($arr['complete_date'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']}{$dl_speed}</font>" : "") . "</td>" . "\n <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['seeder'] == 'yes' ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["agent"]) . "<br />{$lang['userdetails_s_port']}" . (int) $arr["port"] . "<br />" . ($arr["connectable"] == 'yes' ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
} else {
$htmlout_snatch .= "<tr><td class='{$class}' align='center'>" . ($arr['owner'] == $id ? "<b><font color='orange'>{$lang['userdetails_s_towner']}</font></b><br />" : "" . ($arr['completedtime'] != '0' ? "<b><font color='lightgreen'>{$lang['userdetails_s_fin']}</font></b><br />" : "<b><font color='red'>{$lang['userdetails_s_nofin']}</font></b><br />") . "") . "<img src='{$INSTALLER09['pic_base_url']}caticons/{$CURUSER['categorie_icon']}/" . htmlsafechars($arr['image']) . "' alt='" . htmlsafechars($arr['name']) . "' title='" . htmlsafechars($arr['name']) . "' /></td>" . "\n <td class='{$class}'><a class='altlink' href='{$INSTALLER09['baseurl']}/details.php?id=" . (int) $arr['fid'] . "'><b>" . htmlsafechars($arr['torrent_name']) . "</b></a>" . ($arr['completedtime'] != '0' ? "<br /><font color='yellow'>{$lang['userdetails_s_started']}" . get_date($arr['started'], 0, 1) . "</font><br />" : "<font color='yellow'>started:" . get_date($arr['started'], 0, 1) . "</font><br /><font color='orange'>{$lang['userdetails_s_laction']}" . get_date($arr['mtime'], 0, 1) . "</font>" . get_date($arr['completedtime'], 0, 1) . " " . ($arr['completedtime'] == '0' ? "" . ($arr['owner'] == $id ? "" : "[ " . mksize($arr["size"] - $arr["downloaded"]) . "{$lang['userdetails_s_still']}]") . "" : "") . "") . "{$lang['userdetails_s_finished']}" . get_date($arr['completedtime'], 0, 1) . "" . ($arr['completedtime'] != '0' ? "<br /><font color='silver'>{$lang['userdetails_s_ttod']}" . ($arr['leechtime'] != '0' ? mkprettytime($arr['leechtime']) : mkprettytime($arr['c'] - $arr['s']) . "") . "</font> <font color='{$dlc}'>[ {$lang['userdetails_s_dled']} {$dl_speed} ]</font><br />" : "<br />") . "<font color='lightblue'>" . ($arr['seedtime'] != '0' ? "{$lang['userdetails_s_tseed']}" . mkprettytime($arr['seedtime']) . " </font><font color='{$dlc}'> " : "{$lang['userdetails_s_tseedn']}") . "</font><font color='lightgreen'> [{$lang['userdetails_s_uspeed']}" . $ul_speed . " ] </font>" . ($arr['completedtime'] == '0' ? "<br /><font color='{$dlc}'>{$lang['userdetails_s_dspeed']} {$dl_speed}</font>" : "") . "</td>" . "\n <td align='center' class='{$class}'>{$lang['userdetails_s_seed']}" . (int) $arr['seeders'] . "<br />{$lang['userdetails_s_leech']}" . (int) $arr['leechers'] . "</td><td align='center' class='{$class}'><font color='lightgreen'>{$lang['userdetails_s_upld']}<br /><b>" . mksize($arr["uploaded"]) . "</b></font>" . ($INSTALLER09['ratio_free'] ? "" : "<br /><font color='orange'>{$lang['userdetails_s_dld']}<br /><b>" . mksize($arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . mksize($arr["size"]) . "" . ($INSTALLER09['ratio_free'] ? "" : "<br />{$lang['userdetails_s_diff']}<br /><font color='orange'><b>" . mksize($arr['size'] - $arr["downloaded"]) . "</b></font>") . "</td><td align='center' class='{$class}'>" . $ratio . "<br />" . ($arr['active'] == 1 ? "<font color='lightgreen'><b>{$lang['userdetails_s_seeding']}</b></font>" : "<font color='red'><b>{$lang['userdetails_s_nseeding']}</b></font>") . "</td><td align='center' class='{$class}'>" . htmlsafechars($arr["peer_id"]) . "<br />" . ($arr["connectable"] == 1 ? "<b>{$lang['userdetails_s_conn']}</b> <font color='lightgreen'>{$lang['userdetails_yes']}</font>" : "<b>{$lang['userdetails_s_conn']}</b> <font color='red'><b>{$lang['userdetails_no']}</b></font>") . "</td></tr>\n";
}
}
$htmlout_snatch .= "</table>\n";
return $htmlout_snatch;
}
示例9: maketable
function maketable($res)
{
global $cats;
if (!isset($cats))
{
$res2 = mysql_query("SELECT id, image, name FROM categories") or sqlerr(__FILE__, __LINE__);
while ($arr = mysql_fetch_assoc($res2))
{
$catimages[$arr["id"]] = $arr["image"];
$catnames[$arr["id"]] = $arr["name"];
}
}
$ret = '<table class=main border=1 cellspacing=0 cellpadding=5>' .
'<tr><td class="colhead" align="center">Tegund</td><td class="colhead">Nafn</td><td class="colhead" align="center">TTL</td><td class="colhead" align="center">Stærð</td><td class="colhead" align="center">Uppl.</td>'."\n" .
'<td class="colhead" align="center">Downl.</td><td class="colhead" align="center">Hlutfall</td><td class="colhead" align="center">IP-tala</td></tr>'."\n";
while ($arr = mysql_fetch_assoc($res))
{
$res2 = mysql_query("SELECT name,size,category,added FROM torrents WHERE id=$arr[torrent]");
$arr2 = mysql_fetch_assoc($res2);
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 = "---";
$catimage = htmlspecialchars($catimages[$arr2["category"]]);
$catname = htmlspecialchars($catnames[$arr2["category"]]);
$ttl = (28*24) - floor((gmtime() - sql_timestamp_to_unix_timestamp($arr2["added"])) / 3600);
if ($ttl == 1) $ttl .= "<br>klst";
$size = str_replace(" ", "<br>", mksize($arr2["size"]));
$uploaded = str_replace(" ", "<br>", mksize($arr["uploaded"]));
$downloaded = str_replace(" ", "<br>", mksize($arr["downloaded"]));
$ip = $arr['ip'];
$ret .= '<tr><td style="padding: 0px"><img src="pic/'.$catimage.'" alt="'.$catname.'" width="42" height="42"></td>'."\n" .
'<td><a href=details.php?id='.$arr[torrent].'&hit=1><b>';
if(!empty($arr2['name']))
$ret .= htmlspecialchars($arr2[name]);
else
$ret .= '[Ekkert nafn]';
$ret .= '</b></a></td><td align="center">'.$ttl.'</td><td align="center">'.$size.'</td><td align="center">'.$uploaded.'</td>'."\n" .
'<td align="center">'.$downloaded.'</td><td align="center">'.$ratio.'</td><td
align="center">'.$ip.'</td></tr>'."\n";
}
$ret .= "</table>\n";
return $ret;
}
示例10: ratios
function ratios($up, $down)
{
if ($down > 0) {
$ratio = number_format($up / $down, 3);
return "<font color='" . get_ratio_color($ratio) . "'>{$ratio}</font>";
} else {
if ($up > 0) {
return $lang['takemessage_inf'];
} else {
return "---";
}
}
return;
}
示例11: ratios
function ratios($up,$down, $color = True)
{
if ($down > 0)
{
$r = number_format($up / $down, 2);
if ($color)
$r = "<font color=".get_ratio_color($r).">$r</font>";
}
else
if ($up > 0)
$r = "Inf.";
else
$r = "---";
return $r;
}
示例12: ratios
function ratios($up, $down, $color = true)
{
if ($down > 0) {
$r = number_format($up / $down, 2);
if ($color) {
$r = "<font color=" . get_ratio_color($r) . ">{$r}</font>";
}
} else {
if ($up > 0) {
$r = "Inf.";
} else {
$r = "---";
}
}
return $r;
}
示例13: format_ratio
function format_ratio($up, $down, $color = True)
{
if ($down > 0) {
$r = number_format($up / $down, 2);
if ($color) {
$r = "<font color='" . get_ratio_color($r) . "'>{$r}</font>";
}
} else {
if ($up > 0) {
$r = "'Inf.'";
} else {
$r = "'---'";
}
}
return $r;
}
示例14: reqcommenttable
function reqcommenttable($rows)
{
global $CURUSER, $HTTP_SERVER_VARS;
begin_main_frame();
begin_frame();
$count = 0;
foreach ($rows as $row) {
print("<p class=sub>#" . $row["id"] . " bY: ");
if (isset($row["username"])) {
$username = $row["username"];
$ratres = mysql_query("SELECT uploaded, downloaded FROM users WHERE username='$username'");
$rat = mysql_fetch_array($ratres);
if ($rat["downloaded"] > 0) {
$ratio = $rat['uploaded'] / $rat['downloaded'];
$ratio = number_format($ratio, 3);
$color = get_ratio_color($ratio);
if ($color)
$ratio = "<font color=$color>$ratio</font>";
} else
if ($rat["uploaded"] > 0)
$ratio = "Inf.";
else
$ratio = "---";
$title = $row["title"];
if ($title == "")
$title = get_user_class_name($row["class"]);
else
$title = htmlspecialchars($title);
print("<a name=comm".$row["id"]." href=userdetails.php?id=".$row["user"]."><b>".htmlspecialchars($row["username"])."</b></a>".($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "").($row["warned"] == "yes" ? "<img src="."/pic/warned.gif alt=\"Warned\">" : "")." ($title) (Ratio: $ratio)\n");
} else
print("<a name=\"comm" . $row["id"] . "\"><i>(orphaned)</i></a>\n");
print(" at " . $row["added"] . " GMT" .($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? "- [<a href=reqcomment.php?action=edit&cid=$row[id]>Edit</a>]" : "") .(get_user_class() >= UC_MODERATOR ? "- [<a href=reqcomment.php?action=delete&cid=$row[id]>Delete</a>]" : "") . "</p>\n");$avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : "");
if (!$avatar)
$avatar = "/pic/default_avatar.gif";
$text = format_comment($row["text"]);
begin_table(true);
print("<tr valign=top>\n");
print("<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n");
print("<td class=text>$text</td>\n");
print("</tr>\n");
end_table();
}
end_frame();
end_main_frame();
}
示例15: maketable
function maketable($res)
{
global $CURUSER;
$ret = "<table class=main border=1 cellspacing=0 cellpadding=5>" . "<tr><td class=colhead align=center>Type</td><td class=colhead>Name</td><td class=colhead align=center>Size</td><td class=colhead align=right>Se.</td><td class=colhead align=right>Le.</td><td class=colhead align=center>Upl.</td>\n" . "<td class=colhead align=center>Downl.</td><td class=colhead align=center>Ratio</td></tr>\n";
while ($arr = mysql_fetch_assoc($res)) {
$ratio = $CURUSER['downloaded'] > 0 ? $CURUSER['uploaded'] / $CURUSER['downloaded'] : 0;
$ratio = number_format($ratio, 3);
$color = get_ratio_color($ratio);
if ($color) {
$ratio = "<font color={$color}>{$ratio}</font>";
}
$catimage = safeChar($arr["image"]);
$catname = safeChar($arr["catname"]);
$size = str_replace(" ", "<br>", prefixed($arr["size"]));
$uploaded = str_replace(" ", "<br>", prefixed($arr["uploaded"]));
$downloaded = str_replace(" ", "<br>", prefixed($arr["downloaded"]));
$seeders = number_format($arr["seeders"]);
$leechers = number_format($arr["leechers"]);
$ret .= "<tr><td style='padding: 0px'><img src=\"pic/{$catimage}\" alt=\"{$catname}\" width=42 height=42></td>\n" . "<td><a href=details.php?id={$arr['torrent']}&hit=1><b>" . safeChar($arr["torrentname"]) . "</b></a></td><td align=center>{$size}</td><td align=right>{$seeders}</td><td align=right>{$leechers}</td><td align=center>{$uploaded}</td>\n" . "<td align=center>{$downloaded}</td><td align=center>{$ratio}</td></tr>\n";
}
$ret .= "</table>\n";
return $ret;
}