sticky background color

This commit is contained in:
xiaomlove
2021-06-05 15:50:23 +08:00
parent 34a6c2e1f4
commit 2ce9f5105f
13 changed files with 68 additions and 37 deletions

View File

@@ -68,11 +68,9 @@ foreach ($settings as $name => $value) {
}
$SITENAME = $BASIC['SITENAME'];
//$BASEURL = $BASIC['BASEURL'];
$BASEURL = $_SERVER['HTTP_HOST'] ?? '';
$BASEURL = $BASIC['BASEURL'] ?: ($_SERVER['HTTP_HOST'] ?? '');
$announce_urls = array();
//$announce_urls[] = $BASIC['announce_url'];
$announce_urls[] = $BASEURL . '/announce.php';
$announce_urls[] = $BASIC['announce_url'] ?: ($BASEURL . '/announce.php');
$SITE_ONLINE = $MAIN['site_online'];
$max_torrent_size = $MAIN['max_torrent_size'];

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.6.0-beta8');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-05-15');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2020-06-05');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -3159,7 +3159,7 @@ else $displaysmalldescr = true;
foreach ($rows as $row)
{
$id = $row["id"];
$sphighlight = get_torrent_bg_color($row['sp_state']);
$sphighlight = get_torrent_bg_color($row['sp_state'], $row['pos_state']);
print("<tr" . $sphighlight . ">\n");
print("<td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>");
@@ -3889,10 +3889,10 @@ function get_second_icon($row, $catimgurl) //for CHDBits
}
}
function get_torrent_bg_color($promotion = 1)
function get_torrent_bg_color($promotion = 1, $posState = "")
{
global $CURUSER;
$sphighlight = null;
if ($CURUSER['appendpromotion'] == 'highlight'){
$global_promotion_state = get_global_sp_state();
if ($global_promotion_state == 1){
@@ -3910,7 +3910,6 @@ function get_torrent_bg_color($promotion = 1)
$sphighlight = " class='twouphalfdown_bg'";
elseif($promotion==7)
$sphighlight = " class='thirtypercentdown_bg'";
else $sphighlight = "";
}
elseif($global_promotion_state == 2)
$sphighlight = " class='free_bg'";
@@ -3924,11 +3923,16 @@ function get_torrent_bg_color($promotion = 1)
$sphighlight = " class='twouphalfdown_bg'";
elseif($global_promotion_state == 7)
$sphighlight = " class='thirtypercentdown_bg'";
else
$sphighlight = "";
}
else $sphighlight = "";
return $sphighlight;
if (is_null($sphighlight)) {
$torrentSettings = get_setting('torrent');
if ($posState == \App\Models\Torrent::POS_STATE_STICKY_ONE && !empty($torrentSettings['sticky_first_level_background_color'])) {
$sphighlight = sprintf(' style="background-color: %s"', $torrentSettings['sticky_first_level_background_color']);
} elseif ($posState == \App\Models\Torrent::POS_STATE_STICKY_SECOND && !empty($torrentSettings['sticky_second_level_background_color'])) {
$sphighlight = sprintf(' style="background-color: %s"', $torrentSettings['sticky_second_level_background_color']);
}
}
return (string)$sphighlight;
}
function get_torrent_promotion_append($promotion = 1,$forcemode = "",$showtimeleft = false, $added = "", $promotionTimeType = 0, $promotionUntil = ''){

View File

@@ -54,7 +54,7 @@ function benc_resp_raw($x) {
if (isset($_SERVER["HTTP_ACCEPT_ENCODING"]) && $_SERVER["HTTP_ACCEPT_ENCODING"] == "gzip" && function_exists('gzencode')) {
header("Content-Encoding: gzip");
echo gzencode($x, 9, FORCE_GZIP);
}
}
else
echo $x;
}
@@ -69,7 +69,7 @@ function check_cheater($userid, $torrentid, $uploaded, $downloaded, $anctime, $s
$time = date("Y-m-d H:i:s");
$upspeed = ($uploaded > 0 ? $uploaded / $anctime : 0);
$mustBeCheaterSpeed = 1024 * 1024 * 100; //100 MB/s
$mayBeCheaterSpeed = 1024 * 1024 * 25; //25 MB/s
$mayBeCheaterSpeed = 1024 * 1024 * 50; //50 MB/s
if ($uploaded > 1073741824 && $upspeed > ($mustBeCheaterSpeed/$cheaterdet_security)) //Uploaded more than 1 GB with uploading rate higher than 100 MByte/S (For Consertive level). This is no doubt cheating.
{