@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | ->where(['verdict'=>'Waiting']) |
413 | 413 | ->get() |
414 | 414 | ->all(); |
415 | - foreach($ret as &$r){ |
|
415 | + foreach ($ret as &$r) { |
|
416 | 416 | $r["ocode"]=DB::table("oj")->where(["oid"=>$r["oid"]])->first()["ocode"]; |
417 | 417 | } |
418 | 418 | return $ret; |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | if (isset($sub['verdict'])) { |
431 | 431 | $sub["color"]=$this->colorScheme[$sub['verdict']]; |
432 | 432 | } |
433 | - $result = DB::table($this->tableName)->where(['sid'=>$sid])->update($sub); |
|
434 | - |
|
435 | - $contestModel = new ContestModel(); |
|
436 | - $submission_info = DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first(); |
|
437 | - if ($submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])){ |
|
438 | - $sub['pid'] = $submission_info['pid']; |
|
439 | - $sub['uid'] = $submission_info['uid']; |
|
440 | - $sub['cid'] = $submission_info['cid']; |
|
441 | - $contestModel->updateContestRankTable($submission_info['cid'],$sub); |
|
433 | + $result=DB::table($this->tableName)->where(['sid'=>$sid])->update($sub); |
|
434 | + |
|
435 | + $contestModel=new ContestModel(); |
|
436 | + $submission_info=DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first(); |
|
437 | + if ($submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])) { |
|
438 | + $sub['pid']=$submission_info['pid']; |
|
439 | + $sub['uid']=$submission_info['uid']; |
|
440 | + $sub['cid']=$submission_info['cid']; |
|
441 | + $contestModel->updateContestRankTable($submission_info['cid'], $sub); |
|
442 | 442 | } |
443 | 443 | return $result; |
444 | 444 | } |
@@ -509,15 +509,15 @@ discard block |
||
509 | 509 | 'desc' |
510 | 510 | ); |
511 | 511 | |
512 | - if($filter["pcode"]){ |
|
512 | + if ($filter["pcode"]) { |
|
513 | 513 | $paginator=$paginator->where(["pcode"=>$filter["pcode"]]); |
514 | 514 | } |
515 | 515 | |
516 | - if($filter["result"]){ |
|
516 | + if ($filter["result"]) { |
|
517 | 517 | $paginator=$paginator->where(["verdict"=>$filter["result"]]); |
518 | 518 | } |
519 | 519 | |
520 | - if($filter["account"]){ |
|
520 | + if ($filter["account"]) { |
|
521 | 521 | $paginator=$paginator->where(["name"=>$filter["account"]]); |
522 | 522 | } |
523 | 523 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $result=$submissionModel->getWaitingSubmission(); |
30 | 30 | foreach ($result as $row) { |
31 | 31 | $ocode=$row["ocode"]; |
32 | - if(!isset($this->judger[$ocode]) || is_null($this->judger[$ocode])) { |
|
32 | + if (!isset($this->judger[$ocode]) || is_null($this->judger[$ocode])) { |
|
33 | 33 | $this->judger[$ocode]=self::create($ocode); |
34 | 34 | } |
35 | 35 | $this->judger[$ocode]->judge($row); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | public static function create($ocode) { |
40 | 40 | $name=$ocode; |
41 | - $className = "App\\Babel\\Extension\\$name\\Judger"; |
|
42 | - if(class_exists($className)) { |
|
41 | + $className="App\\Babel\\Extension\\$name\\Judger"; |
|
42 | + if (class_exists($className)) { |
|
43 | 43 | return new $className(); |
44 | 44 | } else { |
45 | 45 | return null; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ]; |
36 | 36 | |
37 | 37 | $submitter=self::create($this->post_data["oj"], $sub, $all_data); |
38 | - if(!is_null($submitter)) $submitter->submit(); |
|
38 | + if (!is_null($submitter)) $submitter->submit(); |
|
39 | 39 | |
40 | 40 | // insert submission |
41 | 41 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $submission->updateSubmission($this->post_data["sid"], $sub); |
44 | 44 | } |
45 | 45 | |
46 | - public static function create($oj,& $sub, $all_data) { |
|
47 | - $className = "App\\Babel\\Extension\\$oj\\Submitter"; |
|
48 | - if(class_exists($className)) { |
|
46 | + public static function create($oj, & $sub, $all_data) { |
|
47 | + $className="App\\Babel\\Extension\\$oj\\Submitter"; |
|
48 | + if (class_exists($className)) { |
|
49 | 49 | return new $className($sub, $all_data); |
50 | 50 | } else { |
51 | 51 | return null; |
@@ -35,7 +35,9 @@ |
||
35 | 35 | ]; |
36 | 36 | |
37 | 37 | $submitter=self::create($this->post_data["oj"], $sub, $all_data); |
38 | - if(!is_null($submitter)) $submitter->submit(); |
|
38 | + if(!is_null($submitter)) { |
|
39 | + $submitter->submit(); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // insert submission |
41 | 43 |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | |
13 | 13 | protected function login($all_data) |
14 | 14 | { |
15 | - if(isset($all_data["url"])) $url = $all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
16 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
17 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
18 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = 'false'; |
|
19 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
15 | + if (isset($all_data["url"])) $url=$all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
16 | + if (isset($all_data["data"])) $data=$all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
17 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
18 | + if (isset($all_data["ret"])) $ret=$all_data["ret"]; else $ret='false'; |
|
19 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
20 | 20 | |
21 | 21 | $datapost=curl_init(); |
22 | 22 | $headers=array("Expect:"); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function grab_page($all_data) |
49 | 49 | { |
50 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
51 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
52 | - if(isset($all_data["headers"])) $headers = $all_data["headers"]; else $headers = []; |
|
53 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
50 | + if (isset($all_data["site"])) $site=$all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
51 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
52 | + if (isset($all_data["headers"])) $headers=$all_data["headers"]; else $headers=[]; |
|
53 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
54 | 54 | |
55 | 55 | $ch=curl_init(); |
56 | 56 | curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__)."/../Cookies/cacert.pem"); |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function post_data($all_data) |
76 | 76 | { |
77 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
78 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
79 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
80 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = false; |
|
81 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = true; |
|
82 | - if(isset($all_data["returnHeader"])) $returnHeader = $all_data["returnHeader"]; else $returnHeader = true; |
|
83 | - if(isset($all_data["postJson"])) $postJson = $all_data["postJson"]; else $postJson = false; |
|
84 | - if(isset($all_data["extraHeaders"])) $extraHeaders = $all_data["extraHeaders"]; else $extraHeaders = []; |
|
85 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
77 | + if (isset($all_data["site"])) $site=$all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
78 | + if (isset($all_data["data"])) $data=$all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
79 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
80 | + if (isset($all_data["ret"])) $ret=$all_data["ret"]; else $ret=false; |
|
81 | + if (isset($all_data["follow"])) $follow=$all_data["follow"]; else $follow=true; |
|
82 | + if (isset($all_data["returnHeader"])) $returnHeader=$all_data["returnHeader"]; else $returnHeader=true; |
|
83 | + if (isset($all_data["postJson"])) $postJson=$all_data["postJson"]; else $postJson=false; |
|
84 | + if (isset($all_data["extraHeaders"])) $extraHeaders=$all_data["extraHeaders"]; else $extraHeaders=[]; |
|
85 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
86 | 86 | |
87 | 87 | $datapost=curl_init(); |
88 | 88 | $headers=array("Expect:"); |
@@ -12,11 +12,31 @@ discard block |
||
12 | 12 | |
13 | 13 | protected function login($all_data) |
14 | 14 | { |
15 | - if(isset($all_data["url"])) $url = $all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
16 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
17 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
18 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = 'false'; |
|
19 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
15 | + if(isset($all_data["url"])) { |
|
16 | + $url = $all_data["url"]; |
|
17 | + } else { |
|
18 | + throw new Exception("url is not exist in all_data"); |
|
19 | + } |
|
20 | + if(isset($all_data["data"])) { |
|
21 | + $data = $all_data["data"]; |
|
22 | + } else { |
|
23 | + throw new Exception("data is not exist in all_data"); |
|
24 | + } |
|
25 | + if(isset($all_data["oj"])) { |
|
26 | + $oj = $all_data["oj"]; |
|
27 | + } else { |
|
28 | + throw new Exception("oj is not exist in all_data"); |
|
29 | + } |
|
30 | + if(isset($all_data["ret"])) { |
|
31 | + $ret = $all_data["ret"]; |
|
32 | + } else { |
|
33 | + $ret = 'false'; |
|
34 | + } |
|
35 | + if(isset($all_data["handle"])) { |
|
36 | + $handle = $all_data["handle"]; |
|
37 | + } else { |
|
38 | + $handle = "default"; |
|
39 | + } |
|
20 | 40 | |
21 | 41 | $datapost=curl_init(); |
22 | 42 | $headers=array("Expect:"); |
@@ -47,10 +67,26 @@ discard block |
||
47 | 67 | |
48 | 68 | protected function grab_page($all_data) |
49 | 69 | { |
50 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
51 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
52 | - if(isset($all_data["headers"])) $headers = $all_data["headers"]; else $headers = []; |
|
53 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
70 | + if(isset($all_data["site"])) { |
|
71 | + $site = $all_data["site"]; |
|
72 | + } else { |
|
73 | + throw new Exception("site is not exist in all_data"); |
|
74 | + } |
|
75 | + if(isset($all_data["oj"])) { |
|
76 | + $oj = $all_data["oj"]; |
|
77 | + } else { |
|
78 | + throw new Exception("oj is not exist in all_data"); |
|
79 | + } |
|
80 | + if(isset($all_data["headers"])) { |
|
81 | + $headers = $all_data["headers"]; |
|
82 | + } else { |
|
83 | + $headers = []; |
|
84 | + } |
|
85 | + if(isset($all_data["handle"])) { |
|
86 | + $handle = $all_data["handle"]; |
|
87 | + } else { |
|
88 | + $handle = "default"; |
|
89 | + } |
|
54 | 90 | |
55 | 91 | $ch=curl_init(); |
56 | 92 | curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__)."/../Cookies/cacert.pem"); |
@@ -74,15 +110,51 @@ discard block |
||
74 | 110 | |
75 | 111 | protected function post_data($all_data) |
76 | 112 | { |
77 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
78 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
79 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
80 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = false; |
|
81 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = true; |
|
82 | - if(isset($all_data["returnHeader"])) $returnHeader = $all_data["returnHeader"]; else $returnHeader = true; |
|
83 | - if(isset($all_data["postJson"])) $postJson = $all_data["postJson"]; else $postJson = false; |
|
84 | - if(isset($all_data["extraHeaders"])) $extraHeaders = $all_data["extraHeaders"]; else $extraHeaders = []; |
|
85 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
113 | + if(isset($all_data["site"])) { |
|
114 | + $site = $all_data["site"]; |
|
115 | + } else { |
|
116 | + throw new Exception("site is not exist in all_data"); |
|
117 | + } |
|
118 | + if(isset($all_data["data"])) { |
|
119 | + $data = $all_data["data"]; |
|
120 | + } else { |
|
121 | + throw new Exception("data is not exist in all_data"); |
|
122 | + } |
|
123 | + if(isset($all_data["oj"])) { |
|
124 | + $oj = $all_data["oj"]; |
|
125 | + } else { |
|
126 | + throw new Exception("oj is not exist in all_data"); |
|
127 | + } |
|
128 | + if(isset($all_data["ret"])) { |
|
129 | + $ret = $all_data["ret"]; |
|
130 | + } else { |
|
131 | + $ret = false; |
|
132 | + } |
|
133 | + if(isset($all_data["follow"])) { |
|
134 | + $follow = $all_data["follow"]; |
|
135 | + } else { |
|
136 | + $follow = true; |
|
137 | + } |
|
138 | + if(isset($all_data["returnHeader"])) { |
|
139 | + $returnHeader = $all_data["returnHeader"]; |
|
140 | + } else { |
|
141 | + $returnHeader = true; |
|
142 | + } |
|
143 | + if(isset($all_data["postJson"])) { |
|
144 | + $postJson = $all_data["postJson"]; |
|
145 | + } else { |
|
146 | + $postJson = false; |
|
147 | + } |
|
148 | + if(isset($all_data["extraHeaders"])) { |
|
149 | + $extraHeaders = $all_data["extraHeaders"]; |
|
150 | + } else { |
|
151 | + $extraHeaders = []; |
|
152 | + } |
|
153 | + if(isset($all_data["handle"])) { |
|
154 | + $handle = $all_data["handle"]; |
|
155 | + } else { |
|
156 | + $handle = "default"; |
|
157 | + } |
|
86 | 158 | |
87 | 159 | $datapost=curl_init(); |
88 | 160 | $headers=array("Expect:"); |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | private function _cacheImage($data) |
53 | 53 | { |
54 | - if(!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])){ |
|
54 | + if (!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])) { |
|
55 | 55 | throw new Exception("data is not completely exist in cacheImage"); |
56 | 56 | } |
57 | - $ori = $data["ori"]; |
|
58 | - $path = $data["path"]; |
|
59 | - $baseurl = $data["baseurl"]; |
|
60 | - $space_deli = $data["space_deli"]; |
|
61 | - $cookie = $data["cookie"]; |
|
57 | + $ori=$data["ori"]; |
|
58 | + $path=$data["path"]; |
|
59 | + $baseurl=$data["baseurl"]; |
|
60 | + $space_deli=$data["space_deli"]; |
|
61 | + $cookie=$data["cookie"]; |
|
62 | 62 | |
63 | 63 | $para["path"]=$path; |
64 | 64 | $para["base"]=$baseurl; |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | |
104 | 104 | public function procInfo($data) |
105 | 105 | { |
106 | - if(isset($data["path"])) $path = $data["path"]; else throw new Exception("path is not exist in data"); |
|
107 | - if(isset($data["baseurl"])) $baseurl = $data["baseurl"]; else throw new Exception("baseurl is not exist in data"); |
|
108 | - if(isset($data["space_deli"])) $space_deli = $data["space_deli"]; else $space_deli = true; |
|
109 | - if(isset($data["cookie"])) $cookie = $data["cookie"]; else $cookie = ""; |
|
106 | + if (isset($data["path"])) $path=$data["path"]; else throw new Exception("path is not exist in data"); |
|
107 | + if (isset($data["baseurl"])) $baseurl=$data["baseurl"]; else throw new Exception("baseurl is not exist in data"); |
|
108 | + if (isset($data["space_deli"])) $space_deli=$data["space_deli"]; else $space_deli=true; |
|
109 | + if (isset($data["cookie"])) $cookie=$data["cookie"]; else $cookie=""; |
|
110 | 110 | |
111 | 111 | $this->pro["description"]=$this->_cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie); |
112 | 112 | $this->pro["input"]=$this->_cacheImage($this->pro["input"], $path, $baseurl, $space_deli, $cookie); |
@@ -103,10 +103,26 @@ |
||
103 | 103 | |
104 | 104 | public function procInfo($data) |
105 | 105 | { |
106 | - if(isset($data["path"])) $path = $data["path"]; else throw new Exception("path is not exist in data"); |
|
107 | - if(isset($data["baseurl"])) $baseurl = $data["baseurl"]; else throw new Exception("baseurl is not exist in data"); |
|
108 | - if(isset($data["space_deli"])) $space_deli = $data["space_deli"]; else $space_deli = true; |
|
109 | - if(isset($data["cookie"])) $cookie = $data["cookie"]; else $cookie = ""; |
|
106 | + if(isset($data["path"])) { |
|
107 | + $path = $data["path"]; |
|
108 | + } else { |
|
109 | + throw new Exception("path is not exist in data"); |
|
110 | + } |
|
111 | + if(isset($data["baseurl"])) { |
|
112 | + $baseurl = $data["baseurl"]; |
|
113 | + } else { |
|
114 | + throw new Exception("baseurl is not exist in data"); |
|
115 | + } |
|
116 | + if(isset($data["space_deli"])) { |
|
117 | + $space_deli = $data["space_deli"]; |
|
118 | + } else { |
|
119 | + $space_deli = true; |
|
120 | + } |
|
121 | + if(isset($data["cookie"])) { |
|
122 | + $cookie = $data["cookie"]; |
|
123 | + } else { |
|
124 | + $cookie = ""; |
|
125 | + } |
|
110 | 126 | |
111 | 127 | $this->pro["description"]=$this->_cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie); |
112 | 128 | $this->pro["input"]=$this->_cacheImage($this->pro["input"], $path, $baseurl, $space_deli, $cookie); |