@@ -14,6 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Get tag |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $contents |
|
| 19 | + */ |
|
| 17 | 20 | protected function getTag(string $name, array $attributes = [], $contents = null) { |
| 18 | 21 | |
| 19 | 22 | $tag = new Tag($name, $attributes, $contents); |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Form\Utils { |
| 4 | 4 | |
| 5 | - use Form, Request, Tag; |
|
| 5 | + use Form; |
|
| 6 | + use Request; |
|
| 7 | + use Tag; |
|
| 6 | 8 | |
| 7 | 9 | abstract class Field { |
| 8 | 10 | |
@@ -24,11 +24,17 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | # Set config |
| 26 | 26 | |
| 27 | - if ($this->disabled) $tag->set('disabled', 'disabled'); |
|
| 27 | + if ($this->disabled) { |
|
| 28 | + $tag->set('disabled', 'disabled'); |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | - if ($this->required) $tag->set('data-required', 'required'); |
|
| 31 | + if ($this->required) { |
|
| 32 | + $tag->set('data-required', 'required'); |
|
| 33 | + } |
|
| 30 | 34 | |
| 31 | - if ($this->error) $tag->set('data-error', 'error'); |
|
| 35 | + if ($this->error) { |
|
| 36 | + $tag->set('data-error', 'error'); |
|
| 37 | + } |
|
| 32 | 38 | |
| 33 | 39 | # ------------------------ |
| 34 | 40 | |
@@ -54,9 +60,12 @@ discard block |
||
| 54 | 60 | |
| 55 | 61 | $params = array_merge(['disabled' => false, 'required' => false], $this->config); |
| 56 | 62 | |
| 57 | - foreach ($params as $name => $default) if (isset($config[$name])) { |
|
| 63 | + foreach ($params as $name => $default) { |
|
| 64 | + if (isset($config[$name])) { |
|
| 58 | 65 | |
| 59 | - try { $this->$name($config[$name]); } catch (\TypeError $e) {} |
|
| 66 | + try { $this->$name($config[$name]); |
|
| 67 | + } |
|
| 68 | + } catch (\TypeError $e) {} |
|
| 60 | 69 | } |
| 61 | 70 | } |
| 62 | 71 | |
@@ -64,7 +73,9 @@ discard block |
||
| 64 | 73 | |
| 65 | 74 | public function post() { |
| 66 | 75 | |
| 67 | - if ($this->posted || $this->disabled || ('' === $this->key)) return false; |
|
| 76 | + if ($this->posted || $this->disabled || ('' === $this->key)) { |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 68 | 79 | |
| 69 | 80 | $this->error = (!$this->set(Request::post($this->name)) && $this->required); |
| 70 | 81 | |
@@ -98,7 +109,9 @@ discard block |
||
| 98 | 109 | |
| 99 | 110 | public function disabled(bool $value = null) { |
| 100 | 111 | |
| 101 | - if (null === $value) return $this->disabled; |
|
| 112 | + if (null === $value) { |
|
| 113 | + return $this->disabled; |
|
| 114 | + } |
|
| 102 | 115 | |
| 103 | 116 | $this->disabled = $value; |
| 104 | 117 | } |
@@ -107,7 +120,9 @@ discard block |
||
| 107 | 120 | |
| 108 | 121 | public function required(bool $value = null) { |
| 109 | 122 | |
| 110 | - if (null === $value) return $this->required; |
|
| 123 | + if (null === $value) { |
|
| 124 | + return $this->required; |
|
| 125 | + } |
|
| 111 | 126 | |
| 112 | 127 | $this->required = $value; |
| 113 | 128 | } |
@@ -116,7 +131,9 @@ discard block |
||
| 116 | 131 | |
| 117 | 132 | public function error(bool $value = null) { |
| 118 | 133 | |
| 119 | - if (null === $value) return $this->error; |
|
| 134 | + if (null === $value) { |
|
| 135 | + return $this->error; |
|
| 136 | + } |
|
| 120 | 137 | |
| 121 | 138 | $this->error = $value; |
| 122 | 139 | } |
@@ -2,8 +2,19 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Frames\Site { |
| 4 | 4 | |
| 5 | - use Frames, Frames\Status, Modules\Auth, Modules\Extend, Modules\Settings, Utils\Menu, Utils\Messages; |
|
| 6 | - use Utils\Template\Variables, Utils\Template\Widgets, Utils\View, Date, Request, Template; |
|
| 5 | + use Frames; |
|
| 6 | + use Frames\Status; |
|
| 7 | + use Modules\Auth; |
|
| 8 | + use Modules\Extend; |
|
| 9 | + use Modules\Settings; |
|
| 10 | + use Utils\Menu; |
|
| 11 | + use Utils\Messages; |
|
| 12 | + use Utils\Template\Variables; |
|
| 13 | + use Utils\Template\Widgets; |
|
| 14 | + use Utils\View; |
|
| 15 | + use Date; |
|
| 16 | + use Request; |
|
| 17 | + use Template; |
|
| 7 | 18 | |
| 8 | 19 | abstract class Section extends Frames\Section { |
| 9 | 20 | |
@@ -39,7 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if (Settings::get('users_registration')) { |
| 41 | 41 | |
| 42 | - if (!Auth::check()) $layout->block('auth')->enable(); else { |
|
| 42 | + if (!Auth::check()) { |
|
| 43 | + $layout->block('auth')->enable(); |
|
| 44 | + } else { |
|
| 43 | 45 | |
| 44 | 46 | $layout->block('user')->enable(); |
| 45 | 47 | |
@@ -47,7 +49,9 @@ discard block |
||
| 47 | 49 | |
| 48 | 50 | $layout->block('user')->name = Auth::user()->name; |
| 49 | 51 | |
| 50 | - if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->block('user')->block('admin')->enable(); |
|
| 52 | + if (Auth::user()->rank === RANK_ADMINISTRATOR) { |
|
| 53 | + $layout->block('user')->block('admin')->enable(); |
|
| 54 | + } |
|
| 51 | 55 | } |
| 52 | 56 | } |
| 53 | 57 | |
@@ -104,9 +108,11 @@ discard block |
||
| 104 | 108 | |
| 105 | 109 | # Set canonical |
| 106 | 110 | |
| 107 | - if ('' === $this->canonical) $page->block('canonical')->disable(); |
|
| 108 | - |
|
| 109 | - else $page->block('canonical')->link = $this->canonical; |
|
| 111 | + if ('' === $this->canonical) { |
|
| 112 | + $page->block('canonical')->disable(); |
|
| 113 | + } else { |
|
| 114 | + $page->block('canonical')->link = $this->canonical; |
|
| 115 | + } |
|
| 110 | 116 | |
| 111 | 117 | # Set layout |
| 112 | 118 | |
@@ -127,19 +133,27 @@ discard block |
||
| 127 | 133 | |
| 128 | 134 | # Check site status |
| 129 | 135 | |
| 130 | - if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance(); |
|
| 136 | + if (Settings::get('site_status') === STATUS_MAINTENANCE) { |
|
| 137 | + return Status::maintenance(); |
|
| 138 | + } |
|
| 131 | 139 | |
| 132 | - if (Settings::get('site_status') === STATUS_UPDATE) return Status::update(); |
|
| 140 | + if (Settings::get('site_status') === STATUS_UPDATE) { |
|
| 141 | + return Status::update(); |
|
| 142 | + } |
|
| 133 | 143 | |
| 134 | 144 | # Check access rights |
| 135 | 145 | |
| 136 | 146 | if ($this instanceof Component\Profile) { |
| 137 | 147 | |
| 138 | - if (!Settings::get('users_registration')) return Status::error404(); |
|
| 148 | + if (!Settings::get('users_registration')) { |
|
| 149 | + return Status::error404(); |
|
| 150 | + } |
|
| 139 | 151 | |
| 140 | 152 | if (($this instanceof Component\Profile\Auth)) { |
| 141 | 153 | |
| 142 | - if (Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
| 154 | + if (Auth::check()) { |
|
| 155 | + Request::redirect(INSTALL_PATH . '/profile'); |
|
| 156 | + } |
|
| 143 | 157 | |
| 144 | 158 | } else if (!Auth::check() || ((false !== Request::get('logout')) && Auth::logout())) { |
| 145 | 159 | |
@@ -153,9 +167,13 @@ discard block |
||
| 153 | 167 | |
| 154 | 168 | # Set global components |
| 155 | 169 | |
| 156 | - foreach (Variables::generate() as $name => $value) Template::global($name, $value); |
|
| 170 | + foreach (Variables::generate() as $name => $value) { |
|
| 171 | + Template::global($name, $value); |
|
| 172 | + } |
|
| 157 | 173 | |
| 158 | - foreach (Widgets::generate() as $name => $block) Template::widget($name, $block); |
|
| 174 | + foreach (Widgets::generate() as $name => $block) { |
|
| 175 | + Template::widget($name, $block); |
|
| 176 | + } |
|
| 159 | 177 | |
| 160 | 178 | # Display page |
| 161 | 179 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Controller { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Validate, Str; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Validate; |
|
| 7 | + use Str; |
|
| 6 | 8 | |
| 7 | 9 | class User { |
| 8 | 10 | |
@@ -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 | |
@@ -2,7 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Entity { |
| 4 | 4 | |
| 5 | - use Modules\Auth, Modules\Entitizer, Modules\Settings, DB; |
|
| 5 | + use Modules\Auth; |
|
| 6 | + use Modules\Entitizer; |
|
| 7 | + use Modules\Settings; |
|
| 8 | + use DB; |
|
| 6 | 9 | |
| 7 | 10 | class Page extends Entitizer\Utils\Entity { |
| 8 | 11 | |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
| 66 | 66 | |
| 67 | - ("FROM " . static::$table . " ent ") . |
|
| 67 | + ("FROM " . static::$table . " ent ") . |
|
| 68 | 68 | |
| 69 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 69 | + ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 70 | 70 | |
| 71 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
| 71 | + ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
| 72 | 72 | |
| 73 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 73 | + ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 74 | 74 | |
| 75 | 75 | # Select entity from DB |
| 76 | 76 | |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
| 93 | 93 | |
| 94 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 94 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 95 | 95 | |
| 96 | - ("FROM " . static::$table_relations . " rel ") . |
|
| 96 | + ("FROM " . static::$table_relations . " rel ") . |
|
| 97 | 97 | |
| 98 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 98 | + ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 99 | 99 | |
| 100 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 100 | + ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 101 | 101 | |
| 102 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 102 | + ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 103 | 103 | |
| 104 | - (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
| 104 | + (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
|
| 105 | 105 | |
| 106 | 106 | if (!(DB::send($query) && DB::last()->status)) return false; |
| 107 | 107 | |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $query = ("UPDATE " . static::$table . " ent JOIN (") . |
| 111 | 111 | |
| 112 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 112 | + ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 113 | 113 | |
| 114 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 114 | + ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 115 | 115 | |
| 116 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 116 | + ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 117 | 117 | |
| 118 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 118 | + ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 119 | 119 | |
| 120 | - (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
| 120 | + (") chk ON chk.id = ent.id SET ent.locked = 0"); |
|
| 121 | 121 | |
| 122 | 122 | if (!(DB::send($query) && DB::last()->status)) return false; |
| 123 | 123 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if ('' === $this->data['slug']) return ''; |
| 23 | 23 | |
| 24 | - return (INSTALL_PATH . '/' . $this->data['slug']); |
|
| 24 | + return (INSTALL_PATH.'/'.$this->data['slug']); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | # Get canonical |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | if ('' === $this->data['slug']) return ''; |
| 32 | 32 | |
| 33 | - return (Settings::get('system_url') . (($this->id !== 1) ? ('/' . $this->data['slug']) : '')); |
|
| 33 | + return (Settings::get('system_url').(($this->id !== 1) ? ('/'.$this->data['slug']) : '')); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | # Implement entity |
@@ -58,19 +58,19 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $selection = array_keys($this->definition->params()); |
| 60 | 60 | |
| 61 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
| 61 | + foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field); |
|
| 62 | 62 | |
| 63 | 63 | # Process query |
| 64 | 64 | |
| 65 | - $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
|
| 65 | + $query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id "). |
|
| 66 | 66 | |
| 67 | - ("FROM " . static::$table . " ent ") . |
|
| 67 | + ("FROM ".static::$table." ent "). |
|
| 68 | 68 | |
| 69 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
| 69 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
| 70 | 70 | |
| 71 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
| 71 | + ("WHERE ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.access <= ".Auth::user()->rank." AND "). |
|
| 72 | 72 | |
| 73 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
| 73 | + ("ent.locked = 0 AND ent.slug = '".addslashes($slug)."' LIMIT 1"); |
|
| 74 | 74 | |
| 75 | 75 | # Select entity from DB |
| 76 | 76 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | # Send lock/update request |
| 91 | 91 | |
| 92 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
| 92 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
| 93 | 93 | |
| 94 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
| 94 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug "). |
|
| 95 | 95 | |
| 96 | - ("FROM " . static::$table_relations . " rel ") . |
|
| 96 | + ("FROM ".static::$table_relations." rel "). |
|
| 97 | 97 | |
| 98 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
| 98 | + ("JOIN ".static::$table_relations." rls ON rls.descendant = rel.descendant "). |
|
| 99 | 99 | |
| 100 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
| 100 | + ("JOIN ".static::$table." ens ON ens.id = rls.ancestor "). |
|
| 101 | 101 | |
| 102 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
| 102 | + ("WHERE rel.ancestor = ".$this->id." GROUP BY rel.descendant"). |
|
| 103 | 103 | |
| 104 | 104 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
| 105 | 105 | |
@@ -107,15 +107,15 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | # Send unlock request |
| 109 | 109 | |
| 110 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
| 110 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
| 111 | 111 | |
| 112 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
| 112 | + ("SELECT rel.descendant as id FROM ".static::$table_relations." rel "). |
|
| 113 | 113 | |
| 114 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
| 114 | + ("JOIN ".static::$table." enc ON enc.id = rel.descendant AND enc.locked = 1 "). |
|
| 115 | 115 | |
| 116 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
| 116 | + ("LEFT JOIN ".static::$table." end ON end.id != enc.id AND end.slug = enc.slug "). |
|
| 117 | 117 | |
| 118 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
| 118 | + ("WHERE end.id IS NULL GROUP BY rel.descendant"). |
|
| 119 | 119 | |
| 120 | 120 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
| 121 | 121 | |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private function getLink() { |
| 21 | 21 | |
| 22 | - if ('' === $this->data['slug']) return ''; |
|
| 22 | + if ('' === $this->data['slug']) { |
|
| 23 | + return ''; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | return (INSTALL_PATH . '/' . $this->data['slug']); |
| 25 | 27 | } |
@@ -28,7 +30,9 @@ discard block |
||
| 28 | 30 | |
| 29 | 31 | private function getCanonical() { |
| 30 | 32 | |
| 31 | - if ('' === $this->data['slug']) return ''; |
|
| 33 | + if ('' === $this->data['slug']) { |
|
| 34 | + return ''; |
|
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | return (Settings::get('system_url') . (($this->id !== 1) ? ('/' . $this->data['slug']) : '')); |
| 34 | 38 | } |
@@ -48,7 +52,9 @@ discard block |
||
| 48 | 52 | |
| 49 | 53 | public function initBySlug(string $slug) { |
| 50 | 54 | |
| 51 | - if (!$this->modifiable || (0 !== $this->id)) return false; |
|
| 55 | + if (!$this->modifiable || (0 !== $this->id)) { |
|
| 56 | + return false; |
|
| 57 | + } |
|
| 52 | 58 | |
| 53 | 59 | # Process value |
| 54 | 60 | |
@@ -58,7 +64,9 @@ discard block |
||
| 58 | 64 | |
| 59 | 65 | $selection = array_keys($this->definition->params()); |
| 60 | 66 | |
| 61 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
| 67 | + foreach ($selection as $key => $field) { |
|
| 68 | + $selection[$key] = ('ent.' . $field); |
|
| 69 | + } |
|
| 62 | 70 | |
| 63 | 71 | # Process query |
| 64 | 72 | |
@@ -74,7 +82,9 @@ discard block |
||
| 74 | 82 | |
| 75 | 83 | # Select entity from DB |
| 76 | 84 | |
| 77 | - if (($this->error = !(DB::send($query) && DB::last()->status)) || (DB::last()->rows !== 1)) return false; |
|
| 85 | + if (($this->error = !(DB::send($query) && DB::last()->status)) || (DB::last()->rows !== 1)) { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 78 | 88 | |
| 79 | 89 | # ------------------------ |
| 80 | 90 | |
@@ -85,7 +95,9 @@ discard block |
||
| 85 | 95 | |
| 86 | 96 | public function updateSlugs() { |
| 87 | 97 | |
| 88 | - if (!$this->modifiable || (0 === $this->id)) return false; |
|
| 98 | + if (!$this->modifiable || (0 === $this->id)) { |
|
| 99 | + return false; |
|
| 100 | + } |
|
| 89 | 101 | |
| 90 | 102 | # Send lock/update request |
| 91 | 103 | |
@@ -103,7 +115,9 @@ discard block |
||
| 103 | 115 | |
| 104 | 116 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
| 105 | 117 | |
| 106 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
| 118 | + if (!(DB::send($query) && DB::last()->status)) { |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 107 | 121 | |
| 108 | 122 | # Send unlock request |
| 109 | 123 | |
@@ -119,7 +133,9 @@ discard block |
||
| 119 | 133 | |
| 120 | 134 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
| 121 | 135 | |
| 122 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
| 136 | + if (!(DB::send($query) && DB::last()->status)) { |
|
| 137 | + return false; |
|
| 138 | + } |
|
| 123 | 139 | |
| 124 | 140 | # ------------------------ |
| 125 | 141 | |
@@ -130,7 +146,9 @@ discard block |
||
| 130 | 146 | |
| 131 | 147 | public function create(array $data) { |
| 132 | 148 | |
| 133 | - if (!parent::create($data)) return false; |
|
| 149 | + if (!parent::create($data)) { |
|
| 150 | + return false; |
|
| 151 | + } |
|
| 134 | 152 | |
| 135 | 153 | $this->updateSlugs(); |
| 136 | 154 | |
@@ -143,7 +161,9 @@ discard block |
||
| 143 | 161 | |
| 144 | 162 | public function edit(array $data) { |
| 145 | 163 | |
| 146 | - if (!parent::edit($data)) return false; |
|
| 164 | + if (!parent::edit($data)) { |
|
| 165 | + return false; |
|
| 166 | + } |
|
| 147 | 167 | |
| 148 | 168 | $this->updateSlugs(); |
| 149 | 169 | |
@@ -156,7 +176,9 @@ discard block |
||
| 156 | 176 | |
| 157 | 177 | public function move(int $parent_id) { |
| 158 | 178 | |
| 159 | - if (!parent::move($parent_id)) return false; |
|
| 179 | + if (!parent::move($parent_id)) { |
|
| 180 | + return false; |
|
| 181 | + } |
|
| 160 | 182 | |
| 161 | 183 | $this->updateSlugs(); |
| 162 | 184 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Form, Utils\Range; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Form; |
|
| 7 | + use Utils\Range; |
|
| 6 | 8 | |
| 7 | 9 | class Menuitem extends Form { |
| 8 | 10 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Form, Utils\Range; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Form; |
|
| 7 | + use Utils\Range; |
|
| 6 | 8 | |
| 7 | 9 | class Page extends Form { |
| 8 | 10 | |
@@ -2,7 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Auth, Modules\Entitizer, Utils\Form, Utils\Range, Geo\Country, Geo\Timezone, Language; |
|
| 5 | + use Modules\Auth; |
|
| 6 | + use Modules\Entitizer; |
|
| 7 | + use Utils\Form; |
|
| 8 | + use Utils\Range; |
|
| 9 | + use Geo\Country; |
|
| 10 | + use Geo\Timezone; |
|
| 11 | + use Language; |
|
| 6 | 12 | |
| 7 | 13 | class User extends Form { |
| 8 | 14 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Lister { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Range, Template; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Range; |
|
| 7 | + use Template; |
|
| 6 | 8 | |
| 7 | 9 | class Pages extends Entitizer\Utils\Lister { |
| 8 | 10 | |
@@ -32,7 +32,9 @@ |
||
| 32 | 32 | |
| 33 | 33 | $parent->block('browse')->disable(); $parent->block('browse_disabled')->enable(); |
| 34 | 34 | |
| 35 | - } else $parent->block('browse')->link = $this->parent->link; |
|
| 35 | + } else { |
|
| 36 | + $parent->block('browse')->link = $this->parent->link; |
|
| 37 | + } |
|
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | # Add item additional data |
@@ -2,7 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Lister { |
| 4 | 4 | |
| 5 | - use Modules\Auth, Modules\Entitizer, Utils\Range, Template; |
|
| 5 | + use Modules\Auth; |
|
| 6 | + use Modules\Entitizer; |
|
| 7 | + use Utils\Range; |
|
| 8 | + use Template; |
|
| 6 | 9 | |
| 7 | 10 | class Users extends Entitizer\Utils\Lister { |
| 8 | 11 | |