forked from Cavemanon/cavepaintings
Whenever we display an image for any reason, show the admin block, fixes #621
This commit is contained in:
@ -9,7 +9,7 @@ class ETServer extends Extension
|
||||
global $database, $page, $user;
|
||||
if ($event->page_matches("register.php")) {
|
||||
error_log("register.php");
|
||||
if(isset($_POST["data"])) {
|
||||
if (isset($_POST["data"])) {
|
||||
$database->execute(
|
||||
"INSERT INTO registration(data) VALUES(:data)",
|
||||
["data"=>$_POST["data"]]
|
||||
@ -17,13 +17,11 @@ class ETServer extends Extension
|
||||
$page->set_title("Thanks!");
|
||||
$page->set_heading("Thanks!");
|
||||
$page->add_block(new Block("Thanks!", "Your data has been recorded~"));
|
||||
|
||||
}
|
||||
elseif ($user->can(Permissions::VIEW_REGISTRATIONS)) {
|
||||
} elseif ($user->can(Permissions::VIEW_REGISTRATIONS)) {
|
||||
$page->set_title("Registrations");
|
||||
$page->set_heading("Registrations");
|
||||
$n = 0;
|
||||
foreach($database->get_all("SELECT responded, data FROM registration ORDER BY responded DESC") as $row) {
|
||||
foreach ($database->get_all("SELECT responded, data FROM registration ORDER BY responded DESC") as $row) {
|
||||
$page->add_block(new Block(
|
||||
$row["responded"],
|
||||
(string)PRE(["style"=>"text-align: left; overflow: scroll;"], $row["data"]),
|
||||
|
@ -353,7 +353,9 @@ class IPBan extends Extension
|
||||
|
||||
public function find_active_ban($ips, $remote, $networks)
|
||||
{
|
||||
if(!$remote) return null;
|
||||
if (!$remote) {
|
||||
return null;
|
||||
}
|
||||
$active_ban_id = null;
|
||||
if (isset($ips[$remote])) {
|
||||
$active_ban_id = $ips[$remote];
|
||||
|
@ -61,10 +61,6 @@ class ViewImage extends Extension
|
||||
|
||||
if (!is_null($image)) {
|
||||
send_event(new DisplayingImageEvent($image));
|
||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
|
||||
send_event($iabbe);
|
||||
ksort($iabbe->parts);
|
||||
$this->theme->display_admin_block($page, $iabbe->parts);
|
||||
} else {
|
||||
$this->theme->display_error(404, "Image not found", "No image in the database has the ID #$image_id");
|
||||
}
|
||||
@ -88,10 +84,16 @@ class ViewImage extends Extension
|
||||
public function onDisplayingImage(DisplayingImageEvent $event)
|
||||
{
|
||||
global $user;
|
||||
$this->theme->display_meta_headers($event->get_image());
|
||||
|
||||
$iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user);
|
||||
send_event($iibbe);
|
||||
ksort($iibbe->parts);
|
||||
$this->theme->display_meta_headers($event->get_image());
|
||||
$this->theme->display_page($event->get_image(), $iibbe->parts);
|
||||
|
||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
|
||||
send_event($iabbe);
|
||||
ksort($iabbe->parts);
|
||||
$this->theme->display_admin_block($page, $iabbe->parts);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user