diff --git a/core/basepage.php b/core/basepage.php index d10c93fd..72c23554 100644 --- a/core/basepage.php +++ b/core/basepage.php @@ -277,7 +277,7 @@ class BasePage */ public function display(): void { - global $page, $user; + global $user; header("HTTP/1.0 {$this->code} Shimmie"); header("Content-type: " . $this->type); @@ -354,8 +354,7 @@ class BasePage usort($sub_links, "sort_nav_links"); $this->add_auto_html_headers(); - $layout = new Layout(); - $layout->display_page($page, $nav_links, $sub_links); + $this->render($nav_links, $sub_links); break; case PageMode::DATA: header("Content-Length: " . strlen($this->data)); @@ -380,7 +379,6 @@ class BasePage header('Accept-Ranges: bytes'); if (isset($_SERVER['HTTP_RANGE'])) { - $c_start = $start; $c_end = $end; list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); if (strpos($range, ',') !== false) { @@ -528,6 +526,100 @@ class BasePage } $this->add_html_header("", 44); } + + /** + * turns the Page into HTML + */ + public function render(array $nav_links, array $sub_links) + { + $head_html = $this->head_html(); + $body_html = $this->body_html(); + + print << + + $head_html + $body_html + +EOD; + } + + protected function head_html(): string { + $html_header_html = $this->get_all_html_headers(); + + return " + + {$this->title} + $html_header_html + + "; + } + + protected function body_html(): string { + $left_block_html = ""; + $main_block_html = ""; + $sub_block_html = ""; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "left": + $left_block_html .= $block->get_html(true); + break; + case "main": + $main_block_html .= $block->get_html(false); + break; + case "subheading": + $sub_block_html .= $block->get_html(false); + break; + default: + print "

error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + $wrapper = ""; + if (strlen($this->heading) > 100) { + $wrapper = ' style="height: 3em; overflow: auto;"'; + } + + $footer_html = $this->footer_html(); + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + return " + +

+ {$this->heading} + $sub_block_html +
+ +
+ $flash_html + $main_block_html +
+ + + "; + } + + protected function footer_html(): string { + $debug = get_debug_info(); + $contact_link = contact_link(); + $contact = empty($contact_link) ? "" : "
Contact"; + + return " + Images © their respective owners, + Shimmie © + Shish & + The Team + 2007-2020, + based on the Danbooru concept. + $debug + $contact + "; + } } class PageNavBuildingEvent extends Event @@ -619,6 +711,7 @@ class NavLink return false; } + } function sort_nav_links(NavLink $a, NavLink $b) diff --git a/core/database.php b/core/database.php index 83a3cf17..c2ed9d9a 100644 --- a/core/database.php +++ b/core/database.php @@ -346,6 +346,7 @@ class MockDatabase extends Database public function __construct(array $responses = []) { + parent::__construct("fake:dsn"); $this->responses = $responses; } diff --git a/core/util.php b/core/util.php index 3837216b..8201605b 100644 --- a/core/util.php +++ b/core/util.php @@ -547,7 +547,6 @@ function _get_themelet_files(string $_theme): array { $base_themelets = []; $base_themelets[] = 'themes/'.$_theme.'/page.class.php'; - $base_themelets[] = 'themes/'.$_theme.'/layout.class.php'; $base_themelets[] = 'themes/'.$_theme.'/themelet.class.php'; $ext_themelets = zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/theme.php"); @@ -591,7 +590,8 @@ function _fatal_error(Exception $e): void $q = (!isset($e->query) || is_null($e->query)) ? "" : "

Query: " . html_escape($e->query); header("HTTP/1.0 500 Internal Error"); echo ' - + + Internal error - SCore-'.$version.' diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index f72dd233..f587fee8 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -45,6 +45,7 @@ class DeleteAliasEvent extends Event public function __construct(string $oldtag) { + parent::__construct(); $this->oldtag = $oldtag; } } diff --git a/ext/artists/main.php b/ext/artists/main.php index 81f99399..59bb175e 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -459,37 +459,37 @@ class Artists extends Extension private function get_artistID_by_url(string $url): int { global $database; - return $database->get_one("SELECT artist_id FROM artist_urls WHERE url = :url", ['url'=>$url]); + return (int)$database->get_one("SELECT artist_id FROM artist_urls WHERE url = :url", ['url'=>$url]); } private function get_artistID_by_memberName(string $member): int { global $database; - return $database->get_one("SELECT artist_id FROM artist_members WHERE name = :name", ['name'=>$member]); + return (int)$database->get_one("SELECT artist_id FROM artist_members WHERE name = :name", ['name'=>$member]); } private function get_artistName_by_artistID(int $artistID): string { global $database; - return $database->get_one("SELECT name FROM artists WHERE id = :id", ['id'=>$artistID]); + return (string)$database->get_one("SELECT name FROM artists WHERE id = :id", ['id'=>$artistID]); } private function get_artistID_by_aliasID(int $aliasID): int { global $database; - return $database->get_one("SELECT artist_id FROM artist_alias WHERE id = :id", ['id'=>$aliasID]); + return (int)$database->get_one("SELECT artist_id FROM artist_alias WHERE id = :id", ['id'=>$aliasID]); } private function get_artistID_by_memberID(int $memberID): int { global $database; - return $database->get_one("SELECT artist_id FROM artist_members WHERE id = :id", ['id'=>$memberID]); + return (int)$database->get_one("SELECT artist_id FROM artist_members WHERE id = :id", ['id'=>$memberID]); } private function get_artistID_by_urlID(int $urlID): int { global $database; - return $database->get_one("SELECT artist_id FROM artist_urls WHERE id = :id", ['id'=>$urlID]); + return (int)$database->get_one("SELECT artist_id FROM artist_urls WHERE id = :id", ['id'=>$urlID]); } private function delete_alias(int $aliasID) diff --git a/ext/pools/main.php b/ext/pools/main.php index 4f6d751f..dd4d887b 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -692,7 +692,7 @@ class Pools extends Extension $images .= " " . $imageID; } - $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); + $count = (int)$database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); $this->add_history($poolID, 0, $images, $count); return $poolID; } @@ -982,7 +982,7 @@ class Pools extends Extension continue; // go on to the next one. } - $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); + $count = (int)$database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); $this->add_history($poolID, $newAction, $imageArray, $count); } } @@ -1020,7 +1020,7 @@ class Pools extends Extension $this->update_count($poolID); if ($history) { - $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); + $count = (int)$database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); $this->add_history($poolID, 1, (string)$imageID, $count); } return true; @@ -1046,7 +1046,7 @@ class Pools extends Extension $this->update_count($poolID); if ($history) { - $count = $database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); + $count = (int)$database->get_one("SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid", ["pid" => $poolID]); $this->add_history($poolID, 0, (string)$imageID, $count); } } diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php deleted file mode 100644 index a7cb7d0d..00000000 --- a/themes/danbooru/layout.class.php +++ /dev/null @@ -1,189 +0,0 @@ - -* Link: https://code.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 -//Changed CSS and layout to make shimmie look even more like danbooru -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -Danbooru Theme - Notes (Bzchan) - -Files: default.php, style.css - -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 $page, array $nav_links, array $sub_links) - { - global $config; - - $theme_name = $config->get_string(SetupConfig::THEME); - //$base_href = $config->get_string('base_href'); - $data_href = get_base_href(); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $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 .= $block->get_html(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 .= $block->get_html(false); - break; - default: - print "

error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
Contact"; - - if (empty($this->subheading)) { - $subheading = ""; - } else { - $subheading = "

{$this->subheading}
"; - } - - $site_name = $config->get_string(SetupConfig::TITLE); // bzchan: change from normal default to get title for top of page - $main_page = $config->get_string(SetupConfig::MAIN_PAGE); // bzchan: change from normal default to get main page for top of page - - $custom_links = ""; - foreach ($nav_links as $nav_link) { - $custom_links .= "
  • ".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."
  • "; - } - - $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 .= "
    "; - } - - - // bzchan: failed attempt to add heading after title_link (failure was it looked bad) - //if($this->heading==$site_name)$this->heading = ''; - //$title_link = "

    $site_name/$this->heading

    "; - - // bzchan: prepare main title link - $title_link = "

    $site_name

    "; - - if ($page->left_enabled) { - $left = ""; - $withleft = "withleft"; - } else { - $left = ""; - $withleft = "noleft"; - } - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} -$header_html - - - - -
    - $title_link - - -
    - $subheading - $sub_block_html - $left -
    - $flash_html - $main_block_html -
    -
    - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept. - $debug - $contact -
    - - -EOD; - } - - /** - * #param string[] $pages_matched - */ - - public function navlinks(Link $link, string $desc, bool $active): ?string - { - $html = null; - if ($active) { - $html = "{$desc}"; - } else { - $html = "{$desc}"; - } - - return $html; - } -} diff --git a/themes/danbooru/page.class.php b/themes/danbooru/page.class.php index bf0fea42..17d62c8f 100644 --- a/themes/danbooru/page.class.php +++ b/themes/danbooru/page.class.php @@ -1,5 +1,46 @@ + * Link: https://code.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 +//Changed CSS and layout to make shimmie look even more like danbooru +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +Danbooru Theme - Notes (Bzchan) +Files: default.php, style.css + +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 Page extends BasePage { /** @var bool */ @@ -9,4 +50,117 @@ class Page extends BasePage { $this->left_enabled = false; } + + public function render(array $nav_links, array $sub_links) + { + global $config; + + $left_block_html = ""; + $user_block_html = ""; + $main_block_html = ""; + $sub_block_html = ""; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "left": + $left_block_html .= $block->get_html(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 .= $block->get_html(false); + break; + default: + print "

    error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + if (empty($this->subheading)) { + $subheading = ""; + } else { + $subheading = "

    {$this->subheading}
    "; + } + + $site_name = $config->get_string(SetupConfig::TITLE); // bzchan: change from normal default to get title for top of page + $main_page = $config->get_string(SetupConfig::MAIN_PAGE); // bzchan: change from normal default to get main page for top of page + + $custom_links = ""; + foreach ($nav_links as $nav_link) { + $custom_links .= "
  • ".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."
  • "; + } + + $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 .= "
    "; + } + + // bzchan: failed attempt to add heading after title_link (failure was it looked bad) + //if($this->heading==$site_name)$this->heading = ''; + //$title_link = "

    $site_name/$this->heading

    "; + + // bzchan: prepare main title link + $title_link = "

    $site_name

    "; + + if ($this->left_enabled) { + $left = ""; + $withleft = "withleft"; + } else { + $left = ""; + $withleft = "noleft"; + } + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + $head_html = $this->head_html(); + $footer_html = $this->footer_html(); + + print << + + $head_html + +
    + $title_link + + +
    + $subheading + $sub_block_html + $left +
    + $flash_html + $main_block_html +
    +
    $footer_html
    + + +EOD; + } + + public function navlinks(Link $link, string $desc, bool $active): ?string + { + $html = null; + if ($active) { + $html = "{$desc}"; + } else { + $html = "{$desc}"; + } + + return $html; + } } diff --git a/themes/danbooru2/layout.class.php b/themes/danbooru2/layout.class.php deleted file mode 100644 index a56a7f18..00000000 --- a/themes/danbooru2/layout.class.php +++ /dev/null @@ -1,185 +0,0 @@ -, updated by Daniel Oaks -* Link: https://code.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 -//Changed CSS and layout to make shimmie look even more like danbooru -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -Danbooru 2 Theme - Notes (Bzchan) - -Files: default.php, style.css - -How to use a theme -- Copy the danbooru2 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, array $nav_links, array $sub_links) - { - global $config; - - //$theme_name = $config->get_string(SetupConfig::THEME); - //$base_href = $config->get_string('base_href'); - //$data_href = get_base_href(); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $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 .= $block->get_html(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 .= $block->get_html(false); - break; - default: - print "

    error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - - if (empty($this->subheading)) { - $subheading = ""; - } else { - $subheading = "

    {$this->subheading}
    "; - } - - $site_name = $config->get_string(SetupConfig::TITLE); // bzchan: change from normal default to get title for top of page - $main_page = $config->get_string(SetupConfig::MAIN_PAGE); // bzchan: change from normal default to get main page for top of page - - $custom_links = ""; - foreach ($nav_links as $nav_link) { - $custom_links .= "
  • ".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."
  • "; - } - - $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 .= "
    "; - } - - - // bzchan: failed attempt to add heading after title_link (failure was it looked bad) - //if($this->heading==$site_name)$this->heading = ''; - //$title_link = "

    $site_name/$this->heading

    "; - - // bzchan: prepare main title link - $title_link = "

    $site_name

    "; - - if ($page->left_enabled) { - $left = ""; - $withleft = "withleft"; - } else { - $left = ""; - $withleft = "noleft"; - } - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} -$header_html - - - -
    - $title_link - - -
    - $subheading - $sub_block_html - $left -
    - $flash_html - $main_block_html -
    -
    - Running Shimmie – - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept
    - $debug - $contact -
    - - -EOD; - } - - public function navlinks(Link $link, string $desc, bool $active): ?string - { - $html = null; - if ($active) { - $html = "{$desc}"; - } else { - $html = "{$desc}"; - } - - return $html; - } -} diff --git a/themes/danbooru2/page.class.php b/themes/danbooru2/page.class.php index ad798d19..1926d839 100644 --- a/themes/danbooru2/page.class.php +++ b/themes/danbooru2/page.class.php @@ -1,4 +1,46 @@ , updated by Daniel Oaks + * Link: https://code.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 +//Changed CSS and layout to make shimmie look even more like danbooru +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +Danbooru 2 Theme - Notes (Bzchan) + +Files: default.php, style.css + +How to use a theme +- Copy the danbooru2 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 Page extends BasePage { @@ -7,4 +49,117 @@ class Page extends BasePage { $this->left_enabled = false; } + + public function render(array $nav_links, array $sub_links) + { + global $config; + + $left_block_html = ""; + $user_block_html = ""; + $main_block_html = ""; + $sub_block_html = ""; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "left": + $left_block_html .= $block->get_html(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 .= $block->get_html(false); + break; + default: + print "

    error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + if (empty($this->subheading)) { + $subheading = ""; + } else { + $subheading = "

    {$this->subheading}
    "; + } + + $site_name = $config->get_string(SetupConfig::TITLE); // bzchan: change from normal default to get title for top of page + $main_page = $config->get_string(SetupConfig::MAIN_PAGE); // bzchan: change from normal default to get main page for top of page + + $custom_links = ""; + foreach ($nav_links as $nav_link) { + $custom_links .= "
  • ".$this->navlinks($nav_link->link, $nav_link->description, $nav_link->active)."
  • "; + } + + $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 .= "
    "; + } + + // bzchan: failed attempt to add heading after title_link (failure was it looked bad) + //if($this->heading==$site_name)$this->heading = ''; + //$title_link = "

    $site_name/$this->heading

    "; + + // bzchan: prepare main title link + $title_link = "

    $site_name

    "; + + if ($this->left_enabled) { + $left = ""; + $withleft = "withleft"; + } else { + $left = ""; + $withleft = "noleft"; + } + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + $head_html = $this->head_html(); + $footer_html = $this->footer_html(); + + print << + + $head_html + +
    + $title_link + + +
    + $subheading + $sub_block_html + $left +
    + $flash_html + $main_block_html +
    +
    $footer_html
    + + +EOD; + } + + public function navlinks(Link $link, string $desc, bool $active): ?string + { + $html = null; + if ($active) { + $html = "{$desc}"; + } else { + $html = "{$desc}"; + } + + return $html; + } } diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php deleted file mode 100644 index 9a856334..00000000 --- a/themes/default/layout.class.php +++ /dev/null @@ -1,87 +0,0 @@ -get_string(SetupConfig::THEME, 'default'); - //$data_href = get_base_href(); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $left_block_html = ""; - $main_block_html = ""; - $sub_block_html = ""; - - foreach ($page->blocks as $block) { - switch ($block->section) { - case "left": - $left_block_html .= $block->get_html(true); - break; - case "main": - $main_block_html .= $block->get_html(false); - break; - case "subheading": - $sub_block_html .= $block->get_html(false); - break; - default: - print "

    error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - - $wrapper = ""; - if (strlen($page->heading) > 100) { - $wrapper = ' style="height: 3em; overflow: auto;"'; - } - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} -$header_html - - - -

    - {$page->heading} - $sub_block_html -
    - -
    - $flash_html - $main_block_html -
    -
    - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept. - $debug - $contact -
    - - -EOD; - } -} diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php deleted file mode 100644 index ea650595..00000000 --- a/themes/futaba/layout.class.php +++ /dev/null @@ -1,94 +0,0 @@ -get_string(SetupConfig::THEME, 'default'); - $data_href = get_base_href(); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $left_block_html = ""; - $main_block_html = ""; - $sub_block_html = ""; - - foreach ($page->blocks as $block) { - switch ($block->section) { - case "left": - $left_block_html .= $block->get_html(true); - break; - case "main": - $main_block_html .= $block->get_html(false); - break; - case "subheading": - $sub_block_html .= $block->body; // $this->block_to_html($block, true); - break; - default: - print "

    error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - - if (empty($page->subheading)) { - $subheading = ""; - } else { - $subheading = "

    {$page->subheading}
    "; - } - - if ($page->left_enabled) { - $left = ""; - $withleft = "withleft"; - } else { - $left = ""; - $withleft = ""; - } - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} -$header_html - - - - -
    -

    {$page->heading}

    - $subheading - $sub_block_html -
    - $left -
    - $flash_html - $main_block_html -
    -
    -
    - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept. -
    Futaba theme based on 4chan's layout and CSS :3 - $debug - $contact -
    - - -EOD; - } -} diff --git a/themes/futaba/page.class.php b/themes/futaba/page.class.php index ad798d19..6f6355da 100644 --- a/themes/futaba/page.class.php +++ b/themes/futaba/page.class.php @@ -7,4 +7,69 @@ class Page extends BasePage { $this->left_enabled = false; } + + public function render($nav_links, $subnav_links) + { + $left_block_html = ""; + $main_block_html = ""; + $sub_block_html = ""; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "left": + $left_block_html .= $block->get_html(true); + break; + case "main": + $main_block_html .= $block->get_html(false); + break; + case "subheading": + $sub_block_html .= $block->body; // $this->block_to_html($block, true); + break; + default: + print "

    error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + if (empty($this->subheading)) { + $subheading = ""; + } else { + $subheading = "

    {$this->subheading}
    "; + } + + if ($this->left_enabled) { + $left = ""; + $withleft = "withleft"; + } else { + $left = ""; + $withleft = ""; + } + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + $head_html = $this->head_html(); + $footer_html = $this->footer_html(); + + print << + + $head_html + +
    +

    {$this->heading}

    + $subheading + $sub_block_html +
    + $left +
    + $flash_html + $main_block_html +
    +
    +
    + $footer_html +
    + + +EOD; + } } diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php deleted file mode 100644 index 6418c2ff..00000000 --- a/themes/lite/layout.class.php +++ /dev/null @@ -1,163 +0,0 @@ - -* 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 Layout -{ - public function display_page(Page $page, array $nav_links, array $sub_links) - { - global $config; - - $theme_name = $config->get_string(SetupConfig::THEME, 'lite'); - $site_name = $config->get_string(SetupConfig::TITLE); - $data_href = get_base_href(); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $menu = ""; - - $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 "

    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 .= "
    "; - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - //$subheading = empty($page->subheading) ? "" : "
    {$page->subheading}
    "; - - /*$wrapper = ""; - if(strlen($page->heading) > 100) { - $wrapper = ' style="height: 3em; overflow: auto;"'; - }*/ - if ($page->left_enabled == false) { - $left_block_html = ""; - $main_block_html = "
    {$main_block_html}
    "; - } else { - $left_block_html = ""; - $main_block_html = "
    {$main_block_html}
    "; - } - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} - $header_html - - - -
    - $menu - $custom_sublinks - $sub_block_html -
    - $left_block_html - $flash_html - $main_block_html -
    - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept.
    - Lite Theme by Zach - $debug - $contact -
    - - -EOD; - } /* end of function display_page() */ - - public function block_to_html(Block $block, bool $hidable=false, string $salt=""): string - { - $h = $block->header; - $b = $block->body; - $i = str_replace(' ', '_', $h) . $salt; - $html = "
    "; - if (!is_null($h)) { - if ($salt == "main") { - $html .= ""; - } else { - $html .= ""; - } - } - if (!is_null($b)) { - if ($salt =="main") { - $html .= "
    {$b}
    "; - } else { - $html .= " - - "; - } - } - $html .= "
    "; - return $html; - } - - /** - * #param string[] $pages_matched - */ - public function navlinks(Link $link, string $desc, bool $active): ?string - { - $html = null; - if ($active) { - $html = "{$desc}"; - } else { - $html = "{$desc}"; - } - - return $html; - } -} /* end of class Layout */ diff --git a/themes/lite/page.class.php b/themes/lite/page.class.php index 6960d615..a76879fc 100644 --- a/themes/lite/page.class.php +++ b/themes/lite/page.class.php @@ -1,4 +1,12 @@ + * 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 { @@ -9,4 +17,129 @@ class Page extends BasePage { $this->left_enabled = false; } + + public function render(array $nav_links, array $sub_links) + { + global $config; + + $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, "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 "

    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 .= "
    "; + } + + if ($this->left_enabled == false) { + $left_block_html = ""; + $main_block_html = "
    {$main_block_html}
    "; + } else { + $left_block_html = ""; + $main_block_html = "
    {$main_block_html}
    "; + } + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + $head_html = $this->head_html(); + $footer_html = $this->footer_html(); + + print << + + $head_html + +
    + $menu + $custom_sublinks + $sub_block_html +
    + $left_block_html + $flash_html + $main_block_html +
    + $footer_html +
    + + +EOD; + } /* end of function display_page() */ + + public function block_to_html(Block $block, bool $hidable=false, string $salt=""): string + { + $h = $block->header; + $b = $block->body; + $i = str_replace(' ', '_', $h) . $salt; + $html = "
    "; + if (!is_null($h)) { + if ($salt == "main") { + $html .= ""; + } else { + $html .= ""; + } + } + if (!is_null($b)) { + if ($salt =="main") { + $html .= "
    {$b}
    "; + } else { + $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; + } } diff --git a/themes/material/layout.class.php b/themes/material/layout.class.php deleted file mode 100644 index 305985fd..00000000 --- a/themes/material/layout.class.php +++ /dev/null @@ -1,288 +0,0 @@ -get_string(SetupConfig::THEME, 'material'); - $site_name = $config->get_string(SetupConfig::TITLE); - $data_href = get_base_href(); - // $main_page = $config->get_string(SetupConfig::MAIN_PAGE); - $contact_link = contact_link(); - $site_link = make_link(); - $header_html = $page->get_all_html_headers(); - - $left_block_html = ""; - $main_block_html = ""; - $head_block_html = ""; - $sub_block_html = ""; - $drawer_block_html = ""; //use exampled in user.theme.php & view.theme.php - $toolbar_block_html = ""; // not used at this point - $subtoolbar_block_html = ""; // use exampled in user.theme.php - // $navigation = ""; - - $h_search = " -
    -
    - -
    - - - -
    -
    -
    - "; - - foreach ($page->blocks as $block) { - switch ($block->section) { - case "toolbar": - $toolbar_block_html .= $this->get_html($block, "toolbar"); - break; - case "subtoolbar": - $subtoolbar_block_html .= $this->get_html($block, "subtoolbar"); - break; - case "left": - if ($block->header == "Navigation") { - $subtoolbar_block_html = $this->rework_navigation($block); - break; - } - // $left_block_html .= $block->get_html(true); - $left_block_html .= $this->get_html($block, "full", true, "left-blocks nav-card mdl-cell--4-col-tablet"); - break; - case "head": - $head_block_html .= $this->get_html($block, "third", true, "nav-card head-blocks"); - break; - case "drawer": - $drawer_block_html .= $this->get_html($block, "full", true, "nav-card drawer-blocks"); - break; - case "main": - // $main_block_html .= $block->get_html(false); - $main_block_html .= $this->get_html($block, "main", true, ""); - break; - case "subheading": - // $sub_block_html .= $block->body; // $this->block_to_html($block, true); - $sub_block_html .= $this->get_html($block, "third", true, "nav-card"); - break; - default: - print "

    error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - /*$subheading = empty($page->subheading) ? "" : "

    {$page->subheading}
    "; - - $wrapper = ""; - if(strlen($page->heading) > 100) { - $wrapper = ' style="height: 3em; overflow: auto;"'; - } - */ - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - - - - {$page->title} - - - - $header_html - - - - - - - -
    -
    - -
    - - - - -
    - $h_search - {$toolbar_block_html} - -
    - -
    -
    - - {$subtoolbar_block_html} -
    -
    -
    - Drawer -
    - $drawer_block_html -
    - -
    -
    -
    -
    - $head_block_html - $sub_block_html -
    -
    -
    -
    - -
    - - $left_block_html -
    -
    -
    - - -
    - $flash_html - $main_block_html -
    -
    -
    -
    - $debug - $contact -
    -
    -
    - -
      -
    • Layout Top
    • -
    • Layout Right
    • -
    • Layout Bottom
    • -
    • Layout Left
    • -
    - - -EOD; - } - - public function rework_navigation(Block $block) - { - // $h = $block->header; - $b = $block->body; - $i = $block->id; - - $dom = new DomDocument(); - $dom->loadHTML($b); - // $output = []; - $html = "
    \n\n
    \n"; - return $html; - } - - /** - * Get the HTML for this block. from core - */ - public function get_html(Block $block, string $section="main", bool $hidable=false, string $extra_class=""): string - { - $h = $block->header; - $b = $block->body; - $i = $block->id;//blotter extention id has `!` - - if ($section == "toolbar") { - $html = "
    \n\n
    \n"; - return $html; - } - if ($section == "subtoolbar") { - $html = "
    \n\n
    \n"; - return $html; - } - if ($section == "full") { - $html = "
    "; - $h_toggler = $hidable ? " shm-toggler" : ""; - if (!empty($h)) { - $html .="

    $h

    "; - } - if (!empty($b)) { - $html .="
    $b
    "; - } - $html .= "
    \n"; - return $html; - } - if ($section == "third") { - $html = "
    "; - $h_toggler = $hidable ? " shm-toggler" : ""; - if (!empty($h)) { - $html .="

    $h

    "; - } - if (!empty($b)) { - $html .="
    $b
    "; - } - $html .= "
    \n"; - return $html; - } - $html = "
    "; - $h_toggler = $hidable ? " shm-toggler" : ""; - if (!empty($h)) { - $html .= "

    $h

    "; - } - if (!empty($b)) { - $html .= "
    $b
    "; - } - $html .= "
    \n"; - return $html; - } -} - - -//@todo fix ext/blotter id tag -//@todo fix table row error for ext/ip_ban -//@todo fix table row error for ext/image_hash_ban -//@todo fix table row error for ext/untag -//@todo fix ext private-messages gives Uncaught TypeError: Cannot read property 'href' of null when no messages are there.. diff --git a/themes/material/page.class.php b/themes/material/page.class.php index 5fc0f7ef..b9b43271 100644 --- a/themes/material/page.class.php +++ b/themes/material/page.class.php @@ -1,4 +1,272 @@ get_string(SetupConfig::THEME, 'material'); + $site_name = $config->get_string(SetupConfig::TITLE); + $data_href = get_base_href(); + // $main_page = $config->get_string(SetupConfig::MAIN_PAGE); + $contact_link = contact_link(); + $site_link = make_link(); + $header_html = $this->get_all_html_headers(); + + $left_block_html = ""; + $main_block_html = ""; + $head_block_html = ""; + $sub_block_html = ""; + $drawer_block_html = ""; //use exampled in user.theme.php & view.theme.php + $toolbar_block_html = ""; // not used at this point + $subtoolbar_block_html = ""; // use exampled in user.theme.php + // $navigation = ""; + + $h_search = " +
    +
    + +
    + + + +
    +
    +
    + "; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "toolbar": + $toolbar_block_html .= $this->get_html($block, "toolbar"); + break; + case "subtoolbar": + $subtoolbar_block_html .= $this->get_html($block, "subtoolbar"); + break; + case "left": + if ($block->header == "Navigation") { + $subtoolbar_block_html = $this->rework_navigation($block); + break; + } + // $left_block_html .= $block->get_html(true); + $left_block_html .= $this->get_html($block, "full", true, "left-blocks nav-card mdl-cell--4-col-tablet"); + break; + case "head": + $head_block_html .= $this->get_html($block, "third", true, "nav-card head-blocks"); + break; + case "drawer": + $drawer_block_html .= $this->get_html($block, "full", true, "nav-card drawer-blocks"); + break; + case "main": + // $main_block_html .= $block->get_html(false); + $main_block_html .= $this->get_html($block, "main", true, ""); + break; + case "subheading": + // $sub_block_html .= $block->body; // $this->block_to_html($block, true); + $sub_block_html .= $this->get_html($block, "third", true, "nav-card"); + break; + default: + print "

    error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + $debug = get_debug_info(); + + $contact = empty($contact_link) ? "" : "
    Contact"; + /*$subheading = empty($this->subheading) ? "" : "

    {$this->subheading}
    "; + + $wrapper = ""; + if(strlen($this->heading) > 100) { + $wrapper = ' style="height: 3em; overflow: auto;"'; + } + */ + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + + print << + + + + + + {$this->title} + + + + $header_html + + + + + + + +
    +
    + +
    + + + + +
    + $h_search + {$toolbar_block_html} + +
    + +
    +
    + + {$subtoolbar_block_html} +
    +
    +
    + Drawer +
    + $drawer_block_html +
    + +
    +
    +
    +
    + $head_block_html + $sub_block_html +
    +
    +
    +
    + +
    + + $left_block_html +
    +
    +
    + + +
    + $flash_html + $main_block_html +
    +
    +
    +
    + $debug + $contact +
    +
    +
    + +
      +
    • Layout Top
    • +
    • Layout Right
    • +
    • Layout Bottom
    • +
    • Layout Left
    • +
    + + +EOD; + } + + public function rework_navigation(Block $block) + { + // $h = $block->header; + $b = $block->body; + $i = $block->id; + + $dom = new DomDocument(); + $dom->loadHTML($b); + // $output = []; + $html = "
    \n\n
    \n"; + return $html; + } + + /** + * Get the HTML for this block. from core + */ + public function get_html(Block $block, string $section="main", bool $hidable=false, string $extra_class=""): string + { + $h = $block->header; + $b = $block->body; + $i = $block->id;//blotter extention id has `!` + + if ($section == "toolbar") { + $html = "
    \n\n
    \n"; + return $html; + } + if ($section == "subtoolbar") { + $html = "
    \n\n
    \n"; + return $html; + } + if ($section == "full") { + $html = "
    "; + $h_toggler = $hidable ? " shm-toggler" : ""; + if (!empty($h)) { + $html .="

    $h

    "; + } + if (!empty($b)) { + $html .="
    $b
    "; + } + $html .= "
    \n"; + return $html; + } + if ($section == "third") { + $html = "
    "; + $h_toggler = $hidable ? " shm-toggler" : ""; + if (!empty($h)) { + $html .="

    $h

    "; + } + if (!empty($b)) { + $html .="
    $b
    "; + } + $html .= "
    \n"; + return $html; + } + $html = "
    "; + $h_toggler = $hidable ? " shm-toggler" : ""; + if (!empty($h)) { + $html .= "

    $h

    "; + } + if (!empty($b)) { + $html .= "
    $b
    "; + } + $html .= "
    \n"; + return $html; + } } diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php deleted file mode 100644 index 8e05917c..00000000 --- a/themes/warm/layout.class.php +++ /dev/null @@ -1,104 +0,0 @@ -get_string(SetupConfig::THEME, 'default'); - $site_name = $config->get_string(SetupConfig::TITLE); - $data_href = get_base_href(); - $main_page = $config->get_string(SetupConfig::MAIN_PAGE); - $contact_link = contact_link(); - $header_html = $page->get_all_html_headers(); - - $left_block_html = ""; - $main_block_html = ""; - $head_block_html = ""; - $sub_block_html = ""; - - foreach ($page->blocks as $block) { - switch ($block->section) { - case "left": - $left_block_html .= $block->get_html(true); - break; - case "head": - $head_block_html .= "".$block->get_html(false).""; - break; - case "main": - $main_block_html .= $block->get_html(false); - break; - case "subheading": - $sub_block_html .= $block->body; // $this->block_to_html($block, true); - break; - default: - print "

    error: {$block->header} using an unknown section ({$block->section})"; - break; - } - } - - $debug = get_debug_info(); - - $contact = empty($contact_link) ? "" : "
    Contact"; - /*$subheading = empty($page->subheading) ? "" : "

    {$page->subheading}
    "; - - $wrapper = ""; - if(strlen($page->heading) > 100) { - $wrapper = ' style="height: 3em; overflow: auto;"'; - } - */ - - $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $page->flash)))."" : ""; - - print << - - - - - - {$page->title} -$header_html - - - -
    - - - - $head_block_html - - - $sub_block_html -
    - -
    - $flash_html - $main_block_html -
    -
    - Images © their respective owners, - Shimmie © - Shish & - The Team - 2007-2019, - based on the Danbooru concept. - $debug - $contact -
    - - -EOD; - } -} diff --git a/themes/warm/page.class.php b/themes/warm/page.class.php index 5fc0f7ef..19c861cb 100644 --- a/themes/warm/page.class.php +++ b/themes/warm/page.class.php @@ -1,4 +1,72 @@ get_string(SetupConfig::TITLE); + $data_href = get_base_href(); + $main_page = $config->get_string(SetupConfig::MAIN_PAGE); + + $left_block_html = ""; + $main_block_html = ""; + $head_block_html = ""; + $sub_block_html = ""; + + foreach ($this->blocks as $block) { + switch ($block->section) { + case "left": + $left_block_html .= $block->get_html(true); + break; + case "head": + $head_block_html .= "".$block->get_html(false).""; + break; + case "main": + $main_block_html .= $block->get_html(false); + break; + case "subheading": + $sub_block_html .= $block->body; // $this->block_to_html($block, true); + break; + default: + print "

    error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + $flash_html = $this->flash ? "".nl2br(html_escape(implode("\n", $this->flash)))."" : ""; + $head_html = $this->head_html(); + $footer_html = $this->footer_html(); + + print << + + $head_html + +

    + + + + $head_block_html + + + $sub_block_html +
    + +
    + $flash_html + $main_block_html +
    + + + +EOD; + } }