@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | { |
15 | 15 | $user = $this->where('email=?' , $email)->fetch($this->table); |
16 | 16 | |
17 | - if (! $user) return false; |
|
17 | + if (! $user) { |
|
18 | + return false; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | $this->user = $user; |
20 | 22 | |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | |
44 | 46 | $user = $this->where('code=?' , $code)->fetch($this->table); |
45 | 47 | |
46 | - if (! $user) return false; |
|
48 | + if (! $user) { |
|
49 | + return false; |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $this->user = $user; |
49 | 53 |
@@ -22,11 +22,15 @@ |
||
22 | 22 | |
23 | 23 | if ($login->isLogged()) { |
24 | 24 | |
25 | - if (in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
25 | + if (in_array($request, $pagesWhenLogout)) { |
|
26 | + $app->url->redirectTo('/'); |
|
27 | + } |
|
26 | 28 | |
27 | 29 | } else { |
28 | 30 | |
29 | - if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
31 | + if (! in_array($request, $pagesWhenLogout)) { |
|
32 | + $app->url->redirectTo('/'); |
|
33 | + } |
|
30 | 34 | } |
31 | 35 | |
32 | 36 | return $next; |
@@ -66,7 +66,9 @@ discard block |
||
66 | 66 | |
67 | 67 | $exists = $this->app->file->exists($file); |
68 | 68 | |
69 | - if (! $exists) return $join . ' Not Found'; |
|
69 | + if (! $exists) { |
|
70 | + return $join . ' Not Found'; |
|
71 | + } |
|
70 | 72 | |
71 | 73 | $trace = debug_backtrace(); |
72 | 74 | |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | |
86 | 88 | $exists = $this->app->file->exists($file); |
87 | 89 | |
88 | - if (! $exists) return $join . ' Not Found'; |
|
90 | + if (! $exists) { |
|
91 | + return $join . ' Not Found'; |
|
92 | + } |
|
89 | 93 | |
90 | 94 | $trace = debug_backtrace(); |
91 | 95 | |
@@ -104,7 +108,9 @@ discard block |
||
104 | 108 | |
105 | 109 | $exists = $this->app->file->exists($file); |
106 | 110 | |
107 | - if (! $exists) return $join . ' Not Found'; |
|
111 | + if (! $exists) { |
|
112 | + return $join . ' Not Found'; |
|
113 | + } |
|
108 | 114 | |
109 | 115 | $trace = debug_backtrace(); |
110 | 116 |
@@ -59,7 +59,9 @@ |
||
59 | 59 | |
60 | 60 | $this->file->call($this->file->to('config/constant.php')); |
61 | 61 | |
62 | - foreach (glob("routes/*.php") AS $route) $this->file->call($this->file->to($route)); |
|
62 | + foreach (glob("routes/*.php") AS $route) { |
|
63 | + $this->file->call($this->file->to($route)); |
|
64 | + } |
|
63 | 65 | |
64 | 66 | $output = $this->route->getProperRoute(); |
65 | 67 |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - if ($this->basController) $action = $this->basController . '/' . $action; |
|
42 | + if ($this->basController) { |
|
43 | + $action = $this->basController . '/' . $action; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | if ($this->groupMiddleware) { |
45 | 47 | |
@@ -75,7 +77,9 @@ discard block |
||
75 | 77 | $middlewareFrom = array_shift($groupOptions['middleware']); |
76 | 78 | $middleware = $groupOptions['middleware']; |
77 | 79 | |
78 | - if ($this->app->request->url() !== $prefix) return $this; |
|
80 | + if ($this->app->request->url() !== $prefix) { |
|
81 | + return $this; |
|
82 | + } |
|
79 | 83 | |
80 | 84 | $this->prefix = $prefix; |
81 | 85 | $this->basController = $controller; |
@@ -137,14 +141,18 @@ discard block |
||
137 | 141 | |
138 | 142 | $output = $this->middleware($middleware); |
139 | 143 | |
140 | - if ($output != '') break; |
|
144 | + if ($output != '') { |
|
145 | + break; |
|
146 | + } |
|
141 | 147 | } |
142 | 148 | |
143 | 149 | } else { |
144 | 150 | |
145 | 151 | $output = $this->middleware($route['middleware']); |
146 | 152 | |
147 | - if ($output != '') break; |
|
153 | + if ($output != '') { |
|
154 | + break; |
|
155 | + } |
|
148 | 156 | } |
149 | 157 | } |
150 | 158 | |
@@ -180,7 +188,9 @@ discard block |
||
180 | 188 | { |
181 | 189 | $methods = ['GET', 'POST']; |
182 | 190 | |
183 | - if (($method == 'both') && in_array($this->app->request->method(), $methods)) return true; |
|
191 | + if (($method == 'both') && in_array($this->app->request->method(), $methods)) { |
|
192 | + return true; |
|
193 | + } |
|
184 | 194 | |
185 | 195 | if (is_array($method)) { |
186 | 196 | |
@@ -190,7 +200,9 @@ discard block |
||
190 | 200 | |
191 | 201 | } else if (count($method) == 2) { |
192 | 202 | |
193 | - if (in_array($method[0], $methods) && in_array($method[1], $methods)) return true; |
|
203 | + if (in_array($method[0], $methods) && in_array($method[1], $methods)) { |
|
204 | + return true; |
|
205 | + } |
|
194 | 206 | |
195 | 207 | } else { |
196 | 208 | |
@@ -233,7 +245,9 @@ discard block |
||
233 | 245 | |
234 | 246 | $output = $middlewareObject->handle($this->app, static::NEXT); |
235 | 247 | |
236 | - if ($output && $output === static::NEXT) $output = ''; |
|
248 | + if ($output && $output === static::NEXT) { |
|
249 | + $output = ''; |
|
250 | + } |
|
237 | 251 | |
238 | 252 | return $output; |
239 | 253 | } |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | $requestUri = $this->server('REQUEST_URI'); |
29 | 29 | |
30 | - if (strpos($requestUri, '?')) list($requestUri, $queryString) = explode('?', $requestUri); |
|
30 | + if (strpos($requestUri, '?')) { |
|
31 | + list($requestUri, $queryString) = explode('?', $requestUri); |
|
32 | + } |
|
31 | 33 | |
32 | 34 | if (! in_array($script, ['/', '\\'])) { |
33 | 35 | |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | $this->url = $requestUri; |
38 | 40 | } |
39 | 41 | |
40 | - if ($this->url !== '/') $this->url = rtrim($this->url, '/'); |
|
42 | + if ($this->url !== '/') { |
|
43 | + $this->url = rtrim($this->url, '/'); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $isSecure = false; |
43 | 47 | |
@@ -45,8 +49,7 @@ discard block |
||
45 | 49 | |
46 | 50 | $isSecure = true; |
47 | 51 | |
48 | - } |
|
49 | - elseif (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
52 | + } elseif (! empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || ! empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { |
|
50 | 53 | $isSecure = true; |
51 | 54 | } |
52 | 55 | |
@@ -100,7 +103,9 @@ discard block |
||
100 | 103 | |
101 | 104 | public function file($input) |
102 | 105 | { |
103 | - if (isset($this->files[$input])) return $this->files[$input]; |
|
106 | + if (isset($this->files[$input])) { |
|
107 | + return $this->files[$input]; |
|
108 | + } |
|
104 | 109 | |
105 | 110 | $upoadedFile = new UploadeFile($this->app, $input); |
106 | 111 |
@@ -35,13 +35,17 @@ discard block |
||
35 | 35 | |
36 | 36 | private function getFileInfo($input) |
37 | 37 | { |
38 | - if (empty($_FILES[$input])) return; |
|
38 | + if (empty($_FILES[$input])) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $file = $_FILES[$input]; |
41 | 43 | |
42 | 44 | $this->error = $file['error']; |
43 | 45 | |
44 | - if ($this->error != UPLOAD_ERR_OK) return; |
|
46 | + if ($this->error != UPLOAD_ERR_OK) { |
|
47 | + return; |
|
48 | + } |
|
45 | 49 | |
46 | 50 | $this->file = $file; |
47 | 51 | |
@@ -106,7 +110,9 @@ discard block |
||
106 | 110 | |
107 | 111 | $newName .= '.' . $this->extension; |
108 | 112 | |
109 | - if (! is_dir($target)) mkdir($target, 0777, true); |
|
113 | + if (! is_dir($target)) { |
|
114 | + mkdir($target, 0777, true); |
|
115 | + } |
|
110 | 116 | |
111 | 117 | $filePath = $target . $newName; |
112 | 118 |
@@ -24,7 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | public function require($input = null, $msg = null) |
26 | 26 | { |
27 | - if (! $this->input) $this->input = $input; |
|
27 | + if (! $this->input) { |
|
28 | + $this->input = $input; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | $value = $this->value($this->input); |
30 | 32 | |
@@ -39,7 +41,9 @@ discard block |
||
39 | 41 | |
40 | 42 | public function email($input = null, $msg = null) |
41 | 43 | { |
42 | - if (! $this->input) $this->input = $input; |
|
44 | + if (! $this->input) { |
|
45 | + $this->input = $input; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | $value = $this->value($this->input); |
45 | 49 | |
@@ -54,7 +58,9 @@ discard block |
||
54 | 58 | |
55 | 59 | public function number($input = null, $msg = null) |
56 | 60 | { |
57 | - if (! $this->input) $this->input = $input; |
|
61 | + if (! $this->input) { |
|
62 | + $this->input = $input; |
|
63 | + } |
|
58 | 64 | |
59 | 65 | $value = $this->value($this->input); |
60 | 66 | |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | |
73 | 79 | public function text($input = null, $msg = null) |
74 | 80 | { |
75 | - if (! $this->input) $this->input = $input; |
|
81 | + if (! $this->input) { |
|
82 | + $this->input = $input; |
|
83 | + } |
|
76 | 84 | |
77 | 85 | $value = $this->value($this->input); |
78 | 86 | |
@@ -148,8 +156,12 @@ discard block |
||
148 | 156 | $id = null; |
149 | 157 | $userId = null; |
150 | 158 | |
151 | - if (count($data) == 2) list($table, $column) = $data; |
|
152 | - if (count($data) == 4) list($table, $column, $id, $userId) = $data; |
|
159 | + if (count($data) == 2) { |
|
160 | + list($table, $column) = $data; |
|
161 | + } |
|
162 | + if (count($data) == 4) { |
|
163 | + list($table, $column, $id, $userId) = $data; |
|
164 | + } |
|
153 | 165 | |
154 | 166 | $sql = $userId ? $column . ' = ? AND ' . $id . ' != ? ' : $column . ' = ?'; |
155 | 167 |
@@ -94,9 +94,13 @@ discard block |
||
94 | 94 | |
95 | 95 | public function join($join, $localId = null, $forginId = null) |
96 | 96 | { |
97 | - if (! $localId) $localId = trim($join, 's' ). '_id'; |
|
97 | + if (! $localId) { |
|
98 | + $localId = trim($join, 's' ). '_id'; |
|
99 | + } |
|
98 | 100 | |
99 | - if (! $forginId) $forginId = 'id'; |
|
101 | + if (! $forginId) { |
|
102 | + $forginId = 'id'; |
|
103 | + } |
|
100 | 104 | |
101 | 105 | $sql = $join . ' ON ' . $this->table . '.' . $localId . ' = ' . $join . '.' . $forginId; |
102 | 106 | |
@@ -109,7 +113,9 @@ discard block |
||
109 | 113 | { |
110 | 114 | $sql = array_shift($bindings); |
111 | 115 | |
112 | - if (is_array($bindings[0])) $bindings = $bindings[0]; |
|
116 | + if (is_array($bindings[0])) { |
|
117 | + $bindings = $bindings[0]; |
|
118 | + } |
|
113 | 119 | |
114 | 120 | $this->addToBindings($bindings); |
115 | 121 |