@@ -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 | $res->body = iconv("gb2312","utf-8//IGNORE",$res->body); |
100 | 98 | $this->pro['pcode'] = "HDU".$con; |
101 | 99 | $this->pro['OJ'] = 8; |
@@ -372,13 +372,16 @@ |
||
372 | 372 | ]; |
373 | 373 | $this->MODEL->updateSubmission($row['sid'], $sub); |
374 | 374 | } |
375 | - }else if($row['oid']==8) { |
|
375 | + } else if($row['oid']==8) { |
|
376 | 376 | try { |
377 | 377 | $sub = []; |
378 | 378 | $response = Requests::get("http://acm.hdu.edu.cn/status.php?first=".$row['remote_id']); |
379 | 379 | 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->body, $match); |
380 | - if(strpos(trim(strip_tags($match[1])), 'Runtime Error')!==false) $sub['verdict'] = 'Runtime Error'; |
|
381 | - else $sub['verdict'] = $hdu_v[trim(strip_tags($match[1]))]; |
|
380 | + if(strpos(trim(strip_tags($match[1])), 'Runtime Error')!==false) { |
|
381 | + $sub['verdict'] = 'Runtime Error'; |
|
382 | + } else { |
|
383 | + $sub['verdict'] = $hdu_v[trim(strip_tags($match[1]))]; |
|
384 | + } |
|
382 | 385 | preg_match ("/<td>(\\d*?)MS<\/td><td>(\\d*?)K<\/td>/", $response->body, $matches); |
383 | 386 | $sub['remote_id'] = $row['remote_id']; |
384 | 387 | $sub['time'] = intval($matches[1]); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->judge_level(); |
26 | 26 | } else if($con=="all"){ |
27 | 27 | $this->getSpojProblem(); |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | //TODO |
30 | 30 | } |
31 | 31 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if (strpos("<h1>Not Found</h1>",$res->body) !== false) { |
79 | 79 | header('HTTP/1.1 404 Not Found'); |
80 | 80 | die(); |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | $this->pro['title'] = trim(self::find('/<h2 id="problem-name".* - (.*)<\/h2>/sU',$res->body)); |
83 | 83 | $temp = $res->body; |
84 | 84 | $temp = explode('<tr><td>Time limit:</td><td>', $temp)[1]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $temp = $res->body; |
96 | 96 | $temp = explode('<tr><td>Resource:</td><td>', $temp)[1]; |
97 | 97 | $this->pro['source'] = strip_tags(explode('</td></tr>', $temp)[0]); |
98 | - }else { |
|
98 | + } else { |
|
99 | 99 | $this->pro['source'] = "SPOJ-".$pid; |
100 | 100 | } |
101 | 101 | |
@@ -164,11 +164,13 @@ discard block |
||
164 | 164 | if ($problem) { |
165 | 165 | $problemModel->clearTags($problem); |
166 | 166 | $new_pid=$this->update_problem($this->oid); |
167 | - }else { |
|
167 | + } else { |
|
168 | 168 | $new_pid=$this->insert_problem($this->oid); |
169 | 169 | } |
170 | 170 | } |
171 | - if(count($table) < 50) $endPos = true; |
|
171 | + if(count($table) < 50) { |
|
172 | + $endPos = true; |
|
173 | + } |
|
172 | 174 | $iterator++; |
173 | 175 | } |
174 | 176 | } |