Skip to content

Commit

Permalink
prevent anonymous users from using /tags (map, alphabetic, popular et…
Browse files Browse the repository at this point in the history
…c) - see #1
  • Loading branch information
Giraffaman committed Jan 5, 2024
1 parent 3f3c896 commit c37b2c1
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions ext/tag_list/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,27 @@ public function onPageRequest(PageRequestEvent $event)
} else {
$sub = $event->get_arg(0);
}
switch ($sub) {
default:
case 'map':
$this->theme->set_heading("Tag Map");
if($user->is_logged_in()) {
if($user->is_logged_in()) {
switch ($sub) {
default:
case 'map':
$this->theme->set_heading("Tag Map");
$this->theme->set_tag_list($this->build_tag_map());
}
break;
case 'alphabetic':
$this->theme->set_heading("Alphabetic Tag List");
$this->theme->set_tag_list($this->build_tag_alphabetic());
break;
case 'popularity':
$this->theme->set_heading("Tag List by Popularity");
$this->theme->set_tag_list($this->build_tag_popularity());
break;
break;
case 'alphabetic':
$this->theme->set_heading("Alphabetic Tag List");
$this->theme->set_tag_list($this->build_tag_alphabetic());
break;
case 'popularity':
$this->theme->set_heading("Tag List by Popularity");
$this->theme->set_tag_list($this->build_tag_popularity());
break;
}
} else {
$errMessage = "You must be registered and logged in to view tags.";
$this->theme->display_error(401, "Error", $errMessage);
}
$this->theme->display_page($page);
$this->theme->display_page($page);
}
}

Expand Down

0 comments on commit c37b2c1

Please sign in to comment.