mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
paid torent max_price&enabled configurable
This commit is contained in:
@@ -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' => '全部',
|
||||
);
|
||||
|
||||
|
||||
@@ -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' => '启用后,有权限的用户可以在发种时设置向下载种子的用户收取一定的魔力,默认:否',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -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' => '全部',
|
||||
|
||||
@@ -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' => '啟用後,有權限的用戶可以在發種時設置向下載種子的用戶收取一定的魔力,默認:否',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -75,8 +75,13 @@ else {
|
||||
"<input id=\"nfoupdate\" type=\"radio\" name=\"nfoaction\" value=\"update\" />".$lang_edit['radio_update']."</font><br /><input type=\"file\" name=\"nfo\" onchange=\"document.getElementById('nfoupdate').checked=true\" />", 1);
|
||||
|
||||
//price
|
||||
if (user_can('torrent-set-price')) {
|
||||
tr(nexus_trans('label.torrent.price'), '<input type="number" min="0" name="price" value="'.$row['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'), '<input type="number" min="0" name="price" value="'.$row['price'].'" placeholder="'.$pricePlaceholder.'" /> ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1);
|
||||
}
|
||||
|
||||
print("<tr><td class=\"rowhead\">".$lang_edit['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
|
||||
|
||||
@@ -340,6 +340,7 @@ if (get_setting('main.spsct') == 'yes') {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php if(get_setting("torrent.paid_torrent_enabled") == "yes"){?>
|
||||
<tr>
|
||||
<td class="rowhead"><?php echo $lang_getrss['row_paid']?>
|
||||
</td>
|
||||
@@ -347,8 +348,10 @@ if (get_setting('main.spsct') == 'yes') {
|
||||
<label><input type="radio" name="paid" value="0" checked><?php echo $lang_getrss['paid_no']?></label>
|
||||
<label><input type="radio" name="paid" value="1"><?php echo $lang_getrss['paid_yes']?></label>
|
||||
<label><input type="radio" name="paid" value="2"><?php echo $lang_getrss['paid_all']?></label>
|
||||
<div><?php echo $lang_getrss['row_paid_help'] ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<td class="rowhead"><?php echo $lang_getrss['row_item_title_type']?>
|
||||
</td>
|
||||
<td class="rowfollow" align="left">
|
||||
|
||||
@@ -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'],"<input type='text' name=tax_factor style=\"width: 100px\" value={$TORRENT['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'],"<input type='number' name=tax_factor style=\"width: 100px\" value={$TORRENT['tax_factor']}> ".$lang_settings['text_tax_factor_note'], 1);
|
||||
tr($lang_settings['row_max_price'],"<input type='number' name=max_price style=\"width: 100px\" value={$TORRENT['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']."<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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -74,8 +74,13 @@ stdhead($lang_upload['head_upload']);
|
||||
tr($lang_upload['row_nfo_file'], "<input type=\"file\" class=\"file\" name=\"nfo\" /><br /><font class=\"medium\">".$lang_upload['text_only_viewed_by'].get_user_class_name($viewnfo_class,false,true,true).$lang_upload['text_or_above']."</font>", 1);
|
||||
}
|
||||
//price
|
||||
if (user_can('torrent-set-price')) {
|
||||
tr(nexus_trans('label.torrent.price'), '<input type="number" min="0" name="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'), '<input type="number" min="0" name="price" placeholder="'.$pricePlaceholder.'" /> ' . nexus_trans('label.torrent.price_help', ['tax_factor' => (floatval(get_setting('torrent.tax_factor', 0)) * 100) . '%']), 1);
|
||||
}
|
||||
|
||||
print("<tr><td class=\"rowhead\" style='padding: 3px' valign=\"top\">".$lang_upload['row_description']."<font color=\"red\">*</font></td><td class=\"rowfollow\">");
|
||||
|
||||
@@ -186,6 +186,7 @@ return [
|
||||
'size_end' => '体积小于',
|
||||
'price' => '价格',
|
||||
'price_help' => '用户下载种子时,发布者将获得收入,但要扣除相应税率,当前税率::tax_factor',
|
||||
'max_price_help' => '允许最大值::max_price',
|
||||
],
|
||||
'hit_and_run' => [
|
||||
'label' => '用户 H&R',
|
||||
|
||||
Reference in New Issue
Block a user