Completed
Push — master ( e7c824...3ed60a )
by Anton
10s
created
www/engine/Framework/Classes/Template/Template.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -54,6 +54,9 @@
 block discarded – undo
54 54
 
55 55
 		# Output contents
56 56
 
57
+		/**
58
+		 * @param string $status
59
+		 */
57 60
 		public static function output(Template\Asset\Block $block, $status = null) {
58 61
 
59 62
 			if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200;
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,18 +10,26 @@  discard block
 block discarded – undo
10 10
 
11 11
 		public static function global(string $name, string $value = null) {
12 12
 
13
-			if (null === $value) return (self::$globals[$name] ?? false);
13
+			if (null === $value) {
14
+				return (self::$globals[$name] ?? false);
15
+			}
14 16
 
15
-			if (!isset(self::$globals[$name])) self::$globals[$name] = $value;
17
+			if (!isset(self::$globals[$name])) {
18
+				self::$globals[$name] = $value;
19
+			}
16 20
 		}
17 21
 
18 22
 		# Set/get widget
19 23
 
20 24
 		public static function widget(string $name, Template\Asset\Block $block = null) {
21 25
 
22
-			if (null === $block) return (self::$widgets[$name] ?? false);
26
+			if (null === $block) {
27
+				return (self::$widgets[$name] ?? false);
28
+			}
23 29
 
24
-			if (!isset(self::$widgets[$name])) self::$widgets[$name] = $block;
30
+			if (!isset(self::$widgets[$name])) {
31
+				self::$widgets[$name] = $block;
32
+			}
25 33
 		}
26 34
 
27 35
 		# Create block
@@ -56,7 +64,9 @@  discard block
 block discarded – undo
56 64
 
57 65
 		public static function output(Template\Asset\Block $block, $status = null) {
58 66
 
59
-			if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200;
67
+			if ((null === $status) || !Headers::isStatusCode($status)) {
68
+				$status = STATUS_CODE_200;
69
+			}
60 70
 
61 71
 			Headers::nocache(); Headers::status($status); Headers::content(MIME_TYPE_HTML);
62 72
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Handlers/Site/Page.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 			$page = function(int $id, string $name, string $title) use(&$parent_id, &$link) {
20 20
 
21
-				$parent_id = $id; $link .= ('/' . $name);
21
+				$parent_id = $id; $link .= ('/'.$name);
22 22
 
23 23
 				return ['id' => $id, 'link' => $link, 'title' => $title];
24 24
 			};
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 				$access = (Auth::check() ? Auth::user()->rank : RANK_GUEST);
33 33
 
34
-				$condition = ("parent_id = " . $parent_id . " AND visibility = " . VISIBILITY_PUBLISHED . " ") .
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Handlers/Tools/Sitemap.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Dispatcher.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 			# Check installation
14 14
 
15
-			if (!$this->installed) Request::redirect(INSTALL_PATH . '/install.php');
15
+			if (!$this->installed) Request::redirect(INSTALL_PATH.'/install.php');
16 16
 
17 17
 			# Connect to database
18 18
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 			# Determine handler class
26 26
 
27
-			$class = ((false !== $handler) ? ('Handlers\\' . $handler) : 'Handlers\Site\Page');
27
+			$class = ((false !== $handler) ? ('Handlers\\'.$handler) : 'Handlers\Site\Page');
28 28
 
29 29
 			# ------------------------
30 30
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Install.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Controller/Database.php 2 patches
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,21 +20,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
 			$system['time'] = REQUEST_TIME;
49 49
 
50
-			$system_file = (DIR_SYSTEM_DATA . 'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT);
50
+			$system_file = (DIR_SYSTEM_DATA.'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT);
51 51
 
52 52
 			if (false === Explorer::save($system_file, $system, true)) return 'INSTALL_ERROR_SYSTEM';
53 53
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Form/Check.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Utils/Tables.php 2 patches
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,9 +12,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 			for ($i = 1; $i <= 3; $i++) $pages[] = ['visibility' => VISIBILITY_PUBLISHED,
34 34
 
35
-				'hash' => Arr::encode([('page-' . $i), 0]),
35
+				'hash' => Arr::encode([('page-'.$i), 0]),
36 36
 
37
-				'name' => ('page-' . $i), 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $i),
37
+				'name' => ('page-'.$i), 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.$i),
38 38
 
39 39
 				'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(),
40 40
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
 			for ($i = 1; $i <= 3; $i++) $menu[] = [
63 63
 
64
-				'position' => ($i - 1), 'slug' => ('page-' . $i),
64
+				'position' => ($i - 1), 'slug' => ('page-'.$i),
65 65
 
66
-				'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $i)];
66
+				'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.$i)];
67 67
 
68 68
 			# ------------------------
69 69
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Controller/General.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.