Skip to content

Commit

Permalink
moved user loggedin checks inside page path conditions to prevent err…
Browse files Browse the repository at this point in the history
…or output on non-pool-related pages
  • Loading branch information
Giraffaman committed Jan 5, 2024
1 parent a4d0e8c commit 05170ee
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ext/pools/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ public function onPageRequest(PageRequestEvent $event)
{
global $config, $database, $page, $user;

if(!$user->is_logged_in()) {
$errMessage = "You must be registered and logged in to use pools.";
$this->theme->display_error(403, "Error", $errMessage);
} else {
if ($event->page_matches("pool/list")) { //index
if ($event->page_matches("pool/list")) { //index
if(!$user->is_logged_in()) {
$errMessage = "You must be registered and logged in to use pools.";
$this->theme->display_error(403, "Error", $errMessage);
} else {
if (isset($_GET['search']) and $_GET['search'] != null) {
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link('pool/list').'/'.$_GET['search'].'/'.strval($event->try_page_num(1)));
Expand All @@ -238,7 +238,12 @@ public function onPageRequest(PageRequestEvent $event)
$errMessage = "You must be registered and logged in to view pools.";
$this->theme->display_error(401, "Error", $errMessage);
}
} elseif ($event->page_matches("pool")) {
}
} elseif ($event->page_matches("pool")) {
if(!$user->is_logged_in()) {
$errMessage = "You must be registered and logged in to use pools.";
$this->theme->display_error(403, "Error", $errMessage);
} else {
$pool_id = 0;
$pool = [];

Expand Down

0 comments on commit 05170ee

Please sign in to comment.