* Link: http://seemslegit.com * License: GPLv2 * Description: A mashup of Default, Danbooru, the interface on qwebirc, and * some other sites, packaged in a light blue color. */ class Page extends BasePage { public bool $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(); $theme_name = $config->get_string(SetupConfig::THEME, 'lite'); $site_name = $config->get_string(SetupConfig::TITLE); $data_href = get_base_href(); $menu = ""; $left_block_html = ""; $main_block_html = ""; $sub_block_html = ""; $user_block_html = ""; foreach ($this->blocks as $block) { switch ($block->section) { case "left": $left_block_html .= $this->block_to_html($block, true); break; case "main": $main_block_html .= $this->block_to_html($block, false); break; case "user": $user_block_html .= $block->body; break; case "subheading": $sub_block_html .= $this->block_to_html($block, false); break; default: print "

error: {$block->header} using an unknown section ({$block->section})"; break; } } $custom_sublinks = ""; if (!empty($sub_links)) { $custom_sublinks = "

"; foreach ($sub_links as $nav_link) { $custom_sublinks .= $this->navlinks($nav_link->link, $nav_link->description, $nav_link->active); } $custom_sublinks .= "
"; } $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; if (!$this->left_enabled) { $left_block_html = ""; $main_block_html = "
{$main_block_html}
"; } else { $left_block_html = ""; $main_block_html = "
$flash_html{$main_block_html}
"; } $head_html = $this->head_html(); $footer_html = $this->footer_html(); print << $head_html
$menu $custom_sublinks $sub_block_html
$left_block_html $main_block_html EOD; } /* end of function display_page() */ public function block_to_html(Block $block, bool $hidable=false): string { $h = $block->header; $b = $block->body; $i = $block->id; $html = $b; if ($h != "Paginator") { $html = "
"; if (!is_null($h)) { $html .= ""; } if (!is_null($b)) { $html .= ""; } $html .= "
"; } return $html; } public function navlinks(Link $link, string $desc, bool $active): ?string { $html = null; if ($active) { $html = "{$desc}"; } else { $html = "{$desc}"; } return $html; } }