2008-05-16 19:39:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Layout {
|
2009-05-11 14:04:33 +00:00
|
|
|
function display_page($page) {
|
|
|
|
global $config;
|
2009-01-20 11:17:49 +00:00
|
|
|
|
2008-05-16 19:39:29 +00:00
|
|
|
$theme_name = $config->get_string('theme', 'default');
|
|
|
|
$data_href = get_base_href();
|
|
|
|
$contact_link = $config->get_string('contact_link');
|
|
|
|
|
|
|
|
$header_html = "";
|
2011-08-28 04:31:30 +00:00
|
|
|
ksort($page->html_headers);
|
|
|
|
foreach($page->html_headers as $line) {
|
2008-05-16 19:39:29 +00:00
|
|
|
$header_html .= "\t\t$line\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$left_block_html = "";
|
|
|
|
$main_block_html = "";
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html = "";
|
2008-05-16 19:39:29 +00:00
|
|
|
|
|
|
|
foreach($page->blocks as $block) {
|
|
|
|
switch($block->section) {
|
|
|
|
case "left":
|
2012-03-12 04:39:04 +00:00
|
|
|
$left_block_html .= $block->get_html(true);
|
2008-05-16 19:39:29 +00:00
|
|
|
break;
|
|
|
|
case "main":
|
2012-03-12 04:39:04 +00:00
|
|
|
$main_block_html .= $block->get_html(false);
|
2008-05-16 19:39:29 +00:00
|
|
|
break;
|
2010-01-03 09:56:07 +00:00
|
|
|
case "subheading":
|
|
|
|
$sub_block_html .= $block->body; // $this->block_to_html($block, true);
|
|
|
|
break;
|
2008-05-16 19:39:29 +00:00
|
|
|
default:
|
|
|
|
print "<p>error: {$block->header} using an unknown section ({$block->section})";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$debug = get_debug_info();
|
|
|
|
|
2011-12-28 14:47:02 +00:00
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
2008-05-16 19:39:29 +00:00
|
|
|
|
|
|
|
if(empty($page->subheading)) {
|
|
|
|
$subheading = "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$subheading = "<div id='subtitle'>{$page->subheading}</div>";
|
|
|
|
}
|
|
|
|
|
2008-05-16 21:54:21 +00:00
|
|
|
if($page->left_enabled) {
|
2012-03-11 16:18:37 +00:00
|
|
|
$left = "<nav>$left_block_html</nav>";
|
2008-05-16 21:54:21 +00:00
|
|
|
$withleft = "withleft";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$left = "";
|
|
|
|
$withleft = "";
|
|
|
|
}
|
|
|
|
|
2012-06-09 16:00:25 +00:00
|
|
|
$flash = get_prefixed_cookie("flash_message");
|
|
|
|
$flash_html = "";
|
|
|
|
if($flash) {
|
|
|
|
$flash_html = "<b id='flash'>".nl2br(html_escape($flash))." <a href='#' onclick=\"\$('#flash').hide(); return false;\">[X]</a></b>";
|
|
|
|
set_prefixed_cookie("flash_message", "", -1, "/");
|
|
|
|
}
|
|
|
|
|
2008-05-16 19:39:29 +00:00
|
|
|
print <<<EOD
|
2012-03-05 10:14:58 +00:00
|
|
|
<!doctype html>
|
|
|
|
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
|
|
|
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
|
|
|
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
|
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
2008-05-16 19:39:29 +00:00
|
|
|
<head>
|
|
|
|
<title>{$page->title}</title>
|
|
|
|
$header_html
|
|
|
|
<script src='$data_href/themes/$theme_name/script.js' type='text/javascript'></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2012-03-11 16:18:37 +00:00
|
|
|
<header>
|
|
|
|
<h1>{$page->heading}</h1>
|
|
|
|
$subheading
|
|
|
|
$sub_block_html
|
|
|
|
</header>
|
2008-05-16 21:54:21 +00:00
|
|
|
$left
|
2012-03-11 16:18:37 +00:00
|
|
|
<article class="$withleft">
|
2012-06-09 16:00:25 +00:00
|
|
|
$flash_html
|
2012-03-11 16:18:37 +00:00
|
|
|
$main_block_html
|
|
|
|
</article>
|
|
|
|
<footer>
|
2008-05-16 19:39:29 +00:00
|
|
|
<hr>
|
|
|
|
Images © their respective owners,
|
2010-01-03 09:41:31 +00:00
|
|
|
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
2012-02-06 05:34:06 +00:00
|
|
|
<a href="http://www.shishnet.org/">Shish</a> &
|
|
|
|
<a href="https://github.com/shish/shimmie2/contributors">The Team</a>
|
|
|
|
2007-2012,
|
2009-06-05 16:55:58 +00:00
|
|
|
based on the Danbooru concept.
|
2008-05-16 22:11:27 +00:00
|
|
|
<br>Futaba theme based on 4chan's layout and CSS :3
|
2008-05-16 19:39:29 +00:00
|
|
|
$debug
|
|
|
|
$contact
|
2012-03-11 16:18:37 +00:00
|
|
|
</footer>
|
2008-05-16 19:39:29 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|