mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
self enable
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once("../include/bittorrent.php");
|
||||
dbconn();
|
||||
loggedinorreturn();
|
||||
parked();
|
||||
\Nexus\Nexus::css('#ban-info td {border: none}', 'header', false);
|
||||
|
||||
$title = nexus_trans('self-enable.title');
|
||||
stdhead($title);
|
||||
begin_main_frame();
|
||||
begin_frame($title, true,10,"100%","center");
|
||||
|
||||
|
||||
if ($CURUSER['enabled'] == 'yes') {
|
||||
printf('<h3>%s</h3>', nexus_trans('self-enable.enable_status_normal'));
|
||||
} else {
|
||||
$latestBanLog = \App\Models\UserBanLog::query()
|
||||
->where('uid', $CURUSER['id'])
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
if (!$latestBanLog) {
|
||||
printf('<h3>%s</h3>', nexus_trans('self-enable.no_ban_info'));
|
||||
} else {
|
||||
$unit = \App\Models\Setting::getSelfEnableBonus();
|
||||
$elapsedDay = ceil((time() - $latestBanLog->created_at->getTimestamp()) / 86400);
|
||||
$total = $unit * $elapsedDay;
|
||||
$isUserBonusEnough = $CURUSER['seedbonus'] >= $total;
|
||||
$userBonusNotEnoughTip = nexus_trans('self-enable.bonus_not_enough', ['bonus' => $CURUSER['seedbonus']]);
|
||||
if (!empty($_POST['submit'])) {
|
||||
if (!$isUserBonusEnough) {
|
||||
stdmsg('Error', $userBonusNotEnoughTip);
|
||||
} else {
|
||||
$userRep = new \App\Repositories\UserRepository();
|
||||
$bonusRep = new \App\Repositories\BonusRepository();
|
||||
$operator = \App\Models\User::query()->find($CURUSER['id']);
|
||||
$bonusRep->consumeUserBonus($CURUSER['id'], $total, \App\Models\BonusLogs::BUSINESS_TYPE_SELF_ENABLE, $title);
|
||||
$userRep->enableUser($operator, $CURUSER['id'], $title);
|
||||
nexus_redirect('index.php');
|
||||
}
|
||||
} else {
|
||||
printf('<h3>%s</h3>', nexus_trans('self-enable.latest_ban_info'));
|
||||
printf('<table id="ban-info" border="1" cellpadding="5" cellspacing="0"><tbody>');
|
||||
printf('<tr><th>UID:</th><td>%s</td></tr>', $latestBanLog->uid);
|
||||
printf('<tr><th>Username:</th><td>%s</td></tr>', $latestBanLog->username);
|
||||
printf('<tr><th>Reason:</th><td>%s</td></tr>', $latestBanLog->reason);
|
||||
printf('<tr><th>CreatedAt:</th><td>%s</td></tr>', $latestBanLog->created_at);
|
||||
printf('</tbody></table>');
|
||||
printf('<p>%s</p>', nexus_trans('self-enable.deduct_bonus_per_day', ['unit' => number_format($unit)]));
|
||||
printf('<p>%s</p>', nexus_trans('self-enable.deduct_bonus_total', ['days' => number_format($elapsedDay), 'total' => number_format($total)]));
|
||||
if ($isUserBonusEnough) {
|
||||
printf('<p>%s</p>', nexus_trans('self-enable.enable_desc'));
|
||||
printf('<form method="post"><input type="hidden" name="submit" value="1"><input type="submit" value="%s"></form>', nexus_trans('self-enable.enable_button'));
|
||||
} else {
|
||||
printf('<p>%s</p>', $userBonusNotEnoughTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end_frame();
|
||||
end_main_frame();
|
||||
stdfoot();
|
||||
?>
|
||||
+2
-1
@@ -99,7 +99,7 @@ elseif ($action == 'savesettings_bonus') // save bonus
|
||||
'tengbupload', 'ratiolimit','dlamountlimit','oneinvite','customtitle','vipstatus','bonusgift', 'basictax', 'taxpercentage',
|
||||
'prolinkpoint', 'prolinktime', 'attendance_initial', 'attendance_step', 'attendance_max', 'cancel_hr', 'attendance_card',
|
||||
'harem_addition', 'hundredgbupload', 'tengbdownload', 'hundredgbdownload', 'official_addition', 'official_tag', 'zero_bonus_tag', 'zero_bonus_factor',
|
||||
'one_tmp_invite', 'rainbow_id', 'change_username_card', 'min_size'
|
||||
'one_tmp_invite', 'rainbow_id', 'change_username_card', 'min_size', 'self_enable'
|
||||
);
|
||||
GetVar($validConfig);
|
||||
$BONUS = [];
|
||||
@@ -630,6 +630,7 @@ elseif ($action == 'bonussettings'){
|
||||
tr($lang_settings['row_attendance_card'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=attendance_card value='".(isset($BONUS["attendance_card"]) ? $BONUS["attendance_card"] : \App\Models\BonusLogs::DEFAULT_BONUS_BUY_ATTENDANCE_CARD )."'>".$lang_settings['text_attendance_card_note'], 1);
|
||||
tr($lang_settings['row_buy_rainbow_id'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=rainbow_id value='".(isset($BONUS["rainbow_id"]) ? $BONUS["rainbow_id"] : \App\Models\BonusLogs::DEFAULT_BONUS_BUY_RAINBOW_ID )."'>".$lang_settings['text_buy_rainbow_id_note'], 1);
|
||||
tr($lang_settings['row_buy_change_username_card'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=change_username_card value='".(isset($BONUS["change_username_card"]) ? $BONUS["change_username_card"] : \App\Models\BonusLogs::DEFAULT_BONUS_BUY_CHANGE_USERNAME_CARD )."'>".$lang_settings['text_buy_change_username_card_note'], 1);
|
||||
tr($lang_settings['row_self_enable'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=self_enable value='".(isset($BONUS["self_enable"]) ? $BONUS["self_enable"] : \App\Models\BonusLogs::DEFAULT_BONUS_SELF_ENABLE )."'>".$lang_settings['text_self_enable_note'], 1);
|
||||
|
||||
|
||||
echo '<tr><td colspan="2" align="center"><b>' . $lang_settings['text_attendance_get_bonus'] . '</b></td></tr>';
|
||||
|
||||
@@ -36,8 +36,8 @@ if (!$row)
|
||||
failedlogins();
|
||||
if ($row['status'] == 'pending')
|
||||
failedlogins($lang_takelogin['std_user_account_unconfirmed']);
|
||||
if ($row["enabled"] == "no")
|
||||
bark($lang_takelogin['std_account_disabled']);
|
||||
//if ($row["enabled"] == "no")
|
||||
// bark($lang_takelogin['std_account_disabled']);
|
||||
|
||||
if (!empty($row['two_step_secret'])) {
|
||||
if (empty($_POST['two_step_code'])) {
|
||||
|
||||
Reference in New Issue
Block a user