diff --git a/README-EN.md b/README-EN.md index bc3d43a3..b24b4139 100644 --- a/README-EN.md +++ b/README-EN.md @@ -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 diff --git a/README.md b/README.md index 9675c19f..821ec261 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/include/config.php b/include/config.php index 883a5180..6fbb8e38 100644 --- a/include/config.php +++ b/include/config.php @@ -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']; diff --git a/include/constants.php b/include/constants.php index 487b21b0..698f5dd7 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ \n"); print(""); @@ -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 = ''){ diff --git a/include/functions_announce.php b/include/functions_announce.php index 959004ec..724f4324 100644 --- a/include/functions_announce.php +++ b/include/functions_announce.php @@ -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. { diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index 8cf9aeba..e3d8d1c8 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -706,6 +706,10 @@ $lang_settings = array 'text_login_secret_lifetime_deadline' => '当前密钥有效期至', 'row_enable_technical_info' => '启用技术信息', 'text_enable_technical_info' => "默认'否'。技术信息来自软件 MediaInfo 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' => '二级置顶背景颜色,不设置则无背景色。', ); ?> diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index 2f1ca9ff..da15421f 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -706,6 +706,10 @@ $lang_settings = array 'text_login_secret_lifetime_deadline' => '當前密鑰有效期至', 'row_enable_technical_info' => '啟用技術信息', 'text_enable_technical_info' => "默認'否'。技術信息來自軟件 MediaInfo 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' => '二級置頂背景顏色,不設置則無背景色。', ); ?> diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index f444b5cc..831ac6f6 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -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 MediaInfo 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.', ); ?> diff --git a/nexus/Install/settings.default.php b/nexus/Install/settings.default.php index 48bb2a95..dd4aaa07 100644 --- a/nexus/Install/settings.default.php +++ b/nexus/Install/settings.default.php @@ -1,10 +1,12 @@ + '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' => 'https://nexusphp.org', ), - 'backup' => + 'backup' => array ( 'enabled' => 'no', 'frequency' => 'daily', @@ -370,4 +374,4 @@ 'google_drive_refresh_token' => '', 'google_drive_folder_id' => '', ), -); \ No newline at end of file +); diff --git a/public/download.php b/public/download.php index 6856d111..5bb24cda 100644 --- a/public/download.php +++ b/public/download.php @@ -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 diff --git a/public/settings.php b/public/settings.php index 7c53a4b4..316a8361 100644 --- a/public/settings.php +++ b/public/settings.php @@ -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 ("
"); tr($lang_settings['row_site_name']," ".$lang_settings['text_site_name_note'], 1); -// tr($lang_settings['row_base_url']," ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1); -// tr($lang_settings['row_announce_url']," ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1); + tr($lang_settings['row_base_url']," ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"] . $lang_settings['text_base_url_note'], 1); + tr($lang_settings['row_announce_url']," ".$lang_settings['text_it_should_be'] . $_SERVER["HTTP_HOST"]."/announce.php", 1); // tr($lang_settings['row_mysql_host']," ".$lang_settings['text_mysql_host_note'], 1); // tr($lang_settings['row_mysql_user']," ".$lang_settings['text_mysql_user_note'], 1); // tr($lang_settings['row_mysql_password']," ".$lang_settings['text_mysql_password_note'], 1); @@ -588,6 +593,8 @@ elseif ($action == 'torrentsettings') print ($notice); print (""); + tr($lang_settings['row_sticky_first_level_background_color']," ".$lang_settings['text_sticky_first_level_background_color_note'], 1); + tr($lang_settings['row_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']."".$lang_settings['text_random_promotion_note_two'], 1); tr($lang_settings['row_large_torrent_promotion'], $lang_settings['text_torrent_larger_than']."".$lang_settings['text_gb_promoted_to']."".$lang_settings['text_by_system_upon_uploading']."
".$lang_settings['text_large_torrent_promotion_note'], 1); @@ -724,7 +731,7 @@ elseif ($action == 'showmenu') // settings main page tr($lang_settings['row_torrents_settings'], " ".$lang_settings['text_torrents_settings_note']."
", 1); tr($lang_settings['row_attachment_settings'], "
".$lang_settings['text_attachment_settings_note']."
", 1); tr($lang_settings['row_advertisement_settings'], "
".$lang_settings['text_advertisement_settings_note']."
", 1); - tr($lang_settings['row_code_settings'], "
".$lang_settings['text_code_settings_note']."
", 1); +// tr($lang_settings['row_code_settings'], "
".$lang_settings['text_code_settings_note']."
", 1); } print(""); stdfoot(); diff --git a/public/takeupload.php b/public/takeupload.php index 17deed73..3d91f28a 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -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)"); /*