Passed
Branch feature/babel (9a8402)
by John
03:52
created
app/Models/SubmissionModel.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Babel/Judge/Judger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Babel/Submit/Submitter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
app/Babel/Submit/Curl.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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:");
Please login to merge, or discard this patch.
app/Babel/Crawl/CrawlerBase.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.