This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/themes/rule34v2/view.theme.php
2023-12-15 17:20:46 +00:00

44 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Shimmie2;
use MicroHTML\HTMLElement;
use function MicroHTML\{TR, TH, TD, emptyHTML, rawHTML, joinHTML, DIV, INPUT, A};
class CustomViewImageTheme extends ViewImageTheme
{
protected function build_info(Image $image, $editor_parts): string
{
global $user;
if (count($editor_parts) == 0) {
return ($image->is_locked() ? "<br>[Post Locked]" : "");
}
$html = make_form(make_link("post/set"))."
<input type='hidden' name='image_id' value='{$image->id}'>
<table style='width: 500px; max-width: 100%;' class='image_info form'>
";
foreach ($editor_parts as $part) {
$html .= $part;
}
if (
(!$image->is_locked() || $user->can(Permissions::EDIT_IMAGE_LOCK)) &&
$user->can(Permissions::EDIT_IMAGE_TAG)
) {
$html .= "
<tr><td colspan='4'>
<input class='edit' type='submit' value='Set'>
</td></tr>
";
}
$html .= "
</table>
</form>
";
return $html;
}
}