@@ -35,11 +35,15 @@ |
||
| 35 | 35 | |
| 36 | 36 | # Check if install file exists |
| 37 | 37 | |
| 38 | - if (Informer::checkInstallFile()) Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
| 38 | + if (Informer::checkInstallFile()) { |
|
| 39 | + Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | # Check if configuration file is loaded |
| 41 | 43 | |
| 42 | - if (!Settings::loaded()) Messages::set('warning', Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
| 44 | + if (!Settings::loaded()) { |
|
| 45 | + Messages::set('warning', Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
| 46 | + } |
|
| 43 | 47 | |
| 44 | 48 | # ------------------------ |
| 45 | 49 | |
@@ -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,7 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function add(string $name, string $type = null) { |
| 21 | 21 | |
| 22 | - if (!isset($this->definition->params()[$name]) || isset($this->list[$name])) return; |
|
| 22 | + if (!isset($this->definition->params()[$name]) || isset($this->list[$name])) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $this->list[$name] = new Definition\Item\Index($name, $type); |
| 25 | 27 | } |
@@ -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 |
@@ -16,7 +16,9 @@ |
||
| 16 | 16 | |
| 17 | 17 | # Set field configuration |
| 18 | 18 | |
| 19 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
| 19 | + foreach (get_defined_vars() as $name => $value) { |
|
| 20 | + $this->$name = $value; |
|
| 21 | + } |
|
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | # Get field statement |