@@ -46,7 +46,9 @@ |
||
46 | 46 | |
47 | 47 | $system_file = (DIR_SYSTEM_DATA . 'System.json'); |
48 | 48 | |
49 | - if (false !== ($data = Explorer::json($system_file))) $this->parse($data); |
|
49 | + if (false !== ($data = Explorer::json($system_file))) { |
|
50 | + $this->parse($data); |
|
51 | + } |
|
50 | 52 | } |
51 | 53 | } |
52 | 54 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $condition = ("parent_id = " . $parent_id . " AND visibility = " . VISIBILITY_PUBLISHED . " ") . |
35 | 35 | |
36 | - ("AND access <= " . $access . " AND name = '" . addslashes($name) . "'"); |
|
36 | + ("AND access <= " . $access . " AND name = '" . addslashes($name) . "'"); |
|
37 | 37 | |
38 | 38 | if (!(DB::select(TABLE_PAGES, $selection, $condition, null, 1) && (DB::last()->rows === 1))) return false; |
39 | 39 |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | ("AND access <= " . $access . " AND name = '" . addslashes($name) . "'"); |
37 | 37 | |
38 | - if (!(DB::select(TABLE_PAGES, $selection, $condition, null, 1) && (DB::last()->rows === 1))) return false; |
|
38 | + if (!(DB::select(TABLE_PAGES, $selection, $condition, null, 1) && (DB::last()->rows === 1))) { |
|
39 | + return false; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $path[] = $page(...array_values(DB::last()->row())); |
41 | 43 | } |
@@ -53,9 +55,11 @@ discard block |
||
53 | 55 | |
54 | 56 | # Set breadcrumbs |
55 | 57 | |
56 | - if (count($this->path) <= 1) $contents->block('breadcrumbs')->disable(); |
|
57 | - |
|
58 | - else $contents->block('breadcrumbs')->path = $this->path; |
|
58 | + if (count($this->path) <= 1) { |
|
59 | + $contents->block('breadcrumbs')->disable(); |
|
60 | + } else { |
|
61 | + $contents->block('breadcrumbs')->path = $this->path; |
|
62 | + } |
|
59 | 63 | |
60 | 64 | # Set contents |
61 | 65 | |
@@ -70,7 +74,9 @@ discard block |
||
70 | 74 | |
71 | 75 | protected function handle() { |
72 | 76 | |
73 | - if (false === ($path = $this->getPath())) return false; |
|
77 | + if (false === ($path = $this->getPath())) { |
|
78 | + return false; |
|
79 | + } |
|
74 | 80 | |
75 | 81 | $this->path = $path; |
76 | 82 | |
@@ -78,11 +84,17 @@ discard block |
||
78 | 84 | |
79 | 85 | $this->page = Entitizer::get(ENTITY_TYPE_PAGE, ($this->path ? end($this->path)['id'] : 1)); |
80 | 86 | |
81 | - if (0 === $this->page->id) return false; |
|
87 | + if (0 === $this->page->id) { |
|
88 | + return false; |
|
89 | + } |
|
82 | 90 | |
83 | 91 | # Set data |
84 | 92 | |
85 | - if ($this->page->id !== 1) $this->title = $this->page->title; else $this->layout = 'Index'; |
|
93 | + if ($this->page->id !== 1) { |
|
94 | + $this->title = $this->page->title; |
|
95 | + } else { |
|
96 | + $this->layout = 'Index'; |
|
97 | + } |
|
86 | 98 | |
87 | 99 | $this->description = $this->page->description; |
88 | 100 | $this->keywords = $this->page->keywords; |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $selection = 'MAX(time_modified) as last_modified'; |
14 | 14 | |
15 | - if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) return 0; |
|
15 | + if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) { |
|
16 | + return 0; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -29,9 +31,13 @@ discard block |
||
29 | 31 | |
30 | 32 | $condition = ['visibility' => VISIBILITY_PUBLISHED, 'access' => ACCESS_PUBLIC]; |
31 | 33 | |
32 | - if (!(DB::select(TABLE_PAGES, 'id', $condition) && DB::last()->status)) return []; |
|
34 | + if (!(DB::select(TABLE_PAGES, 'id', $condition) && DB::last()->status)) { |
|
35 | + return []; |
|
36 | + } |
|
33 | 37 | |
34 | - while (null !== ($page = DB::last()->row())) $pages[] = $page['id']; |
|
38 | + while (null !== ($page = DB::last()->row())) { |
|
39 | + $pages[] = $page['id']; |
|
40 | + } |
|
35 | 41 | |
36 | 42 | # Init pages |
37 | 43 | |
@@ -59,7 +65,9 @@ discard block |
||
59 | 65 | |
60 | 66 | $last_modified = $this->getLastModified(); |
61 | 67 | |
62 | - if ($sitemap->load($last_modified)) return $sitemap; |
|
68 | + if ($sitemap->load($last_modified)) { |
|
69 | + return $sitemap; |
|
70 | + } |
|
63 | 71 | |
64 | 72 | # Fill sitemap |
65 | 73 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | # Connect to database |
18 | 18 | |
19 | - DB::connect ( |
|
19 | + DB::connect( |
|
20 | 20 | |
21 | 21 | $this->database['server'], $this->database['user'], |
22 | 22 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | # Check installation |
14 | 14 | |
15 | - if (!$this->installed) Request::redirect(INSTALL_PATH . '/install.php'); |
|
15 | + if (!$this->installed) { |
|
16 | + Request::redirect(INSTALL_PATH . '/install.php'); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Connect to database |
18 | 20 |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | $extensions = ['mysqli', 'mbstring', 'gd', 'simplexml']; |
16 | 16 | |
17 | - foreach ($extensions as $name) self::$requirements[$name] = extension_loaded($name); |
|
17 | + foreach ($extensions as $name) { |
|
18 | + self::$requirements[$name] = extension_loaded($name); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | # Check mod_rewrite |
20 | 22 | |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | |
25 | 27 | $writables = ['data' => DIR_SYSTEM_DATA, 'uploads' => DIR_UPLOADS]; |
26 | 28 | |
27 | - foreach ($writables as $name => $dir) self::$requirements[$name] = is_writable($dir); |
|
29 | + foreach ($writables as $name => $dir) { |
|
30 | + self::$requirements[$name] = is_writable($dir); |
|
31 | + } |
|
28 | 32 | |
29 | 33 | # Set checking status |
30 | 34 |
@@ -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 | |
@@ -49,7 +47,9 @@ discard block |
||
49 | 47 | |
50 | 48 | $system_file = (DIR_SYSTEM_DATA . 'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT); |
51 | 49 | |
52 | - if (false === Explorer::save($system_file, $system, true)) return 'INSTALL_ERROR_SYSTEM'; |
|
50 | + if (false === Explorer::save($system_file, $system, true)) { |
|
51 | + return 'INSTALL_ERROR_SYSTEM'; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | # ------------------------ |
55 | 55 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $languages = []; |
14 | 14 | |
15 | - foreach (Extend\Languages::items() as $code => $language) $languages[$code] = $language['title']; |
|
15 | + foreach (Extend\Languages::items() as $code => $language) { |
|
16 | + $languages[$code] = $language['title']; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -25,7 +27,9 @@ discard block |
||
25 | 27 | |
26 | 28 | $templates = []; |
27 | 29 | |
28 | - foreach (Extend\Templates::items() as $name => $template) $templates[$name] = $template['title']; |
|
30 | + foreach (Extend\Templates::items() as $name => $template) { |
|
31 | + $templates[$name] = $template['title']; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | # ------------------------ |
31 | 35 |
@@ -12,9 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | # Count pages |
14 | 14 | |
15 | - if (!(DB::select(TABLE_PAGES, 'COUNT(id) as count') && (DB::last()->rows === 1))) return false; |
|
15 | + if (!(DB::select(TABLE_PAGES, 'COUNT(id) as count') && (DB::last()->rows === 1))) { |
|
16 | + return false; |
|
17 | + } |
|
16 | 18 | |
17 | - if (intval(DB::last()->row()['count']) > 0) return true; |
|
19 | + if (intval(DB::last()->row()['count']) > 0) { |
|
20 | + return true; |
|
21 | + } |
|
18 | 22 | |
19 | 23 | # Insert initial pages |
20 | 24 | |
@@ -30,7 +34,8 @@ discard block |
||
30 | 34 | |
31 | 35 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
32 | 36 | |
33 | - for ($i = 1; $i <= 3; $i++) $pages[] = ['visibility' => VISIBILITY_PUBLISHED, |
|
37 | + for ($i = 1; $i <= 3; $i++) { |
|
38 | + $pages[] = ['visibility' => VISIBILITY_PUBLISHED, |
|
34 | 39 | |
35 | 40 | 'hash' => Arr::encode([('page-' . $i), 0]), |
36 | 41 | |
@@ -39,6 +44,7 @@ discard block |
||
39 | 44 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
40 | 45 | |
41 | 46 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
47 | + } |
|
42 | 48 | |
43 | 49 | # ------------------------ |
44 | 50 | |
@@ -51,19 +57,25 @@ discard block |
||
51 | 57 | |
52 | 58 | # Count menuitems |
53 | 59 | |
54 | - if (!(DB::select(TABLE_MENU, 'COUNT(id) as count') && (DB::last()->rows === 1))) return false; |
|
60 | + if (!(DB::select(TABLE_MENU, 'COUNT(id) as count') && (DB::last()->rows === 1))) { |
|
61 | + return false; |
|
62 | + } |
|
55 | 63 | |
56 | - if (intval(DB::last()->row()['count']) > 0) return true; |
|
64 | + if (intval(DB::last()->row()['count']) > 0) { |
|
65 | + return true; |
|
66 | + } |
|
57 | 67 | |
58 | 68 | # Insert initial menuitems |
59 | 69 | |
60 | 70 | $menu = []; |
61 | 71 | |
62 | - for ($i = 1; $i <= 3; $i++) $menu[] = [ |
|
72 | + for ($i = 1; $i <= 3; $i++) { |
|
73 | + $menu[] = [ |
|
63 | 74 | |
64 | 75 | 'position' => ($i - 1), 'slug' => ('page-' . $i), |
65 | 76 | |
66 | 77 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $i)]; |
78 | + } |
|
67 | 79 | |
68 | 80 | # ------------------------ |
69 | 81 | |
@@ -90,7 +102,9 @@ discard block |
||
90 | 102 | |
91 | 103 | $definitions[] = Entitizer\Definition::get(ENTITY_TYPE_USER_SESSION); |
92 | 104 | |
93 | - foreach ($definitions as $definition) if (!$definition->createTable()) return false; |
|
105 | + foreach ($definitions as $definition) { |
|
106 | + if (!$definition->createTable()) return false; |
|
107 | + } |
|
94 | 108 | |
95 | 109 | # ------------------------ |
96 | 110 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | # Check for demo mode |
14 | 14 | |
15 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
15 | + if (Informer::isDemoMode()) { |
|
16 | + return 'DEMO_MODE_RESTRICTION'; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Define errors list |
18 | 20 | |
@@ -25,12 +27,16 @@ discard block |
||
25 | 27 | |
26 | 28 | foreach ($post as $name => $value) { |
27 | 29 | |
28 | - if (!Settings::set($name, $value)) return (isset($errors[$name]) ? $errors[$name] : false); |
|
30 | + if (!Settings::set($name, $value)) { |
|
31 | + return (isset($errors[$name]) ? $errors[$name] : false); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Save settings |
32 | 36 | |
33 | - if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
|
37 | + if (!Settings::save()) { |
|
38 | + return 'SETTINGS_ERROR_SAVE'; |
|
39 | + } |
|
34 | 40 | |
35 | 41 | # ------------------------ |
36 | 42 |