From 18160f02e8bf9da9088ef54ee17472d1ad1afbc4 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Sat, 21 Feb 2004 23:52:11 +0000 Subject: - Sanatize title before doing LIKE matches. --- modules/title.module | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/title.module') diff --git a/modules/title.module b/modules/title.module index e23031aa4..fd02de0c7 100644 --- a/modules/title.module +++ b/modules/title.module @@ -26,6 +26,7 @@ function title_page() { $title = urldecode(arg(1)); $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title = '%s' AND n.status = 1 ORDER BY n.created DESC", $title); + $title = trim(str_replace(array('_', '%', '*'), ' ', $title)); if (db_num_rows($result) == 0) { // No node with exact title found, try substring. $result = db_query("SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.title LIKE '%%%s%%' AND n.status = 1 ORDER BY n.created DESC", $title); -- cgit v1.2.3