@@ -31,4 +31,6 @@ |
||
| 31 | 31 | |
| 32 | 32 | # Set error reporting |
| 33 | 33 | |
| 34 | -if (DEBUG_MODE) error_reporting(E_ALL); |
|
| 34 | +if (DEBUG_MODE) { |
|
| 35 | + error_reporting(E_ALL); |
|
| 36 | +} |
|
@@ -32,9 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $param = static::$param[$this->loader->section()]; $name = Request::post('name'); |
| 34 | 34 | |
| 35 | - if (false === Settings::set($param, $name)) return $ajax->setError(Language::get(static::$error_activate)); |
|
| 35 | + if (false === Settings::set($param, $name)) { |
|
| 36 | + return $ajax->setError(Language::get(static::$error_activate)); |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | - if (false === Settings::save()) return $ajax->setError(Language::get(static::$error_save)); |
|
| 39 | + if (false === Settings::save()) { |
|
| 40 | + return $ajax->setError(Language::get(static::$error_save)); |
|
| 41 | + } |
|
| 38 | 42 | |
| 39 | 43 | } else if (Request::post('action') === 'list') { |
| 40 | 44 | |
@@ -52,7 +56,9 @@ discard block |
||
| 52 | 56 | |
| 53 | 57 | $this->loader = new static::$loader_class(Request::get('list')); |
| 54 | 58 | |
| 55 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 59 | + if (Request::isAjax()) { |
|
| 60 | + return $this->handleAjax(); |
|
| 61 | + } |
|
| 56 | 62 | |
| 57 | 63 | # ------------------------ |
| 58 | 64 | |
@@ -55,7 +55,11 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $count = Informer::countEntries(TABLE_PAGES, true); |
| 57 | 57 | |
| 58 | - if (false === $count) return false; else if ($count > 0) return true; |
|
| 58 | + if (false === $count) { |
|
| 59 | + return false; |
|
| 60 | + } else if ($count > 0) { |
|
| 61 | + return true; |
|
| 62 | + } |
|
| 59 | 63 | |
| 60 | 64 | # Process dataset |
| 61 | 65 | |
@@ -69,7 +73,8 @@ discard block |
||
| 69 | 73 | |
| 70 | 74 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]]; |
| 71 | 75 | |
| 72 | - for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
| 76 | + for ($id = 2; $id <= 4; $id++) { |
|
| 77 | + $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
| 73 | 78 | |
| 74 | 79 | 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
| 75 | 80 | |
@@ -78,10 +83,13 @@ discard block |
||
| 78 | 83 | 'contents' => Template::createBlock(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->getContents(), |
| 79 | 84 | |
| 80 | 85 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
| 86 | + } |
|
| 81 | 87 | |
| 82 | 88 | # Process insertion |
| 83 | 89 | |
| 84 | - if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::getLast()->status)) return false; |
|
| 90 | + if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::getLast()->status)) { |
|
| 91 | + return false; |
|
| 92 | + } |
|
| 85 | 93 | |
| 86 | 94 | self::fillRelationsTable(TABLE_PAGES_RELATIONS, 4); |
| 87 | 95 | |
@@ -98,21 +106,29 @@ discard block |
||
| 98 | 106 | |
| 99 | 107 | $count = Informer::countEntries(TABLE_MENU, true); |
| 100 | 108 | |
| 101 | - if (false === $count) return false; else if ($count > 0) return true; |
|
| 109 | + if (false === $count) { |
|
| 110 | + return false; |
|
| 111 | + } else if ($count > 0) { |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 102 | 114 | |
| 103 | 115 | # Process dataset |
| 104 | 116 | |
| 105 | 117 | $menu = []; |
| 106 | 118 | |
| 107 | - for ($id = 1; $id <= 3; $id++) $menu[] = [ |
|
| 119 | + for ($id = 1; $id <= 3; $id++) { |
|
| 120 | + $menu[] = [ |
|
| 108 | 121 | |
| 109 | 122 | 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
| 110 | 123 | |
| 111 | 124 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
| 125 | + } |
|
| 112 | 126 | |
| 113 | 127 | # Process insertion |
| 114 | 128 | |
| 115 | - if (!(DB::insert(TABLE_MENU, $menu, true) && DB::getLast()->status)) return false; |
|
| 129 | + if (!(DB::insert(TABLE_MENU, $menu, true) && DB::getLast()->status)) { |
|
| 130 | + return false; |
|
| 131 | + } |
|
| 116 | 132 | |
| 117 | 133 | self::fillRelationsTable(TABLE_MENU_RELATIONS, 3); |
| 118 | 134 | |
@@ -127,7 +143,9 @@ discard block |
||
| 127 | 143 | |
| 128 | 144 | $definitions = self::getDefinitions(false); |
| 129 | 145 | |
| 130 | - foreach ($definitions as $definition) if (!$definition->createTables()) return false; |
|
| 146 | + foreach ($definitions as $definition) { |
|
| 147 | + if (!$definition->createTables()) return false; |
|
| 148 | + } |
|
| 131 | 149 | |
| 132 | 150 | # ------------------------ |
| 133 | 151 | |
@@ -140,7 +158,9 @@ discard block |
||
| 140 | 158 | |
| 141 | 159 | $definitions = self::getDefinitions(true); |
| 142 | 160 | |
| 143 | - foreach ($definitions as $definition) if (!$definition->removeTables()) return false; |
|
| 161 | + foreach ($definitions as $definition) { |
|
| 162 | + if (!$definition->removeTables()) return false; |
|
| 163 | + } |
|
| 144 | 164 | |
| 145 | 165 | # ------------------------ |
| 146 | 166 | |
@@ -20,21 +20,19 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | # Connect to DB |
| 22 | 22 | |
| 23 | - try { DB::connect($server, $user, $password, $name); } |
|
| 24 | - |
|
| 25 | - catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } |
|
| 26 | - |
|
| 27 | - catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } |
|
| 28 | - |
|
| 29 | - catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
| 23 | + try { DB::connect($server, $user, $password, $name); } catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
| 30 | 24 | |
| 31 | 25 | # Create tables |
| 32 | 26 | |
| 33 | - if (!Install\Utils\Tables::create()) return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
| 27 | + if (!Install\Utils\Tables::create()) { |
|
| 28 | + return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
| 29 | + } |
|
| 34 | 30 | |
| 35 | 31 | # Fill tables |
| 36 | 32 | |
| 37 | - if (!Install\Utils\Tables::fill()) return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
| 33 | + if (!Install\Utils\Tables::fill()) { |
|
| 34 | + return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
| 35 | + } |
|
| 38 | 36 | |
| 39 | 37 | # Save system file |
| 40 | 38 | |
@@ -47,7 +45,9 @@ discard block |
||
| 47 | 45 | |
| 48 | 46 | $system['time'] = REQUEST_TIME; |
| 49 | 47 | |
| 50 | - if (!Schema::get('System')->save($system)) return 'INSTALL_ERROR_SYSTEM'; |
|
| 48 | + if (!Schema::get('System')->save($system)) { |
|
| 49 | + return 'INSTALL_ERROR_SYSTEM'; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | # ------------------------ |
| 53 | 53 | |
@@ -10,14 +10,18 @@ |
||
| 10 | 10 | |
| 11 | 11 | private function getSystemUrl() { |
| 12 | 12 | |
| 13 | - if (!empty($_SERVER['HTTP_HOST'])) return ((Request::isSecure() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']); |
|
| 13 | + if (!empty($_SERVER['HTTP_HOST'])) { |
|
| 14 | + return ((Request::isSecure() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']); |
|
| 15 | + } |
|
| 14 | 16 | } |
| 15 | 17 | |
| 16 | 18 | # Get system email |
| 17 | 19 | |
| 18 | 20 | private function getSystemEmail() { |
| 19 | 21 | |
| 20 | - if (!empty($_SERVER['HTTP_HOST'])) return ('admin@' . $_SERVER['HTTP_HOST']); |
|
| 22 | + if (!empty($_SERVER['HTTP_HOST'])) { |
|
| 23 | + return ('admin@' . $_SERVER['HTTP_HOST']); |
|
| 24 | + } |
|
| 21 | 25 | } |
| 22 | 26 | |
| 23 | 27 | # Constructor |
@@ -21,12 +21,16 @@ |
||
| 21 | 21 | |
| 22 | 22 | foreach (Settings::setArray($post) as $name => $result) { |
| 23 | 23 | |
| 24 | - if (!$result) return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
|
| 24 | + if (!$result) { |
|
| 25 | + return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
|
| 26 | + } |
|
| 25 | 27 | } |
| 26 | 28 | |
| 27 | 29 | # Save settings |
| 28 | 30 | |
| 29 | - if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
|
| 31 | + if (!Settings::save()) { |
|
| 32 | + return 'SETTINGS_ERROR_SAVE'; |
|
| 33 | + } |
|
| 30 | 34 | |
| 31 | 35 | # ------------------------ |
| 32 | 36 | |
@@ -56,7 +56,9 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | if (Request::post('action') === 'remove') { |
| 58 | 58 | |
| 59 | - if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove)); |
|
| 59 | + if (!$this->entity->remove()) { |
|
| 60 | + return $ajax->setError(Language::get(static::$message_error_remove)); |
|
| 61 | + } |
|
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | # ------------------------ |
@@ -78,7 +80,9 @@ discard block |
||
| 78 | 80 | |
| 79 | 81 | # Handle ajax request |
| 80 | 82 | |
| 81 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 83 | + if (Request::isAjax()) { |
|
| 84 | + return $this->handleAjax(); |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | # Init entity |
| 84 | 88 | |
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | |
| 105 | 109 | # Display success message |
| 106 | 110 | |
| 107 | - if (false !== Request::get('submitted')) Popup::set('positive', Language::get(static::$message_success_rename)); |
|
| 111 | + if (false !== Request::get('submitted')) { |
|
| 112 | + Popup::set('positive', Language::get(static::$message_success_rename)); |
|
| 113 | + } |
|
| 108 | 114 | |
| 109 | 115 | # ------------------------ |
| 110 | 116 | |
@@ -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 | |
@@ -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 | |