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

@@ -5,6 +5,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E
## Functional Features
- Upload torrent
- Special section
- Request torrent
- Subtitle
- Exam

View File

@@ -4,6 +4,7 @@
## 功能特性
- 发种
- 特别区
- 求种
- 字幕
- 考核
@@ -22,6 +23,7 @@
## 更多信息
博客:[https://nexusphp.org](http://nexusphp.org/)
论坛:[https://discuss.nexusphp.org](https://discuss.nexusphp.org/)
文档:[https://doc.nexusphp.org](http://doc.nexusphp.org/)
QQ群: [764452568](https://jq.qq.com/?_wv=1027&k=IbltZcIx)
![扫码加入](http://demo.nexusphp.org/attachments/202105/20210508190106ed3a3620fc34ab12660586652bc74e34.png)

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.
{

View File

@@ -706,6 +706,10 @@ $lang_settings = array
'text_login_secret_lifetime_deadline' => '当前密钥有效期至',
'row_enable_technical_info' => '启用技术信息',
'text_enable_technical_info' => "默认'否'。技术信息来自软件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 视图的结果",
'row_sticky_first_level_background_color' => '一级置顶背景颜色',
'text_sticky_first_level_background_color_note' => '一级置顶背景颜色,不设置则无背景色。',
'row_sticky_second_level_background_color' => '二级置顶背景颜色',
'text_sticky_second_level_background_color_note' => '二级置顶背景颜色,不设置则无背景色。',
);
?>

View File

@@ -706,6 +706,10 @@ $lang_settings = array
'text_login_secret_lifetime_deadline' => '當前密鑰有效期至',
'row_enable_technical_info' => '啟用技術信息',
'text_enable_technical_info' => "默認'否'。技術信息來自軟件 <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text 視圖的結果",
'row_sticky_first_level_background_color' => '一級置頂背景顏色',
'text_sticky_first_level_background_color_note' => '一級置頂背景顏色,不設置則無背景色。',
'row_sticky_second_level_background_color' => '二級置頂背景顏色',
'text_sticky_second_level_background_color_note' => '二級置頂背景顏色,不設置則無背景色。',
);
?>

View File

@@ -706,6 +706,10 @@ $lang_settings = array
'text_login_secret_lifetime_deadline' => 'Current login secret deadline',
'row_enable_technical_info' => 'Enable Technical Information',
'text_enable_technical_info' => "Default 'No'. Technical Information comes from software <b><a href=\"https://mediaarea.net/en/MediaInfo\" target='_blank'>MediaInfo</a></b> Text view",
'row_sticky_first_level_background_color' => 'Sticky first level bg color',
'text_sticky_first_level_background_color_note' => 'Sticky first level bg color, it will be none if not set.',
'row_sticky_second_level_background_color' => 'Sticky second level bg color',
'text_sticky_second_level_background_color_note' => 'Sticky second level bg color, it will be none if not set.',
);
?>

View File

@@ -1,10 +1,12 @@
<?php
return array (
'basic' =>
'basic' =>
array (
'SITENAME' => 'NexusPHP',
'BASEURL' => '',
'announce_url' => '',
),
'main' =>
'main' =>
array (
'site_online' => 'yes',
'max_torrent_size' => '1048576',
@@ -82,7 +84,7 @@
'enable_pt_gen_system' => 'no',
'enable_technical_info' => 'no',
),
'smtp' =>
'smtp' =>
array (
'smtptype' => 'advanced',
'emailnotify' => 'no',
@@ -94,7 +96,7 @@
'accountname' => '',
'accountpassword' => '',
),
'security' =>
'security' =>
array (
'securelogin' => 'no',
'securetracker' => 'no',
@@ -114,7 +116,7 @@
'login_secret_deadline' => '2021-02-03 18:55:46',
'login_secret' => '8e19c6a796602bda113fb2f5bc9da2b0',
),
'authority' =>
'authority' =>
array (
'defaultclass' => '1',
'staffmem' => '13',
@@ -163,7 +165,7 @@
'userbar' => '2',
'view_special_torrent' => '4',
),
'tweak' =>
'tweak' =>
array (
'where' => 'no',
'iplog1' => 'yes',
@@ -180,7 +182,7 @@
'prolinkimg' => 'pic/prolink.png',
'analyticscode' => '',
),
'bonus' =>
'bonus' =>
array (
'donortimes' => '2',
'perseeding' => '1',
@@ -214,7 +216,7 @@
'prolinkpoint' => '1',
'prolinktime' => '600',
),
'account' =>
'account' =>
array (
'neverdelete' => '6',
'neverdeletepacked' => '3',
@@ -265,7 +267,7 @@
'nmdl' => '3072',
'nmprratio' => '4.55',
'nmderatio' => '4.45',
'getInvitesByPromotion' =>
'getInvitesByPromotion' =>
array (
2 => '1',
3 => '0',
@@ -277,7 +279,7 @@
9 => '10',
),
),
'torrent' =>
'torrent' =>
array (
'prorules' => 'no',
'randomhalfleech' => '5',
@@ -307,8 +309,10 @@
'thirtypercentleechbecome' => '1',
'expirethirtypercentleech' => '0',
'minvotes' => '10',
'sticky_first_level_background_color' => '#89c9e6',
'sticky_second_level_background_color' => '#aadbf3',
),
'attachment' =>
'attachment' =>
array (
'enableattach' => 'yes',
'classone' => '1',
@@ -341,7 +345,7 @@
'altthumbwidth' => '180',
'altthumbheight' => '135',
),
'advertisement' =>
'advertisement' =>
array (
'enablead' => 'yes',
'enablenoad' => 'yes',
@@ -352,14 +356,14 @@
'bonusnoadtime' => '15',
'adclickbonus' => '0',
),
'code' =>
'code' =>
array (
'mainversion' => 'NexusPHP',
'subversion' => 'v1.6.0-beta6',
'releasedate' => '2021-05-08',
'website' => '<a href="https://nexusphp.org" target="_blank">https://nexusphp.org</a>',
),
'backup' =>
'backup' =>
array (
'enabled' => 'no',
'frequency' => 'daily',
@@ -370,4 +374,4 @@
'google_drive_refresh_token' => '',
'google_drive_folder_id' => '',
),
);
);

View File

@@ -108,7 +108,8 @@ $trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id']
$dict = bdec_file($fn, $max_torrent_size);
//$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]";
$dict['value']['announce']['value'] = getSchemeAndHttpHost() . "/announce.php?authkey=$trackerReportAuthKey";
$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey";
//$dict['value']['announce']['value'] = getSchemeAndHttpHost() . "/announce.php?authkey=$trackerReportAuthKey";
$dict['value']['announce']['string'] = strlen($dict['value']['announce']['value']).":".$dict['value']['announce']['value'];
$dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']);
/*if ($announce_urls[1] != "") // add multi-tracker

View File

@@ -62,7 +62,7 @@ elseif ($action == 'savesettings_basic') // save basic
{
stdhead($lang_settings['head_save_basic_settings']);
$validConfig = array(
'SITENAME',
'SITENAME', 'BASEURL', 'announce_url'
);
GetVar($validConfig);
$BASIC = [];
@@ -128,7 +128,12 @@ elseif ($action == 'savesettings_account') // save account
elseif($action == 'savesettings_torrent') // save account
{
stdhead($lang_settings['head_save_torrent_settings']);
$validConfig = array('prorules', 'randomhalfleech','randomfree','randomtwoup','randomtwoupfree','randomtwouphalfdown','largesize', 'largepro','expirehalfleech','expirefree','expiretwoup','expiretwoupfree','expiretwouphalfleech', 'expirenormal','hotdays','hotseeder','halfleechbecome','freebecome','twoupbecome','twoupfreebecome', 'twouphalfleechbecome','normalbecome','uploaderdouble','deldeadtorrent', 'randomthirtypercentdown', 'thirtypercentleechbecome', 'expirethirtypercentleech');
$validConfig = array(
'prorules', 'randomhalfleech','randomfree','randomtwoup','randomtwoupfree','randomtwouphalfdown','largesize', 'largepro','expirehalfleech',
'expirefree','expiretwoup','expiretwoupfree','expiretwouphalfleech', 'expirenormal','hotdays','hotseeder','halfleechbecome','freebecome',
'twoupbecome','twoupfreebecome', 'twouphalfleechbecome','normalbecome','uploaderdouble','deldeadtorrent', 'randomthirtypercentdown',
'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color'
);
GetVar($validConfig);
$TORRENT = [];
foreach($validConfig as $config) {
@@ -423,8 +428,8 @@ elseif ($action == 'basicsettings') // basic settings
$config = get_setting('basic');
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_basic'>");
tr($lang_settings['row_site_name'],"<input type='text' style=\"width: 300px\" name=SITENAME value='".($config["SITENAME"] ? $config["SITENAME"]: "Nexus")."'> ".$lang_settings['text_site_name_note'], 1);
// tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["BASEURL"] : $_SERVER["HTTP_HOST"])."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1);
// tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"]."/announce.php")."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
tr($lang_settings['row_base_url'],"<input type='text' style=\"width: 300px\" name=BASEURL value='".($config["BASEURL"] ? $config["BASEURL"] : $_SERVER["HTTP_HOST"])."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1);
tr($lang_settings['row_announce_url'],"<input type='text' style=\"width: 300px\" name=announce_url value='".($config["announce_url"] ? $config["announce_url"] : $_SERVER["HTTP_HOST"]."/announce.php")."'> ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1);
// tr($lang_settings['row_mysql_host'],"<input type='text' style=\"width: 300px\" name=mysql_host value='".($config["mysql_host"] ? $config["mysql_host"] : "localhost")."'> ".$lang_settings['text_mysql_host_note'], 1);
// tr($lang_settings['row_mysql_user'],"<input type='text' style=\"width: 300px\" name=mysql_user value='".($config["mysql_user"] ? $config["mysql_user"] : "root")."'> ".$lang_settings['text_mysql_user_note'], 1);
// tr($lang_settings['row_mysql_password'],"<input type='password' style=\"width: 300px\" name=mysql_pass value=''> ".$lang_settings['text_mysql_password_note'], 1);
@@ -588,6 +593,8 @@ elseif ($action == 'torrentsettings')
print ($notice);
print ("<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='savesettings_torrent'>");
tr($lang_settings['row_sticky_first_level_background_color'],"<input type='text' name=sticky_first_level_background_color style=\"width: 100px\" value={$TORRENT['sticky_first_level_background_color']}> ".$lang_settings['text_sticky_first_level_background_color_note'], 1);
tr($lang_settings['row_sticky_second_level_background_color'],"<input type='text' name=sticky_second_level_background_color style=\"width: 100px\" value={$TORRENT['sticky_second_level_background_color']}> ".$lang_settings['text_sticky_second_level_background_color_note'], 1);
yesorno($lang_settings['row_promotion_rules'], 'prorules', $TORRENT["prorules"], $lang_settings['text_promotion_rules_note']);
tr($lang_settings['row_random_promotion'], $lang_settings['text_random_promotion_note_one']."<ul><li><input type='text' style=\"width: 50px\" name=randomhalfleech value='".(isset($TORRENT["randomhalfleech"]) ? $TORRENT["randomhalfleech"] : 5 )."'>".$lang_settings['text_halfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomfree value='".(isset($TORRENT["randomfree"]) ? $TORRENT["randomfree"] : 2 )."'>".$lang_settings['text_free_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoup value='".(isset($TORRENT["randomtwoup"]) ? $TORRENT["randomtwoup"] : 2 )."'>".$lang_settings['text_twoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwoupfree value='".(isset($TORRENT["randomtwoupfree"]) ? $TORRENT["randomtwoupfree"] : 1 )."'>".$lang_settings['text_freetwoup_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomtwouphalfdown value='".(isset($TORRENT["randomtwouphalfdown"]) ? $TORRENT["randomtwouphalfdown"] : 0 )."'>".$lang_settings['text_twouphalfleech_chance_becoming']."</li><li><input type='text' style=\"width: 50px\" name=randomthirtypercentdown value='".(isset($TORRENT["randomthirtypercentdown"]) ? $TORRENT["randomthirtypercentdown"] : 0 )."'>".$lang_settings['text_thirtypercentleech_chance_becoming']."</li></ul>".$lang_settings['text_random_promotion_note_two'], 1);
tr($lang_settings['row_large_torrent_promotion'], $lang_settings['text_torrent_larger_than']."<input type='text' style=\"width: 50px\" name=largesize value='".(isset($TORRENT["largesize"]) ? $TORRENT["largesize"] : 20 )."'>".$lang_settings['text_gb_promoted_to']."<select name=largepro>".promotion_selection((isset($TORRENT['largepro']) ? $TORRENT['largepro'] : 2), 1)."</select>".$lang_settings['text_by_system_upon_uploading']."<br />".$lang_settings['text_large_torrent_promotion_note'], 1);
@@ -724,7 +731,7 @@ elseif ($action == 'showmenu') // settings main page
tr($lang_settings['row_torrents_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='torrentsettings'><input type='submit' value=\"".$lang_settings['submit_torrents_settings']."\"> ".$lang_settings['text_torrents_settings_note']."</form>", 1);
tr($lang_settings['row_attachment_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='attachmentsettings'><input type='submit' value=\"".$lang_settings['submit_attachment_settings']."\"> ".$lang_settings['text_attachment_settings_note']."</form>", 1);
tr($lang_settings['row_advertisement_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='advertisementsettings'><input type='submit' value=\"".$lang_settings['submit_advertisement_settings']."\"> ".$lang_settings['text_advertisement_settings_note']."</form>", 1);
tr($lang_settings['row_code_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='codesettings'><input type='submit' value=\"".$lang_settings['submit_code_settings']."\"> ".$lang_settings['text_code_settings_note']."</form>", 1);
// tr($lang_settings['row_code_settings'], "<form method='post' action='".$_SERVER["SCRIPT_NAME"]."'><input type='hidden' name='action' value='codesettings'><input type='submit' value=\"".$lang_settings['submit_code_settings']."\"> ".$lang_settings['text_code_settings_note']."</form>", 1);
}
print("</table>");
stdfoot();

View File

@@ -137,7 +137,9 @@ function dict_get($d, $k, $t) {
return $v["value"];
}
list($ann, $info) = dict_check($dict, "announce(string):info");
//list($ann, $info) = dict_check($dict, "announce(string):info");
//@see https://blog.rhilip.info/archives/1036/
list($info) = dict_check($dict, "info");
list($dname, $plen, $pieces) = dict_check($info, "name(string):piece length(integer):pieces(string)");
/*