From 2859d5819173bf48c4b79caf86c57841fe53dbfc Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 13 Jun 2013 12:42:30 +0100 Subject: [PATCH] regex and trimming updates for danbooru and lite themes --- themes/danbooru/layout.class.php | 6 +++--- themes/lite/layout.class.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index 2a54ae20..dbe89cf6 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -125,7 +125,7 @@ class Layout { global $user; $username = url_escape($user->name); // hack - $qp = explode("/", @$_GET["q"]); + $qp = explode("/", ltrim(@$_GET["q"], "/")); $hw = class_exists("Wiki"); // php sucks switch($qp[0]) { @@ -247,10 +247,10 @@ EOD; * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) */ $html = null; - $url = $_GET['q']; + $url = ltrim($_GET['q'], "/"); $re1='.*?'; - $re2='((?:[a-z][a-z]+))'; + $re2='((?:[a-z][a-z_]+))'; if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) { $url=$matches[1][0]; diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index cd498298..2e132e44 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -80,7 +80,7 @@ class Layout { global $user; $username = url_escape($user->name); // hack - $qp = explode("/", @$_GET["q"]); + $qp = explode("/", ltrim(@$_GET["q"], "/")); $hw = class_exists("Wiki"); // php sucks switch($qp[0]) { @@ -236,10 +236,10 @@ EOD; * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) */ $html = null; - $url = $_GET['q']; + $url = ltrim($_GET['q'], "/"); $re1='.*?'; - $re2='((?:[a-z][a-z]+))'; + $re2='((?:[a-z][a-z_]+))'; if ($c=preg_match_all ("/".$re1.$re2."/is", $url, $matches)) { $url=$matches[1][0];