@@ -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 |
@@ -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 |
@@ -23,7 +23,9 @@ |
||
23 | 23 | |
24 | 24 | public function redirectTo($path, $num = 0) |
25 | 25 | { |
26 | - if ($path == 'error') $this->app->session->set('error', true); |
|
26 | + if ($path == 'error') { |
|
27 | + $this->app->session->set('error', true); |
|
28 | + } |
|
27 | 29 | |
28 | 30 | header('Refresh: ' . $num . '; URL=' . $this->link($path)); |
29 | 31 | exit; |
@@ -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 |
@@ -59,7 +59,9 @@ discard block |
||
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 | |
@@ -82,7 +84,9 @@ discard block |
||
82 | 84 | |
83 | 85 | public function share($key, $value) |
84 | 86 | { |
85 | - if ($value instanceof Closure) $value = call_user_func($value, $this); |
|
87 | + if ($value instanceof Closure) { |
|
88 | + $value = call_user_func($value, $this); |
|
89 | + } |
|
86 | 90 | |
87 | 91 | $this->container[$key] = $value; |
88 | 92 | } |