diff --git a/lang/chs/lang_getrss.php b/lang/chs/lang_getrss.php index d030750f..a03a96f5 100644 --- a/lang/chs/lang_getrss.php +++ b/lang/chs/lang_getrss.php @@ -41,9 +41,10 @@ $lang_getrss = array 'text_mode' => "", 'text_keyword_note' => "只订阅标题中包含此关键字的项目", 'row_sticky' => '置顶', - 'row_paid' => '收费', - 'paid_no' => '免费', - 'paid_yes' => '收费', + 'row_paid' => '下载需扣除魔力', + 'row_paid_help' => '注意:此并非 Free/50% 之类的促销类型,当发种人设置种子收费时,下载是需要扣除相应魔力的', + 'paid_no' => '不需要', + 'paid_yes' => '需要', 'paid_all' => '全部', ); diff --git a/lang/chs/lang_settings.php b/lang/chs/lang_settings.php index b5afd556..cc7d6ae4 100644 --- a/lang/chs/lang_settings.php +++ b/lang/chs/lang_settings.php @@ -809,6 +809,10 @@ $lang_settings = array 'text_initial_tmp_invites_note' => "新注册用户的初始临时邀请名额,有效期 7 天。默认'0'。", 'row_tax_factor' => '收费种子收税系数', 'text_tax_factor_note' => '假如价格100, 此系数为 0.1,发布者实际收入为 100 - 100 x 0.1 = 90,注意不要大于 1 或小于 0。', + 'row_max_price' => '收费种子最高收费', + 'text_max_price_note' => '默认:1,000,000,设置为 0 无限制', + 'row_paid_torrent_enabled' => '是否启用收费种子', + 'text_paid_torrent_enabled_note' => '启用后,有权限的用户可以在发种时设置向下载种子的用户收取一定的魔力,默认:否', ); ?> diff --git a/lang/cht/lang_getrss.php b/lang/cht/lang_getrss.php index 0ce8ef76..090a6c35 100644 --- a/lang/cht/lang_getrss.php +++ b/lang/cht/lang_getrss.php @@ -42,7 +42,8 @@ $lang_getrss = array 'text_mode' => "", 'text_keyword_note' => "只訂閱標題中包含此關鍵字的項目", 'row_sticky' => '置頂', - 'row_paid' => '收費', + 'row_paid' => '下載需扣除魔力', + 'row_paid_help' => '註意:此並非 Free/50% 之類的促銷類型,當發種人設置種子收費時,下載是需要扣除相應魔力的', 'paid_no' => '免費', 'paid_yes' => '收費', 'paid_all' => '全部', diff --git a/lang/cht/lang_settings.php b/lang/cht/lang_settings.php index 5ff7624b..773a221c 100644 --- a/lang/cht/lang_settings.php +++ b/lang/cht/lang_settings.php @@ -809,6 +809,10 @@ $lang_settings = array 'text_initial_tmp_invites_note' => "新註冊用戶的初始臨時邀請名額,有效期 7 天。默認'0'。", 'row_tax_factor' => '收費種子收稅系數', 'text_tax_factor_note' => '假如價格100, 此系數為 0.1,發布者實際收入為 100 - 100 x 0.1 = 90,註意不要大於 1 或小於 0。', + 'row_max_price' => '收費種子最高收費', + 'text_max_price_note' => '默認:1,000,000,設置為 0 無限製', + 'row_paid_torrent_enabled' => '是否啟用收費種子', + 'text_paid_torrent_enabled_note' => '啟用後,有權限的用戶可以在發種時設置向下載種子的用戶收取一定的魔力,默認:否', ); ?> diff --git a/lang/en/lang_getrss.php b/lang/en/lang_getrss.php index 26b20289..6d02bc90 100644 --- a/lang/en/lang_getrss.php +++ b/lang/en/lang_getrss.php @@ -41,7 +41,8 @@ $lang_getrss = array 'text_mode' => "matching mode ", 'text_keyword_note' => "Ony subscribe to items with these keywords in titles.", 'row_sticky' => 'Sticky', - 'row_paid' => 'Paid', + 'row_paid' => 'Magic will be deducted for downloading', + 'row_paid_help' => 'Note: This is not a Free/50% type of promotion, when the uploader sets the torrent to be paid, the download will require deduct bonus', 'paid_no' => 'Free', 'paid_yes' => 'Paid', 'paid_all' => 'All', diff --git a/lang/en/lang_settings.php b/lang/en/lang_settings.php index 88a7a893..8013f389 100644 --- a/lang/en/lang_settings.php +++ b/lang/en/lang_settings.php @@ -809,6 +809,10 @@ $lang_settings = array 'text_initial_tmp_invites_note' => "How many temporary invites should each user be given upon registration? Default '0'.", 'row_tax_factor' => 'Tax factor for paid torrents', 'text_tax_factor_note' => 'If the price is 100, this factor is 0.1 and the actual revenue of the uploader is 100 - 100 x 0.1 = 90, note that it should not be greater than 1 or less than 0.', + 'row_max_price' => 'Maximum fee for paid torrents', + 'text_max_price_note' => 'default: 1,000,000, set to 0 no limit', + 'row_paid_torrent_enabled' => 'Whether to enable paid torrents', + 'text_paid_torrent_enabled_note' => 'When enabled, users with permission can set a certain amount of bonus to be charged to users who download the torrents when they are sent, default: no', ); ?> diff --git a/nexus/Install/settings.default.php b/nexus/Install/settings.default.php index ff49c364..68ebb746 100644 --- a/nexus/Install/settings.default.php +++ b/nexus/Install/settings.default.php @@ -358,6 +358,8 @@ return array ( 'approval_status_none_visible' => 'yes', 'nfo_view_style_default' => \App\Models\Torrent::NFO_VIEW_STYLE_DOS, 'tax_factor' => '0.3', + 'paid_torrent_enabled' => 'yes', + 'max_price' => 1000000, ), 'attachment' => array ( diff --git a/public/edit.php b/public/edit.php index f27f8385..4c34d53e 100644 --- a/public/edit.php +++ b/public/edit.php @@ -75,8 +75,13 @@ else { "".$lang_edit['radio_update']."
", 1); //price - if (user_can('torrent-set-price')) { - tr(nexus_trans('label.torrent.price'), '  ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1); + if (user_can('torrent-set-price') && get_setting("torrent.paid_torrent_enabled") == "yes") { + $maxPrice = get_setting("torrent.max_price"); + $pricePlaceholder = ""; + if ($maxPrice > 0) { + $pricePlaceholder = nexus_trans("label.torrent.max_price_help", ["max_price" => $maxPrice]); + } + tr(nexus_trans('label.torrent.price'), '  ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1); } print("".$lang_edit['row_description']."*"); diff --git a/public/getrss.php b/public/getrss.php index 3c15d7ae..e0ab69dd 100644 --- a/public/getrss.php +++ b/public/getrss.php @@ -340,6 +340,7 @@ if (get_setting('main.spsct') == 'yes') { + @@ -347,8 +348,10 @@ if (get_setting('main.spsct') == 'yes') { +
+ diff --git a/public/settings.php b/public/settings.php index 411f2f1a..d19abb17 100644 --- a/public/settings.php +++ b/public/settings.php @@ -158,7 +158,7 @@ elseif($action == 'savesettings_torrent') // save account 'thirtypercentleechbecome', 'expirethirtypercentleech', 'sticky_first_level_background_color', 'sticky_second_level_background_color', 'download_support_passkey', 'claim_enabled', 'claim_torrent_ttl', 'claim_torrent_user_counts_up_limit', 'claim_user_torrent_counts_up_limit', 'claim_remove_deduct_user_bonus', 'claim_give_up_deduct_user_bonus', 'claim_bonus_multiplier', 'claim_reach_standard_seed_time', 'claim_reach_standard_uploaded', 'approval_status_icon_enabled', 'approval_status_none_visible', - 'nfo_view_style_default', 'tax_factor', + 'nfo_view_style_default', 'tax_factor', 'max_price', 'paid_torrent_enabled' ); $validConfig = apply_filter('setting_valid_config', $validConfig); GetVar($validConfig); @@ -741,7 +741,9 @@ elseif ($action == 'torrentsettings') } tr($lang_settings['row_' . $name], $nfoViewStyleRadio, 1); - tr($lang_settings['row_tax_factor']," ".$lang_settings['text_tax_factor_note'], 1); + yesorno($lang_settings['row_paid_torrent_enabled'], 'paid_torrent_enabled', $TORRENT["paid_torrent_enabled"], $lang_settings['text_paid_torrent_enabled_note']); + tr($lang_settings['row_tax_factor']," ".$lang_settings['text_tax_factor_note'], 1); + tr($lang_settings['row_max_price']," ".$lang_settings['text_max_price_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); diff --git a/public/takeedit.php b/public/takeedit.php index afe90007..9ae0ba2c 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -13,6 +13,12 @@ if (!mkglobal("id:name:descr:type")){ global $lang_takeedit; bark($lang_takeedit['std_missing_form_data']); } +//check max price +$maxPrice = get_setting("torrent.max_price"); +$paidTorrentEnabled = get_setting("torrent.paid_torrent_enabled") == "yes"; +if ($maxPrice > 0 && $_POST['price'] > $maxPrice && $paidTorrentEnabled) { + bark('price too much'); +} $id = intval($id ?? 0); if (!$id) @@ -219,7 +225,7 @@ if (isset($_POST['hr'][$newcatmode]) && isset(\App\Models\Torrent::$hrStatus[$_P * price * @since 1.8.0 */ -if (user_can('torrent-set-price')) { +if (user_can('torrent-set-price') && $paidTorrentEnabled) { $updateset[] = "price = " . sqlesc($_POST['price'] ?? 0); } diff --git a/public/takeupload.php b/public/takeupload.php index e84216ad..74ac716a 100644 --- a/public/takeupload.php +++ b/public/takeupload.php @@ -98,6 +98,13 @@ bark("eek"); if (!filesize($tmpname)) bark($lang_takeupload['std_empty_file']); +//check max price +$maxPrice = get_setting("torrent.max_price"); +$paidTorrentEnabled = get_setting("torrent.paid_torrent_enabled") == "yes"; +if ($maxPrice > 0 && $_POST['price'] > $maxPrice && $paidTorrentEnabled) { + bark('price too much'); +} + try { $dict = \Rhilip\Bencode\Bencode::load($tmpname); } catch (\Rhilip\Bencode\ParseErrorException $e) { @@ -373,7 +380,7 @@ if(user_can('torrentmanage') && ($CURUSER['picker'] == 'yes' || get_user_class() if (user_can('torrent-approval-allow-automatic')) { $insert['approval_status'] = \App\Models\Torrent::APPROVAL_STATUS_ALLOW; } -if (user_can('torrent-set-price')) { +if (user_can('torrent-set-price') && $paidTorrentEnabled) { $insert['price'] = $_POST['price'] ?? 0; } do_log("[INSERT_TORRENT]: " . nexus_json_encode($insert)); diff --git a/public/upload.php b/public/upload.php index f3f047de..8f01e1b5 100644 --- a/public/upload.php +++ b/public/upload.php @@ -74,8 +74,13 @@ stdhead($lang_upload['head_upload']); tr($lang_upload['row_nfo_file'], "
".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."", 1); } //price - if (user_can('torrent-set-price')) { - tr(nexus_trans('label.torrent.price'), '  ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1); + if (user_can('torrent-set-price') && get_setting("torrent.paid_torrent_enabled") == "yes") { + $maxPrice = get_setting("torrent.max_price"); + $pricePlaceholder = ""; + if ($maxPrice > 0) { + $pricePlaceholder = nexus_trans("label.torrent.max_price_help", ["max_price" => $maxPrice]); + } + tr(nexus_trans('label.torrent.price'), '  ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1); } print("".$lang_upload['row_description']."*"); diff --git a/resources/lang/zh_CN/label.php b/resources/lang/zh_CN/label.php index 54ef71f4..b8f1e757 100644 --- a/resources/lang/zh_CN/label.php +++ b/resources/lang/zh_CN/label.php @@ -186,6 +186,7 @@ return [ 'size_end' => '体积小于', 'price' => '价格', 'price_help' => '用户下载种子时,发布者将获得收入,但要扣除相应税率,当前税率::tax_factor', + 'max_price_help' => '允许最大值::max_price', ], 'hit_and_run' => [ 'label' => '用户 H&R',