@@ -40,7 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | # Display success message |
| 42 | 42 | |
| 43 | - if (false !== Request::get('submitted')) Popup::set('positive', Language::get('SETTINGS_SUCCESS')); |
|
| 43 | + if (false !== Request::get('submitted')) { |
|
| 44 | + Popup::set('positive', Language::get('SETTINGS_SUCCESS')); |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | # ------------------------ |
| 46 | 48 | |
@@ -20,23 +20,28 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | # Validate values |
| 22 | 22 | |
| 23 | - if (false === ($password = Validate::userPassword($password))) |
|
| 24 | - |
|
| 23 | + if (false === ($password = Validate::userPassword($password))) { |
|
| 24 | + |
|
| 25 | 25 | return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | - if (false === ($password_new = Validate::userPassword($password_new))) |
|
| 28 | - |
|
| 28 | + if (false === ($password_new = Validate::userPassword($password_new))) { |
|
| 29 | + |
|
| 29 | 30 | return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID']; |
| 31 | + } |
|
| 30 | 32 | |
| 31 | - if (0 !== strcmp($password_new, $password_retype)) |
|
| 32 | - |
|
| 33 | + if (0 !== strcmp($password_new, $password_retype)) { |
|
| 34 | + |
|
| 33 | 35 | return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
| 36 | + } |
|
| 34 | 37 | |
| 35 | 38 | # Check password |
| 36 | 39 | |
| 37 | 40 | $password = Str::encode(Auth::user()->auth_key, $password); |
| 38 | 41 | |
| 39 | - if (0 !== strcmp(Auth::user()->password, $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 42 | + if (0 !== strcmp(Auth::user()->password, $password)) { |
|
| 43 | + return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 44 | + } |
|
| 40 | 45 | |
| 41 | 46 | # Encode password |
| 42 | 47 | |
@@ -49,7 +54,9 @@ discard block |
||
| 49 | 54 | $data['auth_key'] = $auth_key; |
| 50 | 55 | $data['password'] = $password; |
| 51 | 56 | |
| 52 | - if (!Auth::user()->edit($data)) return 'USER_ERROR_EDIT_PASSWORD'; |
|
| 57 | + if (!Auth::user()->edit($data)) { |
|
| 58 | + return 'USER_ERROR_EDIT_PASSWORD'; |
|
| 59 | + } |
|
| 53 | 60 | |
| 54 | 61 | # ------------------------ |
| 55 | 62 | |
@@ -20,13 +20,19 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | # Validate values |
| 22 | 22 | |
| 23 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
| 23 | + if (false === ($email = Validate::userEmail($email))) { |
|
| 24 | + return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | # Check email exists |
| 26 | 28 | |
| 27 | - if (false === ($check_email = Auth::user()->check($email, 'email'))) return 'USER_ERROR_EDIT_PERSONAL'; |
|
| 29 | + if (false === ($check_email = Auth::user()->check($email, 'email'))) { |
|
| 30 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
| 31 | + } |
|
| 28 | 32 | |
| 29 | - if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
| 33 | + if ($check_email === 1) { |
|
| 34 | + return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
| 35 | + } |
|
| 30 | 36 | |
| 31 | 37 | # Update user |
| 32 | 38 | |
@@ -40,7 +46,9 @@ discard block |
||
| 40 | 46 | $data['country'] = $country; |
| 41 | 47 | $data['timezone'] = $timezone; |
| 42 | 48 | |
| 43 | - if (!Auth::user()->edit($data)) return 'USER_ERROR_EDIT_PERSONAL'; |
|
| 49 | + if (!Auth::user()->edit($data)) { |
|
| 50 | + return 'USER_ERROR_EDIT_PERSONAL'; |
|
| 51 | + } |
|
| 44 | 52 | |
| 45 | 53 | # ------------------------ |
| 46 | 54 | |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | |
| 51 | 51 | # Display success message |
| 52 | 52 | |
| 53 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
| 53 | + if (false !== Request::get('submitted')) { |
|
| 54 | + Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | # ------------------------ |
| 56 | 58 | |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
| 48 | 48 | |
| 49 | - 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
|
| 49 | + 'locked' => false, 'slug' => ('page-'.($id - 1)), 'name' => ('page-'.($id - 1)), |
|
| 50 | 50 | |
| 51 | - 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . ($id - 1)), |
|
| 51 | + 'title' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.($id - 1)), |
|
| 52 | 52 | |
| 53 | 53 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
| 54 | 54 | |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | for ($id = 1; $id <= 3; $id++) $menu[] = [ |
| 83 | 83 | |
| 84 | - 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
|
| 84 | + 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-'.$id), |
|
| 85 | 85 | |
| 86 | - 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
|
| 86 | + 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE').' '.$id)]; |
|
| 87 | 87 | |
| 88 | 88 | # Process insertion |
| 89 | 89 | |
@@ -30,7 +30,11 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $count = Informer::countEntries(TABLE_PAGES, true); |
| 32 | 32 | |
| 33 | - if (false === $count) return false; else if ($count > 0) return true; |
|
| 33 | + if (false === $count) { |
|
| 34 | + return false; |
|
| 35 | + } else if ($count > 0) { |
|
| 36 | + return true; |
|
| 37 | + } |
|
| 34 | 38 | |
| 35 | 39 | # Process dataset |
| 36 | 40 | |
@@ -44,7 +48,8 @@ discard block |
||
| 44 | 48 | |
| 45 | 49 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]]; |
| 46 | 50 | |
| 47 | - for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
| 51 | + for ($id = 2; $id <= 4; $id++) { |
|
| 52 | + $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED, |
|
| 48 | 53 | |
| 49 | 54 | 'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)), |
| 50 | 55 | |
@@ -53,10 +58,13 @@ discard block |
||
| 53 | 58 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
| 54 | 59 | |
| 55 | 60 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
| 61 | + } |
|
| 56 | 62 | |
| 57 | 63 | # Process insertion |
| 58 | 64 | |
| 59 | - if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) return false; |
|
| 65 | + if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::last()->status)) { |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 60 | 68 | |
| 61 | 69 | self::fillRelationsTable(TABLE_PAGES_RELATIONS, 4); |
| 62 | 70 | |
@@ -73,21 +81,29 @@ discard block |
||
| 73 | 81 | |
| 74 | 82 | $count = Informer::countEntries(TABLE_MENU, true); |
| 75 | 83 | |
| 76 | - if (false === $count) return false; else if ($count > 0) return true; |
|
| 84 | + if (false === $count) { |
|
| 85 | + return false; |
|
| 86 | + } else if ($count > 0) { |
|
| 87 | + return true; |
|
| 88 | + } |
|
| 77 | 89 | |
| 78 | 90 | # Process dataset |
| 79 | 91 | |
| 80 | 92 | $menu = []; |
| 81 | 93 | |
| 82 | - for ($id = 1; $id <= 3; $id++) $menu[] = [ |
|
| 94 | + for ($id = 1; $id <= 3; $id++) { |
|
| 95 | + $menu[] = [ |
|
| 83 | 96 | |
| 84 | 97 | 'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id), |
| 85 | 98 | |
| 86 | 99 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)]; |
| 100 | + } |
|
| 87 | 101 | |
| 88 | 102 | # Process insertion |
| 89 | 103 | |
| 90 | - if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) return false; |
|
| 104 | + if (!(DB::insert(TABLE_MENU, $menu, true) && DB::last()->status)) { |
|
| 105 | + return false; |
|
| 106 | + } |
|
| 91 | 107 | |
| 92 | 108 | self::fillRelationsTable(TABLE_MENU_RELATIONS, 3); |
| 93 | 109 | |
@@ -116,7 +132,9 @@ discard block |
||
| 116 | 132 | |
| 117 | 133 | $definitions[] = Entitizer::definition(TABLE_USERS_SESSIONS); |
| 118 | 134 | |
| 119 | - foreach ($definitions as $definition) if (!$definition->createTable()) return false; |
|
| 135 | + foreach ($definitions as $definition) { |
|
| 136 | + if (!$definition->createTable()) return false; |
|
| 137 | + } |
|
| 120 | 138 | |
| 121 | 139 | # ------------------------ |
| 122 | 140 | |
@@ -16,9 +16,11 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | # Set breadcrumbs |
| 18 | 18 | |
| 19 | - if (count($this->path) <= 1) $contents->block('breadcrumbs')->disable(); |
|
| 20 | - |
|
| 21 | - else $contents->block('breadcrumbs')->path = $this->path; |
|
| 19 | + if (count($this->path) <= 1) { |
|
| 20 | + $contents->block('breadcrumbs')->disable(); |
|
| 21 | + } else { |
|
| 22 | + $contents->block('breadcrumbs')->path = $this->path; |
|
| 23 | + } |
|
| 22 | 24 | |
| 23 | 25 | # Set contents |
| 24 | 26 | |
@@ -41,19 +43,31 @@ discard block |
||
| 41 | 43 | |
| 42 | 44 | $slug = implode('/', $this->url->path()); |
| 43 | 45 | |
| 44 | - if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1); |
|
| 46 | + if ('' !== $slug) { |
|
| 47 | + $this->page->initBySlug($slug); |
|
| 48 | + } else { |
|
| 49 | + $this->page->init(1); |
|
| 50 | + } |
|
| 45 | 51 | |
| 46 | 52 | # Display error if not found |
| 47 | 53 | |
| 48 | - if (0 === $this->page->id) return false; |
|
| 54 | + if (0 === $this->page->id) { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 49 | 57 | |
| 50 | 58 | # Get path |
| 51 | 59 | |
| 52 | - if (false !== ($path = $this->page->path())) $this->path = $path; |
|
| 60 | + if (false !== ($path = $this->page->path())) { |
|
| 61 | + $this->path = $path; |
|
| 62 | + } |
|
| 53 | 63 | |
| 54 | 64 | # Set data |
| 55 | 65 | |
| 56 | - if ($this->page->id !== 1) $this->title = $this->page->title; else $this->layout = 'Index'; |
|
| 66 | + if ($this->page->id !== 1) { |
|
| 67 | + $this->title = $this->page->title; |
|
| 68 | + } else { |
|
| 69 | + $this->layout = 'Index'; |
|
| 70 | + } |
|
| 57 | 71 | |
| 58 | 72 | $this->description = $this->page->description; |
| 59 | 73 | $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 | |
@@ -27,11 +29,15 @@ discard block |
||
| 27 | 29 | |
| 28 | 30 | $condition = ['visibility' => VISIBILITY_PUBLISHED, 'access' => ACCESS_PUBLIC, 'locked' => 0]; |
| 29 | 31 | |
| 30 | - if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::last()->status)) return; |
|
| 32 | + if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::last()->status)) { |
|
| 33 | + return; |
|
| 34 | + } |
|
| 31 | 35 | |
| 32 | 36 | # ------------------------ |
| 33 | 37 | |
| 34 | - while (null !== ($page = DB::last()->row())) yield Entitizer::create(TABLE_PAGES, $page); |
|
| 38 | + while (null !== ($page = DB::last()->row())) { |
|
| 39 | + yield Entitizer::create(TABLE_PAGES, $page); |
|
| 40 | + } |
|
| 35 | 41 | } |
| 36 | 42 | |
| 37 | 43 | # Handle request |
@@ -44,7 +50,9 @@ discard block |
||
| 44 | 50 | |
| 45 | 51 | # Get last modification time |
| 46 | 52 | |
| 47 | - if ($sitemap->load($this->getLastModified())) return $sitemap; |
|
| 53 | + if ($sitemap->load($this->getLastModified())) { |
|
| 54 | + return $sitemap; |
|
| 55 | + } |
|
| 48 | 56 | |
| 49 | 57 | # Fill sitemap |
| 50 | 58 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Form, Utils\Range; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Form; |
|
| 7 | + use Utils\Range; |
|
| 6 | 8 | |
| 7 | 9 | class Page extends Form { |
| 8 | 10 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | protected function init() { |
| 14 | 14 | |
| 15 | - $this->config->add('active', false, function (bool $active) { |
|
| 15 | + $this->config->add('active', false, function(bool $active) { |
|
| 16 | 16 | |
| 17 | 17 | return ($active ? "ent.active = 1" : ''); |
| 18 | 18 | }); |