Whenever we display an image for any reason, show the admin block, fixes #621
This commit is contained in:
parent
bfcefb97e7
commit
1fc75c0b18
7 changed files with 19 additions and 15 deletions
|
@ -93,7 +93,9 @@ class Tag
|
||||||
$tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); # trailing slashes?
|
$tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); # trailing slashes?
|
||||||
$tag = trim($tag, ", \t\n\r\0\x0B");
|
$tag = trim($tag, ", \t\n\r\0\x0B");
|
||||||
|
|
||||||
if($tag == ".") $tag = ""; // hard-code one bad case...
|
if ($tag == ".") {
|
||||||
|
$tag = "";
|
||||||
|
} // hard-code one bad case...
|
||||||
|
|
||||||
if (mb_strlen($tag, 'UTF-8') > 255) {
|
if (mb_strlen($tag, 'UTF-8') > 255) {
|
||||||
throw new ScoreException("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n");
|
throw new ScoreException("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n");
|
||||||
|
|
|
@ -59,7 +59,8 @@ function install()
|
||||||
function get_dsn()
|
function get_dsn()
|
||||||
{
|
{
|
||||||
if (getenv("INSTALL_DSN")) {
|
if (getenv("INSTALL_DSN")) {
|
||||||
$dsn = getenv("INSTALL_DSN");;
|
$dsn = getenv("INSTALL_DSN");
|
||||||
|
;
|
||||||
} elseif (@$_POST["database_type"] == DatabaseDriver::SQLITE) {
|
} elseif (@$_POST["database_type"] == DatabaseDriver::SQLITE) {
|
||||||
/** @noinspection PhpUnhandledExceptionInspection */
|
/** @noinspection PhpUnhandledExceptionInspection */
|
||||||
$id = bin2hex(random_bytes(5));
|
$id = bin2hex(random_bytes(5));
|
||||||
|
|
|
@ -17,9 +17,7 @@ class ETServer extends Extension
|
||||||
$page->set_title("Thanks!");
|
$page->set_title("Thanks!");
|
||||||
$page->set_heading("Thanks!");
|
$page->set_heading("Thanks!");
|
||||||
$page->add_block(new Block("Thanks!", "Your data has been recorded~"));
|
$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_title("Registrations");
|
||||||
$page->set_heading("Registrations");
|
$page->set_heading("Registrations");
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
|
@ -353,7 +353,9 @@ class IPBan extends Extension
|
||||||
|
|
||||||
public function find_active_ban($ips, $remote, $networks)
|
public function find_active_ban($ips, $remote, $networks)
|
||||||
{
|
{
|
||||||
if(!$remote) return null;
|
if (!$remote) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$active_ban_id = null;
|
$active_ban_id = null;
|
||||||
if (isset($ips[$remote])) {
|
if (isset($ips[$remote])) {
|
||||||
$active_ban_id = $ips[$remote];
|
$active_ban_id = $ips[$remote];
|
||||||
|
|
|
@ -61,10 +61,6 @@ class ViewImage extends Extension
|
||||||
|
|
||||||
if (!is_null($image)) {
|
if (!is_null($image)) {
|
||||||
send_event(new DisplayingImageEvent($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 {
|
} else {
|
||||||
$this->theme->display_error(404, "Image not found", "No image in the database has the ID #$image_id");
|
$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)
|
public function onDisplayingImage(DisplayingImageEvent $event)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
$this->theme->display_meta_headers($event->get_image());
|
||||||
|
|
||||||
$iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user);
|
$iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user);
|
||||||
send_event($iibbe);
|
send_event($iibbe);
|
||||||
ksort($iibbe->parts);
|
ksort($iibbe->parts);
|
||||||
$this->theme->display_meta_headers($event->get_image());
|
|
||||||
$this->theme->display_page($event->get_image(), $iibbe->parts);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ use function \MicroHTML\P;
|
||||||
use function \MicroHTML\SELECT;
|
use function \MicroHTML\SELECT;
|
||||||
use function \MicroHTML\OPTION;
|
use function \MicroHTML\OPTION;
|
||||||
|
|
||||||
|
|
||||||
class CustomUserPageTheme extends UserPageTheme
|
class CustomUserPageTheme extends UserPageTheme
|
||||||
{
|
{
|
||||||
public function display_user_block(Page $page, User $user, $parts)
|
public function display_user_block(Page $page, User $user, $parts)
|
||||||
|
|
Reference in a new issue