@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function details($gcode) |
80 | 80 | { |
81 | 81 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
82 | - if(empty($basic_info)) return []; |
|
82 | + if (empty($basic_info)) return []; |
|
83 | 83 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
84 | 84 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
85 | 85 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["create_time"]), 'M jS, Y'); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | foreach ($user_list as &$u) { |
121 | 121 | $u["role_parsed"]=$this->role[$u["role"]]; |
122 | 122 | $u["role_color"]=$this->role_color[$u["role"]]; |
123 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
123 | + if (is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
124 | 124 | } |
125 | 125 | return $user_list; |
126 | 126 | } |
@@ -79,7 +79,9 @@ discard block |
||
79 | 79 | public function details($gcode) |
80 | 80 | { |
81 | 81 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
82 | - if(empty($basic_info)) return []; |
|
82 | + if(empty($basic_info)) { |
|
83 | + return []; |
|
84 | + } |
|
83 | 85 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
84 | 86 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
85 | 87 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["create_time"]), 'M jS, Y'); |
@@ -120,7 +122,9 @@ discard block |
||
120 | 122 | foreach ($user_list as &$u) { |
121 | 123 | $u["role_parsed"]=$this->role[$u["role"]]; |
122 | 124 | $u["role_color"]=$this->role_color[$u["role"]]; |
123 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
125 | + if(is_null($u["sub_group"])) { |
|
126 | + $u["sub_group"]="None"; |
|
127 | + } |
|
124 | 128 | } |
125 | 129 | return $user_list; |
126 | 130 | } |
@@ -147,7 +147,7 @@ |
||
147 | 147 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
148 | 148 | $targetClearance=$groupModel->judgeClearance($all_data["gid"], $all_data["uid"]); |
149 | 149 | if ($clearance>1) { |
150 | - if($targetClearance!=0) { |
|
150 | + if ($targetClearance!=0) { |
|
151 | 151 | return ResponseModel::err(7003); |
152 | 152 | } |
153 | 153 | $groupModel->changeClearance($all_data["uid"], $all_data["gid"], 1); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | class AccountController extends Controller |
17 | 17 | { |
18 | 18 | |
19 | - public function updateAvatar(Request $request){ |
|
19 | + public function updateAvatar(Request $request) { |
|
20 | 20 | $isValid=$request->file('avatar')->isValid(); |
21 | 21 | if ($isValid) { |
22 | 22 | $extension=$request->file('avatar')->extension(); |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - public function changeBasicInfo(Request $request){ |
|
46 | + public function changeBasicInfo(Request $request) { |
|
47 | 47 | // if(!$request->has('username')){ |
48 | 48 | // return ResponseModel::err(1003); |
49 | 49 | // } |
50 | 50 | // $username = $request->input('username'); |
51 | - $describes = $request->input('describes'); |
|
52 | - if(strlen($describes) > 255){ |
|
51 | + $describes=$request->input('describes'); |
|
52 | + if (strlen($describes)>255) { |
|
53 | 53 | return ResponseModel::err(1006); |
54 | 54 | } |
55 | 55 | // $old_username=Auth::user()->name; |
@@ -58,79 +58,79 @@ discard block |
||
58 | 58 | // } |
59 | 59 | $user=Auth::user(); |
60 | 60 | // $user->name = $username; |
61 | - $user->describes = $describes; |
|
61 | + $user->describes=$describes; |
|
62 | 62 | $user->save(); |
63 | 63 | return ResponseModel::success(); |
64 | 64 | } |
65 | 65 | |
66 | - public function changePassword(Request $request){ |
|
67 | - if(!$request->has('old_password') || !$request->has('new_password') || !$request->has('confirm_password')){ |
|
66 | + public function changePassword(Request $request) { |
|
67 | + if (!$request->has('old_password') || !$request->has('new_password') || !$request->has('confirm_password')) { |
|
68 | 68 | return ResponseModel::err(1003); |
69 | 69 | } |
70 | - $old_password = $request->input('old_password'); |
|
71 | - $new_password = $request->input('new_password'); |
|
72 | - $confirm_password = $request->input('confirm_password'); |
|
73 | - if($new_password != $confirm_password){ |
|
70 | + $old_password=$request->input('old_password'); |
|
71 | + $new_password=$request->input('new_password'); |
|
72 | + $confirm_password=$request->input('confirm_password'); |
|
73 | + if ($new_password!=$confirm_password) { |
|
74 | 74 | return ResponseModel::err(2004); |
75 | 75 | } |
76 | - if(strlen($new_password) < 8 || strlen($old_password) < 8){ |
|
76 | + if (strlen($new_password)<8 || strlen($old_password)<8) { |
|
77 | 77 | return ResponseModel::err(1006); |
78 | 78 | } |
79 | - $user = Auth::user(); |
|
80 | - if(!Hash::check($old_password, $user->password)){ |
|
79 | + $user=Auth::user(); |
|
80 | + if (!Hash::check($old_password, $user->password)) { |
|
81 | 81 | return ResponseModel::err(2005); |
82 | 82 | } |
83 | - $user->password = Hash::make($new_password); |
|
83 | + $user->password=Hash::make($new_password); |
|
84 | 84 | $user->save(); |
85 | 85 | return ResponseModel::success(); |
86 | 86 | } |
87 | 87 | |
88 | - public function checkEmailCooldown(Request $request){ |
|
89 | - $last_send = $request->session()->get('last_email_send'); |
|
90 | - if(empty($last_send) || time() - $last_send >= 300){ |
|
91 | - $request->session()->put('last_email_send',time()); |
|
92 | - return ResponseModel::success(200,null,0); |
|
93 | - }else{ |
|
94 | - $cooldown = 300 - (time() - $last_send); |
|
95 | - return ResponseModel::success(200,null,$cooldown); |
|
88 | + public function checkEmailCooldown(Request $request) { |
|
89 | + $last_send=$request->session()->get('last_email_send'); |
|
90 | + if (empty($last_send) || time()-$last_send>=300) { |
|
91 | + $request->session()->put('last_email_send', time()); |
|
92 | + return ResponseModel::success(200, null, 0); |
|
93 | + } else { |
|
94 | + $cooldown=300-(time()-$last_send); |
|
95 | + return ResponseModel::success(200, null, $cooldown); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - public function changeExtraInfo(Request $request){ |
|
100 | - $input = $request->input(); |
|
101 | - $allow_change = ['gender','contact','school','country','location']; |
|
102 | - foreach($input as $key => $value){ |
|
103 | - if(!in_array($key,$allow_change)){ |
|
99 | + public function changeExtraInfo(Request $request) { |
|
100 | + $input=$request->input(); |
|
101 | + $allow_change=['gender', 'contact', 'school', 'country', 'location']; |
|
102 | + foreach ($input as $key => $value) { |
|
103 | + if (!in_array($key, $allow_change)) { |
|
104 | 104 | return ResponseModel::error(1007); |
105 | 105 | } |
106 | 106 | } |
107 | - $account_model = new AccountModel(); |
|
108 | - $user_id = Auth::user()->id; |
|
107 | + $account_model=new AccountModel(); |
|
108 | + $user_id=Auth::user()->id; |
|
109 | 109 | foreach ($input as $key => $value) { |
110 | - if(strlen($value) != 0){ |
|
111 | - $account_model->setExtraInfo($user_id,$key,$value,0); |
|
112 | - }else{ |
|
113 | - $account_model->unsetExtraInfoIfExist($user_id,$key); |
|
110 | + if (strlen($value)!=0) { |
|
111 | + $account_model->setExtraInfo($user_id, $key, $value, 0); |
|
112 | + } else { |
|
113 | + $account_model->unsetExtraInfoIfExist($user_id, $key); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return ResponseModel::success(); |
117 | 117 | } |
118 | 118 | |
119 | - public function saveEditorWidth(Request $request){ |
|
120 | - $input = $request->input(); |
|
121 | - $allow_change = ['editor_left_width']; |
|
122 | - foreach($input as $key => $value){ |
|
123 | - if(!in_array($key,$allow_change)){ |
|
119 | + public function saveEditorWidth(Request $request) { |
|
120 | + $input=$request->input(); |
|
121 | + $allow_change=['editor_left_width']; |
|
122 | + foreach ($input as $key => $value) { |
|
123 | + if (!in_array($key, $allow_change)) { |
|
124 | 124 | return ResponseModel::error(1007); |
125 | 125 | } |
126 | 126 | } |
127 | - $account_model = new AccountModel(); |
|
128 | - $user_id = Auth::user()->id; |
|
127 | + $account_model=new AccountModel(); |
|
128 | + $user_id=Auth::user()->id; |
|
129 | 129 | foreach ($input as $key => $value) { |
130 | - if(strlen($value) != 0){ |
|
131 | - $account_model->setExtraInfo($user_id,$key,$value,0); |
|
132 | - }else{ |
|
133 | - $account_model->unsetExtraInfoIfExist($user_id,$key); |
|
130 | + if (strlen($value)!=0) { |
|
131 | + $account_model->setExtraInfo($user_id, $key, $value, 0); |
|
132 | + } else { |
|
133 | + $account_model->unsetExtraInfoIfExist($user_id, $key); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | return ResponseModel::success(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if(empty($last_send) || time() - $last_send >= 300){ |
91 | 91 | $request->session()->put('last_email_send',time()); |
92 | 92 | return ResponseModel::success(200,null,0); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $cooldown = 300 - (time() - $last_send); |
95 | 95 | return ResponseModel::success(200,null,$cooldown); |
96 | 96 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | foreach ($input as $key => $value) { |
110 | 110 | if(strlen($value) != 0){ |
111 | 111 | $account_model->setExtraInfo($user_id,$key,$value,0); |
112 | - }else{ |
|
112 | + } else{ |
|
113 | 113 | $account_model->unsetExtraInfoIfExist($user_id,$key); |
114 | 114 | } |
115 | 115 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | foreach ($input as $key => $value) { |
130 | 130 | if(strlen($value) != 0){ |
131 | 131 | $account_model->setExtraInfo($user_id,$key,$value,0); |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | $account_model->unsetExtraInfoIfExist($user_id,$key); |
134 | 134 | } |
135 | 135 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | ]; |
132 | 132 | } |
133 | 133 | |
134 | - $editor_left_width = $account->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
134 | + $editor_left_width=$account->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
135 | 135 | |
136 | 136 | return is_null($prob_detail) ? redirect("/problem") : view('problem.editor', [ |
137 | 137 | 'page_title'=>$prob_detail["title"], |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function index() |
23 | 23 | { |
24 | 24 | $contestModel=new ContestModel(); |
25 | - $return_list=$contestModel->list(Auth::check()?Auth::user()->id:0); |
|
25 | + $return_list=$contestModel->list(Auth::check() ?Auth::user()->id : 0); |
|
26 | 26 | $featured=$contestModel->featured(); |
27 | 27 | return view('contest.index', [ |
28 | 28 | 'page_title'=>"Contest", |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ]; |
158 | 158 | } |
159 | 159 | |
160 | - $editor_left_width = $accountModel->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
160 | + $editor_left_width=$accountModel->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
161 | 161 | |
162 | 162 | return view('contest.board.editor', [ |
163 | 163 | 'page_title'=>"Problem Detail", |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'WRONG_ANSWER'=>"Wrong Answer", |
109 | 109 | ]; |
110 | 110 | |
111 | - $hdu_v = [ |
|
111 | + $hdu_v=[ |
|
112 | 112 | 'Accepted'=>"Accepted", |
113 | 113 | "Presentation Error"=>"Presentation Error", |
114 | 114 | 'Time Limit Exceeded'=>"Time Limit Exceed", |
@@ -364,22 +364,22 @@ discard block |
||
364 | 364 | "verdict"=>$sub['verdict'] |
365 | 365 | ]; |
366 | 366 | $this->MODEL->updateSubmission($row['sid'], $sub); |
367 | - }else if($row['oid'] == 8) { |
|
367 | + } else if ($row['oid']==8) { |
|
368 | 368 | try { |
369 | - $sub = []; |
|
370 | - $response = Request::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
|
371 | - preg_match ('/<\/td><td>[\\s\\S]*?<\/td><td>[\\s\\S]*?<\/td><td>([\\s\\S]*?)<\/td><td>[\\s\\S]*?<\/td><td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/', $response, $match); |
|
372 | - $sub['verdict'] = $hdu_v[trim(strip_tags($match[1]))]; |
|
373 | - preg_match ("/<td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/", $response, $matches); |
|
374 | - $sub['remote_id'] = $row['remote_id']; |
|
375 | - $sub['time'] = intval($matches[1]); |
|
376 | - $sub['memory'] = intval($matches[2]); |
|
369 | + $sub=[]; |
|
370 | + $response=Request::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
|
371 | + preg_match('/<\/td><td>[\\s\\S]*?<\/td><td>[\\s\\S]*?<\/td><td>([\\s\\S]*?)<\/td><td>[\\s\\S]*?<\/td><td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/', $response, $match); |
|
372 | + $sub['verdict']=$hdu_v[trim(strip_tags($match[1]))]; |
|
373 | + preg_match("/<td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/", $response, $matches); |
|
374 | + $sub['remote_id']=$row['remote_id']; |
|
375 | + $sub['time']=intval($matches[1]); |
|
376 | + $sub['memory']=intval($matches[2]); |
|
377 | 377 | // $sub['score'] = ($sub['verdict'] == 'Accepted')?100:0; |
378 | 378 | |
379 | - if($sub['verdict'] == 'Compile Error') { |
|
380 | - $ret = Request::get("http://acm.hdu.edu.cn/viewerror.php?rid=".$row['remote_id']); |
|
381 | - preg_match ("/<pre>([\\s\\S]*?)<\/pre>/", $ret, $match); |
|
382 | - $sub['compile_info'] = trim(strip_tags($match[0])); |
|
379 | + if ($sub['verdict']=='Compile Error') { |
|
380 | + $ret=Request::get("http://acm.hdu.edu.cn/viewerror.php?rid=".$row['remote_id']); |
|
381 | + preg_match("/<pre>([\\s\\S]*?)<\/pre>/", $ret, $match); |
|
382 | + $sub['compile_info']=trim(strip_tags($match[0])); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $this->MODEL->updateSubmission($row['sid'], $sub); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | private function get_last_uva($earliest) |
434 | 434 | { |
435 | - $ret = []; |
|
435 | + $ret=[]; |
|
436 | 436 | if (!$earliest) { |
437 | 437 | return $ret; |
438 | 438 | } |
@@ -364,7 +364,7 @@ |
||
364 | 364 | "verdict"=>$sub['verdict'] |
365 | 365 | ]; |
366 | 366 | $this->MODEL->updateSubmission($row['sid'], $sub); |
367 | - }else if($row['oid'] == 8) { |
|
367 | + } else if($row['oid'] == 8) { |
|
368 | 368 | try { |
369 | 369 | $sub = []; |
370 | 370 | $response = Request::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
@@ -59,8 +59,8 @@ |
||
59 | 59 | $UVa->submit(); |
60 | 60 | } |
61 | 61 | |
62 | - if($oj=='hdu') { |
|
63 | - $HDU = new HDU($sub, $all_data); |
|
62 | + if ($oj=='hdu') { |
|
63 | + $HDU=new HDU($sub, $all_data); |
|
64 | 64 | $HDU->submit(); |
65 | 65 | } |
66 | 66 | } |
@@ -80,46 +80,46 @@ |
||
80 | 80 | |
81 | 81 | public function crawler($con) |
82 | 82 | { |
83 | - if($con == "all") { |
|
84 | - return ; |
|
83 | + if ($con=="all") { |
|
84 | + return; |
|
85 | 85 | } |
86 | - $this->con = $con; |
|
87 | - $this->imgi = 1; |
|
88 | - $problemModel = new ProblemModel(); |
|
89 | - $res = Requests::get("http://acm.hdu.edu.cn/showproblem.php?pid={$con}"); |
|
90 | - if (strpos("No such problem",$res->body) !== false) { |
|
86 | + $this->con=$con; |
|
87 | + $this->imgi=1; |
|
88 | + $problemModel=new ProblemModel(); |
|
89 | + $res=Requests::get("http://acm.hdu.edu.cn/showproblem.php?pid={$con}"); |
|
90 | + if (strpos("No such problem", $res->body)!==false) { |
|
91 | 91 | header('HTTP/1.1 404 Not Found'); |
92 | 92 | die(); |
93 | 93 | } |
94 | - else if(strpos("Invalid Parameter.",$res->body) !== false) { |
|
94 | + else if (strpos("Invalid Parameter.", $res->body)!==false) { |
|
95 | 95 | header('HTTP/1.1 404 Not Found'); |
96 | 96 | die(); |
97 | 97 | } |
98 | 98 | else { |
99 | - $this->pro['pcode'] = "HDU".$con; |
|
100 | - $this->pro['OJ'] = 8; |
|
101 | - $this->pro['contest_id'] = null; |
|
102 | - $this->pro['index_id'] = $con; |
|
103 | - $this->pro['origin'] = "http://acm.hdu.edu.cn/showproblem.php?pid={$con}"; |
|
104 | - $this->pro['title'] = self::find("/<h1 style='color:#1A5CC8'>([\s\S]*?)<\/h1>/",$res->body); |
|
105 | - $this->pro['time_limit'] = self::find('/Time Limit:.*\/(.*) MS/',$res->body); |
|
106 | - $this->pro['memory_limit'] = self::find('/Memory Limit:.*\/(.*) K/',$res->body); |
|
107 | - $this->pro['solved_count'] = self::find("/Accepted Submission(s): ([\d+]*?)/",$res->body); |
|
99 | + $this->pro['pcode']="HDU".$con; |
|
100 | + $this->pro['OJ']=8; |
|
101 | + $this->pro['contest_id']=null; |
|
102 | + $this->pro['index_id']=$con; |
|
103 | + $this->pro['origin']="http://acm.hdu.edu.cn/showproblem.php?pid={$con}"; |
|
104 | + $this->pro['title']=self::find("/<h1 style='color:#1A5CC8'>([\s\S]*?)<\/h1>/", $res->body); |
|
105 | + $this->pro['time_limit']=self::find('/Time Limit:.*\/(.*) MS/', $res->body); |
|
106 | + $this->pro['memory_limit']=self::find('/Memory Limit:.*\/(.*) K/', $res->body); |
|
107 | + $this->pro['solved_count']=self::find("/Accepted Submission(s): ([\d+]*?)/", $res->body); |
|
108 | 108 | $this->pro['input_type']='standard input'; |
109 | 109 | $this->pro['output_type']='standard output'; |
110 | - $this->pro['description'] = $this->cacheImage(HtmlDomParser::str_get_html(self::find("/Problem Description.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU",$res->body), true, true, DEFAULT_TARGET_CHARSET, false)); |
|
111 | - $this->pro['input'] = self::find("/<div class=panel_title align=left>Input.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU",$res->body); |
|
112 | - $this->pro['output'] = self::find("/<div class=panel_title align=left>Output.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU",$res->body); |
|
113 | - $this->pro['sample'] = []; |
|
114 | - $this->pro['sample'][] = [ |
|
115 | - 'sample_input'=>self::find("/<pre><div.*>(.*)<\/div><\/pre>/sU",$res->body), |
|
116 | - 'sample_output'=>self::find("/<div.*>Sample Output<\/div><div.*><pre><div.*>(.*)<\/div><\/pre><\/div>/sU",$res->body) |
|
110 | + $this->pro['description']=$this->cacheImage(HtmlDomParser::str_get_html(self::find("/Problem Description.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU", $res->body), true, true, DEFAULT_TARGET_CHARSET, false)); |
|
111 | + $this->pro['input']=self::find("/<div class=panel_title align=left>Input.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU", $res->body); |
|
112 | + $this->pro['output']=self::find("/<div class=panel_title align=left>Output.*<div class=panel_content>(.*)<\/div><div class=panel_bottom>/sU", $res->body); |
|
113 | + $this->pro['sample']=[]; |
|
114 | + $this->pro['sample'][]=[ |
|
115 | + 'sample_input'=>self::find("/<pre><div.*>(.*)<\/div><\/pre>/sU", $res->body), |
|
116 | + 'sample_output'=>self::find("/<div.*>Sample Output<\/div><div.*><pre><div.*>(.*)<\/div><\/pre><\/div>/sU", $res->body) |
|
117 | 117 | ]; |
118 | 118 | // $this->pro['sample']['sample_input'] = self::find("/<pre><div.*>(.*)<\/div><\/pre>/sU",$res->body); |
119 | 119 | // $this->pro['sample']['sample_output'] = self::find("/<div.*>Sample Output<\/div><div.*><pre><div.*>(.*)<\/div><\/pre><\/div>/sU",$res->body); |
120 | - $this->pro['note'] = self::find("/<i>Hint<\/i><\/div>(.*)<\/div><i style='font-size:1px'>/sU",$res->body); |
|
121 | - $this->pro['source'] = self::find("/<div class=panel_title align=left>Source<\/div> (.*)<div class=panel_bottom>/sU",$res->body); |
|
122 | - $this->pro['force_raw'] = 0; |
|
120 | + $this->pro['note']=self::find("/<i>Hint<\/i><\/div>(.*)<\/div><i style='font-size:1px'>/sU", $res->body); |
|
121 | + $this->pro['source']=self::find("/<div class=panel_title align=left>Source<\/div> (.*)<div class=panel_bottom>/sU", $res->body); |
|
122 | + $this->pro['force_raw']=0; |
|
123 | 123 | $problem=$problemModel->pid($this->pro['pcode']); |
124 | 124 | |
125 | 125 | if ($problem) { |
@@ -90,12 +90,10 @@ |
||
90 | 90 | if (strpos("No such problem",$res->body) !== false) { |
91 | 91 | header('HTTP/1.1 404 Not Found'); |
92 | 92 | die(); |
93 | - } |
|
94 | - else if(strpos("Invalid Parameter.",$res->body) !== false) { |
|
93 | + } else if(strpos("Invalid Parameter.",$res->body) !== false) { |
|
95 | 94 | header('HTTP/1.1 404 Not Found'); |
96 | 95 | die(); |
97 | - } |
|
98 | - else { |
|
96 | + } else { |
|
99 | 97 | $this->pro['pcode'] = "HDU".$con; |
100 | 98 | $this->pro['OJ'] = 8; |
101 | 99 | $this->pro['contest_id'] = null; |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | $this->post_data=$all_data; |
19 | 19 | $judger=new JudgerModel(); |
20 | 20 | $judger_list=$judger->list(8); |
21 | - $this->judgerAccount = $judger_list[array_rand($judger_list)]; |
|
21 | + $this->judgerAccount=$judger_list[array_rand($judger_list)]; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | private function hduLogin() |
25 | 25 | { |
26 | - $response=$this->grab_page('http://acm.hdu.edu.cn','hdu'); |
|
26 | + $response=$this->grab_page('http://acm.hdu.edu.cn', 'hdu'); |
|
27 | 27 | if (strpos($response, 'Sign In')!==false) { |
28 | 28 | $params=[ |
29 | 29 | 'username' => $this->judgerAccount["handle"], |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | |
46 | 46 | $response=$this->post_data("http://acm.hdu.edu.cn/submit.php", http_build_query($params), "hdu", true, false); |
47 | - $this->sub['jid'] = $this->judgerAccount['jid']; |
|
47 | + $this->sub['jid']=$this->judgerAccount['jid']; |
|
48 | 48 | $res=Requests::get('http://acm.hdu.edu.cn/status.php?user='.$this->judgerAccount['handle'].'&pid='.$this->post_data['iid']); |
49 | 49 | if (!preg_match("/<td height=22px>([\s\S]*?)<\/td>/", $res->body, $match)) { |
50 | 50 | $this->sub['verdict']='Submission Error'; |