@@ -54,6 +54,9 @@  | 
                                                    ||
| 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;  | 
                                                        
@@ -10,7 +10,7 @@ discard block  | 
                                                    ||
| 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) return (self::$globals[$name] ? ? false);  | 
                                                        |
| 14 | 14 | |
| 15 | 15 | self::$globals[$name] = $value;  | 
                                                        
| 16 | 16 | }  | 
                                                        
@@ -19,7 +19,7 @@ discard block  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 |  		public static function widget(string $name, Template\Asset\Block $block = null) { | 
                                                        
| 21 | 21 | |
| 22 | - if (null === $block) return (self::$widgets[$name] ?? false);  | 
                                                        |
| 22 | + if (null === $block) return (self::$widgets[$name] ? ? false);  | 
                                                        |
| 23 | 23 | |
| 24 | 24 | self::$widgets[$name] = $block;  | 
                                                        
| 25 | 25 | }  | 
                                                        
@@ -10,7 +10,9 @@ discard block  | 
                                                    ||
| 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 | 17 | self::$globals[$name] = $value;  | 
                                                        
| 16 | 18 | }  | 
                                                        
@@ -19,7 +21,9 @@ discard block  | 
                                                    ||
| 19 | 21 | |
| 20 | 22 |  		public static function widget(string $name, Template\Asset\Block $block = null) { | 
                                                        
| 21 | 23 | |
| 22 | - if (null === $block) return (self::$widgets[$name] ?? false);  | 
                                                        |
| 24 | +			if (null === $block) { | 
                                                        |
| 25 | + return (self::$widgets[$name] ?? false);  | 
                                                        |
| 26 | + }  | 
                                                        |
| 23 | 27 | |
| 24 | 28 | self::$widgets[$name] = $block;  | 
                                                        
| 25 | 29 | }  | 
                                                        
@@ -56,7 +60,9 @@ discard block  | 
                                                    ||
| 56 | 60 | |
| 57 | 61 |  		public static function output(Template\Asset\Block $block, $status = null) { | 
                                                        
| 58 | 62 | |
| 59 | - if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200;  | 
                                                        |
| 63 | +			if ((null === $status) || !Headers::isStatusCode($status)) { | 
                                                        |
| 64 | + $status = STATUS_CODE_200;  | 
                                                        |
| 65 | + }  | 
                                                        |
| 60 | 66 | |
| 61 | 67 | Headers::nocache(); Headers::status($status); Headers::content(MIME_TYPE_HTML);  | 
                                                        
| 62 | 68 | |
@@ -10,10 +10,10 @@  | 
                                                    ||
| 10 | 10 | |
| 11 | 11 | # Define constants  | 
                                                        
| 12 | 12 | |
| 13 | -define('DIR_ENGINE',        (dirname(__FILE__) . '/')); | 
                                                        |
| 13 | +define('DIR_ENGINE', (dirname(__FILE__) . '/')); | 
                                                        |
| 14 | 14 | |
| 15 | -define('DIR_WWW',           (DIR_ENGINE . '../')); | 
                                                        |
| 16 | -define('DIR_UPLOADS',       (DIR_ENGINE . '../uploads/')); | 
                                                        |
| 15 | +define('DIR_WWW', (DIR_ENGINE . '../')); | 
                                                        |
| 16 | +define('DIR_UPLOADS', (DIR_ENGINE . '../uploads/')); | 
                                                        |
| 17 | 17 | |
| 18 | 18 | # Require framework main file  | 
                                                        
| 19 | 19 | |
@@ -2,7 +2,9 @@ discard block  | 
                                                    ||
| 2 | 2 | |
| 3 | 3 | # Check PHP version  | 
                                                        
| 4 | 4 | |
| 5 | -if (version_compare(PHP_VERSION, '7.0.0') < 0) exit('PHP version 7 or higher is required.'); | 
                                                        |
| 5 | +if (version_compare(PHP_VERSION, '7.0.0') < 0) { | 
                                                        |
| 6 | +	exit('PHP version 7 or higher is required.'); | 
                                                        |
| 7 | +}  | 
                                                        |
| 6 | 8 | |
| 7 | 9 | # Set error reporting  | 
                                                        
| 8 | 10 | |
@@ -37,9 +39,11 @@ discard block  | 
                                                    ||
| 37 | 39 | |
| 38 | 40 | # Require class file  | 
                                                        
| 39 | 41 | |
| 40 | - if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name;  | 
                                                        |
| 41 | -  | 
                                                        |
| 42 | - else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name;  | 
                                                        |
| 42 | +	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) { | 
                                                        |
| 43 | + require_once $file_name;  | 
                                                        |
| 44 | +	} else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) { | 
                                                        |
| 45 | + require_once $file_name;  | 
                                                        |
| 46 | + }  | 
                                                        |
| 43 | 47 | |
| 44 | 48 | # Check if class exists  | 
                                                        
| 45 | 49 | |
@@ -50,5 +54,7 @@ discard block  | 
                                                    ||
| 50 | 54 | |
| 51 | 55 | # Call autoload method  | 
                                                        
| 52 | 56 | |
| 53 | - if (method_exists($class_name, '__autoload')) $class_name::__autoload();  | 
                                                        |
| 54 | -});  | 
                                                        |
| 57 | +	if (method_exists($class_name, '__autoload')) { | 
                                                        |
| 58 | + $class_name::__autoload();  | 
                                                        |
| 59 | + }  | 
                                                        |
| 60 | + });  | 
                                                        |
@@ -2,14 +2,14 @@  | 
                                                    ||
| 2 | 2 | |
| 3 | 3 | # Define constants  | 
                                                        
| 4 | 4 | |
| 5 | -define('DIR_SYSTEM',                (dirname(__FILE__) . '/')); | 
                                                        |
| 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_PLUGINS',        (DIR_SYSTEM . 'Plugins/')); | 
                                                        |
| 12 | -define('DIR_SYSTEM_TEMPLATES',      (DIR_SYSTEM . 'Templates/')); | 
                                                        |
| 5 | +define('DIR_SYSTEM', (dirname(__FILE__) . '/')); | 
                                                        |
| 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_PLUGINS', (DIR_SYSTEM . 'Plugins/')); | 
                                                        |
| 12 | +define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM . 'Templates/')); | 
                                                        |
| 13 | 13 | |
| 14 | 14 | # Require classes  | 
                                                        
| 15 | 15 | |
@@ -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 | |
@@ -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 | |