Skip to content

Commit

Permalink
release: 0.5.0 Aphyocharacinae
Browse files Browse the repository at this point in the history
release: 0.5.0 Aphyocharacinae
  • Loading branch information
ZsgsDesign committed Aug 14, 2021
2 parents c641599 + 95c9766 commit 6a8f406
Show file tree
Hide file tree
Showing 299 changed files with 10,437 additions and 10,559 deletions.
26 changes: 22 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ APP_DISPLAY_NAME="NJUPT Online Judge" #Display Name
APP_ENV=local #Current Environment Name
APP_KEY=base64:6KvSj1hj/VJCNXnHECU16OVbcHk7h20O5TbsyOz5WuA= #App Key
APP_DEBUG=true #Debug Mode
APP_URL=http://ojsystem.com/
APP_URL=http://ojsystem.com
APP_MULTI_DOMAIN=true # Multi Domain Mode, Automatic match APP_URL, note that you still need to set APP_URL for console command proper running
APP_LOCALE=en
APP_BACKUP=false #Enable Scheduling Backup
APP_LOGO="" #URL for site logo
APP_DESC=
APP_THEME="default" # choose from https://njuptaaa.github.io/docs/#/noj/guide/theme
APP_ALLOW_OAUTH_TEMP_ACCOUNT=false

FUNC_ENABLE_REGISTER=true

BABEL_MIRROR=https://acm.njupt.edu.cn/babel #The mirror of babel marketplace

SESSION_DOMAIN=.ojsystem.com
SESSION_DOMAIN=.ojsystem.com # set null if multi-domain or http 419

LOG_CHANNEL=stack

Expand Down Expand Up @@ -52,12 +57,25 @@ BAIDU_SITE_VERIFICATION=""

GOOGLE_ANALYTICS=""

GITHUB_ENABLE=false
GITHUB_KEY=
GITHUB_SECRET=
GITHUB_CALLBACK_URL=
GITHUB_CALLBACK_URL= # should be like http://www.your-noj-website.com/oauth/github/callback

MOSS_USERID=
AAUTH_ENABLE=false
AAUTH_KEY=
AAUTH_SECRET=
AAUTH_CALLBACK_URL= # should be like http://www.your-noj-website.com/oauth/aauth/callback

CONTACT_EMAIL="[email protected]"
CONTACT_QQ="Group 668108264"
CONTACT_TEL=

TERM_SUBJECT_FULL_NAME="NJUPT Online Judge"
TERM_SUBJECT_NAME="NOJ"
TERM_STREET="9 Wenyuan Road"
TERM_CITY="Nanjing"
TERM_PROVINCE="Jiangsu"
TERM_STATE="China"
TERM_ZIP="221000"
TERM_CONTACT_EMAIL="[email protected]"
53 changes: 26 additions & 27 deletions app/Admin/Controllers/AbuseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Admin\Controllers;

use App\User;
use App\Models\Eloquent\Abuse;
use App\Models\Eloquent\Group;
use App\Models\Eloquent\GroupBanned;
Expand All @@ -23,7 +22,7 @@ class AbuseController extends AdminController
*
* @var string
*/
protected $title = 'Abuses';
protected $title='Abuses';

/**
* Make a grid builder.
Expand All @@ -32,7 +31,7 @@ class AbuseController extends AdminController
*/
protected function grid()
{
$grid = new Grid(new Abuse);
$grid=new Grid(new Abuse);

$grid->column('id', __('Id'));
$grid->column('title', __('Title'));
Expand All @@ -58,7 +57,7 @@ protected function grid()
*/
protected function detail($id)
{
$show = new Show(Abuse::findOrFail($id));
$show=new Show(Abuse::findOrFail($id));

$show->field('id', __('Id'));
$show->field('title', __('Title'));
Expand All @@ -81,7 +80,7 @@ protected function detail($id)
*/
protected function form()
{
$form = new Form(new Abuse);
$form=new Form(new Abuse);

$form->text('title', __('Title'));
$form->number('cause', __('Cause'));
Expand All @@ -92,23 +91,23 @@ protected function form()

$form->ignore(['created_at']);

$form->saving(function (Form $form) {
$abuse = $form->model();
$form->saving(function(Form $form) {
$abuse=$form->model();
//get gategory and subject id
$regex = '/^([A-Za-z]+) #(\d+)/';
$matches = [];
preg_match($regex,$abuse->title,$matches);
$category = array_search(strtolower($matches[1]),Abuse::$supportCategory);
$subject_id = (int)$matches[2];
switch($abuse->category) {
$regex='/^([A-Za-z]+) #(\d+)/';
$matches=[];
preg_match($regex, $abuse->title, $matches);
$category=array_search(strtolower($matches[1]), Abuse::$supportCategory);
$subject_id=(int) $matches[2];
switch ($abuse->category) {
case 0:
$gid = $subject_id;
$group = Group::find($gid);
if(empty($group)) {
return ;
$gid=$subject_id;
$group=Group::find($gid);
if (empty($group)) {
return;
}
if($form->audit) {
$ban_time = request()->created_at;
if ($form->audit) {
$ban_time=request()->created_at;
sendMessage([
'sender' => 1,
'receiver' => $abuse->user_id,
Expand All @@ -128,20 +127,20 @@ protected function form()
'reason' => $abuse->supplement,
'removed_at' => $ban_time
]);
return ;
}else{
return;
} else {
sendMessage([
'sender' => 1,
'receiver' => $abuse->user_id,
'title' => "Your abuse report about group {$group->name} was rejected",
'content' => "Hi, Dear **{$abuse->user->name}**,\n\n We have checked your Abuse report about group **[{$group->name}]({$group->link})**.\n\n However, we regret to say that the information you submitted is not sufficient for us to take action.\n\n Of course, we will continue to follow up the investigation.\n\n Thank you for your contribution to our community environment.\n\n Sincerely, NOJ"
]);
$abuse->delete();
return ;
return;
}
return;
case 1:
$ban_time = request()->created_at;
$ban_time=request()->created_at;
UserBanned::create([
'abuse_id' => $abuse->id,
'user_id' => $subject_id,
Expand Down Expand Up @@ -170,15 +169,15 @@ public function edit($id, Content $content)

protected function check_form()
{
$form = new Form(new Abuse);
$form->display('id',__('Abuse id'));
$form=new Form(new Abuse);
$form->display('id', __('Abuse id'));
$form->display('title', __('Title'));
$form->display('cause', __('Cause'));
$form->display('supplement', __('Supplement'));
$form->display('link', __('Group Link'));
$form->display('user_id', __('Submitter'));
$form->radio('audit','result')->options(['0' => 'Reject', '1'=> 'Pass']);
$form->datetime('created_at','ban until');
$form->radio('audit', 'result')->options(['0' => 'Reject', '1'=> 'Pass']);
$form->datetime('created_at', 'ban until');

return $form;
}
Expand Down
135 changes: 135 additions & 0 deletions app/Admin/Controllers/AnnouncementController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php

namespace App\Admin\Controllers;

use App\Models\Eloquent\Announcement;
use App\Models\Eloquent\User;
use App\Models\Eloquent\OJ;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Controllers\HasResourceActions;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;
use Encore\Admin\Show;

class AnnouncementController extends AdminController
{
use HasResourceActions;

/**
* Index interface.
*
* @param Content $content
* @return Content
*/
public function index(Content $content)
{
return $content
->header(__('admin.announcements.index.header'))
->description(__('admin.announcements.index.description'))
->body($this->grid()->render());
}

/**
* Show interface.
*
* @param mixed $id
* @param Content $content
* @return Content
*/
public function show($id, Content $content)
{
return $content
->header(__('admin.announcements.show.header'))
->description(__('admin.announcements.show.description'))
->body($this->detail($id));
}

/**
* Edit interface.
*
* @param mixed $id
* @param Content $content
* @return Content
*/
public function edit($id, Content $content)
{
return $content
->header(__('admin.announcements.edit.header'))
->description(__('admin.announcements.edit.description'))
->body($this->form()->edit($id));
}

/**
* Create interface.
*
* @param Content $content
* @return Content
*/
public function create(Content $content)
{
return $content
->header(__('admin.announcements.create.header'))
->description(__('admin.announcements.create.description'))
->body($this->form());
}

/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid=new Grid(new Announcement());

$grid->column('anid', 'ANID');
$grid->column('user', __('admin.announcements.user'))->display(function() {
return $this->user->name;
}); ;
$grid->column('title', __('admin.announcements.title'))->editable();
$grid->column('created_at', __('admin.created_at'));
$grid->column('updated_at', __('admin.updated_at'));

$grid->filter(function(Grid\Filter $filter) {
$filter->like('title', __('admin.announcements.title'));
$filter->equal('uid', __('admin.announcements.user'))->select(User::all()->pluck('name', 'id'));
});

return $grid;
}

/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show=new Show(Announcement::findOrFail($id));

$show->field('anid', 'ANID');
$show->field('user.name', __('admin.announcements.user'));
$show->field('title', __('admin.announcements.title'));
$show->field('content', __('admin.announcements.content'));
$show->field('created_at', __('admin.created_at'));
$show->field('updated_at', __('admin.updated_at'));

return $show;
}

/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form=new Form(new Announcement());
$form->text('title', __('admin.announcements.title'))->required();
$form->simplemde('content', __('admin.announcements.content'))->help(__('admin.announcements.help.markdown'))->required();
$form->select('uid', __('admin.announcements.user'))->options(User::all()->pluck('name', 'id'))->required();
return $form;
}
}
12 changes: 6 additions & 6 deletions app/Admin/Controllers/BabelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private static function marketspaceView()
{
$extensionList=ExtensionModel::list();

if(empty($extensionList)){
if (empty($extensionList)) {
return view('admin::babel.empty');
}

Expand All @@ -145,7 +145,7 @@ private static function marketspaceDetailView($code)
{
$details=ExtensionModel::remoteDetail($code);

if(empty($details)){
if (empty($details)) {
return view('admin::babel.empty');
}

Expand All @@ -158,7 +158,7 @@ private static function executingView($extension)
{
$details=ExtensionModel::remoteDetail($extension);

if(empty($details)){
if (empty($details)) {
return view('admin::babel.empty');
}

Expand All @@ -169,15 +169,15 @@ private static function executingView($extension)

private static function executeArtisan($command)
{
$fp = popen('php "'.base_path('artisan').'" '.$command, "r");
while($b = fgets($fp, 2048)) {
$fp=popen('php "'.base_path('artisan').'" '.$command, "r");
while ($b=fgets($fp, 2048)) {
echo str_pad(json_encode([
"ret"=>200,
"desc"=>"Succeed",
"data"=>[
"message"=>$b
]
])."\n",4096);
])."\n", 4096);
@ob_flush();
flush();
}
Expand Down
Loading

0 comments on commit 6a8f406

Please sign in to comment.