add okebooru theme #1

Merged
butterbutt merged 1 commits from okebooru_theme into master 2020-10-13 08:33:50 -05:00
14 changed files with 1332 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<?php declare(strict_types=1);
class CustomAdminPageTheme extends AdminPageTheme
{
public function display_page()
{
global $page;
$page->disable_left();
parent::display_page();
}
}

BIN
themes/okebooru/clip.woff2 Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
<?php declare(strict_types=1);
class CustomCommentListTheme extends CommentListTheme
{
public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post)
{
global $config, $page, $user;
$page->disable_left();
// parts for the whole page
$prev = $page_number - 1;
$next = $page_number + 1;
$h_prev = ($page_number <= 1) ? "Prev" :
"<a href='".make_link("comment/list/$prev")."'>Prev</a>";
$h_index = "<a href='".make_link()."'>Index</a>";
$h_next = ($page_number >= $total_pages) ? "Next" :
"<a href='".make_link("comment/list/$next")."'>Next</a>";
$nav = "$h_prev | $h_index | $h_next";
$page->set_title("Comments");
$page->set_heading("Comments");
$page->add_block(new Block("Navigation", $nav, "left"));
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages);
// parts for each image
$position = 10;
$comment_captcha = $config->get_bool('comment_captcha');
$comment_limit = $config->get_int("comment_list_count", 10);
foreach ($images as $pair) {
$image = $pair[0];
$comments = $pair[1];
$thumb_html = $this->build_thumb_html($image);
$s = "&nbsp;&nbsp;&nbsp;";
$un = $image->get_owner()->name;
$t = "";
foreach ($image->get_tag_array() as $tag) {
$u_tag = url_escape($tag);
$t .= "<a href='".make_link("post/list/$u_tag/1")."'>".html_escape($tag)."</a> ";
}
$p = autodate($image->posted);
$r = Extension::is_enabled(RatingsInfo::KEY) ? "<b>Rating</b> ".Ratings::rating_to_human($image->rating) : "";
$comment_html = "<b>Date</b> $p $s <b>User</b> $un $s $r<br><b>Tags</b> $t<p>&nbsp;";
$comment_count = count($comments);
if ($comment_limit > 0 && $comment_count > $comment_limit) {
//$hidden = $comment_count - $comment_limit;
$comment_html .= "<p>showing $comment_limit of $comment_count comments</p>";
$comments = array_slice($comments, -$comment_limit);
}
foreach ($comments as $comment) {
$comment_html .= $this->comment_to_html($comment);
}
if ($can_post) {
if (!$user->is_anonymous()) {
$comment_html .= $this->build_postbox($image->id);
} else {
if (!$comment_captcha) {
$comment_html .= $this->build_postbox($image->id);
} else {
$comment_html .= "<a href='".make_link("post/view/".$image->id)."'>Add Comment</a>";
}
}
}
$html = "
<table><tr>
<td style='width: 220px;'>$thumb_html</td>
<td style='text-align: left;'>$comment_html</td>
</tr></table>
";
$page->add_block(new Block("&nbsp;", $html, "main", $position++));
}
}
public function display_recent_comments(array $comments)
{
// no recent comments in this theme
}
protected function comment_to_html(Comment $comment, bool $trim=false): string
{
global $user;
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
//$i_uid = $comment->owner_id;
$h_name = html_escape($comment->owner_name);
//$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = $comment->comment_id;
$i_image_id = $comment->image_id;
$h_posted = autodate($comment->posted);
$h_userlink = "<a class='username' href='".make_link("user/$h_name")."'>$h_name</a>";
$h_del = "";
if ($user->can(Permissions::DELETE_COMMENT)) {
$comment_preview = substr(html_unescape($tfe->stripped), 0, 50);
$j_delete_confirm_message = json_encode("Delete comment by {$comment->owner_name}:\n$comment_preview");
$h_delete_script = html_escape("return confirm($j_delete_confirm_message);");
$h_delete_link = make_link("comment/delete/$i_comment_id/$i_image_id");
$h_del = " - <a onclick='$h_delete_script' href='$h_delete_link'>Del</a>";
}
//$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>&gt;&gt;&gt;</a>\n" : "";
if ($trim) {
return "<p class='comment'>$h_userlink $h_del<br/>$h_posted<br/>$h_comment</p>";
} else {
return "
<table class='comment'><tr>
<td class='meta'>$h_userlink<br/>$h_posted$h_del</td>
<td>$h_comment</td>
</tr></table>
";
}
}
}

View File

@ -0,0 +1,16 @@
<?php declare(strict_types=1);
class CustomExtManagerTheme extends ExtManagerTheme
{
public function display_table(Page $page, array $extensions, bool $editable)
{
$page->disable_left();
parent::display_table($page, $extensions, $editable);
}
public function display_doc(Page $page, ExtensionInfo $info)
{
$page->disable_left();
parent::display_doc($page, $info);
}
}

BIN
themes/okebooru/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -0,0 +1,53 @@
<?php declare(strict_types=1);
class CustomIndexTheme extends IndexTheme
{
/**
* #param Image[] $images
*/
public function display_page(Page $page, array $images)
{
$this->display_shortwiki($page);
$this->display_page_header($page, $images);
$nav = $this->build_navigation($this->page_number, $this->total_pages, $this->search_terms);
$page->add_block(new Block("Search", $nav, "left", 0));
if (count($images) > 0) {
$this->display_page_images($page, $images);
} else {
$this->display_error(404, "No Images Found", "No images were found to match the search criteria");
}
}
/**
* #param string[] $search_terms
*/
protected function build_navigation(int $page_number, int $total_pages, array $search_terms): string
{
$h_search_string = count($search_terms) == 0 ? "" : html_escape(implode(" ", $search_terms));
$h_search_link = make_link();
return "
<p><form action='$h_search_link' method='GET'>
<input name='search' type='text' value='$h_search_string' class='autocomplete_tags' placeholder='' style='width:75%'/>
<input type='submit' value='Go' style='width:20%'>
<input type='hidden' name='q' value='/post/list'>
</form>
<div id='search_completions'></div>";
}
/**
* #param Image[] $images
*/
protected function build_table(array $images, ?string $query): string
{
$h_query = html_escape($query);
$table = "<div class='shm-image-list' data-query='$h_query'>";
foreach ($images as $image) {
$table .= "\t<span class=\"thumb\">" . $this->build_thumb_html($image) . "</span>\n";
}
$table .= "</div>";
return $table;
}
}

View File

@ -0,0 +1,166 @@
<?php declare(strict_types=1);
/**
* Name: Okebooru Theme
* Author: Bzchan <bzchan@animemahou.com>, updated by Daniel Oaks <daniel@danieloaks.net>, modified for Okebooru by butterbutt <butterbutt@thisisjoes.site>
* Link: https://code.shishnet.org/shimmie2/
* License: GPLv2
* Description: This is the Danbooru 2 theme with some fun modifications
* specifically for Okebooru <https://booru.oke.moe>.
*/
//Small changes added by zshall <http://seemslegit.com>
//Changed CSS and layout to make shimmie look even more like danbooru
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Danbooru 2 Theme - Notes (Bzchan)
Files: default.php, style.css
How to use a theme
- Copy the danbooru2 folder with all its contained files into the "themes"
directory in your shimmie installation.
- Log into your shimmie and change the Theme in the Board Config to your
desired theme.
Changes in this theme include
- Adding and editing various elements in the style.css file.
- $site_name and $front_name retreival from config added.
- $custom_link and $title_link preparation just before html is outputed.
- Altered outputed html to include the custom links and removed heading
from being displayed (subheading is still displayed)
- Note that only the sidebar has been left aligned. Could not properly
left align the main block because blocks without headers currently do
not have ids on there div elements. (this was a problem because
paginator block must be centered and everything else left aligned)
Tips
- You can change custom links to point to whatever pages you want as well as adding
more custom links.
- The main title link points to the Front Page set in your Board Config options.
- The text of the main title is the Title set in your Board Config options.
- Themes make no changes to your database or main code files so you can switch
back and forward to other themes all you like.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
class Page extends BasePage
{
public $left_enabled = true;
public function disable_left()
{
$this->left_enabled = false;
}
public function render()
{
global $config;
list($nav_links, $sub_links) = $this->get_nav_links();
$left_block_html = "";
$user_block_html = "";
$main_block_html = "";
$sub_block_html = "";
foreach ($this->blocks as $block) {
switch ($block->section) {
case "left":
$left_block_html .= $block->get_html(true);
break;
case "user":
$user_block_html .= $block->body; // $this->block_to_html($block, true);
break;
case "subheading":
$sub_block_html .= $block->body; // $this->block_to_html($block, true);
break;
case "main":
if ($block->header == "Images") {
$block->header = "&nbsp;";
}
$main_block_html .= $block->get_html(false);
break;
default:
print "<p>error: {$block->header} using an unknown section ({$block->section})";
break;
}
}
if (empty($this->subheading)) {
$subheading = "";
} else {
$subheading = "<div id='subtitle'>{$this->subheading}</div>";
}
$site_name = $config->get_string(SetupConfig::TITLE); // bzchan: change from normal default to get title for top of page
$main_page = $config->get_string(SetupConfig::MAIN_PAGE); // bzchan: change from normal default to get main page for top of page
$custom_links = "";
foreach ($nav_links as $nav_link) {
$custom_links .= "<li>".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."</li>";
}
$custom_sublinks = "";
if (!empty($sub_links)) {
$custom_sublinks = "<div class='sbar'>";
foreach ($sub_links as $nav_link) {
$custom_sublinks .= "<li>".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."</li>";
}
$custom_sublinks .= "</div>";
}
// bzchan: failed attempt to add heading after title_link (failure was it looked bad)
//if($this->heading==$site_name)$this->heading = '';
//$title_link = "<h1><a href='".make_link($main_page)."'>$site_name</a>/$this->heading</h1>";
// bzchan: prepare main title link
$title_link = "<h1 id='site-title'><a href='".make_link()."'><span id='left' class='small'><span class='fast-flicker small'>O</span>KE</span><span id='right' class='small'>BOO<span class='flicker small'>RU</span></span></a></h1>";
if ($this->left_enabled) {
$left = "<nav>$left_block_html</nav>";
$withleft = "withleft";
} else {
$left = "";
$withleft = "noleft";
}
$flash_html = $this->flash ? "<b id='flash'>".nl2br(html_escape(implode("\n", $this->flash)))."</b>" : "";
$head_html = $this->head_html();
$footer_html = $this->footer_html();
print <<<EOD
<!doctype html>
<html class="no-js" lang="en">
$head_html
<body>
<header>
$title_link
<ul id="navbar" class="flat-list">
$custom_links
</ul>
<ul id="subnavbar" class="flat-list">
$custom_sublinks
</ul>
</header>
$subheading
$sub_block_html
$left
<article class="$withleft">
$flash_html
$main_block_html
</article>
<footer><div>$footer_html</div></footer>
</body>
</html>
EOD;
}
public function navlinks(Link $link, string $desc, bool $active): ?string
{
$html = null;
if ($active) {
$html = "<a class='current-page' href='{$link->make_link()}'>{$desc}</a>";
} else {
$html = "<a class='tab' href='{$link->make_link()}'>{$desc}</a>";
}
return $html;
}
}

View File

@ -0,0 +1,27 @@
User-agent: *
Allow: /
Disallow: /artist
Disallow: /artist_commentaries
Disallow: /comment
Disallow: /explore
Disallow: /forum
Disallow: /inline
Disallow: /forum_topics
Disallow: /note
Disallow: /pool
Disallow: /post
Disallow: /session
Disallow: /static
Disallow: /tag
Disallow: /tag_alias
Disallow: /tag_implication
Disallow: /uploads
Disallow: /user_upgrades
Disallow: /user
Disallow: /wiki
Disallow: /report
Disallow: /job_task
Disallow: /help
Disallow: /admin
Disallow: /dmail
Disallow: /batch

648
themes/okebooru/style.css Normal file
View File

@ -0,0 +1,648 @@
span#left, span#right, span.flicker, span.fast-flicker {
font-family: clip, "Arial", sans-serif;
font-size: clamp(4rem, 1.428rem + 14.285vw, 6rem);
}
span.small {
font-size: 2.5rem !important;
}
span#left {
color: #ffe6ff;
text-shadow: 0 0 0.6rem #ffe6ff, 0 0 1.5rem #ff65bd,
-0.2rem 0.1rem 1rem #ff65bd, 0.2rem 0.1rem 1rem #ff65bd,
0 -0.5rem 2rem #ff2483, 0 0.5rem 3rem #ff2483;
animation: shine-one 2s forwards, flicker 3s infinite;
}
span#right {
color: #b2f3f2;
text-shadow: 0 0 0.6rem #b2f3f2, 0 0 1.5rem #75f1f1,
-0.2rem 0.1rem 1rem #75f1f1, 0.2rem 0.1rem 1rem #75f1f1,
0 -0.5rem 2rem #1cf3f1, 0 0.5rem 3rem #1cf3f1;
animation: shine-two 2s forwards, flicker 6s infinite;
}
h1 a:hover {
text-decoration: none;
}
h1#site-title span {
padding: 1em 0 0 0;
text-align: left;
margin: 0;
color: #ffffff;
text-shadow: 0 0 0.6rem #ffffff, 0 0 1.5rem #ffffff,
-0.2rem 0.1rem 1rem #ffffff, 0.2rem 0.1rem 1rem #ffffff,
0 -0.5rem 2rem #e6e6e6, 0 0.5rem 3rem #e6e6e6;
}
h1#site-title span a {
color: #e1c6ff;
text-shadow: 0 0 0.6rem #bf86ff, 0 0 1.5rem #bf86ff,
-0.2rem 0.1rem 1rem #bf86ff, 0.2rem 0.1rem 1rem #8737e2,
0 -0.5rem 2rem #8737e2, 0 0.5rem 3rem #8737e2;
}
h1#site-title span a:active {
color: #faf5ff;
text-decoration: none;
}
.flicker {
animation: shine-two 2s forwards, blink-two 10s 1s infinite;
}
.fast-flicker {
animation: shine-one 2s forwards, blink-one 3s 2s infinite;
}
@keyframes shine-one {
0% {
color: #6b1839;
text-shadow: none;
}
100% {
color: #ffe6ff;
text-shadow: 0 0 0.6rem #ffe6ff, 0 0 1.5rem #ff65bd,
-0.2rem 0.1rem 1rem #ff65bd, 0.2rem 0.1rem 1rem #ff65bd,
0 -0.5rem 2rem #ff2483, 0 0.5rem 3rem #ff2483;
}
}
@keyframes shine-two {
0% {
color: #178685;
text-shadow: none;
}
100% {
color: #b2f3f2;
text-shadow: 0 0 0.6rem #b2f3f2, 0 0 1.5rem #75f1f1,
-0.2rem 0.1rem 1rem #75f1f1, 0.2rem 0.1rem 1rem #75f1f1,
0 -0.5rem 2rem #1cf3f1, 0 0.5rem 3rem #1cf3f1;
}
}
@keyframes blink-one {
0%,
22%,
36%,
75% {
color: #ffe6ff;
text-shadow: 0 0 0.6rem #ffe6ff, 0 0 1.5rem #ff65bd,
-0.2rem 0.1rem 1rem #ff65bd, 0.2rem 0.1rem 1rem #ff65bd,
0 -0.5rem 2rem #ff2483, 0 0.5rem 3rem #ff2483;
}
28%,
33% {
color: #ff65bd;
text-shadow: none;
}
82%,
97% {
color: #ff2483;
text-shadow: none;
}
}
@keyframes blink-two {
0%,
22%,
36%,
75% {
color: #ddfefd;
text-shadow: 0 0 0.6rem #b2f3f2, 0 0 1.5rem #75f1f1,
-0.2rem 0.1rem 1rem #75f1f1, 0.2rem 0.1rem 1rem #75f1f1,
0 -0.5rem 2rem #1cf3f1, 0 0.5rem 3rem #1cf3f1;
}
28%,
33% {
color: #75f1f1;
text-shadow: 0 0 0.6rem #b2f3f2, 0 0 1.5rem #75f1f1;
}
82%,
97% {
color: #178685;
text-shadow: none;
}
}
@keyframes flicker {
from {
opacity: 1;
}
4% {
opacity: 0.9;
}
6% {
opacity: 0.85;
}
8% {
opacity: 0.95;
}
10% {
opacity: 0.9;
}
11% {
opacity: 0.922;
}
12% {
opacity: 0.9;
}
14% {
opacity: 0.95;
}
16% {
opacity: 0.98;
}
17% {
opacity: 0.9;
}
19% {
opacity: 0.93;
}
20% {
opacity: 0.99;
}
24% {
opacity: 1;
}
26% {
opacity: 0.94;
}
28% {
opacity: 0.98;
}
37% {
opacity: 0.93;
}
38% {
opacity: 0.5;
}
39% {
opacity: 0.96;
}
42% {
opacity: 1;
}
44% {
opacity: 0.97;
}
46% {
opacity: 0.94;
}
56% {
opacity: 0.9;
}
58% {
opacity: 0.9;
}
60% {
opacity: 0.99;
}
68% {
opacity: 1;
}
70% {
opacity: 0.9;
}
72% {
opacity: 0.95;
}
93% {
opacity: 0.93;
}
95% {
opacity: 0.95;
}
97% {
opacity: 0.93;
}
to {
opacity: 1;
}
}
/*TODO: text input background colors*/
/*.autocomplete_tags {
background-color: #fff8dc;
}*/
ul.ui-autocomplete {
background: #383838;
border: solid 2px #ff6499;
border-radius: 4px;
}
ul.ui-autocomplete, ul.ui-autocomplete > li {
max-width: 60ch;
line-height: 1.5;
padding-left: 5px;
}
ul.ui-autocomplete > li:nth-child(odd) {
background: #000000;
}
ul.ui-autocomplete > li:nth-child(even) {
background: #383838;
}
.noleft{
padding-left:2rem;
}
HEADER {
margin-bottom:0.9rem;
}
HEADER #site-title {
padding:0.6rem 2rem 0.25rem;
}
HEADER ul#navbar, HEADER ul#subnavbar {
font-family:Verdana,Helvetica,sans-serif;
font-size:110%;
}
HEADER ul#navbar {
margin:0;
padding:0 1rem 0 2rem;
}
HEADER ul#navbar li {
margin:0;
}
HEADER ul#navbar li a {
display:inline-block;
margin:0 0.15rem;
padding:0.4rem 0.6rem;
}
HEADER ul#navbar li:first-child a {
margin-left: -0.6rem;
color: #FF3333;
font-weight: bold;
}
HEADER ul#navbar li a.current-page {
background-color:#383838;
border-radius:0.2rem 0.2rem 0 0;
font-weight:bold;
}
HEADER ul#subnavbar {
margin:0 0 0.5rem;
padding:0 1rem 0 2rem;
background-color:#383838;
}
HEADER ul#subnavbar li {
display:inline-block;
margin:0 0.15rem;
padding:0.4rem 0.6rem;
}
HEADER ul#subnavbar li:first-child {
margin-left: -0.6rem;
}
body {
background-color:#000000;
color:#FFFFFF;
font-weight:normal;
font-style:normal;
font-variant:normal;
font-size-adjust:none;
font-stretch:normal;
font-size:80%;
line-height:normal;
-x-system-font:none;
}
h1 {
margin-top:0;
margin-bottom:0;
padding:0.3rem;
font-size:2.2rem;
}
h1 a {
color:black;
}
h3 {
margin-top:0;
margin-bottom:0;
padding:0.2rem 0.2rem 0.2rem 0;
font-size:1rem;
}
h4 {
font-size:1.4rem;
}
h5 {
font-size:1.2rem;
}
table.zebra {border-spacing: 0;border-collapse: collapse;}
table.zebra > tbody > tr:hover {background: #383838;}
table.zebra th { padding-right: 0.4rem;color: #171BB3;}
table.zebra td {margin: 0;padding-right: 0.6rem;border: 1px dotted #EEE;}
table.zebra th {margin: 0;text-align: left;}
thead {
font-weight:bold;
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
}
td {
vertical-align:top;
}
#subtitle {
margin:auto;
width:256px;
border-top:medium none;
text-align:center;
font-size:0.75em;
}
#short-wiki-description {
padding:0 2em;
font-size:1.2em;
}
#short-wiki-description h2 {
padding-bottom:0.2em;
}
FOOTER {
clear:both;
border-top:solid 1px #E7E7F7;
margin-top:1rem;
text-align:center;
color:#555555;
font-size:0.8rem;
}
FOOTER > DIV {
margin: 1rem 2rem;
}
form {
margin:0;
}
a {
text-decoration:none;
}
a:hover {
text-decoration:underline;
}
NAV {
float:left;
padding:0 1rem 0.2rem 2rem;
width:11.5rem;
text-align:left;
}
NAV section + section {
margin-top:1rem;
}
NAV table {
width:15rem;
}
NAV td {
vertical-align:middle;
}
NAV input {
padding:0;
width:100%;
}
NAV select {
padding:0;
width:100%;
}
NAV h3 {
text-align:left;
}
#comments p {
overflow:hidden;
max-width:150px;
width:15rem;
text-align:left;
}
TABLE.tag_list {
width: auto;
border-collapse: collapse;
}
TABLE.tag_list>THEAD {
display: none;
}
TABLE.tag_list>TBODY>TR>TD {
display: inline;
padding: 0;
line-height: 1em;
}
TABLE.tag_list>TBODY>TR>TD:after {
content: " ";
}
.tag_count {
display:inline-block;
margin-left:0.4rem;
color:#AAAAAA;
}
.more {
content:"More â";
}
.comment {
margin-bottom:8px;
}
.comment .meta {
width: 15rem;
color: gray;
}
.comment TD {
text-align: left;
}
.withleft {
margin-left:14.5rem;
}
div#paginator {
display:block;
clear:both;
padding:2em 0 1em;
text-align:center;
font-weight:bold;
font-size:1em;
}
.paginator {
margin:16px;
text-align:center;
}
div#paginator b {
margin:3px;
padding:4px 8px;
}
div#paginator a {
margin:3px;
padding:4px 8px;
border:1px solid #EEEEEE;
}
div#paginator a:hover {
border:1px solid #EEEEEE;
background:blue none repeat scroll 0 0;
color:white;
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
}
span.thumb {
display:inline-block;
float:left;
width:220px;
height:220px;
text-align:center;
}
#pagelist {
margin-top:32px;
}
#large_upload_form {
width:600px;
}
.setupblock, .tagcategoryblock {
margin:0.6rem 1rem 0.6rem 0;
padding:0.5rem 0.6rem 0.7rem;
width:18rem;
border:1px solid #AAAAAA;
border-radius:0.25rem;
display:inline-block;
}
.tagcategoryblock table {
width:100%;
border-spacing:0;
}
.tagcategoryblock input, .tagcategoryblock span {
width:100%;
height:100%;
}
.tagcategoryblock td:first-child {
padding:0.3rem 0.7rem 0.4rem 0;
text-align:right;
width:40%;
}
.tagcategoryblock td:last-child {
width:60%;
}
.tagcategoryblock td:last-child span {
padding:0.24rem 0.7rem 0.5rem 0;
display:block;
}
.tagcategoryblock button {
width:100%;
margin-top:0.4rem;
padding:0.2rem 0.6rem;
}
.helpable {
border-bottom:1px dashed gray;
}
.ok {
background:#AAFFAA none repeat scroll 0 0;
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
}
.bad {
background:#FFAAAA none repeat scroll 0 0;
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
}
.comment .username {
font-weight:bold;
font-size:1.5em;
}
HEADER {
text-align:left;
}
HEADER h1 {
text-align:left;
}
* {
margin:0;
padding:0;
font-family:Tahoma,Verdana,Helvetica,sans-serif;
}
a:link {
color:#5becff;
text-decoration:none;
}
a:visited {
color:#ff6499;
text-decoration:none;
}
a:hover {
color:#ff6499;
text-decoration:underline;
}
a:active {
color:#ff6499;
text-decoration:none;
}
ul.flat-list {
display:block;
margin:0;
padding:0;
}
ul.flat-list * {
display:inline;
text-align:left;
}
ul.flat-list li {
margin:0 1.3em 0 0;
list-style-type:none;
text-align:left;
font-weight:bold;
}
ul.flat-list li a {
font-weight:normal;
}
#tips {
margin-left:16px;
}
#blotter1 {
position: relative;
margin-right:16px;
margin-left:16px;
font-size: 90%;
}
#blotter2 {
margin-right:16px;
margin-left:16px;
font-size: 90%;
}
#flash {
background:#383838;
border:1px solid #e06d7f;
margin:1rem 0;
padding:1rem;
text-align:center;
border-radius:0.5rem;
}
ARTICLE {
margin-right:1rem;
}
ARTICLE section + section {
margin-top:1rem;
}
form + form {
margin-top:0.5rem;
}
#Imagemain h3 {
display:none;
}

View File

@ -0,0 +1,10 @@
<?php declare(strict_types=1);
class CustomTagListTheme extends TagListTheme
{
public function display_page(Page $page)
{
$page->disable_left();
parent::display_page($page);
}
}

View File

@ -0,0 +1,66 @@
<?php declare(strict_types=1);
class Themelet extends BaseThemelet
{
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
{
if ($total_pages == 0) {
$total_pages = 1;
}
$body = $this->build_paginator($page_number, $total_pages, $base, $query);
$page->add_block(new Block(null, $body, "main", 90));
}
private function gen_page_link(string $base_url, ?string $query, int $page, string $name): string
{
$link = make_link("$base_url/$page", $query);
return "<a href='$link'>$name</a>";
}
private function gen_page_link_block(string $base_url, ?string $query, int $page, int $current_page, string $name): string
{
$paginator = "";
if ($page == $current_page) {
$paginator .= "<b>$page</b>";
} else {
$paginator .= $this->gen_page_link($base_url, $query, $page, $name);
}
return $paginator;
}
private function build_paginator(int $current_page, int $total_pages, string $base_url, ?string $query): string
{
$next = $current_page + 1;
$prev = $current_page - 1;
$at_start = ($current_page <= 3 || $total_pages <= 3);
$at_end = ($current_page >= $total_pages -2);
$first_html = $at_start ? "" : $this->gen_page_link($base_url, $query, 1, "1");
$prev_html = $at_start ? "" : $this->gen_page_link($base_url, $query, $prev, "&lt;&lt;");
$next_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $next, "&gt;&gt;");
$last_html = $at_end ? "" : $this->gen_page_link($base_url, $query, $total_pages, "$total_pages");
$start = $current_page-2 > 1 ? $current_page-2 : 1;
$end = $current_page+2 <= $total_pages ? $current_page+2 : $total_pages;
$pages = [];
foreach (range($start, $end) as $i) {
$pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, (string)$i);
}
$pages_html = implode(" ", $pages);
if (strlen($first_html) > 0) {
$pdots = "...";
} else {
$pdots = "";
}
if (strlen($last_html) > 0) {
$ndots = "...";
} else {
$ndots = "";
}
return "<div id='paginator'>$prev_html $first_html $pdots $pages_html $ndots $last_html $next_html</div>";
}
}

View File

@ -0,0 +1,16 @@
<?php declare(strict_types=1);
class CustomUploadTheme extends UploadTheme
{
public function display_block(Page $page)
{
// this theme links to /upload
// $page->add_block(new Block("Upload", $this->build_upload_block(), "left", 20));
}
public function display_page(Page $page)
{
$page->disable_left();
parent::display_page($page);
}
}

View File

@ -0,0 +1,115 @@
<?php declare(strict_types=1);
class CustomUserPageTheme extends UserPageTheme
{
public function display_login_page(Page $page)
{
global $config;
$page->set_title("Login");
$page->set_heading("Login");
$page->disable_left();
$html = "
<form action='".make_link("user_admin/login")."' method='POST'>
<table summary='Login Form'>
<tr>
<td width='70'><label for='user'>Name</label></td>
<td width='70'><input id='user' type='text' name='user'></td>
</tr>
<tr>
<td><label for='pass'>Password</label></td>
<td><input id='pass' type='password' name='pass'></td>
</tr>
<tr><td colspan='2'><input type='submit' value='Log In'></td></tr>
</table>
</form>
";
if ($config->get_bool("login_signup_enabled")) {
$html .= "<small><a href='".make_link("user_admin/create")."'>Create Account</a></small>";
}
$page->add_block(new Block("Login", $html, "main", 90));
}
public function display_user_links(Page $page, User $user, $parts)
{
// no block in this theme
}
public function display_login_block(Page $page)
{
// no block in this theme
}
public function display_user_block(Page $page, User $user, $parts)
{
$html = "";
$blocked = ["Pools", "Pool Changes", "Alias Editor", "My Profile"];
foreach ($parts as $part) {
if (in_array($part["name"], $blocked)) {
continue;
}
$html .= "<li><a href='{$part["link"]}'>{$part["name"]}</a>";
}
$b = new Block("User Links", $html, "user", 90);
$b->is_content = false;
$page->add_block($b);
}
public function display_signup_page(Page $page)
{
global $config;
$tac = $config->get_string("login_tac", "");
$tfe = new TextFormattingEvent($tac);
send_event($tfe);
$tac = $tfe->formatted;
$reca = "<tr><td colspan='2'>".captcha_get_html()."</td></tr>";
if (empty($tac)) {
$html = "";
} else {
$html = "<p>$tac</p>";
}
$html .= "
<form action='".make_link("user_admin/create")."' method='POST'>
<table style='width: 300px;'>
<tr><td>Name</td><td><input type='text' name='name'></td></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
<tr><td>Email (Optional)</td><td><input type='text' name='email'></td></tr>
$reca;
<tr><td colspan='2'><input type='Submit' value='Create Account'></td></tr>
</table>
</form>
";
$page->set_title("Create Account");
$page->set_heading("Create Account");
$page->disable_left();
$page->add_block(new Block("Signup", $html));
}
public function display_ip_list(Page $page, array $uploads, array $comments, array $events)
{
$html = "<table id='ip-history' style='width: 400px;'>";
$html .= "<tr><td>Uploaded from: ";
foreach ($uploads as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$html .= "</td><td>Commented from:";
foreach ($comments as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$html .= "</td></tr>";
$html .= "<tr><td colspan='2'>(Most recent at top)</td></tr></table>";
$page->add_block(new Block("IPs", $html));
}
public function display_user_page(User $duser, $stats)
{
global $page;
$page->disable_left();
parent::display_user_page($duser, $stats);
}
}

View File

@ -0,0 +1,77 @@
<?php declare(strict_types=1);
class CustomViewImageTheme extends ViewImageTheme
{
public function display_page(Image $image, $editor_parts)
{
global $page;
$page->set_heading(html_escape($image->get_tag_list()));
$page->add_block(new Block("Search", $this->build_navigation($image), "left", 0));
$page->add_block(new Block("Information", $this->build_information($image), "left", 15));
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 15));
}
private function build_information(Image $image): string
{
$h_owner = html_escape($image->get_owner()->name);
$h_ownerlink = "<a href='".make_link("user/$h_owner")."'>$h_owner</a>";
$h_ip = html_escape($image->owner_ip);
$h_type = html_escape($image->get_mime());
$h_date = autodate($image->posted);
$h_filesize = to_shorthand_int($image->filesize);
global $user;
if ($user->can(Permissions::VIEW_IP)) {
$h_ownerlink .= " ($h_ip)";
}
$html = "
ID: {$image->id}
<br>Uploader: $h_ownerlink
<br>Date: $h_date
<br>Size: $h_filesize ({$image->width}x{$image->height})
<br>Type: $h_type
";
if ($image->length!=null) {
$h_length = format_milliseconds($image->length);
$html .= "<br/>Length: $h_length";
}
if (!is_null($image->source)) {
$h_source = html_escape($image->source);
if (substr($image->source, 0, 7) != "http://" && substr($image->source, 0, 8) != "https://") {
$h_source = "http://" . $h_source;
}
$html .= "<br>Source: <a href='$h_source'>link</a>";
}
if (Extension::is_enabled(RatingsInfo::KEY)) {
if ($image->rating == null || $image->rating == "?") {
$image->rating = "?";
}
if (Extension::is_enabled(RatingsInfo::KEY)) {
$h_rating = Ratings::rating_to_human($image->rating);
$html .= "<br>Rating: $h_rating";
}
}
return $html;
}
protected function build_navigation(Image $image): string
{
//$h_pin = $this->build_pin($image);
$h_search = "
<form action='".make_link()."' method='GET'>
<input name='search' type='text' style='width:75%'>
<input type='submit' value='Go' style='width:20%'>
<input type='hidden' name='q' value='/post/list'>
<input type='submit' value='Find' style='display: none;'>
</form>
";
return "$h_search";
}
}