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 = "";
|
2009-06-04 20:40:24 +00:00
|
|
|
ksort($page->headers);
|
2008-05-16 19:39:29 +00:00
|
|
|
foreach($page->headers as $line) {
|
|
|
|
$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":
|
|
|
|
$left_block_html .= $this->block_to_html($block, true, "left");
|
|
|
|
break;
|
|
|
|
case "main":
|
|
|
|
$main_block_html .= $this->block_to_html($block, false, "main");
|
|
|
|
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();
|
|
|
|
|
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
|
|
|
|
|
|
|
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) {
|
|
|
|
$left = "<div id='nav'>$left_block_html</div>";
|
|
|
|
$withleft = "withleft";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$left = "";
|
|
|
|
$withleft = "";
|
|
|
|
}
|
|
|
|
|
2008-05-16 19:39:29 +00:00
|
|
|
print <<<EOD
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>{$page->title}</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
|
|
|
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
|
|
|
$header_html
|
|
|
|
<script src='$data_href/themes/$theme_name/sidebar.js' type='text/javascript'></script>
|
|
|
|
<script src='$data_href/themes/$theme_name/script.js' type='text/javascript'></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<h1>{$page->heading}</h1>
|
|
|
|
$subheading
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html
|
2008-05-16 19:39:29 +00:00
|
|
|
|
2008-05-16 21:54:21 +00:00
|
|
|
$left
|
|
|
|
<div id="body" class="$withleft">$main_block_html</div>
|
2008-05-16 19:39:29 +00:00
|
|
|
|
|
|
|
<div id="footer">
|
|
|
|
<hr>
|
|
|
|
Images © their respective owners,
|
2010-01-03 09:41:31 +00:00
|
|
|
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
2010-01-11 15:10:07 +00:00
|
|
|
<a href="http://www.shishnet.org/">Shish</a> & Co 2007-2010,
|
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
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
function block_to_html($block, $hidable=false, $salt="") {
|
|
|
|
$h = $block->header;
|
|
|
|
$b = $block->body;
|
|
|
|
$html = "";
|
|
|
|
$i = str_replace(' ', '_', $h) . $salt;
|
|
|
|
if($hidable) {
|
|
|
|
$toggle = " onclick=\"toggle('$i')\"";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$toggle = "";
|
|
|
|
}
|
|
|
|
if(!is_null($h)) $html .= "\n<h3 id='$i-toggle'$toggle>$h</h3>\n";
|
|
|
|
if(!is_null($b)) $html .= "<div id='$i'>$b</div>\n";
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|