@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Check auth |
| 16 | 16 | |
| 17 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
| 17 | + if (Modules\Auth::check()) Request::redirect(INSTALL_PATH.'/admin'); |
|
| 18 | 18 | |
| 19 | 19 | # Handle request |
| 20 | 20 | |
@@ -14,11 +14,15 @@ |
||
| 14 | 14 | |
| 15 | 15 | # Check auth |
| 16 | 16 | |
| 17 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
| 17 | + if (Modules\Auth::check()) { |
|
| 18 | + Request::redirect(INSTALL_PATH . '/admin'); |
|
| 19 | + } |
|
| 18 | 20 | |
| 19 | 21 | # Handle request |
| 20 | 22 | |
| 21 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_401); |
|
| 23 | + if (Template::isBlock($result = $this->handle())) { |
|
| 24 | + return $this->displayPage($result, STATUS_CODE_401); |
|
| 25 | + } |
|
| 22 | 26 | |
| 23 | 27 | # ------------------------ |
| 24 | 28 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) { |
| 18 | 18 | |
| 19 | - Request::redirect(INSTALL_PATH . '/admin/login'); |
|
| 19 | + Request::redirect(INSTALL_PATH.'/admin/login'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | # Handle request |
@@ -19,9 +19,13 @@ |
||
| 19 | 19 | |
| 20 | 20 | # Handle request |
| 21 | 21 | |
| 22 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
| 22 | + if (Template::isBlock($result = $this->handle())) { |
|
| 23 | + return $this->displayPage($result, STATUS_CODE_200); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
| 26 | + if (Ajax::isResponse($result)) { |
|
| 27 | + return Ajax::output($result); |
|
| 28 | + } |
|
| 25 | 29 | |
| 26 | 30 | # ------------------------ |
| 27 | 31 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private function getLayout(Template\Block $contents) { |
| 25 | 25 | |
| 26 | - $layout = View::get('Layouts/' . $this->layout); |
|
| 26 | + $layout = View::get('Layouts/'.$this->layout); |
|
| 27 | 27 | |
| 28 | 28 | # Set menu and user |
| 29 | 29 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | protected function displayPage(Template\Block $contents, int $status = STATUS_CODE_200) { |
| 84 | 84 | |
| 85 | - $page = View::get('Main/' . $this->layout); |
|
| 85 | + $page = View::get('Main/'.$this->layout); |
|
| 86 | 86 | |
| 87 | 87 | # Set language |
| 88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | # Set title |
| 92 | 92 | |
| 93 | - $page->title = ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . CADMIUM_NAME); |
|
| 93 | + $page->title = ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').CADMIUM_NAME); |
|
| 94 | 94 | |
| 95 | 95 | # Set layout |
| 96 | 96 | |
@@ -111,7 +111,9 @@ |
||
| 111 | 111 | |
| 112 | 112 | $ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY); |
| 113 | 113 | |
| 114 | - if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::error404(); |
|
| 114 | + if (!in_array(REQUEST_CLIENT_IP, $ips, true)) { |
|
| 115 | + return Status::error404(); |
|
| 116 | + } |
|
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | # ------------------------ |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | # Handle request |
| 14 | 14 | |
| 15 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
| 15 | + if (Template::isBlock($result = $this->handle())) { |
|
| 16 | + return $this->displayPage($result, STATUS_CODE_200); |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | # ------------------------ |
| 18 | 20 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | # Check auth |
| 14 | 14 | |
| 15 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
| 15 | + if (Modules\Auth::check()) Request::redirect(INSTALL_PATH.'/profile'); |
|
| 16 | 16 | |
| 17 | 17 | # Handle request |
| 18 | 18 | |
@@ -12,11 +12,15 @@ |
||
| 12 | 12 | |
| 13 | 13 | # Check auth |
| 14 | 14 | |
| 15 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
| 15 | + if (Modules\Auth::check()) { |
|
| 16 | + Request::redirect(INSTALL_PATH . '/profile'); |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | # Handle request |
| 18 | 20 | |
| 19 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_401); |
|
| 21 | + if (Template::isBlock($result = $this->handle())) { |
|
| 22 | + return $this->displayPage($result, STATUS_CODE_401); |
|
| 23 | + } |
|
| 20 | 24 | |
| 21 | 25 | # ------------------------ |
| 22 | 26 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) { |
| 16 | 16 | |
| 17 | - Request::redirect(INSTALL_PATH . '/profile/login'); |
|
| 17 | + Request::redirect(INSTALL_PATH.'/profile/login'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | # Handle request |
@@ -19,9 +19,13 @@ |
||
| 19 | 19 | |
| 20 | 20 | # Handle request |
| 21 | 21 | |
| 22 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
| 22 | + if (Template::isBlock($result = $this->handle())) { |
|
| 23 | + return $this->displayPage($result, STATUS_CODE_200); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
| 26 | + if (Ajax::isResponse($result)) { |
|
| 27 | + return Ajax::output($result); |
|
| 28 | + } |
|
| 25 | 29 | |
| 26 | 30 | # ------------------------ |
| 27 | 31 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private function getLayout(Template\Block $contents) { |
| 25 | 25 | |
| 26 | - $layout = View::get('Layouts/' . $this->layout); |
|
| 26 | + $layout = View::get('Layouts/'.$this->layout); |
|
| 27 | 27 | |
| 28 | 28 | # Create layout components |
| 29 | 29 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $layout->getBlock('user')->enable(); |
| 41 | 41 | |
| 42 | - $layout->getBlock('user')->gravatar = Auth::user()->gravatar;; |
|
| 42 | + $layout->getBlock('user')->gravatar = Auth::user()->gravatar; ; |
|
| 43 | 43 | |
| 44 | 44 | $layout->getBlock('user')->name = Auth::user()->name; |
| 45 | 45 | |
@@ -50,9 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | # Set title |
| 52 | 52 | |
| 53 | - $layout->title = (('' !== SEO::title()) ? SEO::title() : |
|
| 54 | - |
|
| 55 | - (('' !== $this->title) ? Language::get($this->title) : Settings::get('site_title'))); |
|
| 53 | + $layout->title = (('' !== SEO::title()) ? SEO::title() : (('' !== $this->title) ? Language::get($this->title) : Settings::get('site_title'))); |
|
| 56 | 54 | |
| 57 | 55 | # Set slogan |
| 58 | 56 | |
@@ -95,13 +93,11 @@ discard block |
||
| 95 | 93 | |
| 96 | 94 | $page->keywords = ('' !== SEO::keywords()) ? SEO::keywords() : Settings::get('site_keywords'); |
| 97 | 95 | |
| 98 | - $page->robots = ((SEO::robotsIndex() ? 'INDEX' : 'NOINDEX') . ',' . (SEO::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
| 96 | + $page->robots = ((SEO::robotsIndex() ? 'INDEX' : 'NOINDEX').','.(SEO::robotsFollow() ? 'FOLLOW' : 'NOFOLLOW')); |
|
| 99 | 97 | |
| 100 | 98 | # Set title |
| 101 | 99 | |
| 102 | - $page->title = (('' !== SEO::title()) ? SEO::title() : |
|
| 103 | - |
|
| 104 | - ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . Settings::get('site_title'))); |
|
| 100 | + $page->title = (('' !== SEO::title()) ? SEO::title() : ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').Settings::get('site_title'))); |
|
| 105 | 101 | |
| 106 | 102 | # Set canonical |
| 107 | 103 | |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $layout->getBlock('auth')->disable(); |
| 47 | 47 | |
| 48 | - if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->getBlock('admin')->enable(); |
|
| 48 | + if (Auth::user()->rank === RANK_ADMINISTRATOR) { |
|
| 49 | + $layout->getBlock('admin')->enable(); |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | # Set title |
@@ -105,9 +107,11 @@ discard block |
||
| 105 | 107 | |
| 106 | 108 | # Set canonical |
| 107 | 109 | |
| 108 | - if ('' === SEO::canonical()) $page->getBlock('canonical')->disable(); |
|
| 109 | - |
|
| 110 | - else $page->getBlock('canonical')->link = SEO::canonical(); |
|
| 110 | + if ('' === SEO::canonical()) { |
|
| 111 | + $page->getBlock('canonical')->disable(); |
|
| 112 | + } else { |
|
| 113 | + $page->getBlock('canonical')->link = SEO::canonical(); |
|
| 114 | + } |
|
| 111 | 115 | |
| 112 | 116 | # Set layout |
| 113 | 117 | |
@@ -119,9 +123,13 @@ discard block |
||
| 119 | 123 | |
| 120 | 124 | # Set global components |
| 121 | 125 | |
| 122 | - foreach (Variables::generate() as $name => $value) Template::setGlobal($name, $value); |
|
| 126 | + foreach (Variables::generate() as $name => $value) { |
|
| 127 | + Template::setGlobal($name, $value); |
|
| 128 | + } |
|
| 123 | 129 | |
| 124 | - foreach (Widgets::generate() as $name => $block) Template::setWidget($name, $block); |
|
| 130 | + foreach (Widgets::generate() as $name => $block) { |
|
| 131 | + Template::setWidget($name, $block); |
|
| 132 | + } |
|
| 125 | 133 | |
| 126 | 134 | # ------------------------ |
| 127 | 135 | |
@@ -134,9 +142,13 @@ discard block |
||
| 134 | 142 | |
| 135 | 143 | # Check site status |
| 136 | 144 | |
| 137 | - if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance(); |
|
| 145 | + if (Settings::get('site_status') === STATUS_MAINTENANCE) { |
|
| 146 | + return Status::maintenance(); |
|
| 147 | + } |
|
| 138 | 148 | |
| 139 | - if (Settings::get('site_status') === STATUS_UPDATE) return Status::update(); |
|
| 149 | + if (Settings::get('site_status') === STATUS_UPDATE) { |
|
| 150 | + return Status::update(); |
|
| 151 | + } |
|
| 140 | 152 | |
| 141 | 153 | # ------------------------ |
| 142 | 154 | |
@@ -36,22 +36,22 @@ |
||
| 36 | 36 | |
| 37 | 37 | foreach (array_unique($languages) as $path) foreach ($phrases as $name) { |
| 38 | 38 | |
| 39 | - Language::load($path . 'Phrases/' . $name . '.php'); |
|
| 39 | + Language::load($path.'Phrases/'.$name.'.php'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | # Set template globals |
| 43 | 43 | |
| 44 | - Template::setGlobal('template_name', strtolower(Extend\Templates::active())); |
|
| 44 | + Template::setGlobal('template_name', strtolower(Extend\Templates::active())); |
|
| 45 | 45 | |
| 46 | - Template::setGlobal('site_title', Settings::get('site_title')); |
|
| 46 | + Template::setGlobal('site_title', Settings::get('site_title')); |
|
| 47 | 47 | |
| 48 | - Template::setGlobal('system_url', Settings::get('system_url')); |
|
| 48 | + Template::setGlobal('system_url', Settings::get('system_url')); |
|
| 49 | 49 | |
| 50 | - Template::setGlobal('system_email', Settings::get('system_email')); |
|
| 50 | + Template::setGlobal('system_email', Settings::get('system_email')); |
|
| 51 | 51 | |
| 52 | - Template::setGlobal('install_path', INSTALL_PATH); |
|
| 52 | + Template::setGlobal('install_path', INSTALL_PATH); |
|
| 53 | 53 | |
| 54 | - Template::setGlobal('index_page', (('' !== INSTALL_PATH) ? INSTALL_PATH : '/')); |
|
| 54 | + Template::setGlobal('index_page', (('' !== INSTALL_PATH) ? INSTALL_PATH : '/')); |
|
| 55 | 55 | |
| 56 | 56 | # Init utils |
| 57 | 57 | |
@@ -34,10 +34,12 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $phrases = array_merge(static::PHRASES, array_keys(Extend\Addons::items() ?? [])); |
| 36 | 36 | |
| 37 | - foreach (array_unique($languages) as $path) foreach ($phrases as $name) { |
|
| 37 | + foreach (array_unique($languages) as $path) { |
|
| 38 | + foreach ($phrases as $name) { |
|
| 38 | 39 | |
| 39 | 40 | Language::load($path . 'Phrases/' . $name . '.php'); |
| 40 | 41 | } |
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | # Set template globals |
| 43 | 45 | |
@@ -59,7 +61,9 @@ discard block |
||
| 59 | 61 | |
| 60 | 62 | # Set timezone |
| 61 | 63 | |
| 62 | - if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) date_default_timezone_set($timezone); |
|
| 64 | + if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) { |
|
| 65 | + date_default_timezone_set($timezone); |
|
| 66 | + } |
|
| 63 | 67 | |
| 64 | 68 | # ------------------------ |
| 65 | 69 | |
@@ -12,7 +12,11 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $text = Language::get($code); |
| 14 | 14 | |
| 15 | - if (!$popup) Messages::set('error', $text); else Popup::set('negative', $text); |
|
| 15 | + if (!$popup) { |
|
| 16 | + Messages::set('error', $text); |
|
| 17 | + } else { |
|
| 18 | + Popup::set('negative', $text); |
|
| 19 | + } |
|
| 16 | 20 | |
| 17 | 21 | # ------------------------ |
| 18 | 22 | |
@@ -23,15 +27,21 @@ discard block |
||
| 23 | 27 | |
| 24 | 28 | public function handle(callable $callback, bool $popup = false) { |
| 25 | 29 | |
| 26 | - if (false === ($post = $this->post())) return false; |
|
| 30 | + if (false === ($post = $this->post())) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 27 | 33 | |
| 28 | 34 | # Check form for errors |
| 29 | 35 | |
| 30 | - if ($this->hasErrors()) return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
| 36 | + if ($this->hasErrors()) { |
|
| 37 | + return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
| 38 | + } |
|
| 31 | 39 | |
| 32 | 40 | # Call controller method |
| 33 | 41 | |
| 34 | - if (is_string($result = $callback($post))) return $this->displayError($result, $popup); |
|
| 42 | + if (is_string($result = $callback($post))) { |
|
| 43 | + return $this->displayError($result, $popup); |
|
| 44 | + } |
|
| 35 | 45 | |
| 36 | 46 | if (is_array($result)) { $this->getField($result[0])->error = true; return $this->displayError($result[1], $popup); } |
| 37 | 47 | |