@@ -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,23 +29,31 @@ |
||
29 | 29 | |
30 | 30 | # Check for demo mode |
31 | 31 | |
32 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
32 | + if (Informer::isDemoMode()) { |
|
33 | + return 'DEMO_MODE_RESTRICTION'; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Validate name |
35 | 37 | |
36 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
38 | + if (false === ($name = Validate::fileName($name))) { |
|
39 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Check if item exists |
39 | 43 | |
40 | 44 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
41 | 45 | |
42 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
46 | + @file_exists($this->entity->parent()->pathFull() . $name)) { |
|
47 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
48 | + } |
|
43 | 49 | |
44 | 50 | # Rename item |
45 | 51 | |
46 | - if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
52 | + if (!$this->entity->rename($name)) { |
|
53 | + return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
47 | 54 | |
48 | 55 | 'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME'); |
56 | + } |
|
49 | 57 | |
50 | 58 | # ------------------------ |
51 | 59 |
@@ -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,23 +29,31 @@ |
||
29 | 29 | |
30 | 30 | # Check for demo mode |
31 | 31 | |
32 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
32 | + if (Informer::isDemoMode()) { |
|
33 | + return 'DEMO_MODE_RESTRICTION'; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Validate name |
35 | 37 | |
36 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
38 | + if (false === ($name = Validate::fileName($name))) { |
|
39 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Check if item exists |
39 | 43 | |
40 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
44 | + if (@file_exists($this->parent->pathFull() . $name)) { |
|
45 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
46 | + } |
|
41 | 47 | |
42 | 48 | # Create item |
43 | 49 | |
44 | 50 | $entity = Filemanager::get($type, $this->parent); |
45 | 51 | |
46 | - if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
52 | + if (!$entity->create($name)) { |
|
53 | + return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
47 | 54 | |
48 | 55 | 'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE'); |
56 | + } |
|
49 | 57 | |
50 | 58 | # ------------------------ |
51 | 59 |
@@ -19,11 +19,15 @@ |
||
19 | 19 | |
20 | 20 | private function add(string $type, string $name, array $args) { |
21 | 21 | |
22 | - if (('' === $name) || isset($this->list[$name])) return; |
|
22 | + if (('' === $name) || isset($this->list[$name])) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $this->list[$name] = new $this->types[$type](...$args); |
25 | 27 | |
26 | - if (($type !== 'textual') || $this->list[$name]->short) $this->secure[] = $name; |
|
28 | + if (($type !== 'textual') || $this->list[$name]->short) { |
|
29 | + $this->secure[] = $name; |
|
30 | + } |
|
27 | 31 | } |
28 | 32 | |
29 | 33 | # Constructor |
@@ -32,11 +32,11 @@ |
||
32 | 32 | |
33 | 33 | public function statement() { |
34 | 34 | |
35 | - return ("FOREIGN KEY (`" . $this->name . "`) REFERENCES `" . $this->table . "` (`" . $this->field . "`)") . |
|
35 | + return ("FOREIGN KEY (`".$this->name."`) REFERENCES `".$this->table."` (`".$this->field."`)"). |
|
36 | 36 | |
37 | - ((null !== $this->delete) ? (" ON DELETE " . $this->delete) : "") . |
|
37 | + ((null !== $this->delete) ? (" ON DELETE ".$this->delete) : ""). |
|
38 | 38 | |
39 | - ((null !== $this->update) ? (" ON UPDATE " . $this->update) : ""); |
|
39 | + ((null !== $this->update) ? (" ON UPDATE ".$this->update) : ""); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -23,9 +23,13 @@ |
||
23 | 23 | |
24 | 24 | $this->name = $name; $this->table = $table; $this->field = $field; |
25 | 25 | |
26 | - if (null !== $delete) $this->delete = $this->getAction($delete); |
|
26 | + if (null !== $delete) { |
|
27 | + $this->delete = $this->getAction($delete); |
|
28 | + } |
|
27 | 29 | |
28 | - if (null !== $update) $this->update = $this->getAction($delete); |
|
30 | + if (null !== $update) { |
|
31 | + $this->update = $this->getAction($delete); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Get statement |
@@ -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 | } |
@@ -30,9 +30,9 @@ |
||
30 | 30 | |
31 | 31 | public function statement() { |
32 | 32 | |
33 | - return ((null !== $this->type) ? ($this->type . " ") : "") . |
|
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 | } |
@@ -23,7 +23,9 @@ |
||
23 | 23 | |
24 | 24 | $this->name = $name; |
25 | 25 | |
26 | - if (null !== $type) $this->type = $this->getType($type); |
|
26 | + if (null !== $type) { |
|
27 | + $this->type = $this->getType($type); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | # Get statement |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function statement() { |
21 | 21 | |
22 | - return ("`" . $this->name . "` int(10) UNSIGNED NOT NULL" . ($this->auto_increment ? " AUTO_INCREMENT" : "")); |
|
22 | + return ("`".$this->name."` int(10) UNSIGNED NOT NULL".($this->auto_increment ? " AUTO_INCREMENT" : "")); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | # Cast value |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
25 | 25 | |
26 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function statement() { |
23 | 23 | |
24 | - return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
|
24 | + return ("`".$this->name."` ".($this->short ? "tiny" : "")."int(".$this->length.")"). |
|
25 | 25 | |
26 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->unsigned ? " UNSIGNED" : "")." NOT NULL DEFAULT '".$this->default."'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
25 | 25 | |
26 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function statement() { |
23 | 23 | |
24 | - return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
|
24 | + return ("`".$this->name."` ".($this->short ? ("varchar(".$this->length.")") : "text")). |
|
25 | 25 | |
26 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->binary ? " BINARY" : "")." NOT NULL DEFAULT '".$this->default."'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function statement() { |
23 | 23 | |
24 | - return ("`" . $this->name . "` tinyint(1) UNSIGNED NOT NULL DEFAULT '" . intval($this->default) . "'"); |
|
24 | + return ("`".$this->name."` tinyint(1) UNSIGNED NOT NULL DEFAULT '".intval($this->default)."'"); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | # Cast value |