@@ -54,6 +54,9 @@ |
||
54 | 54 | |
55 | 55 | # Output contents |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $status |
|
59 | + */ |
|
57 | 60 | public static function output(Template\Asset\Block $block, $status = null) { |
58 | 61 | |
59 | 62 | if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public static function global(string $name, string $value = null) { |
12 | 12 | |
13 | - if (null === $value) return (self::$globals[$name] ?? false); |
|
13 | + if (null === $value) return (self::$globals[$name] ? ? false); |
|
14 | 14 | |
15 | 15 | self::$globals[$name] = $value; |
16 | 16 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function widget(string $name, Template\Asset\Block $block = null) { |
21 | 21 | |
22 | - if (null === $block) return (self::$widgets[$name] ?? false); |
|
22 | + if (null === $block) return (self::$widgets[$name] ? ? false); |
|
23 | 23 | |
24 | 24 | self::$widgets[$name] = $block; |
25 | 25 | } |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | public static function global(string $name, string $value = null) { |
12 | 12 | |
13 | - if (null === $value) return (self::$globals[$name] ?? false); |
|
13 | + if (null === $value) { |
|
14 | + return (self::$globals[$name] ?? false); |
|
15 | + } |
|
14 | 16 | |
15 | 17 | self::$globals[$name] = $value; |
16 | 18 | } |
@@ -19,7 +21,9 @@ discard block |
||
19 | 21 | |
20 | 22 | public static function widget(string $name, Template\Asset\Block $block = null) { |
21 | 23 | |
22 | - if (null === $block) return (self::$widgets[$name] ?? false); |
|
24 | + if (null === $block) { |
|
25 | + return (self::$widgets[$name] ?? false); |
|
26 | + } |
|
23 | 27 | |
24 | 28 | self::$widgets[$name] = $block; |
25 | 29 | } |
@@ -56,7 +60,9 @@ discard block |
||
56 | 60 | |
57 | 61 | public static function output(Template\Asset\Block $block, $status = null) { |
58 | 62 | |
59 | - if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200; |
|
63 | + if ((null === $status) || !Headers::isStatusCode($status)) { |
|
64 | + $status = STATUS_CODE_200; |
|
65 | + } |
|
60 | 66 | |
61 | 67 | Headers::nocache(); Headers::status($status); Headers::content(MIME_TYPE_HTML); |
62 | 68 |
@@ -2,7 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Auth\Utils { |
4 | 4 | |
5 | - use System\Modules\Auth, System\Modules\Entitizer, System\Modules\Settings, System\Utils\View, Date, Language, Mailer; |
|
5 | + use System\Modules\Auth; |
|
6 | + use System\Modules\Entitizer; |
|
7 | + use System\Modules\Settings; |
|
8 | + use System\Utils\View; |
|
9 | + use Date; |
|
10 | + use Language; |
|
11 | + use Mailer; |
|
6 | 12 | |
7 | 13 | abstract class Mail { |
8 | 14 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Controller { |
4 | 4 | |
5 | - use System\Modules\Entitizer, Arr; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use Arr; |
|
6 | 7 | |
7 | 8 | class Page { |
8 | 9 |
@@ -35,9 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | # Check name exists |
37 | 37 | |
38 | - if (false === ($check_name = $this->page->check('hash', $hash))) return 'PAGE_ERROR_MODIFY'; |
|
38 | + if (false === ($check_name = $this->page->check('hash', $hash))) { |
|
39 | + return 'PAGE_ERROR_MODIFY'; |
|
40 | + } |
|
39 | 41 | |
40 | - if ($check_name === 1) return 'PAGE_ERROR_NAME_DUPLICATE'; |
|
42 | + if ($check_name === 1) { |
|
43 | + return 'PAGE_ERROR_NAME_DUPLICATE'; |
|
44 | + } |
|
41 | 45 | |
42 | 46 | # Modify page |
43 | 47 | |
@@ -57,7 +61,9 @@ discard block |
||
57 | 61 | |
58 | 62 | $modifier = ((0 === $this->page->id) ? 'create' : 'edit'); |
59 | 63 | |
60 | - if (!$this->page->$modifier($data)) return 'PAGE_ERROR_MODIFY'; |
|
64 | + if (!$this->page->$modifier($data)) { |
|
65 | + return 'PAGE_ERROR_MODIFY'; |
|
66 | + } |
|
61 | 67 | |
62 | 68 | # ------------------------ |
63 | 69 |
@@ -2,7 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Controller { |
4 | 4 | |
5 | - use System\Modules\Auth, System\Modules\Entitizer, Str, Validate; |
|
5 | + use System\Modules\Auth; |
|
6 | + use System\Modules\Entitizer; |
|
7 | + use Str; |
|
8 | + use Validate; |
|
6 | 9 | |
7 | 10 | class User { |
8 | 11 |
@@ -31,30 +31,46 @@ discard block |
||
31 | 31 | |
32 | 32 | # Validate name & email |
33 | 33 | |
34 | - if (false === ($name = Auth\Validate::userName($name))) return 'USER_ERROR_NAME_INVALID'; |
|
34 | + if (false === ($name = Auth\Validate::userName($name))) { |
|
35 | + return 'USER_ERROR_NAME_INVALID'; |
|
36 | + } |
|
35 | 37 | |
36 | - if (false === ($email = Validate::email($email))) return 'USER_ERROR_EMAIL_INVALID'; |
|
38 | + if (false === ($email = Validate::email($email))) { |
|
39 | + return 'USER_ERROR_EMAIL_INVALID'; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Validate password |
39 | 43 | |
40 | 44 | if ((0 === $this->user->id) || ('' !== $password)) { |
41 | 45 | |
42 | - if (false === ($password = Auth\Validate::userPassword($password))) return 'USER_ERROR_PASSWORD_INVALID'; |
|
46 | + if (false === ($password = Auth\Validate::userPassword($password))) { |
|
47 | + return 'USER_ERROR_PASSWORD_INVALID'; |
|
48 | + } |
|
43 | 49 | |
44 | - if (0 !== strcmp($password, $password_retype)) return 'USER_ERROR_PASSWORD_MISMATCH'; |
|
50 | + if (0 !== strcmp($password, $password_retype)) { |
|
51 | + return 'USER_ERROR_PASSWORD_MISMATCH'; |
|
52 | + } |
|
45 | 53 | } |
46 | 54 | |
47 | 55 | # Check name exists |
48 | 56 | |
49 | - if (false === ($check_name = $this->user->check('name', $name))) return 'USER_ERROR_MODIFY'; |
|
57 | + if (false === ($check_name = $this->user->check('name', $name))) { |
|
58 | + return 'USER_ERROR_MODIFY'; |
|
59 | + } |
|
50 | 60 | |
51 | - if ($check_name === 1) return 'USER_ERROR_NAME_DUPLICATE'; |
|
61 | + if ($check_name === 1) { |
|
62 | + return 'USER_ERROR_NAME_DUPLICATE'; |
|
63 | + } |
|
52 | 64 | |
53 | 65 | # Check email exists |
54 | 66 | |
55 | - if (false === ($check_email = $this->user->check('email', $email))) return 'USER_ERROR_MODIFY'; |
|
67 | + if (false === ($check_email = $this->user->check('email', $email))) { |
|
68 | + return 'USER_ERROR_MODIFY'; |
|
69 | + } |
|
56 | 70 | |
57 | - if ($check_email === 1) return 'USER_ERROR_EMAIL_DUPLICATE'; |
|
71 | + if ($check_email === 1) { |
|
72 | + return 'USER_ERROR_EMAIL_DUPLICATE'; |
|
73 | + } |
|
58 | 74 | |
59 | 75 | # Modify user |
60 | 76 | |
@@ -84,7 +100,9 @@ discard block |
||
84 | 100 | |
85 | 101 | $modifier = ((0 === $this->user->id) ? 'create' : 'edit'); |
86 | 102 | |
87 | - if (!$this->user->$modifier($data)) return 'USER_ERROR_MODIFY'; |
|
103 | + if (!$this->user->$modifier($data)) { |
|
104 | + return 'USER_ERROR_MODIFY'; |
|
105 | + } |
|
88 | 106 | |
89 | 107 | # ------------------------ |
90 | 108 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Form { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Form, System\Utils\Lister; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Form; |
|
7 | + use System\Utils\Lister; |
|
6 | 8 | |
7 | 9 | class Page extends Form { |
8 | 10 |
@@ -2,7 +2,13 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Form { |
4 | 4 | |
5 | - use System\Modules\Auth, System\Modules\Entitizer, System\Utils\Form, System\Utils\Lister, Geo\Country, Geo\Timezone, Language; |
|
5 | + use System\Modules\Auth; |
|
6 | + use System\Modules\Entitizer; |
|
7 | + use System\Utils\Form; |
|
8 | + use System\Utils\Lister; |
|
9 | + use Geo\Country; |
|
10 | + use Geo\Timezone; |
|
11 | + use Language; |
|
6 | 12 | |
7 | 13 | class User extends Form { |
8 | 14 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Form { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Form; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Form; |
|
6 | 7 | |
7 | 8 | class Widget extends Form { |
8 | 9 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Entitizer, System\Utils\Lister, Template; |
|
5 | + use System\Modules\Entitizer; |
|
6 | + use System\Utils\Lister; |
|
7 | + use Template; |
|
6 | 8 | |
7 | 9 | class Pages extends Entitizer\Utils\Listview { |
8 | 10 |
@@ -34,7 +34,9 @@ |
||
34 | 34 | |
35 | 35 | $contents->block('parent')->block('browse')->disable(); |
36 | 36 | |
37 | - } else $contents->block('parent')->block('browse')->link = $this->parent->link; |
|
37 | + } else { |
|
38 | + $contents->block('parent')->block('browse')->link = $this->parent->link; |
|
39 | + } |
|
38 | 40 | } |
39 | 41 | |
40 | 42 | # Add item additional data |
@@ -2,7 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace System\Modules\Entitizer\Listview { |
4 | 4 | |
5 | - use System\Modules\Auth, System\Modules\Entitizer, System\Utils\Lister, Template; |
|
5 | + use System\Modules\Auth; |
|
6 | + use System\Modules\Entitizer; |
|
7 | + use System\Utils\Lister; |
|
8 | + use Template; |
|
6 | 9 | |
7 | 10 | class Users extends Entitizer\Utils\Listview { |
8 | 11 |
@@ -36,7 +36,9 @@ |
||
36 | 36 | |
37 | 37 | $view->rank = Lister\Rank::get($user->rank); |
38 | 38 | |
39 | - if ($user->id === Auth::user()->id) $view->block('remove')->class = 'disabled'; |
|
39 | + if ($user->id === Auth::user()->id) { |
|
40 | + $view->block('remove')->class = 'disabled'; |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | } |
42 | 44 | } |