mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
bonus can buy: tmp invite + rainbow ID + change username card
This commit is contained in:
@@ -11,6 +11,9 @@ class BonusLogs extends NexusModel
|
||||
|
||||
const DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN = 10000;
|
||||
const DEFAULT_BONUS_BUY_ATTENDANCE_CARD = 1000;
|
||||
const DEFAULT_BONUS_BUY_TEMPORARY_INVITE = 500;
|
||||
const DEFAULT_BONUS_BUY_RAINBOW_ID = 5000;
|
||||
const DEFAULT_BONUS_BUY_CHANGE_USERNAME_CARD = 100000;
|
||||
|
||||
const BUSINESS_TYPE_CANCEL_HIT_AND_RUN = 1;
|
||||
const BUSINESS_TYPE_BUY_MEDAL = 2;
|
||||
@@ -26,6 +29,9 @@ class BonusLogs extends NexusModel
|
||||
const BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO = 12;
|
||||
const BUSINESS_TYPE_LUCKY_DRAW = 13;
|
||||
const BUSINESS_TYPE_EXCHANGE_DOWNLOAD = 14;
|
||||
const BUSINESS_TYPE_BUY_TEMPORARY_INVITE = 15;
|
||||
const BUSINESS_TYPE_BUY_RAINBOW_ID = 16;
|
||||
const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17;
|
||||
|
||||
public static array $businessTypes = [
|
||||
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
|
||||
@@ -42,6 +48,9 @@ class BonusLogs extends NexusModel
|
||||
self::BUSINESS_TYPE_GIFT_TO_LOW_SHARE_RATIO => ['text' => 'Gift to low share ratio'],
|
||||
self::BUSINESS_TYPE_LUCKY_DRAW => ['text' => 'Lucky draw'],
|
||||
self::BUSINESS_TYPE_EXCHANGE_DOWNLOAD => ['text' => 'Exchange download'],
|
||||
self::BUSINESS_TYPE_BUY_TEMPORARY_INVITE => ['text' => 'Buy temporary invite'],
|
||||
self::BUSINESS_TYPE_BUY_RAINBOW_ID => ['text' => 'Buy rainbow ID'],
|
||||
self::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => ['text' => 'Buy change username card'],
|
||||
];
|
||||
|
||||
public static function getBonusForCancelHitAndRun()
|
||||
@@ -56,5 +65,23 @@ class BonusLogs extends NexusModel
|
||||
return $result ?? self::DEFAULT_BONUS_BUY_ATTENDANCE_CARD;
|
||||
}
|
||||
|
||||
public static function getBonusForBuyTemporaryInvite()
|
||||
{
|
||||
$result = Setting::get('bonus.one_tmp_invite');
|
||||
return $result ?? self::DEFAULT_BONUS_BUY_TEMPORARY_INVITE;
|
||||
}
|
||||
|
||||
public static function getBonusForBuyRainbowId()
|
||||
{
|
||||
$result = Setting::get('bonus.rainbow_id');
|
||||
return $result ?? self::DEFAULT_BONUS_BUY_RAINBOW_ID;
|
||||
}
|
||||
|
||||
public static function getBonusForBuyChangeUsernameCard()
|
||||
{
|
||||
$result = Setting::get('bonus.change_username_card');
|
||||
return $result ?? self::DEFAULT_BONUS_BUY_CHANGE_USERNAME_CARD;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ class Invite extends NexusModel
|
||||
const VALID_YES = 1;
|
||||
const VALID_NO = 0;
|
||||
|
||||
const TEMPORARY_INVITE_VALID_DAYS = 7;
|
||||
|
||||
protected $casts = [
|
||||
'expired_at' => 'datetime',
|
||||
];
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<?php
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Exceptions\NexusException;
|
||||
use App\Models\BonusLogs;
|
||||
use App\Models\HitAndRun;
|
||||
use App\Models\Invite;
|
||||
use App\Models\Medal;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Models\UserMedal;
|
||||
use App\Models\UserMeta;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Nexus\Database\NexusDB;
|
||||
@@ -95,6 +98,85 @@ class BonusRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function consumeToBuyTemporaryInvite($uid, $count = 1): bool
|
||||
{
|
||||
$user = User::query()->findOrFail($uid);
|
||||
$requireBonus = BonusLogs::getBonusForBuyTemporaryInvite();
|
||||
$toolRep = new ToolRepository();
|
||||
$hashArr = $toolRep->generateUniqueInviteHash([], $count, $count);
|
||||
NexusDB::transaction(function () use ($user, $requireBonus, $hashArr) {
|
||||
$comment = nexus_trans('bonus.comment_buy_temporary_invite', [
|
||||
'bonus' => $requireBonus,
|
||||
'count' => count($hashArr)
|
||||
], $user->locale);
|
||||
do_log("comment: $comment");
|
||||
$this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_TEMPORARY_INVITE, $comment);
|
||||
$invites = [];
|
||||
foreach ($hashArr as $hash) {
|
||||
$invites[] = [
|
||||
'inviter' => $user->id,
|
||||
'invitee' => '',
|
||||
'hash' => $hash,
|
||||
'valid' => 0,
|
||||
'expired_at' => Carbon::now()->addDays(Invite::TEMPORARY_INVITE_VALID_DAYS),
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
Invite::query()->insert($invites);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public function consumeToBuyRainbowId($uid, $duration = 30): bool
|
||||
{
|
||||
$user = User::query()->findOrFail($uid);
|
||||
$requireBonus = BonusLogs::getBonusForBuyRainbowId();
|
||||
NexusDB::transaction(function () use ($user, $requireBonus, $duration) {
|
||||
$comment = nexus_trans('bonus.comment_buy_rainbow_id', [
|
||||
'bonus' => $requireBonus,
|
||||
'duration' => $duration,
|
||||
], $user->locale);
|
||||
do_log("comment: $comment");
|
||||
$this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_RAINBOW_ID, $comment);
|
||||
$metaData = [
|
||||
'meta_key' => UserMeta::META_KEY_PERSONALIZED_USERNAME,
|
||||
'duration' => $duration,
|
||||
];
|
||||
$userRep = new UserRepository();
|
||||
$userRep->addMeta($user, $metaData, $metaData, false);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public function consumeToBuyChangeUsernameCard($uid): bool
|
||||
{
|
||||
$user = User::query()->findOrFail($uid);
|
||||
$requireBonus = BonusLogs::getBonusForBuyChangeUsernameCard();
|
||||
if (UserMeta::query()->where('uid', $uid)->where('meta_key', UserMeta::META_KEY_CHANGE_USERNAME)->exists()) {
|
||||
throw new NexusException("user already has change username card");
|
||||
}
|
||||
NexusDB::transaction(function () use ($user, $requireBonus) {
|
||||
$comment = nexus_trans('bonus.comment_buy_change_username_card', [
|
||||
'bonus' => $requireBonus,
|
||||
], $user->locale);
|
||||
do_log("comment: $comment");
|
||||
$this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD, $comment);
|
||||
$metaData = [
|
||||
'meta_key' => UserMeta::META_KEY_CHANGE_USERNAME,
|
||||
];
|
||||
$userRep = new UserRepository();
|
||||
$userRep->addMeta($user, $metaData, $metaData, false);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public function consumeUserBonus($user, $requireBonus, $logBusinessType, $logComment = '', array $userUpdates = [])
|
||||
{
|
||||
if (!isset(BonusLogs::$businessTypes[$logBusinessType])) {
|
||||
|
||||
@@ -466,7 +466,7 @@ class UserRepository extends BaseRepository
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addMeta($user, array $metaData, array $keyExistsUpdates = [])
|
||||
public function addMeta($user, array $metaData, array $keyExistsUpdates = [], $notify = true)
|
||||
{
|
||||
$user = $this->getUser($user);
|
||||
$locale = $user->locale;
|
||||
@@ -484,7 +484,9 @@ class UserRepository extends BaseRepository
|
||||
} else {
|
||||
$durationText = nexus_trans('label.permanent', [], $locale);
|
||||
}
|
||||
$message['msg'] = nexus_trans('user.grant_props_notification.body', ['name' => $metaName, 'operator' => Auth::user()->username, 'duration' => $durationText], $locale);
|
||||
$operatorId = get_user_id();
|
||||
$operatorInfo = get_user_row($operatorId);
|
||||
$message['msg'] = nexus_trans('user.grant_props_notification.body', ['name' => $metaName, 'operator' => $operatorInfo['username'], 'duration' => $durationText], $locale);
|
||||
if (!empty($metaData['duration'])) {
|
||||
$metaData['deadline'] = now()->addDays($metaData['duration']);
|
||||
}
|
||||
@@ -520,7 +522,9 @@ class UserRepository extends BaseRepository
|
||||
}
|
||||
if ($result) {
|
||||
clear_user_cache($user->id, $user->passkey);
|
||||
Message::query()->insert($message);
|
||||
if ($notify) {
|
||||
Message::add($message);
|
||||
}
|
||||
}
|
||||
do_log($log);
|
||||
return $result;
|
||||
@@ -570,7 +574,7 @@ class UserRepository extends BaseRepository
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addTemporaryInvite(User $operator, int $uid, string $action, int $count, int|null $days, string|null $reason = '')
|
||||
public function addTemporaryInvite(User|null $operator, int $uid, string $action, int $count, int|null $days, string|null $reason = '')
|
||||
{
|
||||
do_log("uid: $uid, action: $action, count: $count, days: $days, reason: $reason");
|
||||
$action = strtolower($action);
|
||||
@@ -578,7 +582,9 @@ class UserRepository extends BaseRepository
|
||||
throw new \InvalidArgumentException("days or count lte 0");
|
||||
}
|
||||
$targetUser = User::query()->findOrFail($uid, User::$commonFields);
|
||||
$this->checkPermission($operator, $targetUser);
|
||||
if ($operator) {
|
||||
$this->checkPermission($operator, $targetUser);
|
||||
}
|
||||
$toolRep = new ToolRepository();
|
||||
$locale = $targetUser->locale;
|
||||
|
||||
@@ -587,7 +593,7 @@ class UserRepository extends BaseRepository
|
||||
$body = nexus_trans('message.temporary_invite_change.body', [
|
||||
'change_type' => $changeType,
|
||||
'count' => $count,
|
||||
'operator' => $operator->username,
|
||||
'operator' => $operator->username ?? '',
|
||||
'reason' => $reason,
|
||||
], $locale);
|
||||
$message = [
|
||||
@@ -611,7 +617,7 @@ class UserRepository extends BaseRepository
|
||||
];
|
||||
}
|
||||
}
|
||||
NexusDB::transaction(function () use ($uid, $message, $inviteData, $count) {
|
||||
NexusDB::transaction(function () use ($uid, $message, $inviteData, $count, $operator) {
|
||||
if (!empty($inviteData)) {
|
||||
Invite::query()->insert($inviteData);
|
||||
do_log("[INSERT TEMPORARY INVITE] to $uid, count: $count");
|
||||
@@ -624,7 +630,9 @@ class UserRepository extends BaseRepository
|
||||
;
|
||||
do_log("[DELETE TEMPORARY INVITE] of $uid, count: $count");
|
||||
}
|
||||
Message::add($message);
|
||||
if ($operator) {
|
||||
Message::add($message);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-04');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-05');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -156,6 +156,16 @@ $lang_mybonus = array
|
||||
'col_count' => '数量',
|
||||
'col_size' => '体积',
|
||||
'col_a' => 'A 值',
|
||||
'text_buy_tmp_invite' => '1个临时邀请名额',
|
||||
'text_buy_tmp_invite_note' => '如果有足够的魔力值,你可以用它来换取临时邀请名额,有效期 7 天。交易完成后,你的魔力值会减少,邀请临时名额数则会增加。',
|
||||
'text_success_tmp_invites' => "祝贺你,你获得了<b>1</b>个新的临时邀请名额!",
|
||||
'text_buy_rainbow_id' => "购买彩虹 ID",
|
||||
'text_buy_rainbow_id_note' => '为用户名增加如彩虹般闪烁的效果,有效期 30 天,重复购买时间累加。',
|
||||
'text_success_buy_rainbow_id' => "祝贺你,彩虹 ID 增加了<b>30</b>天!",
|
||||
'text_buy_change_username_card' => "购买改名卡",
|
||||
'text_buy_change_username_card_note' => '修改用户名一次,永久有效。',
|
||||
'text_success_buy_change_username_card' => "祝贺你,成功购买了<b>改名卡</b>!",
|
||||
'text_change_username_card_already_has' => '已经拥有改名卡',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -799,6 +799,14 @@ $lang_settings = array
|
||||
'row_protected_forum' => '隐私保护论坛板块',
|
||||
'text_protected_forum' => '输入开启隐私保护的论坛板块ID,该版块的回复仅楼主作者及管理员以上可见,使用逗号分割(如:1,2,3)',
|
||||
'forum_format_error' => '论坛ID格式错误,请检查输入!',
|
||||
'row_buy_an_tmp_invite' => '购买临时邀请名额',
|
||||
'text_buy_an_tmp_invite_note' => "个魔力值,如果他选择交换一个临时邀请名额。默认'500'。",
|
||||
'row_buy_rainbow_id' => '购买彩虹 ID',
|
||||
'text_buy_rainbow_id_note' => "个魔力值,如果他选择交换一个彩虹 ID,有效期 30 天。默认'5,000'。",
|
||||
'row_buy_change_username_card' => '购买改名卡',
|
||||
'text_buy_change_username_card_note' => "个魔力值,如果他选择交换一个改名卡,永久有效。默认'100,000'。",
|
||||
'row_initial_tmp_invites' => '初始临时邀请名额',
|
||||
'text_initial_tmp_invites_note' => "新注册用户的初始临时邀请名额,有效期 7 天。默认'0'。",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -156,6 +156,16 @@ $lang_mybonus = array
|
||||
'col_count' => '數量',
|
||||
'col_size' => '體積',
|
||||
'col_a' => 'A 值',
|
||||
'text_buy_tmp_invite' => '1個臨時邀請名額',
|
||||
'text_buy_tmp_invite_note' => '如果有足夠的魔力值,你可以用它來換取臨時邀請名額,有效期 7 天。交易完成後,你的魔力值會減少,邀請臨時名額數則會增加。',
|
||||
'text_success_tmp_invites' => "祝賀你,你獲得了<b>1</b>個新的臨時邀請名額!",
|
||||
'text_buy_rainbow_id' => "購買彩虹 ID",
|
||||
'text_buy_rainbow_id_note' => '為用戶名增加如彩虹般閃爍的效果,有效期 30 天,重復購買時間累加。',
|
||||
'text_success_buy_rainbow_id' => "祝賀你,彩虹 ID 增加了<b>30</b>天!",
|
||||
'text_buy_change_username_card' => "購買改名卡",
|
||||
'text_buy_change_username_card_note' => '修改用戶名一次,永久有效。',
|
||||
'text_success_buy_change_username_card' => "祝賀你,成功購買了<b>改名卡</b>!",
|
||||
'text_change_username_card_already_has' => '已經擁有改名卡',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -799,6 +799,14 @@ $lang_settings = array
|
||||
'row_protected_forum' => '隱私保護論壇板塊',
|
||||
'text_protected_forum' => '輸入開啟隱私保護的論壇板塊ID,該版塊的回覆僅樓主作者及管理員以上可見,使用逗號分割(如:1,2,3)',
|
||||
'forum_format_error' => '論壇ID格式錯誤,請核查校對!',
|
||||
'row_buy_an_tmp_invite' => '購買臨時邀請名額',
|
||||
'text_buy_an_tmp_invite_note' => "個魔力值,如果他選擇交換一個臨時邀請名額。默認'500'。",
|
||||
'row_buy_rainbow_id' => '購買彩虹 ID',
|
||||
'text_buy_rainbow_id_note' => "個魔力值,如果他選擇交換一個彩虹 ID,有效期 30 天。默認'5,000'。",
|
||||
'row_buy_change_username_card' => '購買改名卡',
|
||||
'text_buy_change_username_card_note' => "個魔力值,如果他選擇交換一個改名卡,永久有效。默認'100,000'。",
|
||||
'row_initial_tmp_invites' => '初始臨時邀請名額',
|
||||
'text_initial_tmp_invites_note' => "新註冊用戶的初始臨時邀請名額,有效期 7 天。默認'0'。",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -156,6 +156,16 @@ where<ul><li><b>A</b> is an intermediate variable</li><li><b>Ti</b> is the <b>i<
|
||||
'col_count' => 'Counts',
|
||||
'col_size' => 'Size',
|
||||
'col_a' => 'A Value',
|
||||
'text_buy_tmp_invite' => '1 Temporary Invite',
|
||||
'text_buy_tmp_invite_note' => "With enough bonus points acquired, you are able to exchange them for a few temporary invites, valid for 7 days. The points are then removed from your Bonus Bank and the temporary invitations are added to your temporary invites amount.",
|
||||
'text_success_tmp_invites' => "Congratulations! You have got yourself <b>1</b> new temporary invite!",
|
||||
'text_buy_rainbow_id' => "Buy Rainbow ID",
|
||||
'text_buy_rainbow_id_note' => 'Adds a rainbow-like shimmering effect to usernames, valid for 30 days and cumulative over time with repeat purchases.',
|
||||
'text_success_buy_rainbow_id' => "Congratulations, Rainbow ID added <b>30</b> days!",
|
||||
'text_buy_change_username_card' => "Buy change username card",
|
||||
'text_buy_change_username_card_note' => 'Change your username once and it will be valid forever.',
|
||||
'text_success_buy_change_username_card' => "Congratulations on your successful purchase of a <b>change username card</b>!",
|
||||
'text_change_username_card_already_has' => 'Already have a change username card',
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -799,6 +799,14 @@ $lang_settings = array
|
||||
'row_protected_forum' => 'Privacy Protection Forums',
|
||||
'text_protected_forum' => 'The IDs of forums\' which enables privacy protection , seperated by commas(e.g. 1,2,3)',
|
||||
'forum_format_error' => 'The format of forums is wrong, please check it again!',
|
||||
'row_buy_an_tmp_invite' => 'Buy an temporary invite',
|
||||
'text_buy_an_tmp_invite_note' => " bonus points to get a temporary invite. Default '500'.",
|
||||
'row_buy_rainbow_id' => 'Buy Rainbow ID',
|
||||
'text_buy_rainbow_id_note' => " bonus points to get a rainbow ID, valid for 30 days. Default '5,000'.",
|
||||
'row_buy_change_username_card' => 'Buy Change username card',
|
||||
'text_buy_change_username_card_note' => " bonus points to get a Change username card, valid forever. Default '100,000'.",
|
||||
'row_initial_tmp_invites' => "Initial Number of Temporary Invites",
|
||||
'text_initial_tmp_invites_note' => "How many temporary invites should each user be given upon registration? Default '0'.",
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -94,6 +94,7 @@ return array (
|
||||
'offer_skip_approved_count' => 5,
|
||||
'upload_deny_approval_deny_count' => 2,
|
||||
'enable_global_search' => 'yes',
|
||||
'tmp_invite_count' => 0,
|
||||
),
|
||||
'smtp' =>
|
||||
array (
|
||||
@@ -242,6 +243,9 @@ return array (
|
||||
'hundredgbdownload' => 8000,
|
||||
'official_addition' => '0.5',
|
||||
'zero_bonus_factor' => '0.2',
|
||||
'one_tmp_invite' => BonusLogs::DEFAULT_BONUS_BUY_TEMPORARY_INVITE,
|
||||
'rainbow_id' => BonusLogs::DEFAULT_BONUS_BUY_RAINBOW_ID,
|
||||
'change_username_card' => BonusLogs::DEFAULT_BONUS_BUY_CHANGE_USERNAME_CARD,
|
||||
),
|
||||
'account' =>
|
||||
array (
|
||||
|
||||
@@ -263,7 +263,11 @@ JS;
|
||||
$rer = sql_query("SELECT * FROM invites WHERE $whereStr $limit") or sqlerr();
|
||||
$num1 = mysql_num_rows($rer);
|
||||
|
||||
print("<tr><td class=colhead>".$lang_invite['text_email']."</td><td class=colhead>".$lang_invite['text_hash']."</td><td class=colhead>".$lang_invite['text_send_date']."</td><td class='colhead'>".$lang_invite['text_hash_status']."</td><td class='colhead'>".$lang_invite['text_invitee_user']."</td>");
|
||||
print("<tr><td class=colhead>".$lang_invite['text_email']."</td><td class=colhead>".$lang_invite['text_hash']."</td><td class=colhead>".$lang_invite['text_send_date']."</td>");
|
||||
if ($menuSelected == 'sent') {
|
||||
print("<td class='colhead'>".$lang_invite['text_hash_status']."</td>");
|
||||
}
|
||||
print "<td class='colhead'>".$lang_invite['text_invitee_user']."</td>";
|
||||
if ($menuSelected == 'tmp') {
|
||||
print("<td class='colhead'>".$lang_invite['text_expired_at']."</td>");
|
||||
print("<td class='colhead'>".nexus_trans('label.created_at')."</td>");
|
||||
@@ -281,7 +285,9 @@ JS;
|
||||
$tr .= "<td class=rowfollow>{$arr1['invitee']}</td>";
|
||||
$tr .= sprintf('<td class="rowfollow">%s%s</td>', $arr1['hash'], $registerLink);
|
||||
$tr .= "<td class=rowfollow>{$arr1['time_invited']}</td>";
|
||||
$tr .= "<td class=rowfollow>".\App\Models\Invite::$validInfo[$arr1['valid']]['text']."</td>";
|
||||
if ($menuSelected == 'sent') {
|
||||
$tr .= "<td class=rowfollow>".\App\Models\Invite::$validInfo[$arr1['valid']]['text']."</td>";
|
||||
}
|
||||
if (!$isHashValid) {
|
||||
$tr .= "<td class=rowfollow><a href=userdetails.php?id={$arr1['invitee_register_uid']}><font color=#1f7309>".$arr1['invitee_register_username']."</font></a></td>";
|
||||
} else {
|
||||
|
||||
@@ -75,6 +75,15 @@ function bonusarray($option = 0){
|
||||
$bonus['description'] = $lang_mybonus['text_buy_invite_note'];
|
||||
$results[] = $bonus;
|
||||
|
||||
//Tmp Invite
|
||||
$bonus = array();
|
||||
$bonus['points'] = \App\Models\BonusLogs::getBonusForBuyTemporaryInvite();
|
||||
$bonus['art'] = 'tmp_invite';
|
||||
$bonus['menge'] = 1;
|
||||
$bonus['name'] = $lang_mybonus['text_buy_tmp_invite'];
|
||||
$bonus['description'] = $lang_mybonus['text_buy_tmp_invite_note'];
|
||||
$results[] = $bonus;
|
||||
|
||||
//Custom Title
|
||||
$bonus = array();
|
||||
$bonus['points'] = $customtitle_bonus;
|
||||
@@ -126,6 +135,24 @@ function bonusarray($option = 0){
|
||||
$bonus['description'] = $lang_mybonus['text_attendance_card_note'];
|
||||
$results[] = $bonus;
|
||||
|
||||
//Rainbow ID
|
||||
$bonus = array();
|
||||
$bonus['points'] = \App\Models\BonusLogs::getBonusForBuyRainbowId();
|
||||
$bonus['art'] = 'rainbow_id';
|
||||
$bonus['menge'] = 0;
|
||||
$bonus['name'] = $lang_mybonus['text_buy_rainbow_id'];
|
||||
$bonus['description'] = $lang_mybonus['text_buy_rainbow_id_note'];
|
||||
$results[] = $bonus;
|
||||
|
||||
//Change username card
|
||||
$bonus = array();
|
||||
$bonus['points'] = \App\Models\BonusLogs::getBonusForBuyChangeUsernameCard();
|
||||
$bonus['art'] = 'change_username_card';
|
||||
$bonus['menge'] = 0;
|
||||
$bonus['name'] = $lang_mybonus['text_buy_change_username_card'];
|
||||
$bonus['description'] = $lang_mybonus['text_buy_change_username_card_note'];
|
||||
$results[] = $bonus;
|
||||
|
||||
//Donate
|
||||
$bonus = array();
|
||||
$bonus['points'] = 1000;
|
||||
@@ -278,6 +305,8 @@ if (isset($do)) {
|
||||
$msg = $lang_mybonus['text_success_download'];
|
||||
elseif ($do == "invite")
|
||||
$msg = $lang_mybonus['text_success_invites'];
|
||||
elseif ($do == "tmp_invite")
|
||||
$msg = $lang_mybonus['text_success_tmp_invites'];
|
||||
elseif ($do == "vip")
|
||||
$msg = $lang_mybonus['text_success_vip']."<b>".get_user_class_name(UC_VIP,false,false,true)."</b>".$lang_mybonus['text_success_vip_two'];
|
||||
elseif ($do == "vipfalse")
|
||||
@@ -296,6 +325,10 @@ if (isset($do)) {
|
||||
$msg = $lang_mybonus['text_success_buy_medal'];
|
||||
elseif ($do == "attendance_card")
|
||||
$msg = $lang_mybonus['text_success_buy_attendance_card'];
|
||||
elseif ($do == "rainbow_id")
|
||||
$msg = $lang_mybonus['text_success_buy_rainbow_id'];
|
||||
elseif ($do == "change_username_card")
|
||||
$msg = $lang_mybonus['text_success_buy_change_username_card'];
|
||||
elseif ($do == 'duplicated')
|
||||
$msg = $lockText;
|
||||
else
|
||||
@@ -397,6 +430,12 @@ for ($i=0; $i < count($allBonus); $i++)
|
||||
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['text_ratio_too_high']."\" disabled=\"disabled\" /></td>");
|
||||
}
|
||||
else print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
|
||||
} elseif ($bonusarray['art'] == 'change_username_card') {
|
||||
if (\App\Models\UserMeta::query()->where('uid', $CURUSER['id'])->where('meta_key', \App\Models\UserMeta::META_KEY_CHANGE_USERNAME)->exists()) {
|
||||
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['text_change_username_card_already_has']."\" disabled=\"disabled\"/></td>");
|
||||
} else {
|
||||
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
|
||||
}
|
||||
} else {
|
||||
print("<td class=\"rowfollow\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang_mybonus['submit_exchange']."\" /></td>");
|
||||
}
|
||||
@@ -575,6 +614,17 @@ if ($action == "exchange") {
|
||||
$bonusRep->consumeUserBonus($CURUSER['id'], $points, \App\Models\BonusLogs::BUSINESS_TYPE_EXCHANGE_INVITE, $points. " Points for invites.", ['invites' => $inv, ]);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=invite");
|
||||
}
|
||||
//=== temporary invite
|
||||
elseif($art == "tmp_invite") {
|
||||
// if(!user_can('buyinvite'))
|
||||
// die(get_user_class_name($buyinvite_class,false,false,true).$lang_mybonus['text_plus_only']);
|
||||
// $invites = $CURUSER['invites'];
|
||||
// $inv = $invites+$bonusarray['menge'];
|
||||
// $bonuscomment = date("Y-m-d") . " - " .$points. " Points for invites.\n " .htmlspecialchars($bonuscomment);
|
||||
// sql_query("UPDATE users SET invites = ".sqlesc($inv).", seedbonus = seedbonus - $points, bonuscomment=".sqlesc($bonuscomment)." WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
|
||||
$bonusRep->consumeToBuyTemporaryInvite($CURUSER['id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=tmp_invite");
|
||||
}
|
||||
//=== trade for special title
|
||||
/**** the $words array are words that you DO NOT want the user to have... use to filter "bad words" & user class...
|
||||
the user class is just for show, but what the hell tongue.gif Add more or edit to your liking.
|
||||
@@ -696,32 +746,23 @@ if ($action == "exchange") {
|
||||
if (empty($_POST['hr_id'])) {
|
||||
stderr("Error","Invalid H&R ID: " . ($_POST['hr_id'] ?? ''), false, false);
|
||||
}
|
||||
try {
|
||||
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage(), 'error');
|
||||
stderr('Error', "Something wrong...", false, false);
|
||||
}
|
||||
$bonusRep->consumeToCancelHitAndRun($userid, $_POST['hr_id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=cancel_hr");
|
||||
} elseif ($art == 'buy_medal') {
|
||||
if (empty($_POST['medal_id'])) {
|
||||
stderr("Error","Invalid Medal ID: " . ($_POST['medal_id'] ?? ''), false, false);
|
||||
}
|
||||
try {
|
||||
$bonusRep->consumeToBuyMedal($userid, $_POST['medal_id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=buy_medal");
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage(), 'error');
|
||||
stderr('Error', "Something wrong...", false, false);
|
||||
}
|
||||
$bonusRep->consumeToBuyMedal($userid, $_POST['medal_id']);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=buy_medal");
|
||||
} elseif ($art == 'attendance_card') {
|
||||
try {
|
||||
$bonusRep->consumeToBuyAttendanceCard($userid);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=attendance_card");
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage(), 'error');
|
||||
stderr('Error', "Something wrong...", false, false);
|
||||
}
|
||||
$bonusRep->consumeToBuyAttendanceCard($userid);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=attendance_card");
|
||||
} elseif ($art == 'rainbow_id') {
|
||||
$bonusRep->consumeToBuyRainbowId($userid);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=rainbow_id");
|
||||
} elseif ($art == 'change_username_card') {
|
||||
$bonusRep->consumeToBuyChangeUsernameCard($userid);
|
||||
nexus_redirect("" . get_protocol_prefix() . "$BASEURL/mybonus.php?do=change_username_card");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ if ($action == 'savesettings_main') // save main
|
||||
'smalldescription','altname','extforum','extforumurl','defaultlang','defstylesheet', 'donation','spsct','browsecat','specialcat','waitsystem',
|
||||
'maxdlsystem','bitbucket','torrentnameprefix', 'showforumstats','verification','invite_count','invite_timeout', 'seeding_leeching_time_calc_start',
|
||||
'startsubid', 'logo', 'showlastxforumposts', 'enable_technical_info', 'site_language_enabled', 'show_top_uploader', 'imdb_language', 'offer_skip_approved_count',
|
||||
'upload_deny_approval_deny_count', 'enable_global_search'
|
||||
'upload_deny_approval_deny_count', 'enable_global_search', 'tmp_invite_count',
|
||||
);
|
||||
GetVar($validConfig);
|
||||
$MAIN = [];
|
||||
@@ -99,6 +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',
|
||||
);
|
||||
GetVar($validConfig);
|
||||
$BONUS = [];
|
||||
@@ -616,12 +617,16 @@ elseif ($action == 'bonussettings'){
|
||||
|
||||
tr($lang_settings['row_ratio_limit'],$lang_settings['text_user_with_ratio']."<input type='text' style=\"width: 50px\" name=ratiolimit value='".(isset($BONUS["ratiolimit"]) ? $BONUS["ratiolimit"] : 6 )."'>".$lang_settings['text_uploaded_amount_above']."<input type='text' style=\"width: 50px\" name=dlamountlimit value='".(isset($BONUS["dlamountlimit"]) ? $BONUS["dlamountlimit"] : 50 )."'>".$lang_settings['text_ratio_limit_default'], 1);
|
||||
tr($lang_settings['row_buy_an_invite'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=oneinvite value='".(isset($BONUS["oneinvite"]) ? $BONUS["oneinvite"] : 1000 )."'>".$lang_settings['text_buy_an_invite_note'], 1);
|
||||
tr($lang_settings['row_buy_an_tmp_invite'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=one_tmp_invite value='".(isset($BONUS["one_tmp_invite"]) ? $BONUS["one_tmp_invite"] : \App\Models\BonusLogs::DEFAULT_BONUS_BUY_TEMPORARY_INVITE )."'>".$lang_settings['text_buy_an_tmp_invite_note'], 1);
|
||||
|
||||
tr($lang_settings['row_custom_title'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=customtitle value='".(isset($BONUS["customtitle"]) ? $BONUS["customtitle"] : 5000 )."'>".$lang_settings['text_custom_title_note'], 1);
|
||||
tr($lang_settings['row_vip_status'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=vipstatus value='".(isset($BONUS["vipstatus"]) ? $BONUS["vipstatus"] : 8000 )."'>".$lang_settings['text_vip_status_note'], 1);
|
||||
yesorno($lang_settings['row_allow_giving_bonus_gift'], 'bonusgift', $BONUS["bonusgift"], $lang_settings['text_giving_bonus_gift_note']);
|
||||
tr($lang_settings['row_bonus_gift_tax'], $lang_settings['text_system_charges']."<input type='text' style=\"width: 50px\" name='basictax' value='".(isset($BONUS["basictax"]) ? $BONUS["basictax"] : 5 )."'>".$lang_settings['text_bonus_points_plus']."<input type='text' style=\"width: 50px\" name='taxpercentage' value='".(isset($BONUS["taxpercentage"]) ? $BONUS["taxpercentage"] : 10 )."'>".$lang_settings['text_bonus_gift_tax_note'], 1);
|
||||
tr($lang_settings['row_cancel_hr'],$lang_settings['text_it_costs_user']."<input type='text' style=\"width: 50px\" name=cancel_hr value='".(isset($BONUS["cancel_hr"]) ? $BONUS["cancel_hr"] : \App\Models\BonusLogs::DEFAULT_BONUS_CANCEL_ONE_HIT_AND_RUN )."'>".$lang_settings['text_cancel_hr_note'], 1);
|
||||
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);
|
||||
|
||||
|
||||
echo '<tr><td colspan="2" align="center"><b>' . $lang_settings['text_attendance_get_bonus'] . '</b></td></tr>';
|
||||
@@ -786,6 +791,7 @@ elseif ($action == 'mainsettings') // main settings
|
||||
yesorno($lang_settings['row_enable_invite_system'], 'invitesystem', $MAIN['invitesystem'], $lang_settings['text_invite_system_note']);
|
||||
tr($lang_settings['row_initial_uploading_amount'],"<input type='text' name=iniupload style=\"width: 100px\" value={$MAIN['iniupload']}> ".$lang_settings['text_initial_uploading_amount_note'], 1);
|
||||
tr($lang_settings['row_initial_invites'],"<input type='text' name=invite_count style=\"width: 50px\" value={$MAIN['invite_count']}> ".$lang_settings['text_initial_invites_note'], 1);
|
||||
tr($lang_settings['row_initial_tmp_invites'],"<input type='text' name=tmp_invite_count style=\"width: 50px\" value={$MAIN['tmp_invite_count']}> ".$lang_settings['text_initial_tmp_invites_note'], 1);
|
||||
tr($lang_settings['row_invite_timeout'],"<input type='text' name=invite_timeout style=\"width: 50px\" value={$MAIN['invite_timeout']}> ".$lang_settings['text_invite_timeout_note'], 1);
|
||||
yesorno($lang_settings['row_enable_registration_system'], 'registration', $MAIN['registration'], $lang_settings['row_allow_registrations']);
|
||||
tr($lang_settings['row_verification_type'],"<input type='radio' name='verification'" . ($MAIN["verification"] == "email" ? " checked" : " checked") . " value='email'> ".$lang_settings['text_email'] ." <input type='radio' name='verification'" . ($MAIN["verification"] == "admin" ? " checked" : "") . " value='admin'> ".$lang_settings['text_admin']." <input type='radio' name='verification'" . ($MAIN["verification"] == "automatic" ? " checked" : "") . " value='automatic'> ".$lang_settings['text_automatically']."<br />".$lang_settings['text_verification_type_note'], 1);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once("../include/bittorrent.php");
|
||||
dbconn();
|
||||
cur_user_check ();
|
||||
@@ -164,6 +165,12 @@ if(mysql_num_rows($res_check_user) == 1)
|
||||
|
||||
$ret = sql_query("INSERT INTO users (username, passhash, secret, editsecret, email, country, gender, status, class, invites, ".($type == 'invite' ? "invited_by," : "")." added, last_access, lang, stylesheet".($showschool == 'yes' ? ", school" : "").", uploaded) VALUES (" . $wantusername . "," . $wantpasshash . "," . $secret . "," . $editsecret . "," . $email . "," . $country . "," . $gender . ", 'pending', ".$defaultclass_class.",". $invite_count .", ".($type == 'invite' ? "'$inviter'," : "") ." '". date("Y-m-d H:i:s") ."' , " . " '". date("Y-m-d H:i:s") ."' , ".$sitelangid . ",".$defcss.($showschool == 'yes' ? ",".$school : "").",".($iniupload_main > 0 ? $iniupload_main : 0).")") or sqlerr(__FILE__, __LINE__);
|
||||
$id = mysql_insert_id();
|
||||
$tmpInviteCount = get_setting('main.tmp_invite_count');
|
||||
if ($tmpInviteCount > 0) {
|
||||
$userRep = new \App\Repositories\UserRepository();
|
||||
$userRep->addTemporaryInvite(null, $id, 'increment', $tmpInviteCount, 7);
|
||||
}
|
||||
|
||||
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||
$subject = sqlesc($lang_takesignup['msg_subject'].$SITENAME."!");
|
||||
$msg = sqlesc($lang_takesignup['msg_congratulations'].htmlspecialchars($wantusername).$lang_takesignup['msg_you_are_a_member']);
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return [
|
||||
'comment_buy_medal' => 'Spend :bonus bonus buy :medal_name',
|
||||
'comment_buy_attendance_card' => 'Spend :bonus bonus buy one attend card',
|
||||
'comment_buy_temporary_invite' => 'Spend :bonus bonus buy :count temporary invite',
|
||||
'comment_buy_rainbow_id' => 'Spend :bonus bonus buy :duration days rainbow ID',
|
||||
'comment_buy_change_username_card' => 'Spend :bonus bonus buy change username card',
|
||||
'table_thead' => [
|
||||
'reward_type' => 'Reward type',
|
||||
'count' => 'Count',
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return [
|
||||
'comment_buy_medal' => '花费 :bonus 魔力购买了 :medal_name',
|
||||
'comment_buy_attendance_card' => '花费 :bonus 魔力购买了 1 张补签卡',
|
||||
'comment_buy_temporary_invite' => '花费 :bonus 魔力购买了 :count 个临时邀请',
|
||||
'comment_buy_rainbow_id' => '花费 :bonus 魔力购买了 :duration 天的彩虹 ID',
|
||||
'comment_buy_change_username_card' => '花费 :bonus 魔力购买了改名卡',
|
||||
'table_thead' => [
|
||||
'reward_type' => '奖励类型',
|
||||
'count' => '数量',
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return [
|
||||
'comment_buy_medal' => '花費 :bonus 魔力購買了 :medal_name',
|
||||
'comment_buy_attendance_card' => '花費 :bonus 魔力購買了 1 張補簽卡',
|
||||
'comment_buy_temporary_invite' => '花費 :bonus 魔力購買了 :count 個臨時邀請',
|
||||
'comment_buy_rainbow_id' => '花費 :bonus 魔力購買了 :duration 天的彩虹 ID',
|
||||
'comment_buy_change_username_card' => '花費 :bonus 魔力購買了改名卡',
|
||||
'table_thead' => [
|
||||
'reward_type' => '獎勵類型',
|
||||
'count' => '數量',
|
||||
|
||||
Reference in New Issue
Block a user