mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
[H&R] basically
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.0-beta10');
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.0-beta12');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-06-15');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
|
||||
@@ -2477,7 +2477,8 @@ else {
|
||||
[<a href="torrents.php?inclbookmarked=1&allsec=1&incldead=0"><?php echo $lang_functions['text_bookmarks'] ?></a>]
|
||||
<font class = 'color_bonus'><?php echo $lang_functions['text_bonus'] ?></font>[<a href="mybonus.php"><?php echo $lang_functions['text_use'] ?></a>]: <?php echo number_format($CURUSER['seedbonus'], 1)?>
|
||||
<?php if($attendance){ printf(' '.$lang_functions['text_attended'], $attendance['points']); }else{ printf(' <a href="attendance.php" class="faqlink">%s</a>', $lang_functions['text_attendance']);}?>
|
||||
<font class = 'color_invite'><?php echo $lang_functions['text_invite'] ?></font>[<a href="invite.php?id=<?php echo $CURUSER['id']?>"><?php echo $lang_functions['text_send'] ?></a>]: <?php echo $CURUSER['invites']?><br />
|
||||
<font class = 'color_invite'><?php echo $lang_functions['text_invite'] ?></font>[<a href="invite.php?id=<?php echo $CURUSER['id']?>"><?php echo $lang_functions['text_send'] ?></a>]: <?php echo $CURUSER['invites']?>
|
||||
<?php if(get_setting('hr.mode') != \App\Models\HitAndRun::MODE_DISABLED) { ?><font class='color_bonus'>H&R: </font> <?php echo sprintf('[<a href="myhr.php">%s/%s</a>]', get_row_count('hit_and_runs', "where uid = {$CURUSER['id']} and status = 3"), get_setting('hr.ban_user_when_counts_reach'))?><?php }?><br />
|
||||
<font class="color_ratio"><?php echo $lang_functions['text_ratio'] ?></font> <?php echo $ratio?>
|
||||
<font class='color_uploaded'><?php echo $lang_functions['text_uploaded'] ?></font> <?php echo mksize($CURUSER['uploaded'])?>
|
||||
<font class='color_downloaded'> <?php echo $lang_functions['text_downloaded'] ?></font> <?php echo mksize($CURUSER['downloaded'])?>
|
||||
@@ -2528,12 +2529,6 @@ else {
|
||||
}
|
||||
if ($msgalert)
|
||||
{
|
||||
function msgalert($url, $text, $bgcolor = "red")
|
||||
{
|
||||
print("<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"10\"><tr><td style='border: none; padding: 10px; background: ".$bgcolor."'>\n");
|
||||
print("<b><a href=\"".$url."\"><font color=\"white\">".$text."</font></a></b>");
|
||||
print("</td></tr></table></p><br />");
|
||||
}
|
||||
if($CURUSER['leechwarn'] == 'yes')
|
||||
{
|
||||
$kicktimeout = gettime($CURUSER['leechwarnuntil'], false, false, true);
|
||||
@@ -2909,7 +2904,7 @@ function pager($rpp, $count, $href, $opts = array(), $pagename = "page") {
|
||||
|
||||
$start = $page * $rpp;
|
||||
$add_key_shortcut = key_shortcut($page,$pages-1);
|
||||
return array($pagertop, $pagerbottom, "LIMIT $start,$rpp");
|
||||
return array($pagertop, $pagerbottom, "LIMIT $start,$rpp", $start, $rpp);
|
||||
}
|
||||
|
||||
function commenttable($rows, $type, $parent_id, $review = false)
|
||||
@@ -3247,7 +3242,9 @@ foreach ($rows as $row)
|
||||
$stickyicon = "";
|
||||
}
|
||||
$sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']);
|
||||
print("<td class=\"rowfollow\" width=\"100%\" align=\"left\"><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . "><td class=\"embedded\">".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&hit=1\"><b>".htmlspecialchars($dispname)."</b></a>" . $sp_torrent);
|
||||
$hrImg = get_hr_img($row);
|
||||
|
||||
print("<td class=\"rowfollow\" width=\"100%\" align=\"left\"><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . "><td class=\"embedded\">".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&hit=1\"><b>".htmlspecialchars($dispname)."</b></a>" . $sp_torrent . $hrImg);
|
||||
$picked_torrent = "";
|
||||
if ($CURUSER['appendpicked'] != 'no'){
|
||||
if($row['picktype']=="hot")
|
||||
@@ -4116,6 +4113,17 @@ function get_torrent_promotion_append($promotion = 1,$forcemode = "",$showtimele
|
||||
return $sp_torrent;
|
||||
}
|
||||
|
||||
function get_hr_img(array $torrent)
|
||||
{
|
||||
$mode = get_setting('hr.mode');
|
||||
$result = '';
|
||||
if ($mode == \App\Models\HitAndRun::MODE_GLOBAL || ($mode == \App\Models\HitAndRun::MODE_MANUAL && isset($torrent['hr']) && $torrent['hr'] == \App\Models\Torrent::HR_YES)) {
|
||||
$result = '<img class="hitandrun" src="pic/trans.gif" alt="H&R" title="H&R" />';
|
||||
}
|
||||
do_log("mode: $mode, result: $result");
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_user_id_from_name($username){
|
||||
global $lang_functions;
|
||||
$res = sql_query("SELECT id FROM users WHERE LOWER(username)=LOWER(" . sqlesc($username).")");
|
||||
@@ -5075,4 +5083,11 @@ function get_ip_location_from_geoip($ip)
|
||||
];
|
||||
}
|
||||
|
||||
function msgalert($url, $text, $bgcolor = "red")
|
||||
{
|
||||
print("<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"10\"><tr><td style='border: none; padding: 10px; background: ".$bgcolor."'>\n");
|
||||
print("<b><a href=\"".$url."\"><font color=\"white\">".$text."</font></a></b>");
|
||||
print("</td></tr></table></p><br />");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -656,3 +656,22 @@ function get_tracker_schema_and_host(): array
|
||||
do_log($log);
|
||||
return compact('ssl_torrent', 'base_announce_url');
|
||||
}
|
||||
|
||||
function get_hr_ratio($uped, $downed)
|
||||
{
|
||||
if ($downed > 0) {
|
||||
$ratio = $uped / $downed;
|
||||
$color = get_ratio_color($ratio);
|
||||
if ($ratio > 10000) $ratio = 'Inf.';
|
||||
else
|
||||
$ratio = number_format($ratio, 3);
|
||||
|
||||
if ($color)
|
||||
$ratio = "<font color=\"" . $color . "\">" . $ratio . "</font>";
|
||||
} elseif ($uped > 0)
|
||||
$ratio = 'Inf.';
|
||||
else
|
||||
$ratio = "---";
|
||||
|
||||
return $ratio;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user