From 5b717870d1ee8a5b53e643f1c31f92b372c96717 Mon Sep 17 00:00:00 2001
From: Shish <shish@shishnet.org>
Date: Sun, 1 Jan 2012 17:13:50 +0000
Subject: [PATCH] case sensitivity blargh

---
 core/util.inc.php     |  6 +++++-
 ext/tag_list/main.php | 23 +++++++++--------------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/core/util.inc.php b/core/util.inc.php
index 6c727710..25e020f9 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -204,6 +204,10 @@ function make_link($page=null, $query=null) {
  * @retval string
  */
 function modify_current_url($changes) {
+	return modify_url($_SERVER['QUERY_STRING'], $changes);
+}
+
+function modify_url($url, $changes) {
 	// SHIT: PHP is officially the worst web API ever because it does not
 	// have a built-in function to do this.
 
@@ -212,7 +216,7 @@ function modify_current_url($changes) {
 	// whatever data the user supplied. Thankfully, 4.0.3 added an extra option to
 	// give it an array to use...
 	$params = array();
-	parse_str($_SERVER['QUERY_STRING'], $params);
+	parse_str($url, $params);
 
 	if(isset($changes['q'])) {
 		$base = $changes['q'];
diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php
index 0b1c537e..7efb1223 100644
--- a/ext/tag_list/main.php
+++ b/ext/tag_list/main.php
@@ -136,16 +136,13 @@ class TagList implements Extension {
 
 		$tags_min = $this->get_tags_min();
 
-		$cache_key = "data/tag_inits-" . md5("tc" . $tags_min) . ".html";
-		if(file_exists($cache_key)) {return file_get_contents($cache_key);}
-
-		$tag_data = $database->get_col("
+		$tag_data = $database->get_col($database->engine->scoreql_to_sql("
 			SELECT DISTINCT
 				SCORE_STRNORM(substr(tag, 1, 1))
 			FROM tags
 			WHERE count >= :tags_min
-			ORDER BY substr(tag, 1, 1)
-		", array("tags_min"=>$tags_min));
+			ORDER BY SCORE_STRNORM(substr(tag, 1, 1))
+		"), array("tags_min"=>$tags_min));
 
 		$html = "";
 		foreach($tag_data as $a) {
@@ -153,8 +150,6 @@ class TagList implements Extension {
 		}
 		$html .= "<p><hr>";
 
-		if(SPEED_HAX) {file_put_contents($cache_key, $html);}
-
 		return $html;
 	}
 // }}}
@@ -178,15 +173,15 @@ class TagList implements Extension {
 		if(file_exists($cache_key)) {return file_get_contents($cache_key);}
 
 		// SHIT: PDO/pgsql has problems using the same named param twice -_-;;
-		$tag_data = $database->get_all("
+		$tag_data = $database->get_all($database->engine->scoreql_to_sql("
 				SELECT
 					tag,
 					FLOOR(LOG(2.7, LOG(2.7, count - :tags_min2 + 1)+1)*1.5*100)/100 AS scaled
 				FROM tags
 				WHERE count >= :tags_min
 				AND tag SCORE_ILIKE :starts_with
-				ORDER BY tag
-			", array("tags_min"=>$tags_min, "tags_min2"=>$tags_min, "starts_with"=>$starts_with));
+				ORDER BY SCORE_STRNORM(tag)
+			"), array("tags_min"=>$tags_min, "tags_min2"=>$tags_min, "starts_with"=>$starts_with));
 
 		$html = "";
 		if($config->get_bool("tag_list_pages")) $html .= $this->build_az();
@@ -212,13 +207,13 @@ class TagList implements Extension {
 		$cache_key = "data/tag_alpha-" . md5("ta" . $tags_min . $starts_with) . ".html";
 		if(file_exists($cache_key)) {return file_get_contents($cache_key);}
 
-		$tag_data = $database->get_all("
+		$tag_data = $database->get_all($database->engine->scoreql_to_sql("
 				SELECT tag, count
 				FROM tags
 				WHERE count >= :tags_min
 				AND tag SCORE_ILIKE :starts_with
-				ORDER BY tag
-				", array("tags_min"=>$tags_min, "starts_with"=>$starts_with));
+				ORDER BY SCORE_STRNORM(tag)
+				"), array("tags_min"=>$tags_min, "starts_with"=>$starts_with));
 
 		$html = "";
 		if($config->get_bool("tag_list_pages")) $html .= $this->build_az();