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/page.class.php

166 lines
5.1 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
2020-02-01 18:22:08 +00:00
class Page extends BasePage
{
public function render()
2020-02-01 18:22:08 +00:00
{
2020-10-25 10:48:40 +00:00
global $config, $user;
2020-02-01 18:22:08 +00:00
$theme_name = $config->get_string('theme', 'default');
$data_href = get_base_href();
$header_html = $this->get_all_html_headers();
$left_block_html = "";
$right_block_html = "";
$main_block_html = "";
$head_block_html = "";
$sub_block_html = "";
2023-01-30 21:23:50 +00:00
$main_headings = 0;
foreach ($this->blocks as $block) {
2023-01-30 23:31:41 +00:00
if ($block->section == "main" && !empty($block->header) && $block->header != "Comments") {
2023-01-30 21:23:50 +00:00
$main_headings++;
}
}
2020-02-01 18:22:08 +00:00
foreach ($this->blocks as $block) {
switch ($block->section) {
case "left":
$left_block_html .= $block->get_html(true);
break;
case "right":
$right_block_html .= $block->get_html(true);
break;
case "head":
$head_block_html .= "<td class='headcol'>".$block->get_html(false)."</td>";
break;
case "main":
2023-01-30 21:23:50 +00:00
if ($main_headings == 1) {
$block->header = null;
}
2020-02-01 18:22:08 +00:00
$main_block_html .= $block->get_html(false);
break;
case "subheading":
$sub_block_html .= $block->body; // $block->get_html(true);
break;
default:
print "<p>error: {$block->header} using an unknown section ({$block->section})";
break;
}
}
2023-12-16 01:25:56 +00:00
$query = !empty(CustomIndexTheme::$_search_query) ? html_escape(Tag::implode(CustomIndexTheme::$_search_query)) : "";
2020-03-13 09:23:54 +00:00
assert(!is_null($query)); # used in header.inc, do not remove :P
2020-02-01 18:22:08 +00:00
$flash_html = $this->flash ? "<b id='flash'>".nl2br(html_escape(implode("\n", $this->flash)))."</b>" : "";
$generated = autodate(date('c'));
2020-02-01 18:36:30 +00:00
$footer_html = $this->footer_html();
2020-02-01 18:44:54 +00:00
2020-02-01 18:22:08 +00:00
print <<<EOD
2020-02-01 18:36:30 +00:00
<!DOCTYPE html>
2020-03-13 09:23:54 +00:00
<html lang="en">
2020-02-01 18:36:30 +00:00
<head>
<title>{$this->title}</title>
<meta name="description" content="Rule 34, if it exists there is porn of it."/>
<meta name="viewport" content="width=1024">
2020-02-24 22:46:51 +00:00
<meta name="theme-color" content="#7EB977">
2020-07-07 09:41:06 +00:00
<link rel="stylesheet" href="$data_href/themes/$theme_name/menuh.css?_=1" type="text/css">
2020-02-01 18:22:08 +00:00
$header_html
<script defer src="https://unpkg.com/webp-hero@0.0.0-dev.21/dist-cjs/polyfills.js"></script>
<script defer src="https://unpkg.com/webp-hero@0.0.0-dev.21/dist-cjs/webp-hero.bundle.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
var webpMachine = new webpHero.WebpMachine()
webpMachine.polyfillDocument()
});
</script>
2020-10-25 10:48:40 +00:00
<script src="/themes/rule34v2/prebid-ads.js"></script>
<script>
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function stat(ob) {
ob._ = makeid(10);
var xhr = new XMLHttpRequest();
xhr.open("GET", "/stat.txt?" + new URLSearchParams(ob).toString(), true);
xhr.send();
}
2021-08-30 19:25:11 +00:00
function logTimes() {
2020-10-25 10:48:40 +00:00
var t = window.performance.timing;
stat({
"v": 1,
"class": "{$user->class->name}",
"block": window.canRunAds === undefined,
"proto": window.location.protocol,
"responseStart": t.responseStart - t.fetchStart,
"responseEnd": t.responseEnd - t.fetchStart,
"domLoading": t.domLoading - t.fetchStart,
"domInteractive": t.domInteractive - t.fetchStart,
"domComplete": t.domComplete - t.fetchStart,
})
2021-08-30 19:25:11 +00:00
}
// setTimeout(logTimes, 3000);
2020-10-25 10:48:40 +00:00
</script>
2020-02-01 18:22:08 +00:00
</head>
<body>
<table id="header" width="100%">
<tr>
<td>
EOD;
include "themes/rule34v2/header.inc";
print <<<EOD
2020-02-01 18:36:30 +00:00
</td>
$head_block_html
</tr>
</table>
$sub_block_html
<nav>
$left_block_html
<p>
<a href="//whos.amung.us/show/4vcsbthd"><img src="//whos.amung.us/widget/4vcsbthd.png" style="display:none" alt="web counter" /></a>
</p>
</nav>
<article>
$flash_html
2023-01-11 18:37:02 +00:00
<!-- <h2>Server hardware upgrades will be happening today, expect some downtime while reboots happen~</h2> -->
2020-02-01 18:36:30 +00:00
$main_block_html
</article>
<footer>
2020-03-21 22:17:13 +00:00
<span style="font-size: 12px;">
2020-03-13 09:23:54 +00:00
<a href="http://rule34.paheal.net/wiki/Terms%20of%20use">Terms of use</a>
!!!
<a href="http://rule34.paheal.net/wiki/Privacy%20policy">Privacy policy</a>
!!!
<a href="http://rule34.paheal.net/wiki/2257">18 U.S.C. &sect;2257</a><br />
</span>
2020-02-01 18:36:30 +00:00
<hr />
<br>
Thank you!
2020-02-01 18:44:54 +00:00
Page generated $generated.
2020-02-01 18:36:30 +00:00
$footer_html
2020-02-01 18:22:08 +00:00
</footer>
2020-02-01 18:36:30 +00:00
2020-02-01 18:22:08 +00:00
<!-- BEGIN EroAdvertising ADSPACE CODE -->
<!--<script type="text/javascript" language="javascript" charset="utf-8" src="https://adspaces.ero-advertising.com/adspace/158168.js"></script>-->
<!-- END EroAdvertising ADSPACE CODE -->
</body>
</html>
EOD;
}
}