@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | //writing database |
39 | 39 | $this->transactionDB(); |
40 | 40 | |
41 | - }catch(Throwable $e){ |
|
41 | + } catch(Throwable $e){ |
|
42 | 42 | if ($e->getMessage()!==""){ |
43 | 43 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
44 | 44 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | DB::commit(); |
222 | 222 | |
223 | - }catch(Throwable $e){ |
|
223 | + } catch(Throwable $e){ |
|
224 | 224 | DB::rollback(); |
225 | 225 | if ($e->getMessage()!=="") { |
226 | 226 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | //writing database |
40 | 40 | $this->transactionDB(); |
41 | 41 | |
42 | - }catch(Throwable $e){ |
|
43 | - if ($e->getMessage()!==""){ |
|
42 | + } catch (Throwable $e) { |
|
43 | + if ($e->getMessage()!=="") { |
|
44 | 44 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
45 | 45 | } |
46 | 46 | } |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | public function __construct($class) |
60 | 60 | { |
61 | 61 | $this->command=$class; |
62 | - $this->versionParser = new VersionConstraintParser(); |
|
62 | + $this->versionParser=new VersionConstraintParser(); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | private function parseVersion() |
66 | 66 | { |
67 | - if(empty($this->babelConfig)){ |
|
67 | + if (empty($this->babelConfig)) { |
|
68 | 68 | throw new Exception('Missing babel.json Config file.'); |
69 | 69 | } |
70 | 70 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | DB::commit(); |
136 | 136 | |
137 | - }catch(Throwable $e){ |
|
137 | + } catch (Throwable $e) { |
|
138 | 138 | DB::rollback(); |
139 | 139 | if ($e->getMessage()!=="") { |
140 | 140 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
@@ -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 { |
@@ -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 | } |
@@ -17,14 +17,14 @@ |
||
17 | 17 | * |
18 | 18 | * @var string |
19 | 19 | */ |
20 | - protected $signature = 'manage:resetpass {--uid=: the user you want to reset} {--digit=: the number of the password, should be larger than 8}'; |
|
20 | + protected $signature='manage:resetpass {--uid=: the user you want to reset} {--digit=: the number of the password, should be larger than 8}'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * The console command description. |
24 | 24 | * |
25 | 25 | * @var string |
26 | 26 | */ |
27 | - protected $description = 'Reset user passwords of NOJ'; |
|
27 | + protected $description='Reset user passwords of NOJ'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Create a new command instance. |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:install {extension : The package name of the extension} {--ignore-platform-reqs : Ignore the Platform Requirements when install}'; |
|
17 | + protected $signature='babel:install {extension : The package name of the extension} {--ignore-platform-reqs : Ignore the Platform Requirements when install}'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The console command description. |
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - protected $description = 'Install a given Babel Extension to NOJ'; |
|
24 | + protected $description='Install a given Babel Extension to NOJ'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Create a new command instance. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function handle() |
42 | 42 | { |
43 | - $extension = $this->argument('extension'); |
|
44 | - $ignoreReqs = $this->option('ignore-platform-reqs'); |
|
45 | - $output = new BufferedOutput(); |
|
43 | + $extension=$this->argument('extension'); |
|
44 | + $ignoreReqs=$this->option('ignore-platform-reqs'); |
|
45 | + $output=new BufferedOutput(); |
|
46 | 46 | $installerProvider="Installer"; |
47 | 47 | try { |
48 | 48 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public static function create($oj, $installerProvider, $class) |
71 | 71 | { |
72 | - $className = "App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
72 | + $className="App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
73 | 73 | if (class_exists($className)) { |
74 | 74 | return new $className($class); |
75 | 75 | } else { |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:syncpro {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid= : The holding group} {--cid= : The contest in NOJ}'; |
|
17 | + protected $signature='babel:syncpro {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid= : The holding group} {--cid= : The contest in NOJ}'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The console command description. |
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - protected $description = 'Crawl contests for a given Babel Extension to NOJ'; |
|
24 | + protected $description='Crawl contests for a given Babel Extension to NOJ'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Create a new command instance. |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function handle() |
42 | 42 | { |
43 | - $extension = $this->argument('extension'); |
|
44 | - $vcid = $this->option('vcid'); |
|
45 | - $gid = $this->option('gid'); |
|
46 | - $cid = $this->option('cid'); |
|
47 | - $className = "App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
48 | - $all_data = [ |
|
43 | + $extension=$this->argument('extension'); |
|
44 | + $vcid=$this->option('vcid'); |
|
45 | + $gid=$this->option('gid'); |
|
46 | + $cid=$this->option('cid'); |
|
47 | + $className="App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
48 | + $all_data=[ |
|
49 | 49 | 'oj'=>$extension, |
50 | 50 | 'vcid'=>$vcid, |
51 | 51 | 'gid'=>$gid, |
52 | 52 | 'cid'=>$cid, |
53 | 53 | ]; |
54 | - $Sync = new $className($all_data); |
|
54 | + $Sync=new $className($all_data); |
|
55 | 55 | $Sync->scheduleCrawl(); |
56 | 56 | } |
57 | 57 | } |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:update {extension : The package name of the extension}'; |
|
17 | + protected $signature='babel:update {extension : The package name of the extension}'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The console command description. |
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - protected $description = 'Update a given Babel Extension to NOJ'; |
|
24 | + protected $description='Update a given Babel Extension to NOJ'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Create a new command instance. |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function handle() |
42 | 42 | { |
43 | - $extension = $this->argument('extension'); |
|
44 | - $output = new BufferedOutput(); |
|
43 | + $extension=$this->argument('extension'); |
|
44 | + $output=new BufferedOutput(); |
|
45 | 45 | $this->line("Updating <fg=green>$extension</>"); |
46 | 46 | try { |
47 | 47 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | if (!is_dir($dir)) { |
91 | 91 | return; |
92 | 92 | } |
93 | - $it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
94 | - $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
93 | + $it=new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
94 | + $files=new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
95 | 95 | foreach ($files as $file) { |
96 | 96 | if ($file->isDir()) { |
97 | 97 | rmdir($file->getRealPath()); |