@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | if (!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])) { |
| 89 | 89 | throw new Exception("data is not completely exist in cacheImage"); |
| 90 | 90 | } |
| 91 | - $ori = $data["ori"]; |
|
| 92 | - $path = $data["path"]; |
|
| 93 | - $baseurl = $data["baseurl"]; |
|
| 94 | - $space_deli = $data["space_deli"]; |
|
| 95 | - $cookie = $data["cookie"]; |
|
| 91 | + $ori=$data["ori"]; |
|
| 92 | + $path=$data["path"]; |
|
| 93 | + $baseurl=$data["baseurl"]; |
|
| 94 | + $space_deli=$data["space_deli"]; |
|
| 95 | + $cookie=$data["cookie"]; |
|
| 96 | 96 | |
| 97 | 97 | $para["path"]=$path; |
| 98 | 98 | $para["base"]=$baseurl; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $reg="/< *im[a]?g[^>]*src *= *[\"\\']?([^\"\\'>]*)[^>]*>/si"; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return preg_replace_callback($reg, function ($matches) use ($para) { |
|
| 108 | + return preg_replace_callback($reg, function($matches) use ($para) { |
|
| 109 | 109 | global $config; |
| 110 | 110 | $url=trim($matches[1]); |
| 111 | 111 | if (stripos($url, "http://")===false && stripos($url, "https://")===false) { |
@@ -138,24 +138,24 @@ discard block |
||
| 138 | 138 | public function procInfo($data) |
| 139 | 139 | { |
| 140 | 140 | if (isset($data["path"])) { |
| 141 | - $path = $data["path"]; |
|
| 141 | + $path=$data["path"]; |
|
| 142 | 142 | } else { |
| 143 | 143 | throw new Exception("path is not exist in data"); |
| 144 | 144 | } |
| 145 | 145 | if (isset($data["baseurl"])) { |
| 146 | - $baseurl = $data["baseurl"]; |
|
| 146 | + $baseurl=$data["baseurl"]; |
|
| 147 | 147 | } else { |
| 148 | 148 | throw new Exception("baseurl is not exist in data"); |
| 149 | 149 | } |
| 150 | 150 | if (isset($data["space_deli"])) { |
| 151 | - $space_deli = $data["space_deli"]; |
|
| 151 | + $space_deli=$data["space_deli"]; |
|
| 152 | 152 | } else { |
| 153 | - $space_deli = true; |
|
| 153 | + $space_deli=true; |
|
| 154 | 154 | } |
| 155 | 155 | if (isset($data["cookie"])) { |
| 156 | - $cookie = $data["cookie"]; |
|
| 156 | + $cookie=$data["cookie"]; |
|
| 157 | 157 | } else { |
| 158 | - $cookie = ""; |
|
| 158 | + $cookie=""; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $this->pro["description"]=$this->_cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | } catch (ErrorException $e) { |
| 33 | 33 | } catch (Exception $e) { |
| 34 | 34 | } |
| 35 | - $className = "App\\Babel\\Extension\\$name\\$crawlerProvider"; |
|
| 35 | + $className="App\\Babel\\Extension\\$name\\$crawlerProvider"; |
|
| 36 | 36 | if (class_exists($className)) { |
| 37 | 37 | $temp=new $className(); |
| 38 | 38 | $temp->importCommandLine($commandLineObject); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } catch (ErrorException $e) { |
| 34 | 34 | } catch (Exception $e) { |
| 35 | 35 | } |
| 36 | - $className = "App\\Babel\\Extension\\$name\\$monitorProvider"; |
|
| 36 | + $className="App\\Babel\\Extension\\$name\\$monitorProvider"; |
|
| 37 | 37 | if (class_exists($className)) { |
| 38 | 38 | return new $className(); |
| 39 | 39 | } else { |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | private $member_data; |
| 17 | 17 | private $config; |
| 18 | 18 | |
| 19 | - public function __construct($data, $config = []) |
|
| 19 | + public function __construct($data, $config=[]) |
|
| 20 | 20 | { |
| 21 | - if ($config['mode'] == 'contest') { |
|
| 22 | - $this->contest_data = $data['contest_data']; |
|
| 23 | - $this->member_data = $data['member_data']; |
|
| 21 | + if ($config['mode']=='contest') { |
|
| 22 | + $this->contest_data=$data['contest_data']; |
|
| 23 | + $this->member_data=$data['member_data']; |
|
| 24 | 24 | } else { |
| 25 | - $this->member_data = $data['member_data']; |
|
| 26 | - $this->tag_problems = $data['tag_problems']; |
|
| 25 | + $this->member_data=$data['member_data']; |
|
| 26 | + $this->tag_problems=$data['tag_problems']; |
|
| 27 | 27 | } |
| 28 | - $this->config = $config; |
|
| 28 | + $this->config=$config; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | public function registerEvents(): array |
| 35 | 35 | { |
| 36 | 36 | return [ |
| 37 | - AfterSheet::class => function (AfterSheet $event) { |
|
| 38 | - if ($this->config['mode'] === 'contest') { |
|
| 39 | - $mergeCell = ['A1:A2','B1:E1']; |
|
| 37 | + AfterSheet::class => function(AfterSheet $event) { |
|
| 38 | + if ($this->config['mode']==='contest') { |
|
| 39 | + $mergeCell=['A1:A2', 'B1:E1']; |
|
| 40 | 40 | foreach ($this->contest_data as $c) { |
| 41 | 41 | array_push($mergeCell, $this->mergeCellColumnNext()); |
| 42 | 42 | } |
@@ -51,44 +51,44 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function collection() |
| 53 | 53 | { |
| 54 | - $maxium = $this->config['maxium'] ?? false; |
|
| 55 | - $percent = $this->config['percent'] ?? false; |
|
| 54 | + $maxium=$this->config['maxium'] ?? false; |
|
| 55 | + $percent=$this->config['percent'] ?? false; |
|
| 56 | 56 | |
| 57 | - if ($this->config['mode'] == 'contest') { |
|
| 58 | - $row_1 = ['Member','Total','','','']; |
|
| 59 | - $row_2 = ['','Elo','Rank','Solved','Penalty']; |
|
| 57 | + if ($this->config['mode']=='contest') { |
|
| 58 | + $row_1=['Member', 'Total', '', '', '']; |
|
| 59 | + $row_2=['', 'Elo', 'Rank', 'Solved', 'Penalty']; |
|
| 60 | 60 | foreach ($this->contest_data as $contest) { |
| 61 | 61 | array_push($row_1, $contest['name'], ''); |
| 62 | 62 | array_push($row_2, 'Solved', 'Penalty'); |
| 63 | 63 | } |
| 64 | - $data = [$row_1,$row_2]; |
|
| 64 | + $data=[$row_1, $row_2]; |
|
| 65 | 65 | foreach ($this->member_data as $member) { |
| 66 | - $display_name = $member['name']; |
|
| 66 | + $display_name=$member['name']; |
|
| 67 | 67 | if (!empty($member['nick_name'])) { |
| 68 | - $display_name .= ' ('.$member['nick_name'].')'; |
|
| 68 | + $display_name.=' ('.$member['nick_name'].')'; |
|
| 69 | 69 | } |
| 70 | - $row = [ |
|
| 70 | + $row=[ |
|
| 71 | 71 | $display_name, |
| 72 | 72 | $member['elo'], |
| 73 | 73 | !empty($member['rank_ave']) ? round($member['rank_ave'], 1) : '-', |
| 74 | - $percent === 'true' ? ($member['problem_all'] != 0 ? round($member['solved_all'] / $member['problem_all'] * 100, 1) : '-'). ' %' |
|
| 75 | - : ($maxium === 'true' ? $member['solved_all'] . ' / ' . $member['problem_all'] : $member['solved_all']), |
|
| 74 | + $percent==='true' ? ($member['problem_all']!=0 ? round($member['solved_all'] / $member['problem_all'] * 100, 1) : '-').' %' |
|
| 75 | + : ($maxium==='true' ? $member['solved_all'].' / '.$member['problem_all'] : $member['solved_all']), |
|
| 76 | 76 | round($member['penalty']), |
| 77 | 77 | ]; |
| 78 | 78 | foreach ($this->contest_data as $contest) { |
| 79 | 79 | if (in_array($contest['cid'], array_keys($member['contest_detial']))) { |
| 80 | - $contest_detial = $member['contest_detial'][$contest['cid']]; |
|
| 80 | + $contest_detial=$member['contest_detial'][$contest['cid']]; |
|
| 81 | 81 | array_push( |
| 82 | 82 | $row, |
| 83 | - $percent === 'true' ? (round($contest_detial['solved'] / $contest_detial['problems'] * 100, 1) . ' %') |
|
| 84 | - : ($maxium === 'true' ? $contest_detial['solved'].' / '.$contest_detial['problems'] : $contest_detial['solved']), |
|
| 83 | + $percent==='true' ? (round($contest_detial['solved'] / $contest_detial['problems'] * 100, 1).' %') |
|
| 84 | + : ($maxium==='true' ? $contest_detial['solved'].' / '.$contest_detial['problems'] : $contest_detial['solved']), |
|
| 85 | 85 | round($contest_detial['penalty']) |
| 86 | 86 | ); |
| 87 | 87 | } else { |
| 88 | 88 | array_push( |
| 89 | 89 | $row, |
| 90 | - $percent === 'true' ? '- %' |
|
| 91 | - : ($maxium === 'true' ? '- / -' : ' - '), |
|
| 90 | + $percent==='true' ? '- %' |
|
| 91 | + : ($maxium==='true' ? '- / -' : ' - '), |
|
| 92 | 92 | 0 |
| 93 | 93 | ); |
| 94 | 94 | } |
@@ -96,27 +96,27 @@ discard block |
||
| 96 | 96 | array_push($data, $row); |
| 97 | 97 | } |
| 98 | 98 | } else { |
| 99 | - $row_1 = ['Member']; |
|
| 100 | - $row_2 = ['']; |
|
| 99 | + $row_1=['Member']; |
|
| 100 | + $row_2=['']; |
|
| 101 | 101 | foreach ($this->tag_problems as $tag => $tag_problem_set) { |
| 102 | 102 | array_push($row_1, $tag); |
| 103 | 103 | array_push($row_2, 'Solved'); |
| 104 | 104 | } |
| 105 | - $data = [$row_1,$row_2]; |
|
| 105 | + $data=[$row_1, $row_2]; |
|
| 106 | 106 | foreach ($this->member_data as $member) { |
| 107 | - $display_name = $member['name']; |
|
| 107 | + $display_name=$member['name']; |
|
| 108 | 108 | if (!empty($member['nick_name'])) { |
| 109 | - $display_name .= ' ('.$member['nick_name'].')'; |
|
| 109 | + $display_name.=' ('.$member['nick_name'].')'; |
|
| 110 | 110 | } |
| 111 | - $row = [ |
|
| 111 | + $row=[ |
|
| 112 | 112 | $display_name, |
| 113 | 113 | ]; |
| 114 | 114 | foreach ($member['completion'] as $tag => $tag_completion) { |
| 115 | - $count = count($tag_completion); |
|
| 116 | - $solved = eval('return '.join('+', array_values($tag_completion)).';'); |
|
| 115 | + $count=count($tag_completion); |
|
| 116 | + $solved=eval('return '.join('+', array_values($tag_completion)).';'); |
|
| 117 | 117 | array_push( |
| 118 | 118 | $row, |
| 119 | - $percent === 'true' ? (round($solved / $count * 100, 1) . ' %') : ($maxium === 'true' ? $solved .' / '.$count : $solved) |
|
| 119 | + $percent==='true' ? (round($solved / $count * 100, 1).' %') : ($maxium==='true' ? $solved.' / '.$count : $solved) |
|
| 120 | 120 | ); |
| 121 | 121 | } |
| 122 | 122 | array_push($data, $row); |
@@ -127,33 +127,33 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | private function mergeCellColumnNext() |
| 129 | 129 | { |
| 130 | - static $columns = [ |
|
| 131 | - [3],[4] |
|
| 130 | + static $columns=[ |
|
| 131 | + [3], [4] |
|
| 132 | 132 | ]; |
| 133 | - $columns_str = ['','']; |
|
| 134 | - $chars = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); |
|
| 133 | + $columns_str=['', '']; |
|
| 134 | + $chars=str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); |
|
| 135 | 135 | foreach ($columns as $key => &$column) { |
| 136 | - $column[0] += 2; |
|
| 137 | - if ($column[0] > 25) { |
|
| 136 | + $column[0]+=2; |
|
| 137 | + if ($column[0]>25) { |
|
| 138 | 138 | if (isset($column[1])) { |
| 139 | - $column[1] += 1; |
|
| 140 | - if ($column[1] > 25) { |
|
| 139 | + $column[1]+=1; |
|
| 140 | + if ($column[1]>25) { |
|
| 141 | 141 | if (isset($column[2])) { |
| 142 | - $column[2] += 1; |
|
| 142 | + $column[2]+=1; |
|
| 143 | 143 | } else { |
| 144 | - $column[2] = 0; |
|
| 144 | + $column[2]=0; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } else { |
| 148 | - $column[1] = 0; |
|
| 148 | + $column[1]=0; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | - $columns_str[$key] = ''; |
|
| 152 | - $reverse_column = array_reverse($column); |
|
| 151 | + $columns_str[$key]=''; |
|
| 152 | + $reverse_column=array_reverse($column); |
|
| 153 | 153 | foreach ($reverse_column as $ord) { |
| 154 | - $columns_str[$key] .= $chars[$ord]; |
|
| 154 | + $columns_str[$key].=$chars[$ord]; |
|
| 155 | 155 | } |
| 156 | - $columns_str[$key] .= '1'; |
|
| 156 | + $columns_str[$key].='1'; |
|
| 157 | 157 | } |
| 158 | 158 | return $columns_str[0].':'.$columns_str[1]; |
| 159 | 159 | } |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $version=UpdateModel::checkUpdate(); |
| 15 | 15 | |
| 16 | - $status = [ |
|
| 17 | - ['name' => 'NOJ Version', 'value' => version()], |
|
| 18 | - ['name' => 'Lastest Version', 'value' => is_null($version)?'Failed to fetch latest version':$version["name"]], |
|
| 19 | - ['name' => 'Problems', 'value' => \App\Models\Eloquent\ProblemModel::count()], |
|
| 20 | - ['name' => 'Solutions', 'value' => \App\Models\Eloquent\ProblemSolutionModel::count()], |
|
| 21 | - ['name' => 'Submissions', 'value' => \App\Models\Eloquent\SubmissionModel::count()], |
|
| 22 | - ['name' => 'Contests', 'value' => \App\Models\Eloquent\ContestModel::count()], |
|
| 23 | - ['name' => 'Users', 'value' => \App\Models\Eloquent\UserModel::count()], |
|
| 24 | - ['name' => 'Groups', 'value' => \App\Models\Eloquent\GroupModel::count()], |
|
| 16 | + $status=[ |
|
| 17 | + ['name' => 'NOJ Version', 'value' => version()], |
|
| 18 | + ['name' => 'Lastest Version', 'value' => is_null($version) ? 'Failed to fetch latest version' : $version["name"]], |
|
| 19 | + ['name' => 'Problems', 'value' => \App\Models\Eloquent\ProblemModel::count()], |
|
| 20 | + ['name' => 'Solutions', 'value' => \App\Models\Eloquent\ProblemSolutionModel::count()], |
|
| 21 | + ['name' => 'Submissions', 'value' => \App\Models\Eloquent\SubmissionModel::count()], |
|
| 22 | + ['name' => 'Contests', 'value' => \App\Models\Eloquent\ContestModel::count()], |
|
| 23 | + ['name' => 'Users', 'value' => \App\Models\Eloquent\UserModel::count()], |
|
| 24 | + ['name' => 'Groups', 'value' => \App\Models\Eloquent\GroupModel::count()], |
|
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | return view('admin::dashboard.general', [ |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $extensionList=ExtensionModel::list(); |
| 34 | 34 | |
| 35 | - if(empty($extensionList)){ |
|
| 35 | + if (empty($extensionList)) { |
|
| 36 | 36 | return redirect('/admin'); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $router->resource('contests', ContestController::class); |
| 18 | 18 | $router->resource('groups', GroupController::class); |
| 19 | 19 | |
| 20 | - Route::group(['prefix' => 'babel'], function (Router $router) { |
|
| 20 | + Route::group(['prefix' => 'babel'], function(Router $router) { |
|
| 21 | 21 | $router->get('/', 'BabelController@index'); |
| 22 | 22 | }); |
| 23 | 23 | |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | 'site_title' => config("app.name"), |
| 20 | 20 | 'navigation' => null, |
| 21 | 21 | 'search_key' => $request->input('q'), |
| 22 | - 'search_category' => $request->input('tab','problems'), |
|
| 23 | - 'page' => $request->input('page',1) |
|
| 22 | + 'search_category' => $request->input('tab', 'problems'), |
|
| 23 | + 'page' => $request->input('page', 1) |
|
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $all_data=$request->all(); |
| 38 | 38 | |
| 39 | - if(($all_data['public'] ?? 0) && ($all_data['practice'] ?? 0)){ |
|
| 39 | + if (($all_data['public'] ?? 0) && ($all_data['practice'] ?? 0)) { |
|
| 40 | 40 | return ResponseModel::err(4007); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return ResponseModel::err(1003); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $cid = $contestModel->arrangeContest($all_data["gid"], [ |
|
| 70 | + $cid=$contestModel->arrangeContest($all_data["gid"], [ |
|
| 71 | 71 | "assign_uid"=>Auth::user()->id, |
| 72 | 72 | "name"=>$all_data["name"], |
| 73 | 73 | "description"=>$all_data["description"], |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | "public"=>$all_data["public"] ?? 0, |
| 78 | 78 | ], $problemSet); |
| 79 | 79 | |
| 80 | - return ResponseModel::success(200,'Successful!',$cid); |
|
| 80 | + return ResponseModel::success(200, 'Successful!', $cid); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function changeGroupName(Request $request) |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $groupModel=new GroupModel(); |
| 93 | 93 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 94 | - if ($clearance < 2){ |
|
| 94 | + if ($clearance<2) { |
|
| 95 | 95 | return ResponseModel::err(2001); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $groupModel=new GroupModel(); |
| 112 | 112 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 113 | - if ($clearance < 2){ |
|
| 113 | + if ($clearance<2) { |
|
| 114 | 114 | return ResponseModel::err(2001); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ($all_data["join_policy"] < 1 || $all_data["join_policy"] > 3){ |
|
| 117 | + if ($all_data["join_policy"]<1 || $all_data["join_policy"]>3) { |
|
| 118 | 118 | return ResponseModel::err(1007); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'gid' => 'required|integer', |
| 129 | 129 | ]); |
| 130 | 130 | |
| 131 | - $all_data = $request->all(); |
|
| 131 | + $all_data=$request->all(); |
|
| 132 | 132 | |
| 133 | 133 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
| 134 | 134 | $extension=$request->file('img')->extension(); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $groupModel=new GroupModel(); |
| 142 | 142 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 143 | - if ($clearance < 2){ |
|
| 143 | + if ($clearance<2) { |
|
| 144 | 144 | return ResponseModel::err(2001); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -178,18 +178,18 @@ discard block |
||
| 178 | 178 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 179 | 179 | $target_clearance=$groupModel->judgeClearance($all_data["gid"], $all_data['uid']); |
| 180 | 180 | |
| 181 | - if($target_clearance == -3){ |
|
| 181 | + if ($target_clearance==-3) { |
|
| 182 | 182 | return ResponseModel::err(7004); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if($target_clearance >= $clearance || $clearance < 2 || $all_data['permission'] >= $clearance){ |
|
| 185 | + if ($target_clearance>=$clearance || $clearance<2 || $all_data['permission']>=$clearance) { |
|
| 186 | 186 | return ResponseModel::err(2001); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $groupModel->changeClearance($all_data['uid'], $all_data["gid"], $all_data['permission']); |
| 190 | 190 | |
| 191 | - $result_info = $groupModel->userProfile($all_data['uid'],$all_data["gid"]); |
|
| 192 | - return ResponseModel::success(200,null,$result_info); |
|
| 191 | + $result_info=$groupModel->userProfile($all_data['uid'], $all_data["gid"]); |
|
| 192 | + return ResponseModel::success(200, null, $result_info); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | public function generateContestAccount(Request $request) |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 270 | 270 | $targetClearance=$groupModel->judgeClearance($all_data["gid"], $all_data["uid"]); |
| 271 | 271 | if ($clearance>1) { |
| 272 | - if($targetClearance!=0) { |
|
| 272 | + if ($targetClearance!=0) { |
|
| 273 | 273 | return ResponseModel::err(7003); |
| 274 | 274 | } |
| 275 | 275 | $groupModel->changeClearance($all_data["uid"], $all_data["gid"], 1); |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $groupModel=new GroupModel(); |
| 310 | 310 | $is_user=$groupModel->isUser($all_data["email"]); |
| 311 | - if(!$is_user) return ResponseModel::err(2006); |
|
| 311 | + if (!$is_user) return ResponseModel::err(2006); |
|
| 312 | 312 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 313 | - if($clearance<2) return ResponseModel::err(7002); |
|
| 313 | + if ($clearance<2) return ResponseModel::err(7002); |
|
| 314 | 314 | $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]); |
| 315 | - if($targetClearance!=-3) return ResponseModel::err(7003); |
|
| 315 | + if ($targetClearance!=-3) return ResponseModel::err(7003); |
|
| 316 | 316 | $groupModel->inviteMember($all_data["gid"], $all_data["email"]); |
| 317 | 317 | return ResponseModel::success(200); |
| 318 | 318 | } |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | $all_data=$request->all(); |
| 331 | 331 | |
| 332 | 332 | $groupModel=new GroupModel(); |
| 333 | - if($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
| 333 | + if ($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
| 334 | 334 | $is_group=$groupModel->isGroup($all_data["gcode"]); |
| 335 | - if($is_group) return ResponseModel::err(7006); |
|
| 335 | + if ($is_group) return ResponseModel::err(7006); |
|
| 336 | 336 | |
| 337 | 337 | $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp']; |
| 338 | 338 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $groupModel=new GroupModel(); |
| 384 | 384 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 385 | - if ($clearance < 2){ |
|
| 385 | + if ($clearance<2) { |
|
| 386 | 386 | return ResponseModel::err(2001); |
| 387 | 387 | } |
| 388 | 388 | $groupModel->createNotice($all_data["gid"], Auth::user()->id, $all_data["title"], $all_data["content"]); |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $groupModel=new GroupModel(); |
| 403 | 403 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 404 | - if ($clearance < 2) { |
|
| 404 | + if ($clearance<2) { |
|
| 405 | 405 | return ResponseModel::err(7002); |
| 406 | 406 | } |
| 407 | - $tags = $groupModel->problemTags($all_data['gid'],$all_data['pid']); |
|
| 408 | - if(in_array($all_data['tag'],$tags)){ |
|
| 407 | + $tags=$groupModel->problemTags($all_data['gid'], $all_data['pid']); |
|
| 408 | + if (in_array($all_data['tag'], $tags)) { |
|
| 409 | 409 | return ResponseModel::err(7007); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -443,20 +443,20 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $groupModel=new GroupModel(); |
| 445 | 445 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 446 | - if ($clearance > 0) { |
|
| 447 | - switch($all_data['mode']){ |
|
| 446 | + if ($clearance>0) { |
|
| 447 | + switch ($all_data['mode']) { |
|
| 448 | 448 | case 'contest': |
| 449 | - $ret = $groupModel->groupMemberPracticeContestStat($all_data["gid"]); |
|
| 449 | + $ret=$groupModel->groupMemberPracticeContestStat($all_data["gid"]); |
|
| 450 | 450 | break; |
| 451 | 451 | case 'tag': |
| 452 | - $ret = $groupModel->groupMemberPracticeTagStat($all_data["gid"]); |
|
| 452 | + $ret=$groupModel->groupMemberPracticeTagStat($all_data["gid"]); |
|
| 453 | 453 | break; |
| 454 | 454 | default: |
| 455 | 455 | return ResponseModel::err(1007); |
| 456 | 456 | break; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - return ResponseModel::success(200,null,$ret); |
|
| 459 | + return ResponseModel::success(200, null, $ret); |
|
| 460 | 460 | } |
| 461 | 461 | return ResponseModel::err(7002); |
| 462 | 462 | } |
@@ -466,9 +466,9 @@ discard block |
||
| 466 | 466 | $request->validate([ |
| 467 | 467 | 'gid' => 'required|string', |
| 468 | 468 | ]); |
| 469 | - $gid = $request->input('gid'); |
|
| 469 | + $gid=$request->input('gid'); |
|
| 470 | 470 | $groupModel=new GroupModel(); |
| 471 | - if($groupModel->judgeClearance($gid,Auth::user()->id) < 2) { |
|
| 471 | + if ($groupModel->judgeClearance($gid, Auth::user()->id)<2) { |
|
| 472 | 472 | return ResponseModel::err(2001); |
| 473 | 473 | } |
| 474 | 474 | $groupModel->refreshElo($gid); |