diff --git a/public/invite.php b/public/invite.php index 384b4d6b..159dfc4d 100644 --- a/public/invite.php +++ b/public/invite.php @@ -8,8 +8,9 @@ $id = intval($_GET["id"] ?? 0); $type = unesc($_GET["type"] ?? ''); $menuSelected = $_REQUEST['menu'] ?? 'invitee'; $pageSize = 50; +if (($CURUSER['id'] != $id && !user_can('viewinvite')) || !is_valid_id($id)) + stderr($lang_invite['std_sorry'],$lang_invite['std_permission_denied']); $userRep = new \App\Repositories\UserRepository(); - function inviteMenu ($selected = "invitee") { global $lang_invite, $id, $CURUSER, $invitesystem, $userRep; begin_main_frame("", false, "100%"); diff --git a/public/medal.php b/public/medal.php new file mode 100644 index 00000000..c81d12ed --- /dev/null +++ b/public/medal.php @@ -0,0 +1,68 @@ +where('username', 'name', "%{$q}%"); +} +$total = (clone $query)->count(); +$perPage = 50; +list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?"); +$rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get(); +$q = htmlspecialchars($q); +$title = nexus_trans('medal.label'); +$columnNameLabel = nexus_trans('label.name'); +$columnImageLargeLabel = nexus_trans('medal.fields.image_large'); +$columnPriceLabel = nexus_trans('medal.fields.price'); +$columnDurationLabel = nexus_trans('medal.fields.duration'); +$columnDescriptionLabel = nexus_trans('medal.fields.description'); +$columnActionLabel = nexus_trans('nexus.action'); +$filterForm = <<
+

$title

+ + + + +
+ +FORM; +stdhead($title); +begin_main_frame(); +$table = << + + + + + + + + + + +TABLE; +$table .= ''; +$userMedals = \App\Models\UserMedal::query()->where('uid', $CURUSER['id'])->get()->keyBy('medal_id'); +foreach ($rows as $row) { + if ($userMedals->has($CURUSER['id'])) { + $btnText = nexus_trans('medal.buy_already'); + $disabled = ' disabled'; + } else { + $btnText = nexus_trans('medal.buy_btn'); + $disabled = ''; + } + $action = sprintf( + '', + $btnText, $disabled + ); + $table .= sprintf( + '', + $row->id, $row->name, $row->image_large, $row->duration, $row->description, $action + ); +} +$table .= '
ID$columnNameLabel$columnImageLargeLabel$columnDurationLabel$columnDescriptionLabel$columnActionLabel
%s%s%s%s%s
'; +echo $filterForm . $table . $paginationBottom; +stdfoot(); + diff --git a/resources/lang/zh_CN/medal.php b/resources/lang/zh_CN/medal.php index b3099d15..20cf0f4f 100644 --- a/resources/lang/zh_CN/medal.php +++ b/resources/lang/zh_CN/medal.php @@ -12,4 +12,13 @@ return [ \App\Models\Medal::GET_TYPE_EXCHANGE => '兑换', \App\Models\Medal::GET_TYPE_GRANT => '授予', ], + 'fields' => [ + 'get_type' => '获取方式', + 'description' => '描述', + 'image_large' => '图片', + 'price' => '价格', + 'duration' => '购买后有效期(天)', + ], + 'buy_already' => '已经购买', + 'but_btn' => '购买', ]; diff --git a/resources/lang/zh_CN/nexus.php b/resources/lang/zh_CN/nexus.php index 24ce2f71..30a4ab7a 100644 --- a/resources/lang/zh_CN/nexus.php +++ b/resources/lang/zh_CN/nexus.php @@ -12,4 +12,5 @@ return [ 'unselect_all' => '全不选', 'increment' => '增加', 'decrement' => '减少', + 'action' => '操作', ];