2009-11-24 14:12:20 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Name: Danbooru Theme
|
|
|
|
* Author: Bzchan <bzchan@animemahou.com>
|
|
|
|
* Link: http://trac.shishnet.org/shimmie2/
|
|
|
|
* License: GPLv2
|
|
|
|
* Description: This is a simple theme changing the css to make shimme
|
|
|
|
* look more like danbooru as well as adding a custom links
|
|
|
|
* bar and title to the top of every page.
|
|
|
|
*/
|
|
|
|
//Small changes added by zshall <http://seemslegit.com>
|
|
|
|
//Changed CSS and layout to make shimmie look even more like danbooru
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
Danbooru Theme - Notes (Bzchan)
|
|
|
|
|
2012-03-02 23:57:27 +00:00
|
|
|
Files: default.php, style.css
|
2009-11-24 14:12:20 +00:00
|
|
|
|
|
|
|
How to use a theme
|
|
|
|
- Copy the danbooru folder with all its contained files into the "themes"
|
|
|
|
directory in your shimmie installation.
|
|
|
|
- Log into your shimmie and change the Theme in the Board Config to your
|
|
|
|
desired theme.
|
|
|
|
|
|
|
|
Changes in this theme include
|
|
|
|
- Adding and editing various elements in the style.css file.
|
|
|
|
- $site_name and $front_name retreival from config added.
|
|
|
|
- $custom_link and $title_link preparation just before html is outputed.
|
|
|
|
- Altered outputed html to include the custom links and removed heading
|
|
|
|
from being displayed (subheading is still displayed)
|
|
|
|
- Note that only the sidebar has been left aligned. Could not properly
|
|
|
|
left align the main block because blocks without headers currently do
|
|
|
|
not have ids on there div elements. (this was a problem because
|
|
|
|
paginator block must be centered and everything else left aligned)
|
|
|
|
|
|
|
|
Tips
|
|
|
|
- You can change custom links to point to whatever pages you want as well as adding
|
|
|
|
more custom links.
|
|
|
|
- The main title link points to the Front Page set in your Board Config options.
|
|
|
|
- The text of the main title is the Title set in your Board Config options.
|
|
|
|
- Themes make no changes to your database or main code files so you can switch
|
|
|
|
back and forward to other themes all you like.
|
|
|
|
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
class Layout {
|
|
|
|
public function display_page($page) {
|
2010-01-03 09:36:53 +00:00
|
|
|
global $config, $user;
|
2009-11-24 14:12:20 +00:00
|
|
|
|
|
|
|
$theme_name = $config->get_string('theme');
|
2014-04-19 08:17:28 +00:00
|
|
|
//$base_href = $config->get_string('base_href');
|
2009-11-24 14:12:20 +00:00
|
|
|
$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) {
|
2009-11-24 14:12:20 +00:00
|
|
|
$header_html .= "\t\t$line\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$left_block_html = "";
|
|
|
|
$user_block_html = "";
|
|
|
|
$main_block_html = "";
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html = "";
|
2009-11-24 14:12:20 +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);
|
2009-11-24 14:12:20 +00:00
|
|
|
break;
|
|
|
|
case "user":
|
|
|
|
$user_block_html .= $block->body; // $this->block_to_html($block, true);
|
|
|
|
break;
|
2010-01-03 09:56:07 +00:00
|
|
|
case "subheading":
|
|
|
|
$sub_block_html .= $block->body; // $this->block_to_html($block, true);
|
|
|
|
break;
|
2009-11-24 14:12:20 +00:00
|
|
|
case "main":
|
|
|
|
if($block->header == "Images") {
|
|
|
|
$block->header = " ";
|
|
|
|
}
|
2012-03-12 04:39:04 +00:00
|
|
|
$main_block_html .= $block->get_html(false);
|
2009-11-24 14:12:20 +00:00
|
|
|
break;
|
|
|
|
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>";
|
2009-11-24 14:12:20 +00:00
|
|
|
|
|
|
|
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 = "";
|
2010-01-03 09:36:53 +00:00
|
|
|
if($user->is_anonymous()) {
|
2010-03-23 02:48:44 +00:00
|
|
|
$custom_links .= $this->navlinks(make_link('user_admin/login'), "My Account", array("user", "user_admin", "setup", "admin"));
|
2010-01-03 09:36:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-03-23 03:08:31 +00:00
|
|
|
$custom_links .= $this->navlinks(make_link('user'), "My Account", array("user", "user_admin", "setup", "admin"));
|
2010-01-03 09:36:53 +00:00
|
|
|
}
|
2010-03-23 02:48:44 +00:00
|
|
|
$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"));
|
2009-12-30 07:00:47 +00:00
|
|
|
if(class_exists("Pools")) {
|
2010-03-23 02:48:44 +00:00
|
|
|
$custom_links .= $this->navlinks(make_link('pool/list'), "Pools", array("pool"));
|
2009-12-30 07:00:47 +00:00
|
|
|
}
|
2010-03-23 02:48:44 +00:00
|
|
|
$custom_links .= $this->navlinks(make_link('upload'), "Upload", array("upload"));
|
2009-12-30 07:00:47 +00:00
|
|
|
if(class_exists("Wiki")) {
|
2010-03-23 02:48:44 +00:00
|
|
|
$custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki"));
|
|
|
|
$custom_links .= $this->navlinks(make_link('wiki/more'), "More »", array("wiki/more"));
|
2009-12-30 07:00:47 +00:00
|
|
|
}
|
2009-11-24 14:12:20 +00:00
|
|
|
|
|
|
|
$custom_sublinks = "";
|
|
|
|
// hack
|
|
|
|
$username = url_escape($user->name);
|
|
|
|
// hack
|
2013-06-13 11:42:30 +00:00
|
|
|
$qp = explode("/", ltrim(@$_GET["q"], "/"));
|
2009-11-24 14:12:20 +00:00
|
|
|
// php sucks
|
|
|
|
switch($qp[0]) {
|
|
|
|
default:
|
|
|
|
$custom_sublinks .= $user_block_html;
|
|
|
|
break;
|
2010-01-04 11:24:48 +00:00
|
|
|
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
|
2009-11-24 14:12:20 +00:00
|
|
|
case "post":
|
|
|
|
case "upload":
|
2012-05-23 09:39:21 +00:00
|
|
|
if(class_exists("NumericScore")){ $custom_sublinks .= "<li><b>Popular by </b><a href='".make_link('popular_by_day')."'>Day</a>/<a href='".make_link('popular_by_month')."'>Month</a>/<a href='".make_link('popular_by_year')."'>Year</a></li>";}
|
2009-11-24 14:12:20 +00:00
|
|
|
$custom_sublinks .= "<li><a href='".make_link('post/list')."'>All</a></li>";
|
2014-04-19 08:17:28 +00:00
|
|
|
if(class_exists("Favorites")){ $custom_sublinks .= "<li><a href='".make_link("post/list/favorited_by={$username}/1")."'>My Favorites</a></li>";}
|
2012-05-23 09:39:21 +00:00
|
|
|
if(class_exists("RSS_Images")){ $custom_sublinks .= "<li><a href='".make_link('rss/images')."'>Feed</a></li>";}
|
|
|
|
if(class_exists("RandomImage")){ $custom_sublinks .= "<li><a href='".make_link("random_image/view")."'>Random Image</a></li>";}
|
2014-04-19 08:17:28 +00:00
|
|
|
if(class_exists("Wiki")){ $custom_sublinks .= "<li><a href='".make_link("wiki/posts")."'>Help</a></li>";
|
2012-01-24 15:22:32 +00:00
|
|
|
}else{ $custom_sublinks .= "<li><a href='".make_link("ext_doc/index")."'>Help</a></li>";}
|
2009-12-30 07:00:47 +00:00
|
|
|
break;
|
2010-01-04 11:52:07 +00:00
|
|
|
case "comment":
|
|
|
|
$custom_sublinks .= "<li><a href='".make_link('comment/list')."'>All</a></li>";
|
2010-01-04 12:41:04 +00:00
|
|
|
$custom_sublinks .= "<li><a href='".make_link("ext_doc/comment")."'>Help</a></li>";
|
2010-01-04 11:52:07 +00:00
|
|
|
break;
|
2009-12-30 07:00:47 +00:00
|
|
|
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>";
|
2010-01-04 12:41:04 +00:00
|
|
|
$custom_sublinks .= "<li><a href='".make_link("ext_doc/pools")."'>Help</a></li>";
|
2009-11-24 14:12:20 +00:00
|
|
|
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>";
|
2010-01-04 12:41:04 +00:00
|
|
|
$custom_sublinks .= "<li><a href='".make_link("ext_doc/wiki")."'>Help</a></li>";
|
2009-11-24 14:12:20 +00:00
|
|
|
break;
|
|
|
|
case "tags":
|
2010-01-03 08:55:43 +00:00
|
|
|
case "alias":
|
2009-11-24 14:12:20 +00:00
|
|
|
$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>";
|
2010-01-04 12:41:04 +00:00
|
|
|
$custom_sublinks .= "<li><a href='".make_link("ext_doc/tag_edit")."'>Help</a></li>";
|
2009-11-24 14:12:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-03-23 02:48:44 +00:00
|
|
|
|
2009-11-24 14:12:20 +00:00
|
|
|
// 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) {
|
2012-03-11 16:18:37 +00:00
|
|
|
$left = "<nav>$left_block_html</nav>";
|
2009-11-24 14:12:20 +00:00
|
|
|
$withleft = "withleft";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$left = "";
|
|
|
|
$withleft = "noleft";
|
|
|
|
}
|
|
|
|
|
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, "/");
|
|
|
|
}
|
|
|
|
|
2009-11-24 14:12:20 +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]-->
|
2009-11-24 14:12:20 +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>
|
|
|
|
$title_link
|
|
|
|
<ul id="navbar" class="flat-list">
|
|
|
|
$custom_links
|
|
|
|
</ul>
|
|
|
|
<ul id="subnavbar" class="flat-list">
|
|
|
|
$custom_sublinks
|
|
|
|
</ul>
|
|
|
|
</header>
|
2009-11-24 14:12:20 +00:00
|
|
|
$subheading
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html
|
2009-11-24 14:12:20 +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><em>
|
2009-11-24 14:12:20 +00:00
|
|
|
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> &
|
2014-02-25 17:40:07 +00:00
|
|
|
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
|
|
|
2007-2014,
|
2009-11-24 14:12:20 +00:00
|
|
|
based on the Danbooru concept.
|
|
|
|
$debug
|
|
|
|
$contact
|
2012-03-11 16:18:37 +00:00
|
|
|
</em></footer>
|
2009-11-24 14:12:20 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|
2010-03-23 02:48:44 +00:00
|
|
|
private function navlinks($link, $desc, $pages_matched) {
|
|
|
|
/**
|
|
|
|
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
|
|
|
|
*/
|
|
|
|
$html = null;
|
2013-06-13 11:42:30 +00:00
|
|
|
$url = ltrim($_GET['q'], "/");
|
2010-03-23 02:48:44 +00:00
|
|
|
|
|
|
|
$re1='.*?';
|
2013-06-13 11:42:30 +00:00
|
|
|
$re2='((?:[a-z][a-z_]+))';
|
2010-03-23 02:48:44 +00:00
|
|
|
|
2014-04-19 08:17:28 +00:00
|
|
|
if (preg_match_all("/".$re1.$re2."/is", $url, $matches)) {
|
2010-03-23 02:48:44 +00:00
|
|
|
$url=$matches[1][0];
|
|
|
|
}
|
|
|
|
|
2013-10-04 21:53:26 +00:00
|
|
|
$count_pages_matched = count($pages_matched);
|
|
|
|
|
|
|
|
for($i=0; $i < $count_pages_matched; $i++) {
|
2010-03-23 02:48:44 +00:00
|
|
|
if($url == $pages_matched[$i]) {
|
|
|
|
$html = "<li class='current-page'><a href='$link'>$desc</a></li>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(is_null($html)) {$html = "<li><a class='tab' href='$link'>$desc</a></li>";}
|
|
|
|
return $html;
|
|
|
|
}
|
2009-11-24 14:12:20 +00:00
|
|
|
}
|
2014-04-24 23:13:20 +00:00
|
|
|
|