From d47b9034494a75e043aff695b24f52b1fc60f698 Mon Sep 17 00:00:00 2001 From: Zach Hall Date: Mon, 22 Mar 2010 19:48:44 -0700 Subject: [PATCH] Titlebar updates - current page links --- themes/danbooru/layout.class.php | 41 +++++++++++++++++++++++++------- themes/lite/layout.class.php | 2 +- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index 14f74675..09e8355c 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -102,21 +102,21 @@ class Layout { // bzchan: CUSTOM LINKS are prepared here, change these to whatever you like $custom_links = ""; if($user->is_anonymous()) { - $custom_links .= "
  • My Account
  • "; + $custom_links .= $this->navlinks(make_link('user_admin/login'), "My Account", array("user", "user_admin", "setup", "admin")); } else { - $custom_links .= "
  • My Account
  • "; + $custom_links .= $this->navlinks(make_link('user'), "My Account", array("user", "user_admin")); } - $custom_links .= "
  • Posts
  • "; - $custom_links .= "
  • Comments
  • "; - $custom_links .= "
  • Tags
  • "; + $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 .= "
  • Pools
  • "; + $custom_links .= $this->navlinks(make_link('pool/list'), "Pools", array("pool")); } - $custom_links .= "
  • Upload
  • "; + $custom_links .= $this->navlinks(make_link('upload'), "Upload", array("upload")); if(class_exists("Wiki")) { - $custom_links .= "
  • Wiki
  • "; - $custom_links .= "
  • More »
  • "; + $custom_links .= $this->navlinks(make_link('wiki'), "Wiki", array("wiki")); + $custom_links .= $this->navlinks(make_link('wiki/more'), "More »", array("wiki/more")); } $custom_sublinks = ""; @@ -169,6 +169,7 @@ class Layout { break; } + // 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

    "; @@ -245,5 +246,27 @@ EOD; } return $html; } + private function navlinks($link, $desc, $pages_matched) { + /** + * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) + */ + $html = null; + $url = $_GET['q']; + + $re1='.*?'; + $re2='((?:[a-z][a-z]+))'; + + if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) { + $url=$matches[1][0]; + } + + for($i=0;$i diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index 8516a069..eef078b6 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -238,7 +238,7 @@ EOD; private function navlinks($link, $desc, $pages_matched) { /** - * Woo! We can actually SEE THE CURRENT PAGE!! + * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) */ $html = null; $url = $_GET['q'];