From 90fcccdab0459173ad2953f13ae0eb5b0c14169e Mon Sep 17 00:00:00 2001
From: shish <shish@7f39781d-f577-437e-ae19-be835c7a54ca>
Date: Tue, 26 Aug 2008 09:06:29 +0000
Subject: [PATCH] various fix backports

git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@1006 7f39781d-f577-437e-ae19-be835c7a54ca
---
 core/page.class.php             | 2 --
 core/util.inc.php               | 2 --
 ext/bbcode/main.php             | 4 ++--
 themes/danbooru/index.theme.php | 1 +
 4 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/core/page.class.php b/core/page.class.php
index 97d9e312..55b35507 100644
--- a/core/page.class.php
+++ b/core/page.class.php
@@ -71,8 +71,6 @@ class GenericPage {
 	// ==============================================
 	
 	public function display() {
-		global $config;
-
 		header("Content-type: {$this->type}");
 
 		switch($this->mode) {
diff --git a/core/util.inc.php b/core/util.inc.php
index 046d7312..3aa69fae 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -174,8 +174,6 @@ function _count_execs($db, $sql, $inputarray) {
 }
 
 function get_theme_object($file, $class) {
-	global $config;
-	$theme = $config->get_string("theme", "default");
 	if(class_exists("Custom$class")) {
 		$class = "Custom$class";
 		return new $class();
diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php
index b188412f..95d6aac3 100644
--- a/ext/bbcode/main.php
+++ b/ext/bbcode/main.php
@@ -16,8 +16,8 @@ class BBCode extends Extension {
 		$text = preg_replace("/\[code\](.*?)\[\/code\]/s", "<pre>\\1</pre>", $text);
 		$text = preg_replace("/&gt;&gt;(\d+)/s", "<a href='".make_link("post/view/\\1")."'>&gt;&gt;\\1</a>", $text);
 		$text = preg_replace("/&gt;&gt;([^\d].+)/", "<blockquote><small>\\1</small></blockquote>", $text);
-		$text = preg_replace("/\[url=((?:https?|ftp|irc):\/\/.*?)\](.*?)\[\/url\]/s", "<a href='\\1'>\\2</a>", $text);
-		$text = preg_replace("/\[url\]((?:https?|ftp|irc):\/\/.*?)\[\/url\]/s", "<a href='\\1'>\\1</a>", $text);
+		$text = preg_replace("/\[url=((?:https?|ftp|irc|mailto):\/\/.*?)\](.*?)\[\/url\]/s", "<a href='\\1'>\\2</a>", $text);
+		$text = preg_replace("/\[url\]((?:https?|ftp|irc|mailto):\/\/.*?)\[\/url\]/s", "<a href='\\1'>\\1</a>", $text);
 		$text = preg_replace("/\[\[([^\|\]]+)\|([^\]]+)\]\]/s", "<a href='".make_link("wiki/\\1")."'>\\2</a>", $text);
 		$text = preg_replace("/\[\[([^\]]+)\]\]/s", "<a href='".make_link("wiki/\\1")."'>\\1</a>", $text);
 		$text = str_replace("\n", "\n<br>", $text);
diff --git a/themes/danbooru/index.theme.php b/themes/danbooru/index.theme.php
index 74b2bd09..43a8ab74 100644
--- a/themes/danbooru/index.theme.php
+++ b/themes/danbooru/index.theme.php
@@ -41,6 +41,7 @@ class CustomIndexTheme extends IndexTheme {
 			<p><form action='$h_search_link' method='GET'>
 				<input name='search' type='text'
 						value='$h_search_string' autocomplete='off' />
+				<input type='hidden' name='q' value='/post/list'>
 				<input type='submit' value='Find' style='display: none;' />
 			</form>
 			<div id='search_completions'></div>";