@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | if ($this->form_personal->handle($controller_personal) || $this->form_password->handle($controller_password)) { |
47 | 47 | |
48 | - Request::redirect(INSTALL_PATH . '/profile/edit?submitted'); |
|
48 | + Request::redirect(INSTALL_PATH.'/profile/edit?submitted'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | # Display success message |
@@ -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 |
@@ -24,14 +24,14 @@ |
||
24 | 24 | |
25 | 25 | if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', '); |
26 | 26 | |
27 | - $values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')'); |
|
27 | + $values[] = ('('.$this->getString(array_values($row), '$value', ', ').')'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # Build query |
31 | 31 | |
32 | - $this->query = ('INSERT ' . ($ignore ? 'IGNORE ' : '') . |
|
32 | + $this->query = ('INSERT '.($ignore ? 'IGNORE ' : ''). |
|
33 | 33 | |
34 | - 'INTO ' . $table . ' (' . $names . ') VALUES ' . implode(', ', $values)); |
|
34 | + 'INTO '.$table.' ('.$names.') VALUES '.implode(', ', $values)); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
@@ -29,9 +29,11 @@ |
||
29 | 29 | |
30 | 30 | $names = ''; $values = []; |
31 | 31 | |
32 | - foreach ($set as $key => $row) if (is_array($row)) { |
|
32 | + foreach ($set as $key => $row) { |
|
33 | + if (is_array($row)) { |
|
33 | 34 | |
34 | 35 | if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', '); |
36 | + } |
|
35 | 37 | |
36 | 38 | $values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')'); |
37 | 39 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | # Database tables |
4 | 4 | |
5 | -define('TABLE_PAGES', 'pages'); |
|
6 | -define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
5 | +define('TABLE_PAGES', 'pages'); |
|
6 | +define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
7 | 7 | |
8 | -define('TABLE_MENU', 'menu'); |
|
9 | -define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
8 | +define('TABLE_MENU', 'menu'); |
|
9 | +define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
10 | 10 | |
11 | -define('TABLE_VARIABLES', 'variables'); |
|
12 | -define('TABLE_WIDGETS', 'widgets'); |
|
11 | +define('TABLE_VARIABLES', 'variables'); |
|
12 | +define('TABLE_WIDGETS', 'widgets'); |
|
13 | 13 | |
14 | -define('TABLE_USERS', 'users'); |
|
15 | -define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
16 | -define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|
14 | +define('TABLE_USERS', 'users'); |
|
15 | +define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
16 | +define('TABLE_USERS_SESSIONS', 'users_sessions'); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
41 | 41 | |
42 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
42 | + @file_exists($this->entity->parent()->pathFull().$name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
43 | 43 | |
44 | 44 | # Rename item |
45 | 45 |
@@ -29,19 +29,25 @@ |
||
29 | 29 | |
30 | 30 | # Validate name |
31 | 31 | |
32 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
32 | + if (false === ($name = Validate::fileName($name))) { |
|
33 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Check if item exists |
35 | 37 | |
36 | 38 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
37 | 39 | |
38 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
40 | + @file_exists($this->entity->parent()->pathFull() . $name)) { |
|
41 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
42 | + } |
|
39 | 43 | |
40 | 44 | # Rename item |
41 | 45 | |
42 | - if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
46 | + if (!$this->entity->rename($name)) { |
|
47 | + return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
43 | 48 | |
44 | 49 | 'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME'); |
50 | + } |
|
45 | 51 | |
46 | 52 | # ------------------------ |
47 | 53 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | # Check if item exists |
39 | 39 | |
40 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
40 | + if (@file_exists($this->parent->pathFull().$name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
41 | 41 | |
42 | 42 | # Create item |
43 | 43 |
@@ -29,19 +29,25 @@ |
||
29 | 29 | |
30 | 30 | # Validate name |
31 | 31 | |
32 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
32 | + if (false === ($name = Validate::fileName($name))) { |
|
33 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Check if item exists |
35 | 37 | |
36 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
38 | + if (@file_exists($this->parent->pathFull() . $name)) { |
|
39 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Create item |
39 | 43 | |
40 | 44 | $entity = Filemanager::get($type, $this->parent); |
41 | 45 | |
42 | - if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
46 | + if (!$entity->create($name)) { |
|
47 | + return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
43 | 48 | |
44 | 49 | 'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE'); |
50 | + } |
|
45 | 51 | |
46 | 52 | # ------------------------ |
47 | 53 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | return ((null !== $this->type) ? ($this->type . " ") : "") . |
34 | 34 | |
35 | - ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
35 | + ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -45,9 +45,9 @@ |
||
45 | 45 | |
46 | 46 | public function getStatement() : string { |
47 | 47 | |
48 | - return ((null !== $this->type) ? ($this->type . " ") : "") . |
|
48 | + return ((null !== $this->type) ? ($this->type." ") : ""). |
|
49 | 49 | |
50 | - ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
50 | + ("KEY `".$this->name."` (`".$this->name."`)"); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -36,7 +36,9 @@ |
||
36 | 36 | |
37 | 37 | $this->name = $name; |
38 | 38 | |
39 | - if (null !== $type) $this->type = $this->validateType($type); |
|
39 | + if (null !== $type) { |
|
40 | + $this->type = $this->validateType($type); |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | |
42 | 44 | /** |
@@ -30,9 +30,9 @@ |
||
30 | 30 | |
31 | 31 | $query = ("CREATE TABLE IF NOT EXISTS `" . static::$table . "` (") . |
32 | 32 | |
33 | - implode(", ", $this->getStatements()) . |
|
33 | + implode(", ", $this->getStatements()) . |
|
34 | 34 | |
35 | - (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
|
35 | + (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
|
36 | 36 | |
37 | 37 | # ------------------------ |
38 | 38 |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | private function createMainTable() : bool { |
43 | 43 | |
44 | - $query = ("CREATE TABLE IF NOT EXISTS `" . static::$table . "` (") . |
|
44 | + $query = ("CREATE TABLE IF NOT EXISTS `".static::$table."` ("). |
|
45 | 45 | |
46 | - implode(", ", $this->getStatements()) . |
|
46 | + implode(", ", $this->getStatements()). |
|
47 | 47 | |
48 | 48 | (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
49 | 49 | |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | |
61 | 61 | private function createRelationsTable() : bool { |
62 | 62 | |
63 | - $query = ("CREATE TABLE IF NOT EXISTS `" . static::$table_relations . "` (") . |
|
63 | + $query = ("CREATE TABLE IF NOT EXISTS `".static::$table_relations."` ("). |
|
64 | 64 | |
65 | - ("`ancestor` int(10) UNSIGNED NOT NULL, `descendant` int(10) UNSIGNED NOT NULL, ") . |
|
65 | + ("`ancestor` int(10) UNSIGNED NOT NULL, `descendant` int(10) UNSIGNED NOT NULL, "). |
|
66 | 66 | |
67 | - ("`depth` int(10) UNSIGNED NOT NULL, ") . |
|
67 | + ("`depth` int(10) UNSIGNED NOT NULL, "). |
|
68 | 68 | |
69 | - ("PRIMARY KEY (`ancestor`, `descendant`), KEY (`ancestor`), KEY (`descendant`), KEY (`depth`), ") . |
|
69 | + ("PRIMARY KEY (`ancestor`, `descendant`), KEY (`ancestor`), KEY (`descendant`), KEY (`depth`), "). |
|
70 | 70 | |
71 | - ("FOREIGN KEY (`ancestor`) REFERENCES `" . static::$table . "` (`id`) ON DELETE CASCADE, ") . |
|
71 | + ("FOREIGN KEY (`ancestor`) REFERENCES `".static::$table."` (`id`) ON DELETE CASCADE, "). |
|
72 | 72 | |
73 | - ("FOREIGN KEY (`descendant`) REFERENCES `" . static::$table . "` (`id`) ON DELETE CASCADE ") . |
|
73 | + ("FOREIGN KEY (`descendant`) REFERENCES `".static::$table."` (`id`) ON DELETE CASCADE "). |
|
74 | 74 | |
75 | 75 | (") ENGINE=InnoDB DEFAULT CHARSET=utf8"); |
76 | 76 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | private function removeMainTable() : bool { |
89 | 89 | |
90 | - $query = ("DROP TABLE IF EXISTS `" . static::$table . "`"); |
|
90 | + $query = ("DROP TABLE IF EXISTS `".static::$table."`"); |
|
91 | 91 | |
92 | 92 | return (DB::send($query) && DB::getLast()->status); |
93 | 93 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | private function removeRelationsTable() : bool { |
102 | 102 | |
103 | - $query = ("DROP TABLE IF EXISTS `" . static::$table_relations . "`"); |
|
103 | + $query = ("DROP TABLE IF EXISTS `".static::$table_relations."`"); |
|
104 | 104 | |
105 | 105 | return (DB::send($query) && DB::getLast()->status); |
106 | 106 | } |
@@ -25,7 +25,9 @@ |
||
25 | 25 | |
26 | 26 | foreach ([$this->params, $this->indexes, $this->foreigns] as $group) { |
27 | 27 | |
28 | - foreach ($group->getList() as $item) $statements[] = $item->getStatement(); |
|
28 | + foreach ($group->getList() as $item) { |
|
29 | + $statements[] = $item->getStatement(); |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | # ------------------------ |
@@ -65,9 +65,9 @@ |
||
65 | 65 | |
66 | 66 | private function getPaginationBlock() { |
67 | 67 | |
68 | - $query = (static::$nesting ? ('?parent_id=' . $this->parent->id) : ''); |
|
68 | + $query = (static::$nesting ? ('?parent_id='.$this->parent->id) : ''); |
|
69 | 69 | |
70 | - $url = new Url(INSTALL_PATH . static::$link . $query); |
|
70 | + $url = new Url(INSTALL_PATH.static::$link.$query); |
|
71 | 71 | |
72 | 72 | # ------------------------ |
73 | 73 |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | # Set create button |
31 | 31 | |
32 | - if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) $parent->getBlock('create')->id = $this->parent->id; |
|
33 | - |
|
34 | - else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); } |
|
32 | + if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) { |
|
33 | + $parent->getBlock('create')->id = $this->parent->id; |
|
34 | + } else { $parent->getBlock('create')->disable(); $parent->getBlock('create_disabled')->enable(); } |
|
35 | 35 | |
36 | 36 | # Set edit button |
37 | 37 | |
38 | - if (0 !== $this->parent->id) $parent->getBlock('edit')->id = $this->parent->id; |
|
39 | - |
|
40 | - else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); } |
|
38 | + if (0 !== $this->parent->id) { |
|
39 | + $parent->getBlock('edit')->id = $this->parent->id; |
|
40 | + } else { $parent->getBlock('edit')->disable(); $parent->getBlock('edit_disabled')->enable(); } |
|
41 | 41 | |
42 | 42 | # Add parent additional data |
43 | 43 | |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | foreach ($this->items['list'] as $item) { |
54 | 54 | |
55 | - if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) continue; |
|
55 | + if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) { |
|
56 | + continue; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $items->addItem($view = View::get(!$ajax ? static::$view_item : static::$view_ajax_item)); |
58 | 60 | |
@@ -121,11 +123,15 @@ discard block |
||
121 | 123 | |
122 | 124 | # Set path |
123 | 125 | |
124 | - if (static::$nesting) $contents->path = $this->path; |
|
126 | + if (static::$nesting) { |
|
127 | + $contents->path = $this->path; |
|
128 | + } |
|
125 | 129 | |
126 | 130 | # Process parent block |
127 | 131 | |
128 | - if (static::$nesting && !$ajax) $this->processParent($contents->getBlock('parent')); |
|
132 | + if (static::$nesting && !$ajax) { |
|
133 | + $this->processParent($contents->getBlock('parent')); |
|
134 | + } |
|
129 | 135 | |
130 | 136 | # Process items block |
131 | 137 | |
@@ -133,7 +139,9 @@ discard block |
||
133 | 139 | |
134 | 140 | # Set pagination |
135 | 141 | |
136 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
142 | + if (!$ajax) { |
|
143 | + $contents->pagination = $this->getPaginationBlock(); |
|
144 | + } |
|
137 | 145 | |
138 | 146 | # ------------------------ |
139 | 147 | |
@@ -160,15 +168,21 @@ discard block |
||
160 | 168 | |
161 | 169 | # Get path and depth |
162 | 170 | |
163 | - if (false !== ($path = $this->parent->getPath())) $this->path = $path; |
|
171 | + if (false !== ($path = $this->parent->getPath())) { |
|
172 | + $this->path = $path; |
|
173 | + } |
|
164 | 174 | |
165 | - if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->getSubtreeDepth()))) $this->depth = $depth; |
|
175 | + if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->getSubtreeDepth()))) { |
|
176 | + $this->depth = $depth; |
|
177 | + } |
|
166 | 178 | |
167 | 179 | # Get items list |
168 | 180 | |
169 | 181 | $lister = (static::$nesting ? 'getChildren' : 'getItems'); |
170 | 182 | |
171 | - if (false !== ($items = $this->parent->$lister())) $this->items = $items; |
|
183 | + if (false !== ($items = $this->parent->$lister())) { |
|
184 | + $this->items = $items; |
|
185 | + } |
|
172 | 186 | |
173 | 187 | # ------------------------ |
174 | 188 | |
@@ -183,7 +197,9 @@ discard block |
||
183 | 197 | |
184 | 198 | protected function handle(bool $ajax = false) { |
185 | 199 | |
186 | - if ($ajax) return $this->handleAjax(); |
|
200 | + if ($ajax) { |
|
201 | + return $this->handleAjax(); |
|
202 | + } |
|
187 | 203 | |
188 | 204 | $this->index = Number::forceInt(Request::get('index'), 1, 999999); |
189 | 205 | |
@@ -195,13 +211,17 @@ discard block |
||
195 | 211 | |
196 | 212 | # Get path |
197 | 213 | |
198 | - if (false !== ($path = $this->parent->getPath())) $this->path = $path; |
|
214 | + if (false !== ($path = $this->parent->getPath())) { |
|
215 | + $this->path = $path; |
|
216 | + } |
|
199 | 217 | |
200 | 218 | # Get items list |
201 | 219 | |
202 | 220 | $lister = (static::$nesting ? 'getChildren' : 'getItems'); $display = Settings::get('admin_display_entities'); |
203 | 221 | |
204 | - if (false !== ($items = $this->parent->$lister([], [], $this->index, $display))) $this->items = $items; |
|
222 | + if (false !== ($items = $this->parent->$lister([], [], $this->index, $display))) { |
|
223 | + $this->items = $items; |
|
224 | + } |
|
205 | 225 | |
206 | 226 | # ------------------------ |
207 | 227 |
@@ -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 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Invoker |
29 | 29 | * |
30 | - * @return true|string : true on success or an error code on failure |
|
30 | + * @return string|boolean : true on success or an error code on failure |
|
31 | 31 | */ |
32 | 32 | |
33 | 33 | public function __invoke(array $post) { |