trans increment bulk page

This commit is contained in:
xiaomlove
2023-02-08 17:11:23 +08:00
parent d96c603149
commit 75e2e0ecfe
6 changed files with 105 additions and 36 deletions
+3 -1
View File
@@ -31,7 +31,9 @@ class InviteAddTemporary extends Command
$uid = $this->argument('uid'); $uid = $this->argument('uid');
$days = $this->argument('days'); $days = $this->argument('days');
$count = $this->argument('count'); $count = $this->argument('count');
$this->info("uid: $uid, days: $days, count: $count"); $log = "uid: $uid, days: $days, count: $count";
$this->info($log);
do_log($log);
$uidArr = preg_split('/[\s,]+/', $uid); $uidArr = preg_split('/[\s,]+/', $uid);
GenerateTemporaryInvite::dispatch($uidArr, $days, $count); GenerateTemporaryInvite::dispatch($uidArr, $days, $count);
return Command::SUCCESS; return Command::SUCCESS;
+27
View File
@@ -0,0 +1,27 @@
<?php
$lang_increment_bulk = array
(
'page_title' => '批量添加魔力/补签卡/邀请/上传量/临时邀请',
'sent_success' => ' 已经成功增加并发送了私信',
'types' => [
'seedbonus' => '魔力',
'attendance_card' => '补签卡',
'invites' => '邀请',
'uploaded' => '上传量',
'tmp_invites' => '临时邀请',
],
'labels' => [
'type' => '类型',
'amount' => '数量',
'duration' => '有效期',
'duration_help' => '仅当类型为 [临时邀请] 时需要,单位:天',
'user_class' => '用户等级',
'roles' => '角色',
'msg_subject' => '私信主题',
'msg_body' => '私信内容',
'operator' => '操作者',
],
);
?>
+27
View File
@@ -0,0 +1,27 @@
<?php
$lang_increment_bulk = array
(
'page_title' => '批量添加魔力/補簽卡/邀請/上傳量/臨時邀請',
'sent_success' => ' 已經成功增加並發送了私信',
'types' => [
'seedbonus' => '魔力',
'attendance_card' => '補簽卡',
'invites' => '邀請',
'uploaded' => '上傳量',
'tmp_invites' => '臨時邀請',
],
'labels' => [
'type' => '類型',
'amount' => '數量',
'duration' => '有效期',
'duration_help' => '僅當類型為 [臨時邀請] 時需要,單位:天',
'user_class' => '用戶等級',
'roles' => '角色',
'msg_subject' => '私信主題',
'msg_body' => '私信內容',
'operator' => '操作者',
],
);
?>
+27
View File
@@ -0,0 +1,27 @@
<?php
$lang_increment_bulk = array
(
'page_title' => 'Batch add bonus/attendance card/invite/uploaded/temporary invite',
'sent_success' => ' has been added and inform message has been sent',
'types' => [
'seedbonus' => 'bonus',
'attendance_card' => 'attendance card',
'invites' => 'invite',
'uploaded' => 'upload',
'tmp_invites' => 'temporary invite',
],
'labels' => [
'type' => 'Type',
'amount' => 'Amount',
'duration' => 'Duration',
'duration_help' => 'Required only if type is [Temporary Invitation], in days',
'user_class' => 'User class',
'roles' => 'Roles',
'msg_subject' => 'message subject',
'msg_body' => 'message content',
'operator' => 'Operator',
],
);
?>
+19 -28
View File
@@ -1,24 +1,19 @@
<?php <?php
require "../include/bittorrent.php"; require "../include/bittorrent.php";
dbconn(); dbconn();
require_once(get_langfile_path());
loggedinorreturn(); loggedinorreturn();
if (get_user_class() < UC_SYSOP) if (get_user_class() < UC_SYSOP)
stderr("Sorry", "Access denied."); stderr("Sorry", "Access denied.");
$validTypeMap = [ $validTypeMap = $lang_increment_bulk['types'];
'seedbonus' => 'Bonus',
'attendance_card' => 'Attend card',
'invites' => 'Invite',
'uploaded' => 'Upload',
'tmp_invites' => 'Temporary invite',
];
$type = $_REQUEST['type'] ?? ''; $type = $_REQUEST['type'] ?? '';
stdhead("Add Bonus/Attend card/Invite/upload", false); stdhead($lang_increment_bulk['page_title'], false);
$classes = array_chunk(\App\Models\User::$classes, 4, true); $classes = array_chunk(\App\Models\User::listClass(), 4, true);
?> ?>
<table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded> <table class=main width=737 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<div align=center> <div align=center>
<h1>Add Bonus/Attend card/Invite/upload to all staff members and users:</a></h1> <h1><?php echo $lang_increment_bulk['page_title']?></a></h1>
<form method=post action=take-increment-bulk.php> <form method=post action=take-increment-bulk.php>
<?php <?php
@@ -32,33 +27,33 @@ $classes = array_chunk(\App\Models\User::$classes, 4, true);
<table cellspacing=0 cellpadding=5> <table cellspacing=0 cellpadding=5>
<?php <?php
if (isset($_GET["sent"]) && $_GET["sent"] == 1) { if (isset($_GET["sent"]) && $_GET["sent"] == 1) {
echo '<tr><td colspan=2 class="text" align="center"><font color=red><b> '. ($validTypeMap[$type] ?? '') .' has been added and inform message has been sent.</font></b></tr></td>'; echo '<tr><td colspan=2 class="text" align="center"><font color=red><b> '. ($validTypeMap[$type] ?? '') . $lang_increment_bulk['sent_success'] .'</font></b></tr></td>';
} }
?> ?>
<tr> <tr>
<td class="rowhead" valign="top">Type </td> <td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['type'] ?></td>
<td class="rowfollow"> <td class="rowfollow">
<?php <?php
foreach ($validTypeMap as $name => $text) { foreach ($validTypeMap as $name => $text) {
$desc = ''; $desc = '';
if ($name == 'uploaded') { if ($name == 'uploaded') {
$desc = '&nbsp;(in GB)'; $desc = '&nbsp;(GB)';
} }
printf('<label><input type="radio" name="type" value="%s">%s%s</label>', $name, $text, $desc); printf('<label><input type="radio" name="type" value="%s">%s%s</label>', $name, $text, $desc);
} }
?> ?>
</td> </td>
</tr> </tr>
<tr><td class="rowhead" valign="top">Amount </td><td class="rowfollow"><input type=text name=amount size=10></td></tr> <tr><td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['amount'] ?> </td><td class="rowfollow"><input type=text name=amount size=10></td></tr>
<tr><td class="rowhead" valign="top">Duration </td><td class="rowfollow"><input type=number min="1" name=duration size=10> Only required when Type = 'Temporary invite', Unit: Day</td></tr> <tr><td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['duration'] ?></td><td class="rowfollow"><input type=number min="1" name=duration size=10> <?php echo $lang_increment_bulk['labels']['duration_help'] ?></td></tr>
<tr> <tr>
<td class="rowhead" valign="top">Add to Class</td><td class="rowfollow"> <td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['user_class'] ?></td><td class="rowfollow">
<table style="border: 0" width="100%" cellpadding="0" cellspacing="0"> <table style="border: 0" width="100%" cellpadding="0" cellspacing="0">
<?php <?php
foreach ($classes as $chunk) { foreach ($classes as $chunk) {
printf('<tr>'); printf('<tr>');
foreach ($chunk as $class => $info) { foreach ($chunk as $class => $info) {
printf('<td style="border: 0"><label><input type="checkbox" name="classes[]" value="%s" />%s</label></td>', $class, $info['text']); printf('<td style="border: 0"><label><input type="checkbox" name="classes[]" value="%s" />%s</label></td>', $class, $info);
} }
printf('</tr>'); printf('</tr>');
} }
@@ -66,23 +61,19 @@ $classes = array_chunk(\App\Models\User::$classes, 4, true);
</table> </table>
</td> </td>
</tr> </tr>
<?php do_action('form_role_filter', 'Add to Role') ?> <?php do_action('form_role_filter', $lang_increment_bulk['labels']['roles']) ?>
<tr><td class="rowhead" valign="top">Subject </td><td class="rowfollow"><input type=text name=subject size=82></td></tr> <tr><td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['msg_subject'] ?> </td><td class="rowfollow"><input type=text name=subject size=82></td></tr>
<tr><td class="rowhead" valign="top">Reason </td><td class="rowfollow"><textarea name=msg cols=80 rows=5><?php echo $body ?? ''?></textarea></td></tr> <tr><td class="rowhead" valign="top"><?php echo $lang_increment_bulk['labels']['msg_body'] ?> </td><td class="rowfollow"><textarea name=msg cols=80 rows=5><?php echo $body ?? ''?></textarea></td></tr>
<tr> <tr>
<td class="rowfollow" colspan=2><div align="center"><b>Operator:&nbsp;&nbsp;</b> <td class="rowfollow" colspan=2><div align="center"><b><?php echo $lang_increment_bulk['labels']['operator'] ?>:&nbsp;&nbsp;</b>
<?php echo $CURUSER['username']?> <label><input name="sender" type="radio" value="self" checked><?php echo $CURUSER['username']?></label>
<input name="sender" type="radio" value="self" checked> &nbsp; <label><input name="sender" type="radio" value="system">System</label>
&nbsp; System
<input name="sender" type="radio" value="system">
</div></td></tr> </div></td></tr>
<tr><td class="rowfollow" colspan=2 align=center><input type=submit value="Do It!" class=btn></td></tr> <tr><td class="rowfollow" colspan=2 align=center><input type=submit value="<?php echo nexus_trans('label.submit') ?>" class=btn></td></tr>
</table> </table>
<input type=hidden name=receiver value=<?php echo $receiver ?? ''?>> <input type=hidden name=receiver value=<?php echo $receiver ?? ''?>>
</form> </form>
</div></td></tr></table> </div></td></tr></table>
<br />
NOTE: Do not user BB codes. (NO HTML)
<?php <?php
stdfoot(); stdfoot();
+2 -7
View File
@@ -3,18 +3,13 @@ require "../include/bittorrent.php";
if ($_SERVER["REQUEST_METHOD"] != "POST") if ($_SERVER["REQUEST_METHOD"] != "POST")
stderr("Error", "Permission denied!"); stderr("Error", "Permission denied!");
dbconn(); dbconn();
require_once(get_langfile_path('increment-bulk.php'));
loggedinorreturn(); loggedinorreturn();
if (get_user_class() < UC_SYSOP) if (get_user_class() < UC_SYSOP)
stderr("Sorry", "Permission denied."); stderr("Sorry", "Permission denied.");
$validTypeMap = [ $validTypeMap = $lang_increment_bulk['types'];
'seedbonus' => 'Bonus',
'attendance_card' => 'Attend card',
'invites' => 'Invite',
'uploaded' => 'Upload',
'tmp_invites' => 'Temporary invite',
];
$sender_id = ($_POST['sender'] == 'system' ? 0 : (int)$CURUSER['id']); $sender_id = ($_POST['sender'] == 'system' ? 0 : (int)$CURUSER['id']);
$dt = sqlesc(date("Y-m-d H:i:s")); $dt = sqlesc(date("Y-m-d H:i:s"));
$msg = trim($_POST['msg']); $msg = trim($_POST['msg']);