@@ -39,7 +39,9 @@ |
||
39 | 39 | |
40 | 40 | $modifier = ((0 === $this->menuitem->id) ? 'create' : 'edit'); |
41 | 41 | |
42 | - if (!$this->menuitem->$modifier($data)) return 'MENUITEM_ERROR_MODIFY'; |
|
42 | + if (!$this->menuitem->$modifier($data)) { |
|
43 | + return 'MENUITEM_ERROR_MODIFY'; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | # ------------------------ |
45 | 47 |
@@ -23,7 +23,9 @@ |
||
23 | 23 | |
24 | 24 | # Set defaults |
25 | 25 | |
26 | -if (function_exists('mb_internal_encoding')) mb_internal_encoding('UTF-8'); |
|
26 | +if (function_exists('mb_internal_encoding')) { |
|
27 | + mb_internal_encoding('UTF-8'); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | date_default_timezone_set('UTC'); |
29 | 31 |
@@ -31,7 +31,9 @@ |
||
31 | 31 | |
32 | 32 | public static function delete(string $name) { |
33 | 33 | |
34 | - if (isset($_COOKIE[$name])) unset($_COOKIE[$name]); |
|
34 | + if (isset($_COOKIE[$name])) { |
|
35 | + unset($_COOKIE[$name]); |
|
36 | + } |
|
35 | 37 | } |
36 | 38 | } |
37 | 39 | } |
@@ -26,7 +26,9 @@ |
||
26 | 26 | |
27 | 27 | public function __construct(string $message = '') { |
28 | 28 | |
29 | - if ('' !== $message) $this->message = $message; |
|
29 | + if ('' !== $message) { |
|
30 | + $this->message = $message; |
|
31 | + } |
|
30 | 32 | } |
31 | 33 | } |
32 | 34 |
@@ -2,7 +2,9 @@ discard block |
||
2 | 2 | |
3 | 3 | # Check PHP version |
4 | 4 | |
5 | -if (version_compare(PHP_VERSION, '7.0.0') < 0) exit('PHP version 7 or higher is required.'); |
|
5 | +if (version_compare(PHP_VERSION, '7.0.0') < 0) { |
|
6 | + exit('PHP version 7 or higher is required.'); |
|
7 | +} |
|
6 | 8 | |
7 | 9 | # Set error reporting |
8 | 10 | |
@@ -37,9 +39,11 @@ discard block |
||
37 | 39 | |
38 | 40 | # Require class file |
39 | 41 | |
40 | - if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name; |
|
41 | - |
|
42 | - else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name; |
|
42 | + if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) { |
|
43 | + require_once $file_name; |
|
44 | + } else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) { |
|
45 | + require_once $file_name; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | # Check if class exists |
45 | 49 | |
@@ -50,5 +54,7 @@ discard block |
||
50 | 54 | |
51 | 55 | # Call autoload method |
52 | 56 | |
53 | - if (method_exists($class_name, '__autoload')) $class_name::__autoload(); |
|
54 | -}); |
|
57 | + if (method_exists($class_name, '__autoload')) { |
|
58 | + $class_name::__autoload(); |
|
59 | + } |
|
60 | + }); |
@@ -49,9 +49,13 @@ |
||
49 | 49 | |
50 | 50 | public static function url(string $value) { |
51 | 51 | |
52 | - if (false === ($value = parent::url($value))) return false; |
|
52 | + if (false === ($value = parent::url($value))) { |
|
53 | + return false; |
|
54 | + } |
|
53 | 55 | |
54 | - if (!preg_match('/^https?:\/\//', $value)) return false; |
|
56 | + if (!preg_match('/^https?:\/\//', $value)) { |
|
57 | + return false; |
|
58 | + } |
|
55 | 59 | |
56 | 60 | # ------------------------ |
57 | 61 |
@@ -44,11 +44,15 @@ |
||
44 | 44 | $data['contents'] = $contents; |
45 | 45 | $data['time_modified'] = REQUEST_TIME; |
46 | 46 | |
47 | - if (0 === $this->page->id) $data['time_created'] = REQUEST_TIME; |
|
47 | + if (0 === $this->page->id) { |
|
48 | + $data['time_created'] = REQUEST_TIME; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | $modifier = ((0 === $this->page->id) ? 'create' : 'edit'); |
50 | 52 | |
51 | - if (!$this->page->$modifier($data)) return 'PAGE_ERROR_MODIFY'; |
|
53 | + if (!$this->page->$modifier($data)) { |
|
54 | + return 'PAGE_ERROR_MODIFY'; |
|
55 | + } |
|
52 | 56 | |
53 | 57 | # ------------------------ |
54 | 58 |
@@ -31,30 +31,46 @@ discard block |
||
31 | 31 | |
32 | 32 | # Validate name & email |
33 | 33 | |
34 | - if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID']; |
|
34 | + if (false === ($name = Validate::userName($name))) { |
|
35 | + return ['name', 'USER_ERROR_NAME_INVALID']; |
|
36 | + } |
|
35 | 37 | |
36 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
38 | + if (false === ($email = Validate::userEmail($email))) { |
|
39 | + return ['email', '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 = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
46 | + if (false === ($password = Validate::userPassword($password))) { |
|
47 | + return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
48 | + } |
|
43 | 49 | |
44 | - if (0 !== strcmp($password, $password_retype)) return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
|
50 | + if (0 !== strcmp($password, $password_retype)) { |
|
51 | + return ['password_retype', '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 ['name', 'USER_ERROR_NAME_DUPLICATE']; |
|
61 | + if ($check_name === 1) { |
|
62 | + return ['name', '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 ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
71 | + if ($check_email === 1) { |
|
72 | + return ['email', '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 |
@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | # Display success message |
52 | 52 | |
53 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
53 | + if (false !== Request::get('submitted')) { |
|
54 | + Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | # ------------------------ |
56 | 58 |