From ad2bb8b8b60ee0d2bf37d76373cb4649ab442461 Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 31 Dec 2011 14:12:05 +0000 Subject: [PATCH 01/11] switch timeago to a javascript implementation --- core/util.inc.php | 31 +-------- ext/setup/main.php | 2 - ext/user/main.php | 4 +- lib/jquery.timeago.js | 146 ++++++++++++++++++++++++++++++++++++++++++ lib/shimmie.js | 1 + 5 files changed, 152 insertions(+), 32 deletions(-) create mode 100644 lib/jquery.timeago.js diff --git a/core/util.inc.php b/core/util.inc.php index 98f17866..71a317f3 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -129,34 +129,9 @@ function to_shorthand_int($int) { * @retval string */ function autodate($date, $html=true) { - global $config; - - $format = $config->get_string('autodate_format', "F j, Y"); - $seconds = time() - strtotime($date); - $ago = seconds_to_time($seconds) . " ago"; - $on = "on " . date($format, strtotime($date)); - - if($config->get_bool('use_autodate', true)) { - return ($html ? "$ago" : $ago); - } - else { - return $on; - } -} - -/** - * Turn a number of seconds into a vague human timespan, eg 142 -> "2 minutes" - * - * @retval string - */ -function seconds_to_time($seconds) { - if($seconds<60) return $seconds . " second" . plural($seconds); $seconds = round($seconds/60); - if($seconds<60) return $seconds . " minute" . plural($seconds); $seconds = round($seconds/60); - if($seconds<24) return $seconds . " hour" . plural($seconds); $seconds = round($seconds/24); - if($seconds<7) return $seconds . " day" . plural($seconds); $seconds = round($seconds/7); - if($seconds<4) return $seconds . " week" . plural($seconds); $seconds = round($seconds/4); - if($seconds<12) return $seconds . " month" . plural($seconds); $seconds = round($seconds/12); - return $seconds . " year" . plural($seconds); + $cpu = date('c', strtotime($date)); + $hum = date('F j, Y', strtotime($date)); + return ($html ? "" : $hum); } diff --git a/ext/setup/main.php b/ext/setup/main.php index f1885568..7e7337e8 100644 --- a/ext/setup/main.php +++ b/ext/setup/main.php @@ -169,10 +169,8 @@ class Setup extends SimpleExtension { $config->set_default_string("main_page", "post/list"); $config->set_default_string("base_href", "./index.php?q="); $config->set_default_string("theme", "default"); - $config->set_default_bool("use_autodate", true); $config->set_default_bool("word_wrap", true); $config->set_default_bool("comment_captcha", false); - $config->set_default_string("autodate_format", "F j, Y"); // Automatic caching is disabled by default $config->set_default_string("autocache_location", "data/cache"); $config->set_default_bool("autocache_css", false); diff --git a/ext/user/main.php b/ext/user/main.php index 0b1073fa..fc0da212 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -166,8 +166,8 @@ class UserPage extends SimpleExtension { public function onUserPageBuilding(Event $event) { global $page, $user, $config; - $h_join_date = html_escape($event->display_user->join_date); - $event->add_stats("Join date: $h_join_date", 10); + $h_join_date = autodate($event->display_user->join_date); + $event->add_stats("Joined: $h_join_date", 10); $av = $event->display_user->get_avatar_html(); if($av) $event->add_stats($av, 0); diff --git a/lib/jquery.timeago.js b/lib/jquery.timeago.js new file mode 100644 index 00000000..24ac69c7 --- /dev/null +++ b/lib/jquery.timeago.js @@ -0,0 +1,146 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.10.0 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/lib/shimmie.js b/lib/shimmie.js index 6e72770c..258d592b 100644 --- a/lib/shimmie.js +++ b/lib/shimmie.js @@ -26,6 +26,7 @@ $(document).ready(function() { $confirm.dialog('open'); }); + $("time").timeago(); }); var defaultTexts = new Array(); From 3b73013d1dccf84e67a3d4aa5f42611f71887be2 Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 26 Dec 2011 04:57:59 +0000 Subject: [PATCH 02/11] This should fix the "Undefined variable" error. --- themes/lite/view.theme.php | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 0bb17d06..513e9fea 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -3,6 +3,7 @@ class CustomViewImageTheme extends ViewImageTheme { public function display_page($image, $editor_parts) { global $page; + $metatags = str_replace(" ", ", ", html_escape($image->get_tag_list())); $page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list())); $page->set_heading(html_escape($image->get_tag_list())); $page->add_html_header(""); From c2ad8322efde3e1284e3810c06bf1cd5a75fed34 Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 26 Dec 2011 21:29:04 +0000 Subject: [PATCH 03/11] fixed downloading flash with bookmarklet + added comments --- ext/upload/theme.php | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 50895783..bc0991cc 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -27,7 +27,7 @@ class UploadTheme extends Themelet { if($i==0){ $upload_list .= "
" . - "". + "". "
"; }else{ $upload_list .="
@@ -113,15 +113,31 @@ class UploadTheme extends Themelet { { /* Danbooru > Shimmie Bookmarklet. This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list. + Most likely this will stop working when Danbooru updates to v2, all depends if they switch the ids or not >_>. + Clicking the link on a danbooru image page should give you something along the lines of: + 'http://www.website.com/shimmie/upload?url="http://sonohara.donmai.us/data/crazylongurl.jpg&tags="too many tags"&rating="s"&source="http://danbooru.donmai.us/post/show/012345/"' + TODO: Possibly make the entire/most of the script into a .js file, and just make the bookmarklet load it on click (Something like that?) */ $title = "Danbooru to " . $config->get_string('title'); - $html .= '

' . - $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags, rating & source!))'; + $html .= '

' . + $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags/rating/source!))'; } From d9e1b935b0dcad06df0b933c213886f6ba0c9ef7 Mon Sep 17 00:00:00 2001 From: Daku Date: Tue, 27 Dec 2011 12:10:01 +0000 Subject: [PATCH 04/11] +/- buttons should now work in FF, instead of directing you to blank page --- ext/upload/theme.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/upload/theme.php b/ext/upload/theme.php index bc0991cc..fae6501f 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -27,11 +27,11 @@ class UploadTheme extends Themelet { if($i==0){ $upload_list .= "

" . - "". + "". "
"; }else{ $upload_list .="
- "; }else{ $upload_list .= - "". ""; From 12d4fcf813a6bee3c1b23ae0c790b498d65da693 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 28 Dec 2011 03:11:36 +0000 Subject: [PATCH 05/11] related block should now change title depending on what tag list is set to --- ext/tag_list/theme.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index f0fac49b..54e35f28 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -52,8 +52,12 @@ class TagListTheme extends Themelet { $html .= " $count"; } } - - $page->add_block(new Block("Related", $html, "left")); + + if($config->get_string('tag_list_image_type')=="tags"){ + $page->add_block(new Block("Tags", $html, "left"));} + else{ + $page->add_block(new Block("Related Tags", $html, "left")); + } } From b9bd4db41e407da84dd25ec7343f4be6109a2451 Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 28 Dec 2011 03:13:14 +0000 Subject: [PATCH 06/11] Tag list should now show under the search block, instead of under every other block --- ext/tag_list/theme.php | 4 ++-- themes/danbooru/view.theme.php | 2 +- themes/lite/view.theme.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 54e35f28..99d83664 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -54,9 +54,9 @@ class TagListTheme extends Themelet { } if($config->get_string('tag_list_image_type')=="tags"){ - $page->add_block(new Block("Tags", $html, "left"));} + $page->add_block(new Block("Tags", $html, "left", 10));} else{ - $page->add_block(new Block("Related Tags", $html, "left")); + $page->add_block(new Block("Related Tags", $html, "left", 10)); } } diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index e9538640..49663fa4 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -6,7 +6,7 @@ class CustomViewImageTheme extends ViewImageTheme { $page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list())); $page->set_heading(html_escape($image->get_tag_list())); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); - $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10)); + $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15)); $page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11)); } diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 513e9fea..5eb9d195 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -12,7 +12,7 @@ class CustomViewImageTheme extends ViewImageTheme { $page->add_html_header("get_thumb_link())."\">"); $page->add_html_header("id}"))."\">"); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); - $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 10)); + $page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15)); $page->add_block(new Block(null, $this->build_image_editor($image, $editor_parts), "main", 10)); $page->add_block(new Block(null, $this->build_pin($image), "main", 11)); } From dc4d156e1a0184ec2e8fc7ab7905e37b744746cc Mon Sep 17 00:00:00 2001 From: Daku Date: Wed, 28 Dec 2011 14:47:02 +0000 Subject: [PATCH 07/11] contact link should now properly link to email --- contrib/home/theme.php | 2 +- themes/danbooru/layout.class.php | 2 +- themes/default/layout.class.php | 2 +- themes/flat/layout.class.php | 2 +- themes/futaba/layout.class.php | 2 +- themes/lite/layout.class.php | 2 +- themes/old_default/layout.class.php | 2 +- themes/warm/layout.class.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/home/theme.php b/contrib/home/theme.php index 1fe601ff..21364625 100644 --- a/contrib/home/theme.php +++ b/contrib/home/theme.php @@ -47,7 +47,7 @@ EOD $counter_html diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index 5045adcc..cfdcc91f 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -88,7 +88,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; if(empty($this->subheading)) { $subheading = ""; diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php index 3ee91b82..0c733c1b 100644 --- a/themes/default/layout.class.php +++ b/themes/default/layout.class.php @@ -42,7 +42,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; $wrapper = ""; if(strlen($page->heading) > 100) { diff --git a/themes/flat/layout.class.php b/themes/flat/layout.class.php index f0e9a95b..c4fe7a05 100644 --- a/themes/flat/layout.class.php +++ b/themes/flat/layout.class.php @@ -42,7 +42,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; $subheading = empty($page->subheading) ? "" : "
{$page->subheading}
"; $wrapper = ""; diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php index 51f76716..21dacbc5 100644 --- a/themes/futaba/layout.class.php +++ b/themes/futaba/layout.class.php @@ -37,7 +37,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; if(empty($page->subheading)) { $subheading = ""; diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index c7273ab3..5053515f 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -138,7 +138,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; $subheading = empty($page->subheading) ? "" : "
{$page->subheading}
"; $wrapper = ""; diff --git a/themes/old_default/layout.class.php b/themes/old_default/layout.class.php index cb4e6952..5dff2b59 100644 --- a/themes/old_default/layout.class.php +++ b/themes/old_default/layout.class.php @@ -37,7 +37,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; $subheading = empty($page->subheading) ? "" : "
{$page->subheading}
"; $wrapper = ""; diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php index c843eb3a..680bdcc4 100644 --- a/themes/warm/layout.class.php +++ b/themes/warm/layout.class.php @@ -47,7 +47,7 @@ class Layout { $debug = get_debug_info(); - $contact = empty($contact_link) ? "" : "
Contact"; + $contact = empty($contact_link) ? "" : "
Contact"; $subheading = empty($page->subheading) ? "" : "
{$page->subheading}
"; $wrapper = ""; From dff1eef51a0efd17ff7b698470aa506d1d24a737 Mon Sep 17 00:00:00 2001 From: Daku Date: Thu, 29 Dec 2011 22:55:44 +0000 Subject: [PATCH 08/11] make_form now has a onsubmit option --- core/util.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/util.inc.php b/core/util.inc.php index 71a317f3..6c727710 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -254,13 +254,16 @@ function make_http($link) { * * @retval string */ -function make_form($target, $method="POST", $multipart=False, $form_id="") { +function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") { global $user; $auth = $user->get_auth_html(); $extra = empty($form_id) ? '' : " id='$form_id'"; if($multipart) { $extra .= " enctype='multipart/form-data'"; } + if($onsubmit) { + $extra .= " onsubmit='$onsubmit'"; + } return "
$auth"; } From 0d93f29bce8907e7412f304a694cf84b0ba80ed2 Mon Sep 17 00:00:00 2001 From: Daku Date: Thu, 29 Dec 2011 23:05:09 +0000 Subject: [PATCH 09/11] Delete by Query now requires you to enable the form, aswell as confirm the deletion. --- contrib/admin/theme.php | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/contrib/admin/theme.php b/contrib/admin/theme.php index edd9877d..038b9be7 100644 --- a/contrib/admin/theme.php +++ b/contrib/admin/theme.php @@ -32,12 +32,36 @@ class AdminPageTheme extends Themelet { "; $page->add_block(new Block("Misc Admin Tools", $html)); - + + /* First check + Requires you to click the checkbox to enable the delete by query form */ + $dbqcheck = " + if(document.getElementById("dbqcheck").checked == false){ + document.getElementById("dbqtags").disabled = true; + document.getElementById("dbqsubmit").disabled = true; + }else{ + document.getElementById("dbqtags").disabled = false; + document.getElementById("dbqsubmit").disabled = false; + }"; + + /* Second check + Requires you to confirm the deletion by clicking ok. */ $html = " - ".make_form(make_link("admin_utils"))." + " + + .make_form(make_link("admin_utils"),"post",false,false,"return checkform()")." + - - + + "; $page->add_block(new Block("Delete by Query", $html)); From c39697a40f25564d1152aa84b015042e752f4b5b Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 31 Dec 2011 14:21:02 +0000 Subject: [PATCH 10/11] stub for comment time-ago --- ext/comment/theme.php | 1 + themes/default/style.css | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ext/comment/theme.php b/ext/comment/theme.php index f48a7b25..264cd67b 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -179,6 +179,7 @@ class CommentListTheme extends Themelet { return "
+ $h_userlink: $h_comment $h_dellink
diff --git a/themes/default/style.css b/themes/default/style.css index 811fc9d7..db384169 100644 --- a/themes/default/style.css +++ b/themes/default/style.css @@ -128,6 +128,10 @@ UL { .comment { text-align: left; } +.comment .timeago { + float: right; + font-size: 75%; +} .more:after { content: " >>>"; From 56a780bfd380fb20e93fb98efc89e1933ecbfe35 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 1 Jan 2012 16:54:44 +0000 Subject: [PATCH 11/11] in per-letter mode, don't separate a and A --- core/database.class.php | 3 +++ ext/tag_list/main.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index 69d54e9e..53ed4b4d 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -75,6 +75,7 @@ class MySQL extends DBEngine { $data = str_replace("SCORE_DATETIME", "DATETIME", $data); $data = str_replace("SCORE_NOW", "\"1970-01-01\"", $data); $data = str_replace("SCORE_STRNORM", "", $data); + $data = str_replace("SCORE_ILIKE", "LIKE", $data); return $data; } @@ -96,6 +97,7 @@ class PostgreSQL extends DBEngine { $data = str_replace("SCORE_DATETIME", "TIMESTAMP", $data); $data = str_replace("SCORE_NOW", "current_time", $data); $data = str_replace("SCORE_STRNORM", "lower", $data); + $data = str_replace("SCORE_ILIKE", "ILIKE", $data); return $data; } @@ -142,6 +144,7 @@ class SQLite extends DBEngine { $data = str_replace("SCORE_BOOL", "CHAR(1)", $data); $data = str_replace("SCORE_NOW", "\"1970-01-01\"", $data); $data = str_replace("SCORE_STRNORM", "", $data); + $data = str_replace("SCORE_ILIKE", "LIKE", $data); $cols = array(); $extras = ""; foreach(explode(",", $data) as $bit) { diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index dcdf3b2c..1e71be3b 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -141,7 +141,7 @@ class TagList implements Extension { $tag_data = $database->get_col(" SELECT DISTINCT - substr(tag, 1, 1) + SCORE_STRNORM(substr(tag, 1, 1)) FROM tags WHERE count >= :tags_min ORDER BY tag @@ -183,7 +183,7 @@ class TagList implements Extension { FLOOR(LOG(2.7, LOG(2.7, count - :tags_min + 1)+1)*1.5*100)/100 AS scaled FROM tags WHERE count >= :tags_min - AND tag LIKE :starts_with + AND tag SCORE_ILIKE :starts_with ORDER BY tag ", array("tags_min"=>$tags_min, "starts_with"=>$starts_with)); @@ -215,7 +215,7 @@ class TagList implements Extension { SELECT tag, count FROM tags WHERE count >= :tags_min - AND tag LIKE :starts_with + AND tag SCORE_ILIKE :starts_with ORDER BY tag ", array("tags_min"=>$tags_min, "starts_with"=>$starts_with));