SHM_POST_INFO element for doing info box elements in a standard way
This commit is contained in:
@@ -151,3 +151,20 @@ function SHM_OPTION(string $value, string $text, bool $selected=false): HTMLElem
|
|||||||
|
|
||||||
return OPTION(["value"=>$value], $text);
|
return OPTION(["value"=>$value], $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SHM_POST_INFO(
|
||||||
|
HTMLElement|string $title,
|
||||||
|
bool $can_edit,
|
||||||
|
HTMLElement|string $view,
|
||||||
|
HTMLElement|string $edit = "",
|
||||||
|
): HTMLElement {
|
||||||
|
return TR(
|
||||||
|
TH(["width"=>"50px"], $title),
|
||||||
|
$can_edit ?
|
||||||
|
emptyHTML(
|
||||||
|
TD(["class"=>"view"], $view),
|
||||||
|
TD(["class"=>"edit"], $edit),
|
||||||
|
) :
|
||||||
|
TD($view)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@@ -7,17 +7,18 @@ namespace Shimmie2;
|
|||||||
use MicroHTML\HTMLElement;
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
use function MicroHTML\emptyHTML;
|
use function MicroHTML\emptyHTML;
|
||||||
use function MicroHTML\{INPUT,P,SPAN,TD,TH,TR};
|
use function MicroHTML\{INPUT,P};
|
||||||
|
|
||||||
class ArtistsTheme extends Themelet
|
class ArtistsTheme extends Themelet
|
||||||
{
|
{
|
||||||
public function get_author_editor_html(string $author): string
|
public function get_author_editor_html(string $author): HTMLElement
|
||||||
{
|
{
|
||||||
$h_author = html_escape($author);
|
return SHM_POST_INFO(
|
||||||
return (string)TR(TH("Author", TD(
|
"Author",
|
||||||
SPAN(["class"=>"view"], $h_author),
|
true,
|
||||||
INPUT(["class"=>"edit", "type"=>"text", "name"=>"tag_edit__author", "value"=>$h_author])
|
$author,
|
||||||
)));
|
INPUT(["type"=>"text", "name"=>"tag_edit__author", "value"=>$author])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sidebar_options(string $mode, ?int $artistID=null, $is_admin=false): void
|
public function sidebar_options(string $mode, ?int $artistID=null, $is_admin=false): void
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use function MicroHTML\{TD,TH,TR};
|
||||||
|
|
||||||
class ImageViewCounter extends Extension
|
class ImageViewCounter extends Extension
|
||||||
{
|
{
|
||||||
/** @var ImageViewCounterTheme */
|
/** @var ImageViewCounterTheme */
|
||||||
@@ -63,15 +65,12 @@ class ImageViewCounter extends Extension
|
|||||||
global $user, $database;
|
global $user, $database;
|
||||||
|
|
||||||
if ($user->can(Permissions::SEE_IMAGE_VIEW_COUNTS)) {
|
if ($user->can(Permissions::SEE_IMAGE_VIEW_COUNTS)) {
|
||||||
$view_count = (int)$database->get_one(
|
$view_count = (string)$database->get_one(
|
||||||
"SELECT COUNT(*) FROM image_views WHERE image_id =:image_id",
|
"SELECT COUNT(*) FROM image_views WHERE image_id =:image_id",
|
||||||
["image_id" => $event->image->id]
|
["image_id" => $event->image->id]
|
||||||
);
|
);
|
||||||
|
|
||||||
$event->add_part(
|
$event->add_part(SHM_POST_INFO("Views", false, $view_count, ""), 38);
|
||||||
"<tr><th>Views:</th><td>$view_count</td></tr>",
|
|
||||||
38
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,23 +4,19 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
|
use function MicroHTML\{INPUT};
|
||||||
|
|
||||||
class PostTitlesTheme extends Themelet
|
class PostTitlesTheme extends Themelet
|
||||||
{
|
{
|
||||||
public function get_title_set_html(string $title, bool $can_set): string
|
public function get_title_set_html(string $title, bool $can_set): HTMLElement
|
||||||
{
|
{
|
||||||
$html = "
|
return SHM_POST_INFO(
|
||||||
<tr>
|
"Title",
|
||||||
<th>Title</th>
|
$can_set,
|
||||||
<td>
|
$title,
|
||||||
".($can_set ? "
|
INPUT(["type" => "text", "name" => "post_title", "value" => $title])
|
||||||
<span class='view'>".html_escape($title)."</span>
|
);
|
||||||
<input class='edit' type='text' name='post_title' value='".html_escape($title)."' />
|
|
||||||
" : html_escape("
|
|
||||||
$title
|
|
||||||
"))."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -203,7 +203,7 @@ class Ratings extends Extension
|
|||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$event->add_part(
|
$event->add_part(
|
||||||
(string)$this->theme->get_rater_html(
|
$this->theme->get_rater_html(
|
||||||
$event->image->id,
|
$event->image->id,
|
||||||
$event->image->rating,
|
$event->image->rating,
|
||||||
$user->can(Permissions::EDIT_IMAGE_RATING)
|
$user->can(Permissions::EDIT_IMAGE_RATING)
|
||||||
|
@@ -18,22 +18,12 @@ class RatingsTheme extends Themelet
|
|||||||
|
|
||||||
public function get_rater_html(int $image_id, string $rating, bool $can_rate): HTMLElement
|
public function get_rater_html(int $image_id, string $rating, bool $can_rate): HTMLElement
|
||||||
{
|
{
|
||||||
$human_rating = Ratings::rating_to_human($rating);
|
return SHM_POST_INFO(
|
||||||
|
"Rating",
|
||||||
$html = TR(TH("Rating"));
|
$can_rate,
|
||||||
|
Ratings::rating_to_human($rating),
|
||||||
if ($can_rate) {
|
$this->get_selection_rater_html("rating", selected_options: [$rating])
|
||||||
$selector = $this->get_selection_rater_html(selected_options: [$rating]);
|
);
|
||||||
|
|
||||||
$html->appendChild(TD(
|
|
||||||
SPAN(["class"=>"view"], $human_rating),
|
|
||||||
SPAN(["class"=>"edit"], $selector)
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
$html->appendChild(TD($human_rating));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_form(array $current_ratings)
|
public function display_form(array $current_ratings)
|
||||||
|
@@ -4,6 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
|
use function MicroHTML\{TR, TH, TD, emptyHTML, DIV, INPUT};
|
||||||
|
|
||||||
class RelationshipsTheme extends Themelet
|
class RelationshipsTheme extends Themelet
|
||||||
{
|
{
|
||||||
public function relationship_info(Image $image)
|
public function relationship_info(Image $image)
|
||||||
@@ -29,26 +33,16 @@ class RelationshipsTheme extends Themelet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_parent_editor_html(Image $image): string
|
public function get_parent_editor_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$h_parent_id = $image->parent_id;
|
return SHM_POST_INFO(
|
||||||
$s_parent_id = $h_parent_id ?: "None";
|
"Parent",
|
||||||
|
!$user->is_anonymous(),
|
||||||
$html = "<tr>\n".
|
$image->parent_id ?: "None",
|
||||||
" <th>Parent</th>\n".
|
INPUT(["type"=>"number", "name"=>"tag_edit__parent", "value"=>$image->parent_id])
|
||||||
" <td>\n".
|
);
|
||||||
(
|
|
||||||
!$user->is_anonymous() ?
|
|
||||||
" <span class='view' style='overflow: hidden; white-space: nowrap;'>{$s_parent_id}</span>\n".
|
|
||||||
" <input class='edit' type='number' name='tag_edit__parent' type='number' value='{$h_parent_id}'>\n"
|
|
||||||
:
|
|
||||||
$s_parent_id
|
|
||||||
).
|
|
||||||
" <td>\n".
|
|
||||||
"</tr>\n";
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,12 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
use function MicroHTML\TR;
|
use function MicroHTML\{emptyHTML, A};
|
||||||
use function MicroHTML\TH;
|
|
||||||
use function MicroHTML\TD;
|
|
||||||
use function MicroHTML\A;
|
|
||||||
|
|
||||||
if ( // kill these glitched requests immediately
|
if (
|
||||||
|
// kill these glitched requests immediately
|
||||||
!empty($_SERVER["REQUEST_URI"])
|
!empty($_SERVER["REQUEST_URI"])
|
||||||
&& str_contains(@$_SERVER["REQUEST_URI"], "/http")
|
&& str_contains(@$_SERVER["REQUEST_URI"], "/http")
|
||||||
&& str_contains(@$_SERVER["REQUEST_URI"], "paheal.net")
|
&& str_contains(@$_SERVER["REQUEST_URI"], "paheal.net")
|
||||||
@@ -40,16 +38,19 @@ class Rule34 extends Extension
|
|||||||
$image_link = $config->get_string(ImageConfig::ILINK);
|
$image_link = $config->get_string(ImageConfig::ILINK);
|
||||||
$url0 = $event->image->parse_link_template($image_link, 0);
|
$url0 = $event->image->parse_link_template($image_link, 0);
|
||||||
$url1 = $event->image->parse_link_template($image_link, 1);
|
$url1 = $event->image->parse_link_template($image_link, 1);
|
||||||
$html = (string)TR(
|
$event->add_part(
|
||||||
TH("Links"),
|
SHM_POST_INFO(
|
||||||
TD(
|
"Links",
|
||||||
A(["href"=>$url0], "File Only"),
|
false,
|
||||||
" (",
|
emptyHTML(
|
||||||
A(["href"=>$url1], "Backup Server"),
|
A(["href" => $url0], "File Only"),
|
||||||
")"
|
" (",
|
||||||
)
|
A(["href" => $url1], "Backup Server"),
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
90
|
||||||
);
|
);
|
||||||
$event->add_part($html, 90);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onAdminBuilding(AdminBuildingEvent $event)
|
public function onAdminBuilding(AdminBuildingEvent $event)
|
||||||
@@ -66,7 +67,7 @@ class Rule34 extends Extension
|
|||||||
{
|
{
|
||||||
global $database, $user, $config;
|
global $database, $user, $config;
|
||||||
if ($user->can(Permissions::CHANGE_SETTING) && $config->get_bool('r34_comic_integration')) {
|
if ($user->can(Permissions::CHANGE_SETTING) && $config->get_bool('r34_comic_integration')) {
|
||||||
$current_state = bool_escape($database->get_one("SELECT comic_admin FROM users WHERE id=:id", ['id'=>$event->display_user->id]));
|
$current_state = bool_escape($database->get_one("SELECT comic_admin FROM users WHERE id=:id", ['id' => $event->display_user->id]));
|
||||||
$this->theme->show_comic_changer($event->display_user, $current_state);
|
$this->theme->show_comic_changer($event->display_user, $current_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,7 @@ class Rule34 extends Extension
|
|||||||
]);
|
]);
|
||||||
$database->execute(
|
$database->execute(
|
||||||
'UPDATE users SET comic_admin=:is_admin WHERE id=:id',
|
'UPDATE users SET comic_admin=:is_admin WHERE id=:id',
|
||||||
['is_admin'=>$input['is_admin'] ? 't' : 'f', 'id'=>$input['user_id']]
|
['is_admin' => $input['is_admin'] ? 't' : 'f', 'id' => $input['user_id']]
|
||||||
);
|
);
|
||||||
$page->set_mode(PageMode::REDIRECT);
|
$page->set_mode(PageMode::REDIRECT);
|
||||||
$page->set_redirect(referer_or(make_link()));
|
$page->set_redirect(referer_or(make_link()));
|
||||||
|
@@ -4,6 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
|
use function MicroHTML\{TR, TH, TD, emptyHTML, rawHTML, joinHTML, DIV, INPUT, A};
|
||||||
|
|
||||||
class TagEditTheme extends Themelet
|
class TagEditTheme extends Themelet
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -14,7 +18,7 @@ class TagEditTheme extends Themelet
|
|||||||
{
|
{
|
||||||
global $page;
|
global $page;
|
||||||
$html = "
|
$html = "
|
||||||
".make_form(make_link("tag_edit/replace"))."
|
" . make_form(make_link("tag_edit/replace")) . "
|
||||||
<table class='form'>
|
<table class='form'>
|
||||||
<tr><th>Search</th><td><input type='text' name='search' class='autocomplete_tags' autocomplete='off'></tr>
|
<tr><th>Search</th><td><input type='text' name='search' class='autocomplete_tags' autocomplete='off'></tr>
|
||||||
<tr><th>Replace</th><td><input type='text' name='replace' class='autocomplete_tags' autocomplete='off'></td></tr>
|
<tr><th>Replace</th><td><input type='text' name='replace' class='autocomplete_tags' autocomplete='off'></td></tr>
|
||||||
@@ -37,115 +41,96 @@ class TagEditTheme extends Themelet
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_tag_editor_html(Image $image): string
|
public function get_tag_editor_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$tag_links = [];
|
$tag_links = [];
|
||||||
foreach ($image->get_tag_array() as $tag) {
|
foreach ($image->get_tag_array() as $tag) {
|
||||||
$h_tag = html_escape($tag);
|
|
||||||
$u_tag = url_escape($tag);
|
$u_tag = url_escape($tag);
|
||||||
$h_link = make_link("post/list/$u_tag/1");
|
$tag_links[] = A([
|
||||||
$tag_links[] = "<a href='$h_link'>$h_tag</a>";
|
"href" => make_link("post/list/$u_tag/1"),
|
||||||
|
"class" => "tag",
|
||||||
|
"title" => "View all posts tagged $tag"
|
||||||
|
], $tag);
|
||||||
}
|
}
|
||||||
$h_tag_links = Tag::implode($tag_links);
|
|
||||||
$h_tags = html_escape($image->get_tag_list());
|
|
||||||
|
|
||||||
return "
|
return SHM_POST_INFO(
|
||||||
<tr>
|
"Tags",
|
||||||
<th width='50px'>Tags</th>
|
$user->can(Permissions::EDIT_IMAGE_TAG),
|
||||||
<td>
|
joinHTML(", ", $tag_links),
|
||||||
".($user->can(Permissions::EDIT_IMAGE_TAG) ? "
|
INPUT([
|
||||||
<span class='view'>$h_tag_links</span>
|
"class" => "autocomplete_tags",
|
||||||
<div class='edit'>
|
"type" => "text",
|
||||||
<input class='autocomplete_tags' type='text' name='tag_edit__tags' value='$h_tags' id='tag_editor' autocomplete='off'>
|
"name" => "tag_edit__tags",
|
||||||
</div>
|
"value" => $image->get_tag_list(),
|
||||||
" : "
|
"id"=>"tag_editor",
|
||||||
$h_tag_links
|
"autocomplete" => "off"
|
||||||
")."
|
])
|
||||||
</td>
|
);
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_user_editor_html(Image $image): string
|
public function get_user_editor_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$h_owner = html_escape($image->get_owner()->name);
|
$owner = $image->get_owner()->name;
|
||||||
$h_av = $image->get_owner()->get_avatar_html();
|
$date = rawHTML(autodate($image->posted));
|
||||||
$h_date = autodate($image->posted);
|
$ip = $user->can(Permissions::VIEW_IP) ? rawHTML(" (" . show_ip($image->owner_ip, "Post posted {$image->posted}") . ")") : "";
|
||||||
$h_ip = $user->can(Permissions::VIEW_IP) ? " (".show_ip($image->owner_ip, "Post posted {$image->posted}").")" : "";
|
$info = SHM_POST_INFO(
|
||||||
return "
|
"Uploader",
|
||||||
<tr>
|
$user->can(Permissions::EDIT_IMAGE_OWNER),
|
||||||
<th>Uploader</th>
|
emptyHTML(A(["class" => "username", "href" => make_link("user/$owner")], $owner), $ip, ", ", $date),
|
||||||
<td>
|
INPUT(["type" => "text", "name" => "tag_edit__owner", "value" => $owner])
|
||||||
".($user->can(Permissions::EDIT_IMAGE_OWNER) ? "
|
);
|
||||||
<span class='view'><a class='username' href='".make_link("user/$h_owner")."'>$h_owner</a>$h_ip, $h_date</span>
|
// SHM_POST_INFO returns a TR, let's sneakily append
|
||||||
<input class='edit' type='text' name='tag_edit__owner' value='$h_owner'>
|
// a TD with the avatar in it
|
||||||
" : "
|
$info->appendChild(
|
||||||
<a class='username' href='".make_link("user/$h_owner")."'>$h_owner</a>$h_ip, $h_date
|
TD(
|
||||||
")."
|
["width" => "80px", "rowspan" => "4"],
|
||||||
</td>
|
rawHTML($image->get_owner()->get_avatar_html())
|
||||||
<td width='80px' rowspan='4'>$h_av</td>
|
)
|
||||||
</tr>
|
);
|
||||||
";
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_source_editor_html(Image $image): string
|
public function get_source_editor_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$h_source = html_escape($image->get_source());
|
return SHM_POST_INFO(
|
||||||
$f_source = $this->format_source($image->get_source());
|
"Source",
|
||||||
$style = "overflow: hidden; white-space: nowrap; max-width: 350px; text-overflow: ellipsis;";
|
$user->can(Permissions::EDIT_IMAGE_SOURCE),
|
||||||
return "
|
DIV(
|
||||||
<tr>
|
["style" => "overflow: hidden; white-space: nowrap; max-width: 350px; text-overflow: ellipsis;"],
|
||||||
<th>Source</th>
|
$this->format_source($image->get_source())
|
||||||
<td>
|
),
|
||||||
".($user->can(Permissions::EDIT_IMAGE_SOURCE) ? "
|
INPUT(["type" => "text", "name" => "tag_edit__source", "value" => $image->get_source()])
|
||||||
<div class='view' style='$style'>$f_source</div>
|
);
|
||||||
<input class='edit' type='text' name='tag_edit__source' value='$h_source'>
|
|
||||||
" : "
|
|
||||||
<div style='$style'>$f_source</div>
|
|
||||||
")."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function format_source(string $source=null): string
|
protected function format_source(string $source = null): HTMLElement
|
||||||
{
|
{
|
||||||
if (!empty($source)) {
|
if (!empty($source)) {
|
||||||
if (!str_starts_with($source, "http://") && !str_starts_with($source, "https://")) {
|
if (!str_starts_with($source, "http://") && !str_starts_with($source, "https://")) {
|
||||||
$source = "http://" . $source;
|
$source = "http://" . $source;
|
||||||
}
|
}
|
||||||
$proto_domain = explode("://", $source);
|
$proto_domain = explode("://", $source);
|
||||||
$h_source = html_escape($proto_domain[1]);
|
$h_source = $proto_domain[1];
|
||||||
$u_source = html_escape($source);
|
|
||||||
if (str_ends_with($h_source, "/")) {
|
if (str_ends_with($h_source, "/")) {
|
||||||
$h_source = substr($h_source, 0, -1);
|
$h_source = substr($h_source, 0, -1);
|
||||||
}
|
}
|
||||||
return "<a href='$u_source'>$h_source</a>";
|
return A(["href"=>$source], $h_source);
|
||||||
}
|
}
|
||||||
return "Unknown";
|
return rawHTML("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_lock_editor_html(Image $image): string
|
public function get_lock_editor_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$b_locked = $image->is_locked() ? "Yes (Only admins may edit these details)" : "No";
|
return SHM_POST_INFO(
|
||||||
$h_locked = $image->is_locked() ? " checked" : "";
|
"Locked",
|
||||||
return "
|
$user->can(Permissions::EDIT_IMAGE_LOCK),
|
||||||
<tr>
|
$image->is_locked() ? "Yes (Only admins may edit these details)" : "No",
|
||||||
<th>Locked</th>
|
INPUT(["type" => "checkbox", "name" => "tag_edit__locked", "checked" => $image->is_locked()])
|
||||||
<td>
|
);
|
||||||
".($user->can(Permissions::EDIT_IMAGE_LOCK) ? "
|
|
||||||
<span class='view'>$b_locked</span>
|
|
||||||
<input class='edit' type='checkbox' name='tag_edit__locked'$h_locked>
|
|
||||||
" : "
|
|
||||||
$b_locked
|
|
||||||
")."
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
|
use function MicroHTML\rawHTML;
|
||||||
|
|
||||||
/* Todo:
|
/* Todo:
|
||||||
* usepref(todo2: port userpref)
|
* usepref(todo2: port userpref)
|
||||||
* theme junk
|
* theme junk
|
||||||
@@ -53,7 +57,7 @@ class TagEditCloud extends Extension
|
|||||||
$sb->add_text_option("tageditcloud_ignoretags");
|
$sb->add_text_option("tageditcloud_ignoretags");
|
||||||
}
|
}
|
||||||
|
|
||||||
private function build_tag_map(Image $image): ?string
|
private function build_tag_map(Image $image): ?HTMLElement
|
||||||
{
|
{
|
||||||
global $database, $config;
|
global $database, $config;
|
||||||
|
|
||||||
@@ -204,7 +208,7 @@ class TagEditCloud extends Extension
|
|||||||
$html .= "</div><br>[<span onclick='tageditcloud_toggle_extra(this);' style='color: #0000EF; font-weight:bold;'>show {$rem} more tags</span>]";
|
$html .= "</div><br>[<span onclick='tageditcloud_toggle_extra(this);' style='color: #0000EF; font-weight:bold;'>show {$rem} more tags</span>]";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<div id='tageditcloud' class='tageditcloud'>{$html}</div>"; // FIXME: stupidasallhell
|
return rawHTML("<div id='tageditcloud' class='tageditcloud'>{$html}</div>"); // FIXME: stupidasallhell
|
||||||
}
|
}
|
||||||
|
|
||||||
private function can_tag(Image $image): bool
|
private function can_tag(Image $image): bool
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
|
use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
class ImageInfoBoxBuildingEvent extends Event
|
class ImageInfoBoxBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
public array $parts = [];
|
public array $parts = [];
|
||||||
@@ -17,7 +19,7 @@ class ImageInfoBoxBuildingEvent extends Event
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_part(string $html, int $position=50)
|
public function add_part(HTMLElement $html, int $position=50)
|
||||||
{
|
{
|
||||||
while (isset($this->parts[$position])) {
|
while (isset($this->parts[$position])) {
|
||||||
$position++;
|
$position++;
|
||||||
|
@@ -123,11 +123,7 @@ class ViewImage extends Extension
|
|||||||
global $config;
|
global $config;
|
||||||
$image_info = $config->get_string(ImageConfig::INFO);
|
$image_info = $config->get_string(ImageConfig::INFO);
|
||||||
if ($image_info) {
|
if ($image_info) {
|
||||||
$html = (string)TR(
|
$event->add_part(SHM_POST_INFO("Info", false, $event->image->get_info()), 85);
|
||||||
TH("Info"),
|
|
||||||
TD($event->image->get_info())
|
|
||||||
);
|
|
||||||
$event->add_part($html, 85);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user