@@ -2,68 +2,68 @@ |
||
2 | 2 | |
3 | 3 | # Cadmium |
4 | 4 | |
5 | -define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | -define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
5 | +define('CADMIUM_NAME', 'Cadmium CMS'); |
|
6 | +define('CADMIUM_HOME', 'http://cadmium-cms.com'); |
|
7 | 7 | |
8 | -define('CADMIUM_VERSION', '0.4.1'); |
|
9 | -define('CADMIUM_COPY', '2016'); |
|
8 | +define('CADMIUM_VERSION', '0.4.1'); |
|
9 | +define('CADMIUM_COPY', '2016'); |
|
10 | 10 | |
11 | 11 | # External |
12 | 12 | |
13 | -define('JQUERY_VERSION', '3.1.1'); |
|
14 | -define('SEMANTIC_UI_VERSION', '2.2.6'); |
|
15 | -define('CKEDITOR_VERSION', '4.5.11'); |
|
13 | +define('JQUERY_VERSION', '3.1.1'); |
|
14 | +define('SEMANTIC_UI_VERSION', '2.2.6'); |
|
15 | +define('CKEDITOR_VERSION', '4.5.11'); |
|
16 | 16 | |
17 | 17 | # Sections |
18 | 18 | |
19 | -define('SECTION_ADMIN', 'admin'); |
|
20 | -define('SECTION_SITE', 'site'); |
|
19 | +define('SECTION_ADMIN', 'admin'); |
|
20 | +define('SECTION_SITE', 'site'); |
|
21 | 21 | |
22 | 22 | # Filemanager types |
23 | 23 | |
24 | -define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | -define('FILEMANAGER_TYPE_FILE', 'file'); |
|
24 | +define('FILEMANAGER_TYPE_DIR', 'dir'); |
|
25 | +define('FILEMANAGER_TYPE_FILE', 'file'); |
|
26 | 26 | |
27 | 27 | # Access |
28 | 28 | |
29 | -define('ACCESS_PUBLIC', 0); |
|
30 | -define('ACCESS_REGISTERED', 1); |
|
31 | -define('ACCESS_ADMINISTRATOR', 2); |
|
29 | +define('ACCESS_PUBLIC', 0); |
|
30 | +define('ACCESS_REGISTERED', 1); |
|
31 | +define('ACCESS_ADMINISTRATOR', 2); |
|
32 | 32 | |
33 | 33 | # Frequency |
34 | 34 | |
35 | -define('FREQUENCY_ALWAYS', 'always'); |
|
36 | -define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | -define('FREQUENCY_DAILY', 'daily'); |
|
38 | -define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | -define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | -define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | -define('FREQUENCY_NEVER', 'never'); |
|
35 | +define('FREQUENCY_ALWAYS', 'always'); |
|
36 | +define('FREQUENCY_HOURLY', 'hourly'); |
|
37 | +define('FREQUENCY_DAILY', 'daily'); |
|
38 | +define('FREQUENCY_WEEKLY', 'weekly'); |
|
39 | +define('FREQUENCY_MONTHLY', 'monthly'); |
|
40 | +define('FREQUENCY_YEARLY', 'yearly'); |
|
41 | +define('FREQUENCY_NEVER', 'never'); |
|
42 | 42 | |
43 | 43 | # Rank |
44 | 44 | |
45 | -define('RANK_GUEST', 0); |
|
46 | -define('RANK_USER', 1); |
|
47 | -define('RANK_ADMINISTRATOR', 2); |
|
45 | +define('RANK_GUEST', 0); |
|
46 | +define('RANK_USER', 1); |
|
47 | +define('RANK_ADMINISTRATOR', 2); |
|
48 | 48 | |
49 | 49 | # Sex |
50 | 50 | |
51 | -define('SEX_NOT_SELECTED', 0); |
|
52 | -define('SEX_MALE', 1); |
|
53 | -define('SEX_FEMALE', 2); |
|
51 | +define('SEX_NOT_SELECTED', 0); |
|
52 | +define('SEX_MALE', 1); |
|
53 | +define('SEX_FEMALE', 2); |
|
54 | 54 | |
55 | 55 | # Status |
56 | 56 | |
57 | -define('STATUS_ONLINE', 0); |
|
58 | -define('STATUS_MAINTENANCE', 1); |
|
59 | -define('STATUS_UPDATE', 2); |
|
57 | +define('STATUS_ONLINE', 0); |
|
58 | +define('STATUS_MAINTENANCE', 1); |
|
59 | +define('STATUS_UPDATE', 2); |
|
60 | 60 | |
61 | 61 | # Target |
62 | 62 | |
63 | -define('TARGET_SELF', 0); |
|
64 | -define('TARGET_BLANK', 1); |
|
63 | +define('TARGET_SELF', 0); |
|
64 | +define('TARGET_BLANK', 1); |
|
65 | 65 | |
66 | 66 | # Visibility |
67 | 67 | |
68 | -define('VISIBILITY_DRAFT', 0); |
|
69 | -define('VISIBILITY_PUBLISHED', 1); |
|
68 | +define('VISIBILITY_DRAFT', 0); |
|
69 | +define('VISIBILITY_PUBLISHED', 1); |
@@ -2,32 +2,32 @@ |
||
2 | 2 | |
3 | 3 | # Define constants |
4 | 4 | |
5 | -define('DIR_SYSTEM', (dirname(__FILE__) . '/')); |
|
5 | +define('DIR_SYSTEM', (dirname(__FILE__).'/')); |
|
6 | 6 | |
7 | -define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM . 'Classes/')); |
|
8 | -define('DIR_SYSTEM_DATA', (DIR_SYSTEM . 'Data/')); |
|
9 | -define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM . 'Includes/')); |
|
10 | -define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM . 'Languages/')); |
|
11 | -define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM . 'Templates/')); |
|
7 | +define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM.'Classes/')); |
|
8 | +define('DIR_SYSTEM_DATA', (DIR_SYSTEM.'Data/')); |
|
9 | +define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM.'Includes/')); |
|
10 | +define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM.'Languages/')); |
|
11 | +define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM.'Templates/')); |
|
12 | 12 | |
13 | 13 | # Require classes |
14 | 14 | |
15 | -require_once (DIR_SYSTEM . 'Exception.php'); |
|
15 | +require_once (DIR_SYSTEM.'Exception.php'); |
|
16 | 16 | |
17 | 17 | # Require configuration |
18 | 18 | |
19 | -require_once (DIR_SYSTEM_INCLUDES . 'Config.php'); |
|
20 | -require_once (DIR_SYSTEM_INCLUDES . 'Constants.php'); |
|
21 | -require_once (DIR_SYSTEM_INCLUDES . 'Regex.php'); |
|
22 | -require_once (DIR_SYSTEM_INCLUDES . 'Tables.php'); |
|
19 | +require_once (DIR_SYSTEM_INCLUDES.'Config.php'); |
|
20 | +require_once (DIR_SYSTEM_INCLUDES.'Constants.php'); |
|
21 | +require_once (DIR_SYSTEM_INCLUDES.'Regex.php'); |
|
22 | +require_once (DIR_SYSTEM_INCLUDES.'Tables.php'); |
|
23 | 23 | |
24 | 24 | # Process environment variables |
25 | 25 | |
26 | -define('HTTP_MOD_REWRITE', (getenv('HTTP_MOD_REWRITE') === 'on')); |
|
26 | +define('HTTP_MOD_REWRITE', (getenv('HTTP_MOD_REWRITE') === 'on')); |
|
27 | 27 | |
28 | -define('INSTALL_PATH', rtrim(getenv('INSTALL_PATH'), '/')); |
|
28 | +define('INSTALL_PATH', rtrim(getenv('INSTALL_PATH'), '/')); |
|
29 | 29 | |
30 | -define('DEBUG_MODE', @file_exists(DIR_SYSTEM_DATA . '.debug')); |
|
30 | +define('DEBUG_MODE', @file_exists(DIR_SYSTEM_DATA.'.debug')); |
|
31 | 31 | |
32 | 32 | # Set error reporting |
33 | 33 |
@@ -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 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | # Set system entries |
44 | 44 | |
45 | - $contents->system_version = CADMIUM_VERSION; |
|
45 | + $contents->system_version = CADMIUM_VERSION; |
|
46 | 46 | |
47 | 47 | # Set external entries |
48 | 48 |
@@ -24,14 +24,14 @@ |
||
24 | 24 | |
25 | 25 | public static function checkInstallFile() { |
26 | 26 | |
27 | - return Explorer::isFile(DIR_WWW . 'install.php'); |
|
27 | + return Explorer::isFile(DIR_WWW.'install.php'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # Get OS version |
31 | 31 | |
32 | 32 | public static function osVersion() { |
33 | 33 | |
34 | - return (php_uname('s') . ', ' . php_uname('v')); |
|
34 | + return (php_uname('s').', '.php_uname('v')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | # Get MySQL version |
@@ -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,14 @@ discard block |
||
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'])) return ((Request::isSecure() ? 'https://' : 'http://').$_SERVER['HTTP_HOST']); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | # Get system email |
17 | 17 | |
18 | 18 | private function getSystemEmail() { |
19 | 19 | |
20 | - if (!empty($_SERVER['HTTP_HOST'])) return ('admin@' . $_SERVER['HTTP_HOST']); |
|
20 | + if (!empty($_SERVER['HTTP_HOST'])) return ('admin@'.$_SERVER['HTTP_HOST']); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | # Constructor |
@@ -26,84 +26,84 @@ discard block |
||
26 | 26 | |
27 | 27 | # Admin language |
28 | 28 | |
29 | - $this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function (string $name) { |
|
29 | + $this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function(string $name) { |
|
30 | 30 | |
31 | 31 | return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null); |
32 | 32 | }); |
33 | 33 | |
34 | 34 | # Admin template |
35 | 35 | |
36 | - $this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function (string $name) { |
|
36 | + $this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function(string $name) { |
|
37 | 37 | |
38 | 38 | return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null); |
39 | 39 | }); |
40 | 40 | |
41 | 41 | # Site language |
42 | 42 | |
43 | - $this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function (string $name) { |
|
43 | + $this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function(string $name) { |
|
44 | 44 | |
45 | 45 | return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null); |
46 | 46 | }); |
47 | 47 | |
48 | 48 | # Site template |
49 | 49 | |
50 | - $this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function (string $name) { |
|
50 | + $this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function(string $name) { |
|
51 | 51 | |
52 | 52 | return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null); |
53 | 53 | }); |
54 | 54 | |
55 | 55 | # Site title |
56 | 56 | |
57 | - $this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function (string $title) { |
|
57 | + $this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function(string $title) { |
|
58 | 58 | |
59 | 59 | return (('' !== $title) ? $title : null); |
60 | 60 | }); |
61 | 61 | |
62 | 62 | # Site slogan |
63 | 63 | |
64 | - $this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function (string $slogan) { |
|
64 | + $this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function(string $slogan) { |
|
65 | 65 | |
66 | 66 | return $slogan; |
67 | 67 | }); |
68 | 68 | |
69 | 69 | # Site status |
70 | 70 | |
71 | - $this->addParam('site_status', STATUS_ONLINE, function (string $status) { |
|
71 | + $this->addParam('site_status', STATUS_ONLINE, function(string $status) { |
|
72 | 72 | |
73 | 73 | return ((false !== ($status = Range\Status::validate($status))) ? $status : null); |
74 | 74 | }); |
75 | 75 | |
76 | 76 | # Site description |
77 | 77 | |
78 | - $this->addParam('site_description', '', function (string $description) { |
|
78 | + $this->addParam('site_description', '', function(string $description) { |
|
79 | 79 | |
80 | 80 | return $description; |
81 | 81 | }); |
82 | 82 | |
83 | 83 | # Site keywords |
84 | 84 | |
85 | - $this->addParam('site_keywords', '', function (string $keywords) { |
|
85 | + $this->addParam('site_keywords', '', function(string $keywords) { |
|
86 | 86 | |
87 | 87 | return $keywords; |
88 | 88 | }); |
89 | 89 | |
90 | 90 | # System url |
91 | 91 | |
92 | - $this->addParam('system_url', $this->getSystemUrl(), function (string $url) { |
|
92 | + $this->addParam('system_url', $this->getSystemUrl(), function(string $url) { |
|
93 | 93 | |
94 | 94 | return ((false !== ($url = Validate::url($url))) ? $url : null); |
95 | 95 | }); |
96 | 96 | |
97 | 97 | # System email |
98 | 98 | |
99 | - $this->addParam('system_email', $this->getSystemEmail(), function (string $email) { |
|
99 | + $this->addParam('system_email', $this->getSystemEmail(), function(string $email) { |
|
100 | 100 | |
101 | 101 | return ((false !== ($email = Validate::email($email))) ? $email : null); |
102 | 102 | }); |
103 | 103 | |
104 | 104 | # System timezone |
105 | 105 | |
106 | - $this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function (string $timezone) { |
|
106 | + $this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function(string $timezone) { |
|
107 | 107 | |
108 | 108 | return ((false !== ($timezone = Timezone::validate($timezone))) ? $timezone : null); |
109 | 109 | }); |
@@ -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 |