@@ -44,27 +44,45 @@ discard block |
||
44 | 44 | |
45 | 45 | # Validate values |
46 | 46 | |
47 | - if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID']; |
|
47 | + if (false === ($name = Validate::userName($name))) { |
|
48 | + return ['name', 'USER_ERROR_NAME_INVALID']; |
|
49 | + } |
|
48 | 50 | |
49 | - if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
51 | + if (false === ($password = Validate::userPassword($password))) { |
|
52 | + return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
53 | + } |
|
50 | 54 | |
51 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
55 | + if (false === ($email = Validate::userEmail($email))) { |
|
56 | + return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
57 | + } |
|
52 | 58 | |
53 | - if (0 !== strcmp($password, $password_retype)) return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
|
59 | + if (0 !== strcmp($password, $password_retype)) { |
|
60 | + return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
|
61 | + } |
|
54 | 62 | |
55 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
63 | + if (false === Security::checkCaptcha($captcha)) { |
|
64 | + return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
65 | + } |
|
56 | 66 | |
57 | 67 | # Check name exists |
58 | 68 | |
59 | - if (false === ($check_name = $this->user->check($name, 'name'))) return 'USER_ERROR_AUTH_REGISTER'; |
|
69 | + if (false === ($check_name = $this->user->check($name, 'name'))) { |
|
70 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
71 | + } |
|
60 | 72 | |
61 | - if ($check_name === 1) return ['name', 'USER_ERROR_NAME_DUPLICATE']; |
|
73 | + if ($check_name === 1) { |
|
74 | + return ['name', 'USER_ERROR_NAME_DUPLICATE']; |
|
75 | + } |
|
62 | 76 | |
63 | 77 | # Check email exists |
64 | 78 | |
65 | - if (false === ($check_email = $this->user->check($email, 'email'))) return 'USER_ERROR_AUTH_REGISTER'; |
|
79 | + if (false === ($check_email = $this->user->check($email, 'email'))) { |
|
80 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
81 | + } |
|
66 | 82 | |
67 | - if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
83 | + if ($check_email === 1) { |
|
84 | + return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
85 | + } |
|
68 | 86 | |
69 | 87 | # Encode password |
70 | 88 | |
@@ -87,7 +105,9 @@ discard block |
||
87 | 105 | $data['time_registered'] = REQUEST_TIME; |
88 | 106 | $data['time_logged'] = REQUEST_TIME; |
89 | 107 | |
90 | - if (!$this->user->create($data)) return 'USER_ERROR_AUTH_REGISTER'; |
|
108 | + if (!$this->user->create($data)) { |
|
109 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
110 | + } |
|
91 | 111 | |
92 | 112 | # Send mail |
93 | 113 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->addParam('active', '', function (bool $active) { |
|
15 | + $this->config->addParam('active', '', function(bool $active) { |
|
16 | 16 | |
17 | 17 | return ($active ? "ent.active = 1" : ''); |
18 | 18 | }); |
@@ -38,7 +38,9 @@ |
||
38 | 38 | |
39 | 39 | # Set remove button |
40 | 40 | |
41 | - if ($user->id === Auth::get('id')) $view->getBlock('remove')->class = 'disabled'; |
|
41 | + if ($user->id === Auth::get('id')) { |
|
42 | + $view->getBlock('remove')->class = 'disabled'; |
|
43 | + } |
|
42 | 44 | } |
43 | 45 | } |
44 | 46 | } |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | # Add params |
16 | 16 | |
17 | - $this->params->textual ('code', true, 40, true, ''); |
|
18 | - $this->params->textual ('ip', true, 255, false, ''); |
|
19 | - $this->params->integer ('time', false, 10, true, 0); |
|
17 | + $this->params->textual('code', true, 40, true, ''); |
|
18 | + $this->params->textual('ip', true, 255, false, ''); |
|
19 | + $this->params->integer('time', false, 10, true, 0); |
|
20 | 20 | |
21 | 21 | # Add indexes |
22 | 22 | |
23 | - $this->indexes->add ('code', 'UNIQUE'); |
|
24 | - $this->indexes->add ('ip'); |
|
25 | - $this->indexes->add ('time'); |
|
23 | + $this->indexes->add('code', 'UNIQUE'); |
|
24 | + $this->indexes->add('ip'); |
|
25 | + $this->indexes->add('time'); |
|
26 | 26 | |
27 | 27 | # Add foreign keys |
28 | 28 | |
29 | - $this->foreigns->add ('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
29 | + $this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -12,19 +12,33 @@ |
||
12 | 12 | |
13 | 13 | $extension = strtolower(Explorer::getExtension($file_name, false)); |
14 | 14 | |
15 | - if (self::isImage($extension)) return 'image'; |
|
15 | + if (self::isImage($extension)) { |
|
16 | + return 'image'; |
|
17 | + } |
|
16 | 18 | |
17 | - if (self::isAudio($extension)) return 'audio'; |
|
19 | + if (self::isAudio($extension)) { |
|
20 | + return 'audio'; |
|
21 | + } |
|
18 | 22 | |
19 | - if (self::isVideo($extension)) return 'video'; |
|
23 | + if (self::isVideo($extension)) { |
|
24 | + return 'video'; |
|
25 | + } |
|
20 | 26 | |
21 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
27 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
28 | + return 'word'; |
|
29 | + } |
|
22 | 30 | |
23 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
31 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
32 | + return 'excel'; |
|
33 | + } |
|
24 | 34 | |
25 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
35 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
36 | + return 'powerpoint'; |
|
37 | + } |
|
26 | 38 | |
27 | - if ($extension === 'pdf') return 'pdf'; |
|
39 | + if ($extension === 'pdf') { |
|
40 | + return 'pdf'; |
|
41 | + } |
|
28 | 42 | |
29 | 43 | # ------------------------ |
30 | 44 |
@@ -41,14 +41,18 @@ |
||
41 | 41 | |
42 | 42 | foreach (['full_name', 'city'] as $name) { |
43 | 43 | |
44 | - if ('' === ($text = Auth::get($name))) $contents->getBlock($name)->disable(); |
|
45 | - |
|
46 | - else $contents->getBlock($name)->text = $text; |
|
44 | + if ('' === ($text = Auth::get($name))) { |
|
45 | + $contents->getBlock($name)->disable(); |
|
46 | + } else { |
|
47 | + $contents->getBlock($name)->text = $text; |
|
48 | + } |
|
47 | 49 | } |
48 | 50 | |
49 | 51 | # Set country |
50 | 52 | |
51 | - if ('' === ($country = Auth::get('country'))) $contents->getBlock('country')->disable(); else { |
|
53 | + if ('' === ($country = Auth::get('country'))) { |
|
54 | + $contents->getBlock('country')->disable(); |
|
55 | + } else { |
|
52 | 56 | |
53 | 57 | $contents->getBlock('country')->code = $country; |
54 | 58 |
@@ -33,13 +33,19 @@ discard block |
||
33 | 33 | |
34 | 34 | # Validate values |
35 | 35 | |
36 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
36 | + if (false === ($email = Validate::userEmail($email))) { |
|
37 | + return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
38 | + } |
|
37 | 39 | |
38 | 40 | # Check email exists |
39 | 41 | |
40 | - if (false === ($check_email = Auth::getUser()->check($email, 'email'))) return 'USER_ERROR_EDIT_PERSONAL'; |
|
42 | + if (false === ($check_email = Auth::getUser()->check($email, 'email'))) { |
|
43 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
44 | + } |
|
41 | 45 | |
42 | - if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
46 | + if ($check_email === 1) { |
|
47 | + return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
48 | + } |
|
43 | 49 | |
44 | 50 | # Update user |
45 | 51 | |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | $data['country'] = $country; |
54 | 60 | $data['timezone'] = $timezone; |
55 | 61 | |
56 | - if (!Auth::getUser()->edit($data)) return 'USER_ERROR_EDIT_PERSONAL'; |
|
62 | + if (!Auth::getUser()->edit($data)) { |
|
63 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | # ------------------------ |
59 | 67 |
@@ -33,23 +33,28 @@ discard block |
||
33 | 33 | |
34 | 34 | # Validate values |
35 | 35 | |
36 | - if (false === ($password = Validate::userPassword($password))) |
|
37 | - |
|
36 | + if (false === ($password = Validate::userPassword($password))) { |
|
37 | + |
|
38 | 38 | return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
39 | + } |
|
39 | 40 | |
40 | - if (false === ($password_new = Validate::userPassword($password_new))) |
|
41 | - |
|
41 | + if (false === ($password_new = Validate::userPassword($password_new))) { |
|
42 | + |
|
42 | 43 | return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID']; |
44 | + } |
|
43 | 45 | |
44 | - if (0 !== strcmp($password_new, $password_retype)) |
|
45 | - |
|
46 | + if (0 !== strcmp($password_new, $password_retype)) { |
|
47 | + |
|
46 | 48 | return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
49 | + } |
|
47 | 50 | |
48 | 51 | # Check password |
49 | 52 | |
50 | 53 | $password = Str::encode(Auth::get('auth_key'), $password); |
51 | 54 | |
52 | - if (0 !== strcmp(Auth::get('password'), $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
55 | + if (0 !== strcmp(Auth::get('password'), $password)) { |
|
56 | + return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
57 | + } |
|
53 | 58 | |
54 | 59 | # Encode password |
55 | 60 | |
@@ -62,7 +67,9 @@ discard block |
||
62 | 67 | $data['auth_key'] = $auth_key; |
63 | 68 | $data['password'] = $password; |
64 | 69 | |
65 | - if (!Auth::getUser()->edit($data)) return 'USER_ERROR_EDIT_PASSWORD'; |
|
70 | + if (!Auth::getUser()->edit($data)) { |
|
71 | + return 'USER_ERROR_EDIT_PASSWORD'; |
|
72 | + } |
|
66 | 73 | |
67 | 74 | # ------------------------ |
68 | 75 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | # Check auth |
35 | 35 | |
36 | - if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH . '/admin'); |
|
36 | + if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH.'/admin'); |
|
37 | 37 | |
38 | 38 | # Handle request |
39 | 39 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if (!Auth::isLogged() || ((false !== Request::get('logout')) && Auth::logout())) { |
56 | 56 | |
57 | - Request::redirect(INSTALL_PATH . '/admin/login'); |
|
57 | + Request::redirect(INSTALL_PATH.'/admin/login'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | # Handle request |
@@ -33,11 +33,15 @@ discard block |
||
33 | 33 | |
34 | 34 | # Check auth |
35 | 35 | |
36 | - if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH . '/admin'); |
|
36 | + if (($this instanceof Area\Auth) && Auth::isLogged()) { |
|
37 | + Request::redirect(INSTALL_PATH . '/admin'); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | # Handle request |
39 | 41 | |
40 | - if (Template::isBlock($result = $this->handle())) return (new View\Form($this->_title))->display($result); |
|
42 | + if (Template::isBlock($result = $this->handle())) { |
|
43 | + return (new View\Form($this->_title))->display($result); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | # ------------------------ |
43 | 47 | |
@@ -63,9 +67,13 @@ discard block |
||
63 | 67 | |
64 | 68 | $result = $this->handle(Request::isAjax() && ($request === 'display')); |
65 | 69 | |
66 | - if (Template::isBlock($result)) return (new View\Panel($this->_title))->$request($result); |
|
70 | + if (Template::isBlock($result)) { |
|
71 | + return (new View\Panel($this->_title))->$request($result); |
|
72 | + } |
|
67 | 73 | |
68 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
74 | + if (Ajax::isResponse($result)) { |
|
75 | + return Ajax::output($result); |
|
76 | + } |
|
69 | 77 | |
70 | 78 | # ------------------------ |
71 | 79 | |
@@ -84,14 +92,20 @@ discard block |
||
84 | 92 | |
85 | 93 | $ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY); |
86 | 94 | |
87 | - if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::displayError404(); |
|
95 | + if (!in_array(REQUEST_CLIENT_IP, $ips, true)) { |
|
96 | + return Status::displayError404(); |
|
97 | + } |
|
88 | 98 | } |
89 | 99 | |
90 | 100 | # Handle request |
91 | 101 | |
92 | - if (($this instanceof Area\Auth) || ($this instanceof Area\Install)) return $this->handleFormArea(); |
|
102 | + if (($this instanceof Area\Auth) || ($this instanceof Area\Install)) { |
|
103 | + return $this->handleFormArea(); |
|
104 | + } |
|
93 | 105 | |
94 | - if ($this instanceof Area\Panel) return $this->handlePanelArea(); |
|
106 | + if ($this instanceof Area\Panel) { |
|
107 | + return $this->handlePanelArea(); |
|
108 | + } |
|
95 | 109 | |
96 | 110 | # ------------------------ |
97 | 111 |