? sites/default/files ? sites/default/settings.php Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.9 diff -u -p -r1.9 actions.inc --- includes/actions.inc 17 Feb 2008 22:15:04 -0000 1.9 +++ includes/actions.inc 29 Feb 2008 06:04:09 -0000 @@ -236,7 +236,7 @@ function actions_function_lookup($hash) } // Must be an instance; must check database. - $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s' AND parameters != ''", $hash)); + $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s' AND parameters <> '%s'", $hash, '')); return $aid; } @@ -253,7 +253,7 @@ function actions_synchronize($actions_in $actions_in_code = actions_list(); } $actions_in_db = array(); - $result = db_query("SELECT * FROM {actions} WHERE parameters = ''"); + $result = db_query("SELECT * FROM {actions} WHERE parameters = '%s'", ''); while ($action = db_fetch_object($result)) { $actions_in_db[$action->callback] = array('aid' => $action->aid, 'description' => $action->description); } Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.17 diff -u -p -r1.17 cache.inc --- includes/cache.inc 29 Jan 2008 11:36:06 -0000 1.17 +++ includes/cache.inc 29 Feb 2008 06:04:09 -0000 @@ -157,13 +157,13 @@ function cache_clear_all($cid = NULL, $t else if (time() > ($cache_flush + variable_get('cache_lifetime', 0))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. - db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {". $table ."} WHERE expire <> %d AND expire < %d", CACHE_PERMANENT, time()); variable_set('cache_flush', 0); } } else { // No minimum cache lifetime, flush all temporary cache entries now. - db_query("DELETE FROM {". $table ."} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, time()); + db_query("DELETE FROM {". $table ."} WHERE expire <> %d AND expire < %d", CACHE_PERMANENT, time()); } } else { @@ -172,7 +172,7 @@ function cache_clear_all($cid = NULL, $t db_query("DELETE FROM {". $table ."}"); } else { - db_query("DELETE FROM {". $table ."} WHERE cid LIKE '%s%%'", $cid); + db_query("DELETE FROM {". $table ."} WHERE cid LIKE '%s'", $cid ."%"); } } else { Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.174 diff -u -p -r1.174 locale.inc --- includes/locale.inc 9 Jan 2008 21:36:13 -0000 1.174 +++ includes/locale.inc 29 Feb 2008 06:04:10 -0000 @@ -338,13 +338,13 @@ function locale_languages_edit_form_vali if (!empty($form_state['values']['domain']) && !empty($form_state['values']['prefix'])) { form_set_error('prefix', t('Domain and path prefix values should not be set at the same time.')); } - if (!empty($form_state['values']['domain']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE domain = '%s' AND language != '%s'", $form_state['values']['domain'], $form_state['values']['langcode']))) { + if (!empty($form_state['values']['domain']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE domain = '%s' AND language <> '%s'", $form_state['values']['domain'], $form_state['values']['langcode']))) { form_set_error('domain', t('The domain (%domain) is already tied to a language (%language).', array('%domain' => $form_state['values']['domain'], '%language' => $duplicate->language))); } if (empty($form_state['values']['prefix']) && language_default('language') != $form_state['values']['langcode'] && empty($form_state['values']['domain'])) { form_set_error('prefix', t('Only the default language can have both the domain and prefix empty.')); } - if (!empty($form_state['values']['prefix']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE prefix = '%s' AND language != '%s'", $form_state['values']['prefix'], $form_state['values']['langcode']))) { + if (!empty($form_state['values']['prefix']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE prefix = '%s' AND language <> '%s'", $form_state['values']['prefix'], $form_state['values']['langcode']))) { form_set_error('prefix', t('The prefix (%prefix) is already tied to a language (%language).', array('%prefix' => $form_state['values']['prefix'], '%language' => $duplicate->language))); } } @@ -815,7 +815,7 @@ function locale_translate_edit_form(&$fo } // Fetch translations and fill in default values in the form. - $result = db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = %d AND language != '%s'", $lid, $omit); + $result = db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = %d AND language <> '%s'", $lid, $omit); while ($translation = db_fetch_object($result)) { $form['translations'][$translation->language]['#default_value'] = $translation->translation; } @@ -1920,21 +1920,21 @@ function _locale_translate_seek() { // Compute LIKE section switch ($query['translation']) { case 'translated': - $where = "WHERE (t.translation LIKE '%%%s%%')"; + $where = "WHERE (t.translation LIKE '%s')"; $orderby = "ORDER BY t.translation"; - $arguments[] = $query['string']; + $arguments[] = "%". $query['string'] ."%"; break; case 'untranslated': - $where = "WHERE (s.source LIKE '%%%s%%' AND t.translation IS NULL)"; + $where = "WHERE (s.source LIKE '%s' AND t.translation IS NULL)"; $orderby = "ORDER BY s.source"; - $arguments[] = $query['string']; + $arguments[] = "%". $query['string'] ."%"; break; case 'all' : default: - $where = "WHERE (s.source LIKE '%%%s%%' OR t.translation LIKE '%%%s%%')"; + $where = "WHERE (s.source LIKE '%s' OR t.translation LIKE '%s')"; $orderby = ''; - $arguments[] = $query['string']; - $arguments[] = $query['string']; + $arguments[] = "%". $query['string'] ."%"; + $arguments[] = "%". $query['string'] ."%"; break; } $grouplimit = ''; @@ -1946,8 +1946,8 @@ function _locale_translate_seek() { switch ($query['language']) { // Force search in source strings case "en": - $sql = $join ." WHERE s.source LIKE '%%%s%%' $grouplimit ORDER BY s.source"; - $arguments = array($query['string']); // $where is not used, discard its arguments + $sql = $join ." WHERE s.source LIKE '%s' $grouplimit ORDER BY s.source"; + $arguments = array("%". $query['string'] ."%"); // $where is not used, discard its arguments if (!empty($grouplimit)) { $arguments[] = $query['group']; } @@ -2068,7 +2068,7 @@ function _locale_rebuild_js($langcode = // Construct the array for JavaScript translations. // We sort on plural so that we have all plural forms before singular forms. - $result = db_query("SELECT s.lid, s.source, t.plid, t.plural, t.translation FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.location LIKE '%%.js%%' AND s.textgroup = 'default' ORDER BY t.plural DESC", $language->language); + $result = db_query("SELECT s.lid, s.source, t.plid, t.plural, t.translation FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = '%s' WHERE s.location LIKE '%s' AND s.textgroup = 'default' ORDER BY t.plural DESC", $language->language, '%.js%'); $translations = $plurals = array(); while ($data = db_fetch_object($result)) { Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.264 diff -u -p -r1.264 menu.inc --- includes/menu.inc 23 Feb 2008 08:13:09 -0000 1.264 +++ includes/menu.inc 29 Feb 2008 06:04:11 -0000 @@ -1962,7 +1962,7 @@ function _menu_clear_page_cache() { */ function _menu_set_expanded_menus() { $names = array(); - $result = db_query("SELECT menu_name FROM {menu_links} WHERE expanded != 0 GROUP BY menu_name"); + $result = db_query("SELECT menu_name FROM {menu_links} WHERE expanded <> 0 GROUP BY menu_name"); while ($n = db_fetch_array($result)) { $names[] = $n['menu_name']; } Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.20 diff -u -p -r1.20 path.inc --- includes/path.inc 18 Feb 2008 16:49:23 -0000 1.20 +++ includes/path.inc 29 Feb 2008 06:04:11 -0000 @@ -60,7 +60,7 @@ function drupal_lookup_path($action, $pa return $map[$path_language][$path]; } // Get the most fitting result falling back with alias without language - $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language)); + $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '%s') ORDER BY language DESC", $path, $path_language, '')); $map[$path_language][$path] = $alias; return $alias; } @@ -71,7 +71,7 @@ function drupal_lookup_path($action, $pa $src = ''; if (!isset($map[$path_language]) || !($src = array_search($path, $map[$path_language]))) { // Get the most fitting result falling back with alias without language - if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language))) { + if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '%s') ORDER BY language DESC", $path, $path_language, ''))) { $map[$path_language][$src] = $path; } else { Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.7 diff -u -p -r1.7 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 10 Jan 2008 22:47:17 -0000 1.7 +++ modules/aggregator/aggregator.admin.inc 29 Feb 2008 06:04:11 -0000 @@ -117,10 +117,10 @@ function aggregator_form_feed_validate($ } // Check for duplicate titles. if (isset($form_state['values']['fid'])) { - $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url='%s') AND fid != %d", $form_state['values']['title'], $form_state['values']['url'], $form_state['values']['fid']); + $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url = '%s') AND fid <> %d", $form_state['values']['title'], $form_state['values']['url'], $form_state['values']['fid']); } else { - $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url='%s'", $form_state['values']['title'], $form_state['values']['url']); + $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url = '%s'", $form_state['values']['title'], $form_state['values']['url']); } while ($feed = db_fetch_object($result)) { if (strcasecmp($feed->title, $form_state['values']['title']) == 0) { @@ -286,7 +286,7 @@ function aggregator_form_category_valida if ($form_state['values']['op'] == t('Save')) { // Check for duplicate titles if (isset($form_state['values']['cid'])) { - $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s' AND cid != %d", $form_state['values']['title'], $form_state['values']['cid'])); + $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s' AND cid <> %d", $form_state['values']['title'], $form_state['values']['cid'])); } else { $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s'", $form_state['values']['title'])); Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.14 diff -u -p -r1.14 block.admin.inc --- modules/block/block.admin.inc 22 Dec 2007 23:24:24 -0000 1.14 +++ modules/block/block.admin.inc 29 Feb 2008 06:04:11 -0000 @@ -260,7 +260,7 @@ function block_admin_configure(&$form_st function block_admin_configure_validate($form, &$form_state) { if ($form_state['values']['module'] == 'block') { - if (empty($form_state['values']['info']) || db_result(db_query("SELECT COUNT(*) FROM {boxes} WHERE bid != %d AND info = '%s'", $form_state['values']['delta'], $form_state['values']['info']))) { + if (empty($form_state['values']['info']) || db_result(db_query("SELECT COUNT(*) FROM {boxes} WHERE bid <> %d AND info = '%s'", $form_state['values']['delta'], $form_state['values']['info']))) { form_set_error('info', t('Please ensure that each block description is unique.')); } } Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.300 diff -u -p -r1.300 block.module --- modules/block/block.module 20 Feb 2008 13:46:38 -0000 1.300 +++ modules/block/block.module 29 Feb 2008 06:04:11 -0000 @@ -356,7 +356,7 @@ function block_user($type, $edit, &$acco case 'form': if ($category == 'account') { $rids = array_keys($account->roles); - $result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom != 0 AND (r.rid IN (". db_placeholders($rids) .") OR r.rid IS NULL) ORDER BY b.weight, b.module", $rids); + $result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom <> 0 AND (r.rid IN (". db_placeholders($rids) .") OR r.rid IS NULL) ORDER BY b.weight, b.module", $rids); $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE); while ($block = db_fetch_object($result)) { $data = module_invoke($block->module, 'block', 'list'); Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.621 diff -u -p -r1.621 comment.module --- modules/comment/comment.module 23 Feb 2008 08:02:48 -0000 1.621 +++ modules/comment/comment.module 29 Feb 2008 06:04:12 -0000 @@ -755,7 +755,7 @@ function comment_save($edit) { $parent->thread = (string) rtrim((string) $parent->thread, '/'); // Get the max value in _this_ thread. - $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s.%%' AND nid = %d", $parent->thread, $edit['nid'])); + $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s' AND nid = %d", $parent->thread .".%", $edit['nid'])); if ($max == '') { // First child of this parent. Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.206 diff -u -p -r1.206 filter.module --- modules/filter/filter.module 20 Feb 2008 13:46:39 -0000 1.206 +++ modules/filter/filter.module 29 Feb 2008 06:04:12 -0000 @@ -303,8 +303,8 @@ function filter_formats($index = NULL) { if (!$all) { $where = array(); foreach ($user->roles as $rid => $role) { - $where[] = "roles LIKE '%%,%d,%%'"; - $args[] = $rid; + $where[] = "roles LIKE '%s'"; + $args[] = '%,'. (int) $rid .',%'; } $query .= ' WHERE '. implode(' OR ', $where) .' OR format = %d'; $args[] = variable_get('filter_default_format', 1); Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.452 diff -u -p -r1.452 forum.module --- modules/forum/forum.module 20 Feb 2008 13:46:39 -0000 1.452 +++ modules/forum/forum.module 29 Feb 2008 06:04:12 -0000 @@ -529,7 +529,7 @@ function forum_get_forums($tid = 0) { // This query does not use full ANSI syntax since MySQL 3.x does not support // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. - $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; + $sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid <> 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC"; $sql = db_rewrite_sql($sql); $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1)); @@ -577,7 +577,7 @@ function forum_get_topics($tid, $sortby, $term = taxonomy_get_term($tid); - $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d"); + $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid <> 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d"); $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,'); $sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top. Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.20 diff -u -p -r1.20 node.admin.inc --- modules/node/node.admin.inc 6 Feb 2008 19:38:27 -0000 1.20 +++ modules/node/node.admin.inc 29 Feb 2008 06:04:12 -0000 @@ -464,7 +464,7 @@ function node_admin_nodes() { $result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC'), 50, 0, NULL, $filter['args']); // Enable language column if locale is enabled or if we have any node with language - $count = db_result(db_query("SELECT COUNT(*) FROM {node} n WHERE language != ''")); + $count = db_result(db_query("SELECT COUNT(*) FROM {node} n WHERE language <> '%s'", '')); $multilanguage = (module_exists('locale') || $count); $form['options'] = array( Index: modules/path/path.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v retrieving revision 1.7 diff -u -p -r1.7 path.admin.inc --- modules/path/path.admin.inc 8 Jan 2008 10:35:42 -0000 1.7 +++ modules/path/path.admin.inc 29 Feb 2008 06:04:12 -0000 @@ -15,13 +15,13 @@ function path_admin_overview($keys = NUL // Add the filter form above the overview table. $output = drupal_get_form('path_admin_filter_form', $keys); // Enable language column if locale is enabled or if we have any alias with language - $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''")); + $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language <> '%s'", '')); $multilanguage = (module_exists('locale') || $count); if ($keys) { // Replace wildcards with MySQL/PostgreSQL wildcards. - $keys = preg_replace('!\*+!', '%', $keys); - $sql = "SELECT * FROM {url_alias} WHERE dst LIKE '%%%s%%'"; + $keys = "%". preg_replace('!\*+!', '%', $keys) ."%"; + $sql = "SELECT * FROM {url_alias} WHERE dst LIKE '%s'"; } else { $sql = 'SELECT * FROM {url_alias}'; @@ -135,7 +135,7 @@ function path_admin_form_validate($form, // Language is only set if locale module is enabled, otherwise save for all languages. $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : ''; - if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) { + if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid <> %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) { form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst))); } $item = menu_get_item($src); Index: modules/path/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.module,v retrieving revision 1.139 diff -u -p -r1.139 path.module --- modules/path/path.module 20 Feb 2008 13:46:40 -0000 1.139 +++ modules/path/path.module 29 Feb 2008 06:04:13 -0000 @@ -136,7 +136,7 @@ function path_nodeapi(&$node, $op, $arg) switch ($op) { case 'validate': $node->path = trim($node->path); - if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) { + if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src <> '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) { form_set_error('path', t('The path is already in use.')); } break; Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.264 diff -u -p -r1.264 poll.module --- modules/poll/poll.module 20 Feb 2008 13:46:40 -0000 1.264 +++ modules/poll/poll.module 29 Feb 2008 06:04:13 -0000 @@ -164,7 +164,7 @@ function poll_block($op = 'list', $delta * Closes polls that have exceeded their allowed runtime. */ function poll_cron() { - $result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < '. time() .' AND p.active = 1 AND p.runtime != 0'); + $result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < '. time() .' AND p.active = 1 AND p.runtime <> 0'); while ($poll = db_fetch_object($result)) { db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid); } Index: modules/profile/profile.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v retrieving revision 1.9 diff -u -p -r1.9 profile.admin.inc --- modules/profile/profile.admin.inc 18 Feb 2008 16:53:36 -0000 1.9 +++ modules/profile/profile.admin.inc 29 Feb 2008 06:04:13 -0000 @@ -310,7 +310,7 @@ function profile_field_form_validate($fo if (isset($form_state['values']['fid'])) { $args1[] = $args2[] = $form_state['values']['fid']; - $query_suffix = ' AND fid != %d'; + $query_suffix = ' AND fid <> %d'; } if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s' AND category = '%s'". $query_suffix, $args1))) { @@ -396,7 +396,7 @@ function profile_field_delete_submit($fo */ function profile_admin_settings_autocomplete($string) { $matches = array(); - $result = db_query_range("SELECT category FROM {profile_fields} WHERE LOWER(category) LIKE LOWER('%s%%')", $string, 0, 10); + $result = db_query_range("SELECT category FROM {profile_fields} WHERE LOWER(category) LIKE LOWER('%s')", $string ."%", 0, 10); while ($data = db_fetch_object($result)) { $matches[$data->category] = check_plain($data->category); } Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.236 diff -u -p -r1.236 profile.module --- modules/profile/profile.module 3 Feb 2008 19:36:46 -0000 1.236 +++ modules/profile/profile.module 29 Feb 2008 06:04:13 -0000 @@ -296,10 +296,10 @@ function profile_view_profile(&$user) { // Show private fields to administrators and people viewing their own account. if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) { - $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility <> %d ORDER BY category, weight', PROFILE_HIDDEN); } else { - $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility <> %d AND visibility <> %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN); } $fields = array(); @@ -565,7 +565,7 @@ function _profile_get_fields($category, $args[] = $category; } if (!user_access('administer users')) { - $filters[] = 'visibility != %d'; + $filters[] = 'visibility <> %d'; $args[] = PROFILE_HIDDEN; } $sql .= implode(' AND ', $filters); Index: modules/profile/profile.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 profile.pages.inc --- modules/profile/profile.pages.inc 8 Dec 2007 14:06:22 -0000 1.2 +++ modules/profile/profile.pages.inc 29 Feb 2008 06:04:13 -0000 @@ -29,7 +29,7 @@ function profile_browse() { // Compile a list of fields to show. $fields = array(); - $result = db_query('SELECT name, title, type, weight, page FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS); + $result = db_query('SELECT name, title, type, weight, page FROM {profile_fields} WHERE fid <> %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS); while ($record = db_fetch_object($result)) { $fields[] = $record; } @@ -46,8 +46,8 @@ function profile_browse() { $arguments[] = $value; break; case 'list': - $query = "v.value LIKE '%%%s%%'"; - $arguments[] = $value; + $query = "v.value LIKE '%s'"; + $arguments[] = "%". $value ."%"; break; default: drupal_not_found(); @@ -55,7 +55,7 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access != 0 AND u.status != 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments); + $result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query AND u.access <> 0 AND u.status <> 0 ORDER BY u.access DESC", 20, 0, NULL, $arguments); $content = ''; while ($account = db_fetch_object($result)) { @@ -88,7 +88,7 @@ function profile_browse() { } // Extract the affected users: - $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status != 0 AND access != 0 ORDER BY access DESC', 20, 0, NULL); + $result = pager_query('SELECT uid, access FROM {users} WHERE uid > 0 AND status <> 0 AND access <> 0 ORDER BY access DESC', 20, 0, NULL); $content = ''; while ($account = db_fetch_object($result)) { @@ -110,7 +110,7 @@ function profile_browse() { function profile_autocomplete($field, $string) { $matches = array(); if (db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE fid = %d AND autocomplete = 1", $field))) { - $result = db_query_range("SELECT value FROM {profile_values} WHERE fid = %d AND LOWER(value) LIKE LOWER('%s%%') GROUP BY value ORDER BY value ASC", $field, $string, 0, 10); + $result = db_query_range("SELECT value FROM {profile_values} WHERE fid = %d AND LOWER(value) LIKE LOWER('%s') GROUP BY value ORDER BY value ASC", $field, $string ."%", 0, 10); while ($data = db_fetch_object($result)) { $matches[$data->value] = check_plain($data->value); } Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.251 diff -u -p -r1.251 search.module --- modules/search/search.module 20 Feb 2008 13:46:40 -0000 1.251 +++ modules/search/search.module 29 Feb 2008 06:04:13 -0000 @@ -852,7 +852,7 @@ function _search_parse_query(&$word, &$s } } // Return matching snippet and number of added words - return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $num_new_scores, $num_valid_words); + return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%s'", "% ". $num_new_scores ." %", $num_valid_words); } /** Index: modules/statistics/statistics.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.admin.inc,v retrieving revision 1.6 diff -u -p -r1.6 statistics.admin.inc --- modules/statistics/statistics.admin.inc 8 Jan 2008 10:35:42 -0000 1.6 +++ modules/statistics/statistics.admin.inc 29 Feb 2008 06:04:13 -0000 @@ -107,8 +107,8 @@ function statistics_top_visitors() { * Menu callback; presents the "referrer" page. */ function statistics_top_referrers() { - $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%%%s%%' AND url <> '' GROUP BY url"; - $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%%%s%%'"; + $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%s' AND url <> '%s' GROUP BY url"; + $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url NOT LIKE '%s' AND url <> '%s'"; drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $header = array( @@ -118,7 +118,7 @@ function statistics_top_referrers() { ); $query .= tablesort_sql($header); - $result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']); + $result = pager_query($query, 30, 0, $query_cnt, "%". $_SERVER['HTTP_HOST'] ."%", ''); $rows = array(); while ($referrer = db_fetch_object($result)) { Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.273 diff -u -p -r1.273 statistics.module --- modules/statistics/statistics.module 20 Feb 2008 13:46:40 -0000 1.273 +++ modules/statistics/statistics.module 29 Feb 2008 06:04:13 -0000 @@ -210,7 +210,7 @@ function statistics_cron() { */ function statistics_title_list($dbfield, $dbrows) { if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) { - return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE s.". $dbfield ." != 0 AND n.status = 1 ORDER BY s.". $dbfield ." DESC"), 0, $dbrows); + return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE s.". $dbfield ." <> 0 AND n.status = 1 ORDER BY s.". $dbfield ." DESC"), 0, $dbrows); } return FALSE; } Index: modules/statistics/statistics.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 statistics.pages.inc --- modules/statistics/statistics.pages.inc 20 Oct 2007 21:57:50 -0000 1.2 +++ modules/statistics/statistics.pages.inc 29 Feb 2008 06:04:13 -0000 @@ -15,7 +15,7 @@ function statistics_node_tracker() { array('data' => t('User'), 'field' => 'u.name'), array('data' => t('Operations'))); - $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\''. tablesort_sql($header), 30, 0, NULL, $node->nid); + $result = pager_query("SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE '%s'". tablesort_sql($header), 30, 0, NULL, "node/". (int) $node->nid ."%"); $rows = array(); while ($log = db_fetch_object($result)) { $rows[] = array( Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.64 diff -u -p -r1.64 system.admin.inc --- modules/system/system.admin.inc 20 Feb 2008 13:46:41 -0000 1.64 +++ modules/system/system.admin.inc 29 Feb 2008 06:04:14 -0000 @@ -27,7 +27,7 @@ function system_main_admin_page($arg = N SELECT m.*, ml.* FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path - WHERE ml.link_path != 'admin/help' AND menu_name = '%s' AND ml.plid = %d AND hidden = 0", $admin); + WHERE ml.link_path <> 'admin/help' AND menu_name = '%s' AND ml.plid = %d AND hidden = 0", $admin); while ($item = db_fetch_array($result)) { _menu_link_translate($item); if (!$item['access']) { Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.592 diff -u -p -r1.592 system.module --- modules/system/system.module 20 Feb 2008 13:46:41 -0000 1.592 +++ modules/system/system.module 29 Feb 2008 06:04:15 -0000 @@ -1325,7 +1325,7 @@ function system_actions_manage() { } $row = array(); - $instances_present = db_fetch_object(db_query("SELECT aid FROM {actions} WHERE parameters != ''")); + $instances_present = db_fetch_object(db_query("SELECT aid FROM {actions} WHERE parameters <> '%s'", '')); $header = array( array('data' => t('Action type'), 'field' => 'type'), array('data' => t('Description'), 'field' => 'description'), Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.416 diff -u -p -r1.416 taxonomy.module --- modules/taxonomy/taxonomy.module 20 Feb 2008 13:46:42 -0000 1.416 +++ modules/taxonomy/taxonomy.module 29 Feb 2008 06:04:15 -0000 @@ -734,7 +734,7 @@ function taxonomy_node_type($op, $info) */ function taxonomy_get_related($tid, $key = 'tid') { if ($tid) { - $result = db_query('SELECT t.*, tid1, tid2 FROM {term_relation}, {term_data} t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = %d OR tid2 = %d) AND t.tid != %d ORDER BY weight, name', $tid, $tid, $tid); + $result = db_query('SELECT t.*, tid1, tid2 FROM {term_relation}, {term_data} t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = %d OR tid2 = %d) AND t.tid <> %d ORDER BY weight, name', $tid, $tid, $tid); $related = array(); while ($term = db_fetch_object($result)) { $related[$term->$key] = $term; Index: modules/taxonomy/taxonomy.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v retrieving revision 1.10 diff -u -p -r1.10 taxonomy.pages.inc --- modules/taxonomy/taxonomy.pages.inc 6 Feb 2008 19:38:28 -0000 1.10 +++ modules/taxonomy/taxonomy.pages.inc 29 Feb 2008 06:04:16 -0000 @@ -119,7 +119,7 @@ function taxonomy_autocomplete($vid, $st $last_string = trim(array_pop($array)); $matches = array(); if ($last_string != '') { - $result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = %d AND LOWER(t.name) LIKE LOWER('%%%s%%')", 't', 'tid'), $vid, $last_string, 0, 10); + $result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = %d AND LOWER(t.name) LIKE LOWER('%s')", 't', 'tid'), $vid, "%". $last_string ."%", 0, 10); $prefix = count($array) ? implode(', ', $array) .', ' : ''; Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.24 diff -u -p -r1.24 translation.module --- modules/translation/translation.module 20 Feb 2008 13:46:42 -0000 1.24 +++ modules/translation/translation.module 29 Feb 2008 06:04:16 -0000 @@ -227,7 +227,7 @@ function translation_nodeapi(&$node, $op db_query("UPDATE {node} SET tnid = %d, translate = %d WHERE nid = %d", $node->tnid, $node->translation['status'], $node->nid); if (!empty($node->translation['retranslate'])) { // This is the source node, asking to mark all translations outdated. - db_query("UPDATE {node} SET translate = 1 WHERE tnid = %d AND nid != %d", $node->tnid, $node->nid); + db_query("UPDATE {node} SET translate = 1 WHERE tnid = %d AND nid <> %d", $node->tnid, $node->nid); } } break; Index: modules/user/user.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v retrieving revision 1.19 diff -u -p -r1.19 user.admin.inc --- modules/user/user.admin.inc 20 Feb 2008 13:46:43 -0000 1.19 +++ modules/user/user.admin.inc 29 Feb 2008 06:04:16 -0000 @@ -675,7 +675,7 @@ function user_admin_role() { function user_admin_role_validate($form, &$form_state) { if ($form_state['values']['name']) { if ($form_state['values']['op'] == t('Save role')) { - if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s' AND rid != %d", $form_state['values']['name'], $form_state['values']['rid']))) { + if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s' AND rid <> %d", $form_state['values']['name'], $form_state['values']['rid']))) { form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name']))); } } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.896 diff -u -p -r1.896 user.module --- modules/user/user.module 20 Feb 2008 13:46:43 -0000 1.896 +++ modules/user/user.module 29 Feb 2008 06:04:18 -0000 @@ -527,13 +527,13 @@ function user_search($op = 'search', $ke $keys = preg_replace('!\*+!', '%', $keys); if (user_access('administer users')) { // Administrators can also search in the otherwise private email field. - $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys); + $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%s') OR LOWER(mail) LIKE LOWER('%s')", 15, 0, NULL, "%". $keys ."%", "%". $keys ."%"); while ($account = db_fetch_object($result)) { $find[] = array('title' => $account->name .' ('. $account->mail .')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE))); } } else { - $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); + $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%s')", 15, 0, NULL, "%". $keys ."%"); while ($account = db_fetch_object($result)) { $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE))); } @@ -695,7 +695,7 @@ function user_block($op = 'list', $delta case 2: if (user_access('access content')) { // Retrieve a list of new users who have subsequently accessed the site successfully. - $result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count', 5)); + $result = db_query_range('SELECT uid, name FROM {users} WHERE status <> 0 AND access <> 0 ORDER BY created DESC', 0, variable_get('user_block_whois_new_count', 5)); while ($account = db_fetch_object($result)) { $items[] = $account; } @@ -1481,7 +1481,7 @@ function _user_edit_validate($uid, &$edi if ($error = user_validate_name($edit['name'])) { form_set_error('name', $error); } - else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) { + else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid <> %d AND LOWER(name) = LOWER('%s')", $uid, $edit['name'])) > 0) { form_set_error('name', t('The name %name is already taken.', array('%name' => $edit['name']))); } else if (drupal_is_denied('user', $edit['name'])) { @@ -1493,7 +1493,7 @@ function _user_edit_validate($uid, &$edi if ($error = user_validate_mail($edit['mail'])) { form_set_error('mail', $error); } - else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { + else if (db_result(db_query("SELECT COUNT(*) FROM {users} WHERE uid <> %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) { form_set_error('mail', t('The e-mail address %email is already registered. Have you forgotten your password?', array('%email' => $edit['mail'], '@password' => url('user/password')))); } else if (drupal_is_denied('mail', $edit['mail'])) { @@ -1634,7 +1634,7 @@ function user_roles($membersonly = FALSE ); if (!empty($permission)) { - $result = db_query("SELECT r.* FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%%%s%%' ORDER BY r.name", $permission); + $result = db_query("SELECT r.* FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%s' ORDER BY r.name", "%". $permission ."%"); } else { $result = db_query('SELECT * FROM {role} ORDER BY name'); @@ -1901,7 +1901,7 @@ function user_filters() { $filters['permission'] = array( 'title' => t('permission'), 'join' => 'LEFT JOIN {permission} p ON ur.rid = p.rid', - 'where' => " ((p.perm IS NOT NULL AND p.perm LIKE '%%%s%%') OR u.uid = 1) ", + 'where' => " ((p.perm IS NOT NULL AND p.perm LIKE '%s') OR u.uid = 1) ", 'options' => $options, ); @@ -1934,6 +1934,7 @@ function user_build_filter_query() { if (user_access($value, $account)) { continue; } + $value = "%" . $value . "%"; } $where[] = $filters[$key]['where']; $args[] = $value; Index: modules/user/user.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v retrieving revision 1.12 diff -u -p -r1.12 user.pages.inc --- modules/user/user.pages.inc 18 Feb 2008 16:53:37 -0000 1.12 +++ modules/user/user.pages.inc 29 Feb 2008 06:04:18 -0000 @@ -12,7 +12,7 @@ function user_autocomplete($string = '') { $matches = array(); if ($string) { - $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10); + $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s')", $string ."%", 0, 10); while ($user = db_fetch_object($result)) { $matches[$user->name] = check_plain($user->name); } ? modules/simpletest/simpletest