function _get_page_request() { global $config; $args = _get_query_parts(); if (count($args) == 0 || strlen($args[0]) == 0) { $args = split('/', $config->get_string('front_page')); } return new PageRequestEvent($args); }
public function display_page($page) { global $config, $user; $theme_name = $config->get_string('theme'); $base_href = $config->get_string('base_href'); $data_href = get_base_href(); $contact_link = $config->get_string('contact_link'); $header_html = ""; ksort($page->headers); foreach ($page->headers as $line) { $header_html .= "\t\t{$line}\n"; } $left_block_html = ""; $user_block_html = ""; $main_block_html = ""; $sub_block_html = ""; foreach ($page->blocks as $block) { switch ($block->section) { case "left": $left_block_html .= $this->block_to_html($block, 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 = " "; } $main_block_html .= $this->block_to_html($block, false); break; 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($this->subheading)) { $subheading = ""; } else { $subheading = "<div id='subtitle'>{$this->subheading}</div>"; } $site_name = $config->get_string('title'); // bzchan: change from normal default to get title for top of page $main_page = $config->get_string('main_page'); // bzchan: change from normal default to get main page for top of page // bzchan: CUSTOM LINKS are prepared here, change these to whatever you like $custom_links = ""; if ($user->is_anonymous()) { $custom_links .= $this->navlinks(make_link('user_admin/login'), "My Account", array("user", "user_admin", "setup", "admin")); } else { $custom_links .= $this->navlinks(make_link('user'), "My Account", array("user", "user_admin", "setup", "admin")); } $custom_links .= $this->navlinks(make_link('post/list'), "Posts", array("post")); $custom_links .= $this->navlinks(make_link('comment/list'), "Comments", array("comment")); $custom_links .= $this->navlinks(make_link('tags'), "Tags", array("tags")); if (class_exists("Pools")) { $custom_links .= $this->navlinks(make_link('pool/list'), "Pools", array("pool")); } $custom_links .= $this->navlinks(make_link('upload'), "Upload", array("upload")); if (class_exists("Wiki")) { $custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki")); $custom_links .= $this->navlinks(make_link('wiki/more'), "More »", array("wiki/more")); } $custom_sublinks = ""; // hack global $user; $username = url_escape($user->name); // hack $qp = _get_query_parts(); $hw = class_exists("Wiki"); // php sucks switch ($qp[0]) { default: $custom_sublinks .= $user_block_html; break; case "": # FIXME: this assumes that the front page is # post/list; in 99% of case it will either be # post/list or home, and in the latter case # the subnav links aren't shown, but it would # be nice to be correct # FIXME: this assumes that the front page is # post/list; in 99% of case it will either be # post/list or home, and in the latter case # the subnav links aren't shown, but it would # be nice to be correct case "post": case "upload": $custom_sublinks .= "<li><a href='" . make_link('post/list') . "'>All</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("post/list/favorited_by={$username}/1") . "'>My Favorites</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("ext_doc/index") . "'>Help</a></li>"; break; case "comment": $custom_sublinks .= "<li><a href='" . make_link('comment/list') . "'>All</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("ext_doc/comment") . "'>Help</a></li>"; break; case "pool": $custom_sublinks .= "<li><a href='" . make_link('pool/list') . "'>List</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("pool/new") . "'>Create</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("pool/updated") . "'>Changes</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("ext_doc/pools") . "'>Help</a></li>"; break; case "wiki": $custom_sublinks .= "<li><a href='" . make_link('wiki') . "'>Index</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("wiki/rules") . "'>Rules</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("ext_doc/wiki") . "'>Help</a></li>"; break; case "tags": case "alias": $custom_sublinks .= "<li><a href='" . make_link('tags/map') . "'>Map</a></li>"; $custom_sublinks .= "<li><a href='" . make_link('tags/alphabetic') . "'>Alphabetic</a></li>"; $custom_sublinks .= "<li><a href='" . make_link('tags/popularity') . "'>Popularity</a></li>"; $custom_sublinks .= "<li><a href='" . make_link('tags/categories') . "'>Categories</a></li>"; $custom_sublinks .= "<li><a href='" . make_link('alias/list') . "'>Aliases</a></li>"; $custom_sublinks .= "<li><a href='" . make_link("ext_doc/tag_edit") . "'>Help</a></li>"; break; } // 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($main_page) . "'>{$site_name}</a></h1>"; if ($page->left_enabled) { $left = "<div id='nav'>{$left_block_html}</div>"; $withleft = "withleft"; } else { $left = ""; $withleft = "noleft"; } print <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> \t<head> \t\t<title>{$page->title}</title> \t\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> \t\t<link rel="stylesheet" href="{$data_href}/themes/{$theme_name}/style.css" type="text/css"> {$header_html} \t\t<script src='{$data_href}/themes/{$theme_name}/sidebar.js' type='text/javascript'></script> \t\t<script src='{$data_href}/themes/{$theme_name}/script.js' type='text/javascript'></script> \t</head> \t<body> \t\t<div id="header"> \t\t{$title_link} \t\t<ul id="navbar" class="flat-list"> \t\t\t{$custom_links} \t\t</ul> \t\t<ul id="subnavbar" class="flat-list"> \t\t\t{$custom_sublinks} \t\t</ul> \t\t</div> \t\t{$subheading} \t\t{$sub_block_html} \t\t \t\t{$left} \t\t<div id="body" class="{$withleft}">{$main_block_html}</div> \t\t<div id="footer"> <em> \t\t\tImages © their respective owners, \t\t\t<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> © \t\t\t<a href="http://www.shishnet.org/">Shish</a> & Co 2007-2010, \t\t\tbased on the Danbooru concept. \t\t\t{$debug} \t\t\t{$contact} </em> \t\t</div> \t</body> </html> EOD; }
/** * turns the Page into HTML */ public function display_page(Page $page) { global $config, $user; $theme_name = $config->get_string('theme', 'lite'); $site_name = $config->get_string('title'); $data_href = get_base_href(); $contact_link = $config->get_string('contact_link'); $header_html = ""; foreach ($page->headers as $line) { $header_html .= "\t\t{$line}\n"; } $menu = "<div class='menu'>\n\t\t\t<script type='text/javascript' src='{$data_href}/themes/{$theme_name}/wz_tooltip.js'></script>\n\t\t\t<a href='" . make_link() . "' onmouseover='Tip('Home', BGCOLOR, '#C3D2E0', FADEIN, 100)' onmouseout='UnTip()'><img src='{$data_href}/favicon.ico' style='position: relative; top: 3px;'></a>\n\t\t\t<b>{$site_name}</b> "; // Custom links: These appear on the menu. $custom_links = ""; if ($user->is_anonymous()) { $custom_links .= $this->navlinks(make_link('user_admin/login'), "Account", array("user", "user_admin", "setup", "admin", "profile")); } else { $custom_links .= $this->navlinks(make_link('user'), "Account", array("user", "setup", "user_admin", "admin", "profile")); } $custom_links .= $this->navlinks(make_link('post/list'), "Posts", array("post", "view")); $custom_links .= $this->navlinks(make_link('comment/list'), "Comments", array("comment")); $custom_links .= $this->navlinks(make_link('tags'), "Tags", array("tags")); $custom_links .= $this->navlinks(make_link('upload'), "Upload", array("upload")); if (class_exists("Wiki")) { $custom_links .= $this->navlinks(make_link('wiki/rules'), "Rules", array("wiki/rules")); $custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki")); } $menu .= "{$custom_links}</div>"; $left_block_html = ""; $main_block_html = ""; $sub_block_html = ""; $user_block_html = ""; 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; case "user": $user_block_html .= $block->body; break; case "subheading": $sub_block_html .= $this->block_to_html($block, false, "main"); break; default: print "<p>error: {$block->header} using an unknown section ({$block->section})"; break; } } $custom_sublinks = "<div class='sbar'>"; $cs = null; // hack global $user; $username = url_escape($user->name); // hack $qp = _get_query_parts(); $hw = class_exists("Wiki"); // php sucks switch ($qp[0]) { default: $cs = $user_block_html; break; case "": # FIXME: this assumes that the front page is # post/list; in 99% of case it will either be # post/list or home, and in the latter case # the subnav links aren't shown, but it would # be nice to be correct # FIXME: this assumes that the front page is # post/list; in 99% of case it will either be # post/list or home, and in the latter case # the subnav links aren't shown, but it would # be nice to be correct case "post": $cs .= "<a class='tab' href='" . make_link('post/list') . "'>All</a>"; $cs .= "<a class='tab' href='" . make_link("post/list/favorited_by={$username}/1") . "'>My Favorites</a>"; $cs .= "<a class='tab' href='" . make_link('rss/images') . "'>Feed</a>"; if ($hw) { $cs .= "<a class='tab' href='" . make_link("wiki/posts") . "'>Help</a>"; } break; case "comment": $cs .= "<a class='tab' href='" . make_link('comment/list') . "'>All</a>"; $cs .= "<a class='tab' href='" . make_link('rss/comments') . "'>Feed</a>"; $cs .= "<a class='tab' href='" . make_link("ext_doc/comment") . "'>Help</a>"; break; case "pool": $cs .= "<a class='tab' href='" . make_link('pool/list') . "'>List</a>"; $cs .= "<a class='tab' href='" . make_link("pool/new") . "'>Create</a>"; $cs .= "<a class='tab' href='" . make_link("pool/updated") . "'>Changes</a>"; $cs .= "<a class='tab' href='" . make_link("ext_doc/pools") . "'>Help</a>"; break; case "wiki": $cs .= "<a class='tab' href='" . make_link('wiki') . "'>Index</a>"; $cs .= "<a class='tab' href='" . make_link("wiki/rules") . "'>Rules</a>"; $cs .= "<a class='tab' href='" . make_link("ext_doc/wiki") . "'>Help</a>"; break; case "tags": case "alias": $cs .= "<a class='tab' href='" . make_link('tags/map') . "'>Map</a>"; $cs .= "<a class='tab' href='" . make_link('tags/alphabetic') . "'>Alphabetic</a>"; $cs .= "<a class='tab' href='" . make_link('tags/popularity') . "'>Popularity</a>"; $cs .= "<a class='tab' href='" . make_link('tags/categories') . "'>Categories</a>"; $cs .= "<a class='tab' href='" . make_link('alias/list') . "'>Aliases</a>"; $cs .= "<a class='tab' href='" . make_link("ext_doc/tag_edit") . "'>Help</a>"; break; case "upload": if ($hw) { $cs .= "<a class='tab' href='" . make_link("wiki/upload_guidelines") . "'>Guidelines</a>"; } break; case "random": $cs .= "<a class='tab' href='" . make_link('random/view') . "'>Shuffle</a>"; $cs .= "<a class='tab' href='" . make_link('random/download') . "'>Download</a>"; break; case "featured": $cs .= "<a class='tab' href='" . make_link('featured/download') . "'>Download</a>"; break; } if ($cs == "") { $custom_sublinks = ""; } else { $custom_sublinks .= "{$cs}</div>"; } $debug = get_debug_info(); $contact = empty($contact_link) ? "" : "<br><a href='{$contact_link}'>Contact</a>"; $subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>"; $wrapper = ""; if (strlen($page->heading) > 100) { $wrapper = ' style="height: 3em; overflow: auto;"'; } if ($page->left_enabled == false) { $left_block_html = ""; $main_block_html = "<div id='body_noleft'>{$main_block_html}</div>"; } else { $left_block_html = "<div id='nav'>{$left_block_html}</div>"; $main_block_html = "<div id='body'>{$main_block_html}</div>"; } print <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> \t<head> \t\t<title>{$page->title}</title> \t\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> \t\t<link rel="stylesheet" href="{$data_href}/themes/{$theme_name}/style.css" type="text/css"> \t\t{$header_html} \t</head> \t<body> \t\t{$menu} \t\t{$custom_sublinks} \t\t \t\t{$sub_block_html} \t\t{$left_block_html} \t\t{$main_block_html} \t\t \t\t<div id="footer"> \t\t\tImages © their respective owners, \t\t\t<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> © \t\t\t<a href="http://www.shishnet.org/">Shish</a> & Co 2007-2010, \t\t\tbased on the Danbooru concept.<br /> \t\t\tLite Theme by <a href="http://seemslegit.com">Zach</a> \t\t\t{$debug} \t\t\t{$contact} \t\t</div> \t</body> </html> EOD; }