@@ -87,7 +87,7 @@ |
||
| 87 | 87 | |
| 88 | 88 | public static function isInitial() : bool { |
| 89 | 89 | |
| 90 | - DB::send("SHOW TABLE STATUS WHERE name LIKE '" . TABLE_USERS . "'"); |
|
| 90 | + DB::send("SHOW TABLE STATUS WHERE name LIKE '".TABLE_USERS."'"); |
|
| 91 | 91 | |
| 92 | 92 | if (!(DB::getLast() && (null !== ($data = DB::getLast()->getRow())))) return false; |
| 93 | 93 | |
@@ -31,11 +31,15 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | # Check session code |
| 33 | 33 | |
| 34 | - if (!is_string($code = Session::get('code'))) return false; |
|
| 34 | + if (!is_string($code = Session::get('code'))) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | # Authorize |
| 37 | 39 | |
| 38 | - if (false === ($result = Auth\Utils\Connector\Session::authorize($code, self::$admin))) return false; |
|
| 40 | + if (false === ($result = Auth\Utils\Connector\Session::authorize($code, self::$admin))) { |
|
| 41 | + return false; |
|
| 42 | + } |
|
| 39 | 43 | |
| 40 | 44 | # Update auth |
| 41 | 45 | |
@@ -62,7 +66,9 @@ discard block |
||
| 62 | 66 | |
| 63 | 67 | public static function logout() : bool { |
| 64 | 68 | |
| 65 | - if ((null === self::$user) || (0 === self::$user->id)) return false; |
|
| 69 | + if ((null === self::$user) || (0 === self::$user->id)) { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 66 | 72 | |
| 67 | 73 | # Remove auth entry from db |
| 68 | 74 | |
@@ -89,7 +95,9 @@ discard block |
||
| 89 | 95 | |
| 90 | 96 | DB::send("SHOW TABLE STATUS WHERE name LIKE '" . TABLE_USERS . "'"); |
| 91 | 97 | |
| 92 | - if (!(DB::getLast() && (null !== ($data = DB::getLast()->getRow())))) return false; |
|
| 98 | + if (!(DB::getLast() && (null !== ($data = DB::getLast()->getRow())))) { |
|
| 99 | + return false; |
|
| 100 | + } |
|
| 93 | 101 | |
| 94 | 102 | # ------------------------ |
| 95 | 103 | |
@@ -44,13 +44,15 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | # Validate values |
| 46 | 46 | |
| 47 | - if (false === ($password_new = Validate::userPassword($password_new))) |
|
| 48 | - |
|
| 47 | + if (false === ($password_new = Validate::userPassword($password_new))) { |
|
| 48 | + |
|
| 49 | 49 | return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID']; |
| 50 | + } |
|
| 50 | 51 | |
| 51 | - if (0 !== strcmp($password_new, $password_retype)) |
|
| 52 | - |
|
| 52 | + if (0 !== strcmp($password_new, $password_retype)) { |
|
| 53 | + |
|
| 53 | 54 | return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | # Encode password |
| 56 | 58 | |
@@ -60,7 +62,9 @@ discard block |
||
| 60 | 62 | |
| 61 | 63 | $data = ['auth_key' => $auth_key, 'password' => $password]; |
| 62 | 64 | |
| 63 | - if (!$this->user->edit($data)) return 'USER_ERROR_AUTH_RECOVER'; |
|
| 65 | + if (!$this->user->edit($data)) { |
|
| 66 | + return 'USER_ERROR_AUTH_RECOVER'; |
|
| 67 | + } |
|
| 64 | 68 | |
| 65 | 69 | # Remove secret |
| 66 | 70 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | if ((!$this->user->init($$init_by, $init_by)) || (Auth::isAdmin() && ($this->user->rank < RANK_ADMINISTRATOR))) { |
| 58 | 58 | |
| 59 | - return ['name_email', ('USER_ERROR_' . strtoupper($init_by) .'_INCORRECT')]; |
|
| 59 | + return ['name_email', ('USER_ERROR_'.strtoupper($init_by).'_INCORRECT')]; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | # Check access |
@@ -46,9 +46,13 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | if ((false === ($name = Validate::userName($name_email))) && |
| 48 | 48 | |
| 49 | - (false === ($email = Validate::userEmail($name_email)))) return ['name_email', 'USER_ERROR_NAME_INVALID']; |
|
| 49 | + (false === ($email = Validate::userEmail($name_email)))) { |
|
| 50 | + return ['name_email', 'USER_ERROR_NAME_INVALID']; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 53 | + if (false === Security::checkCaptcha($captcha)) { |
|
| 54 | + return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | # Init user |
| 54 | 58 | |
@@ -61,7 +65,9 @@ discard block |
||
| 61 | 65 | |
| 62 | 66 | # Check access |
| 63 | 67 | |
| 64 | - if (!Auth::isAdmin() && ($this->user->rank === RANK_GUEST)) return 'USER_ERROR_ACCESS'; |
|
| 68 | + if (!Auth::isAdmin() && ($this->user->rank === RANK_GUEST)) { |
|
| 69 | + return 'USER_ERROR_ACCESS'; |
|
| 70 | + } |
|
| 65 | 71 | |
| 66 | 72 | # Create secret |
| 67 | 73 | |
@@ -71,7 +77,9 @@ discard block |
||
| 71 | 77 | |
| 72 | 78 | $data = ['id' => $this->user->id, 'code' => $code, 'ip' => $ip, 'time' => $time]; |
| 73 | 79 | |
| 74 | - if (!$secret->create($data)) return 'USER_ERROR_AUTH_RESET'; |
|
| 80 | + if (!$secret->create($data)) { |
|
| 81 | + return 'USER_ERROR_AUTH_RESET'; |
|
| 82 | + } |
|
| 75 | 83 | |
| 76 | 84 | # Send mail |
| 77 | 85 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | if ((!$this->user->init($$init_by, $init_by)) || (Auth::isAdmin() && ($this->user->rank < RANK_ADMINISTRATOR))) { |
| 58 | 58 | |
| 59 | - return ['name_email', ('USER_ERROR_' . strtoupper($init_by) .'_INCORRECT')]; |
|
| 59 | + return ['name_email', ('USER_ERROR_'.strtoupper($init_by).'_INCORRECT')]; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | # Check password |
@@ -46,9 +46,13 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | if ((false === ($name = Validate::userName($name_email))) && |
| 48 | 48 | |
| 49 | - (false === ($email = Validate::userEmail($name_email)))) return ['name_email', 'USER_ERROR_NAME_INVALID']; |
|
| 49 | + (false === ($email = Validate::userEmail($name_email)))) { |
|
| 50 | + return ['name_email', 'USER_ERROR_NAME_INVALID']; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | - if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 53 | + if (false === ($password = Validate::userPassword($password))) { |
|
| 54 | + return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 55 | + } |
|
| 52 | 56 | |
| 53 | 57 | # Init user |
| 54 | 58 | |
@@ -63,11 +67,15 @@ discard block |
||
| 63 | 67 | |
| 64 | 68 | $password = Str::encode($this->user->auth_key, $password); |
| 65 | 69 | |
| 66 | - if (0 !== strcmp($this->user->password, $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 70 | + if (0 !== strcmp($this->user->password, $password)) { |
|
| 71 | + return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 72 | + } |
|
| 67 | 73 | |
| 68 | 74 | # Check access |
| 69 | 75 | |
| 70 | - if (!Auth::isAdmin() && ($this->user->rank === RANK_GUEST)) return 'USER_ERROR_ACCESS'; |
|
| 76 | + if (!Auth::isAdmin() && ($this->user->rank === RANK_GUEST)) { |
|
| 77 | + return 'USER_ERROR_ACCESS'; |
|
| 78 | + } |
|
| 71 | 79 | |
| 72 | 80 | # Create session |
| 73 | 81 | |
@@ -77,7 +85,9 @@ discard block |
||
| 77 | 85 | |
| 78 | 86 | $data = ['id' => $this->user->id, 'code' => $code, 'ip' => $ip, 'time' => $time]; |
| 79 | 87 | |
| 80 | - if (!$session->create($data)) return 'USER_ERROR_AUTH_LOGIN'; |
|
| 88 | + if (!$session->create($data)) { |
|
| 89 | + return 'USER_ERROR_AUTH_LOGIN'; |
|
| 90 | + } |
|
| 81 | 91 | |
| 82 | 92 | # Set session variable |
| 83 | 93 | |
@@ -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 | |
@@ -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 | } |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
| 30 | 30 | |
| 31 | - ("FROM " . static::$table . " ent ") . |
|
| 31 | + ("FROM " . static::$table . " ent ") . |
|
| 32 | 32 | |
| 33 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 33 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 34 | 34 | |
| 35 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::get('rank') . " AND ") . |
|
| 35 | + ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::get('rank') . " AND ") . |
|
| 36 | 36 | |
| 37 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 37 | + ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 38 | 38 | |
| 39 | 39 | # Select entity from DB |
| 40 | 40 | |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
| 57 | 57 | |
| 58 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 58 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 59 | 59 | |
| 60 | - ("FROM " . static::$table_relations . " rel ") . |
|
| 60 | + ("FROM " . static::$table_relations . " rel ") . |
|
| 61 | 61 | |
| 62 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 62 | + ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 63 | 63 | |
| 64 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 64 | + ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 65 | 65 | |
| 66 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 66 | + ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 67 | 67 | |
| 68 | - (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
| 68 | + (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
| 69 | 69 | |
| 70 | 70 | if (!(DB::send($query) && DB::getLast()->status)) return false; |
| 71 | 71 | |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
| 75 | 75 | |
| 76 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 76 | + ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 77 | 77 | |
| 78 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 78 | + ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 79 | 79 | |
| 80 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 80 | + ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 81 | 81 | |
| 82 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 82 | + ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 83 | 83 | |
| 84 | - (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
| 84 | + (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
| 85 | 85 | |
| 86 | 86 | if (!(DB::send($query) && DB::getLast()->status)) return false; |
| 87 | 87 | |
@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $selection = array_keys($this->definition->params()); |
| 24 | 24 | |
| 25 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
| 25 | + foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field); |
|
| 26 | 26 | |
| 27 | 27 | # Process query |
| 28 | 28 | |
| 29 | - $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
|
| 29 | + $query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id "). |
|
| 30 | 30 | |
| 31 | - ("FROM " . static::$table . " ent ") . |
|
| 31 | + ("FROM ".static::$table." ent "). |
|
| 32 | 32 | |
| 33 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 33 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
| 34 | 34 | |
| 35 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::get('rank') . " AND ") . |
|
| 35 | + ("WHERE ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.access <= ".Auth::get('rank')." AND "). |
|
| 36 | 36 | |
| 37 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 37 | + ("ent.locked = 0 AND ent.slug = '".addslashes($slug)."' LIMIT 1"); |
|
| 38 | 38 | |
| 39 | 39 | # Select entity from DB |
| 40 | 40 | |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | # Send lock/update request |
| 55 | 55 | |
| 56 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
| 56 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
| 57 | 57 | |
| 58 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 58 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug "). |
|
| 59 | 59 | |
| 60 | - ("FROM " . static::$table_relations . " rel ") . |
|
| 60 | + ("FROM ".static::$table_relations." rel "). |
|
| 61 | 61 | |
| 62 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 62 | + ("JOIN ".static::$table_relations." rls ON rls.descendant = rel.descendant "). |
|
| 63 | 63 | |
| 64 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 64 | + ("JOIN ".static::$table." ens ON ens.id = rls.ancestor "). |
|
| 65 | 65 | |
| 66 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 66 | + ("WHERE rel.ancestor = ".$this->id." GROUP BY rel.descendant"). |
|
| 67 | 67 | |
| 68 | 68 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
| 69 | 69 | |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | # Send unlock request |
| 73 | 73 | |
| 74 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
| 74 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
| 75 | 75 | |
| 76 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 76 | + ("SELECT rel.descendant as id FROM ".static::$table_relations." rel "). |
|
| 77 | 77 | |
| 78 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 78 | + ("JOIN ".static::$table." enc ON enc.id = rel.descendant AND enc.locked = 1 "). |
|
| 79 | 79 | |
| 80 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 80 | + ("LEFT JOIN ".static::$table." end ON end.id != enc.id AND end.slug = enc.slug "). |
|
| 81 | 81 | |
| 82 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 82 | + ("WHERE end.id IS NULL GROUP BY rel.descendant"). |
|
| 83 | 83 | |
| 84 | 84 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
| 85 | 85 | |
@@ -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 | |