summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-05-07 21:00:36 +0000
committerDries Buytaert <dries@buytaert.net>2003-05-07 21:00:36 +0000
commita161110a6ba10a43df67179263d62f201631e88d (patch)
treec6b146ed125d82487d6285c259cfb30346c310bc /modules
parent9a62873a4beae8fe620dedcf7ca40954e12cc7cb (diff)
downloadbrdo-a161110a6ba10a43df67179263d62f201631e88d.tar.gz
brdo-a161110a6ba10a43df67179263d62f201631e88d.tar.bz2
- Applied Michael Caerwyn's "%s -> %d" patch.
- Changed all occurences of '%d' to %d as suggested on the mailing list.
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator.module6
-rw-r--r--modules/aggregator/aggregator.module6
-rw-r--r--modules/block.module18
-rw-r--r--modules/block/block.module18
-rw-r--r--modules/blog.module4
-rw-r--r--modules/blog/blog.module4
-rw-r--r--modules/bloggerapi.module2
-rw-r--r--modules/book.module30
-rw-r--r--modules/book/book.module30
-rw-r--r--modules/cloud.module8
-rw-r--r--modules/comment.module4
-rw-r--r--modules/comment/comment.module4
-rw-r--r--modules/drupal.module2
-rw-r--r--modules/drupal/drupal.module2
-rw-r--r--modules/forum.module32
-rw-r--r--modules/forum/forum.module32
-rw-r--r--modules/import.module6
-rw-r--r--modules/locale.module4
-rw-r--r--modules/locale/locale.module4
-rw-r--r--modules/page.module8
-rw-r--r--modules/page/page.module8
-rw-r--r--modules/poll.module24
-rw-r--r--modules/poll/poll.module24
-rw-r--r--modules/queue.module2
-rw-r--r--modules/search.module2
-rw-r--r--modules/search/search.module2
-rw-r--r--modules/statistics.module14
-rw-r--r--modules/statistics/statistics.module14
-rw-r--r--modules/system.module2
-rw-r--r--modules/system/system.module2
-rw-r--r--modules/tracker.module4
-rw-r--r--modules/tracker/tracker.module4
-rw-r--r--modules/user.module46
-rw-r--r--modules/user/user.module46
-rw-r--r--modules/watchdog.module2
-rw-r--r--modules/watchdog/watchdog.module2
36 files changed, 211 insertions, 211 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 4e5af2f5e..69abf97bf 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -359,7 +359,7 @@ function import_save_item($edit) {
db_query("DELETE FROM item WHERE iid = %d", $edit["iid"]);
}
else if ($edit["title"] && $edit["link"]) {
- db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
+ db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d)", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
}
}
@@ -417,7 +417,7 @@ function import_form_feed($edit = array()) {
function import_save_feed($edit) {
if ($edit["fid"] && $edit["title"]) {
- db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
+ db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = %d WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
db_query("DELETE FROM item WHERE fid = %d", $edit["fid"]);
}
else if ($edit["fid"]) {
@@ -427,7 +427,7 @@ function import_save_feed($edit) {
else if ($edit["title"]) {
// a single unique id for bundles and feeds, to use in blocks
$next_id = db_next_id("feed_fid");
- db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', '%s')", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
+ db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', %d)", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
}
}
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 4e5af2f5e..69abf97bf 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -359,7 +359,7 @@ function import_save_item($edit) {
db_query("DELETE FROM item WHERE iid = %d", $edit["iid"]);
}
else if ($edit["title"] && $edit["link"]) {
- db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
+ db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d)", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
}
}
@@ -417,7 +417,7 @@ function import_form_feed($edit = array()) {
function import_save_feed($edit) {
if ($edit["fid"] && $edit["title"]) {
- db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
+ db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = %d WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
db_query("DELETE FROM item WHERE fid = %d", $edit["fid"]);
}
else if ($edit["fid"]) {
@@ -427,7 +427,7 @@ function import_save_feed($edit) {
else if ($edit["title"]) {
// a single unique id for bundles and feeds, to use in blocks
$next_id = db_next_id("feed_fid");
- db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', '%s')", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
+ db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', %d)", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
}
}
diff --git a/modules/block.module b/modules/block.module
index 5ec29cc73..a6bac4fbb 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -67,7 +67,7 @@ function block_block($op = "list", $delta = 0) {
return $blocks;
}
else {
- $block = db_fetch_object(db_query("SELECT * FROM boxes WHERE bid = '%d'", $delta));
+ $block = db_fetch_object(db_query("SELECT * FROM boxes WHERE bid = %d", $delta));
$data["subject"] = $block->title;
$data["content"] = ($block->type == 1) ? eval($block->body) : $block->body;
return $data;
@@ -77,7 +77,7 @@ function block_block($op = "list", $delta = 0) {
function block_admin_save($edit) {
foreach ($edit as $module => $blocks) {
foreach ($blocks as $delta => $block) {
- db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%s'",
+ db_query("UPDATE blocks SET region = %d, status = %d, custom = %d, path = '%s', weight = %d WHERE module = '%s' AND delta = '%s'",
$block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
}
}
@@ -119,7 +119,7 @@ function _block_rehash($order_by = array("weight")) {
}
// reinsert blocks into table
- db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', '%d', '%d', '%d', '%s', '%d')",
+ db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', %d, %d, %d, '%s', %d)",
$block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
@@ -215,7 +215,7 @@ function block_admin_preview() {
}
function block_box_get($bid) {
- return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '%d'", $bid));
+ return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = %d", $bid));
}
function block_box_form($edit = array()) {
@@ -243,18 +243,18 @@ function block_box_save($edit) {
}
if ($edit["bid"]) {
- db_query("UPDATE boxes SET title = '%s', body = '%s', info = '%s', type = '%s' WHERE bid = '%d'", $edit["title"], $edit["body"], $edit["info"], $edit["type"], $edit["bid"]);
+ db_query("UPDATE boxes SET title = '%s', body = '%s', info = '%s', type = %d WHERE bid = %d", $edit["title"], $edit["body"], $edit["info"], $edit["type"], $edit["bid"]);
return t("the block has been updated.");
}
else {
- db_query("INSERT INTO boxes (title, body, info, type) VALUES ('%s', '%s', '%s', '%s')", $edit["title"], $edit["body"], $edit["info"], $edit["type"]);
+ db_query("INSERT INTO boxes (title, body, info, type) VALUES ('%s', '%s', '%s', %d)", $edit["title"], $edit["body"], $edit["info"], $edit["type"]);
return t("the new block has been added.");
}
}
function block_box_delete($bid) {
if ($bid) {
- db_query("DELETE FROM boxes WHERE bid = '%d'", $bid);
+ db_query("DELETE FROM boxes WHERE bid = %d", $bid);
return t("the block has been deleted.");
}
}
@@ -304,7 +304,7 @@ function block_admin() {
function block_user($type, &$edit, &$user) {
switch ($type) {
case "register_form":
- $result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY module, delta", 1);
+ $result = db_query("SELECT * FROM blocks WHERE custom = %d ORDER BY module, delta", 1);
while ($block = db_fetch_object($result)) {
$form .= form_hidden("block][$block->module][$block->delta", $block->status);
@@ -312,7 +312,7 @@ function block_user($type, &$edit, &$user) {
return $form;
case "edit_form":
- $result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY module, delta", 1);
+ $result = db_query("SELECT * FROM blocks WHERE custom = %d ORDER BY module, delta", 1);
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, "block", "list");
diff --git a/modules/block/block.module b/modules/block/block.module
index 5ec29cc73..a6bac4fbb 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -67,7 +67,7 @@ function block_block($op = "list", $delta = 0) {
return $blocks;
}
else {
- $block = db_fetch_object(db_query("SELECT * FROM boxes WHERE bid = '%d'", $delta));
+ $block = db_fetch_object(db_query("SELECT * FROM boxes WHERE bid = %d", $delta));
$data["subject"] = $block->title;
$data["content"] = ($block->type == 1) ? eval($block->body) : $block->body;
return $data;
@@ -77,7 +77,7 @@ function block_block($op = "list", $delta = 0) {
function block_admin_save($edit) {
foreach ($edit as $module => $blocks) {
foreach ($blocks as $delta => $block) {
- db_query("UPDATE blocks SET region = '%s', status = '%d', custom = '%d', path = '%s', weight = '%d' WHERE module = '%s' AND delta = '%s'",
+ db_query("UPDATE blocks SET region = %d, status = %d, custom = %d, path = '%s', weight = %d WHERE module = '%s' AND delta = '%s'",
$block["region"], $block["status"], $block["custom"], $block["path"], $block["weight"], $module, $delta);
}
}
@@ -119,7 +119,7 @@ function _block_rehash($order_by = array("weight")) {
}
// reinsert blocks into table
- db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', '%d', '%d', '%d', '%s', '%d')",
+ db_query("INSERT INTO blocks (module, delta, status, weight, region, path, custom) VALUES ('%s', '%s', %d, %d, %d, '%s', %d)",
$block["module"], $block["delta"], $block["status"], $block["weight"], $block["region"], $block["path"], $block["custom"]);
$blocks[] = $block;
@@ -215,7 +215,7 @@ function block_admin_preview() {
}
function block_box_get($bid) {
- return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '%d'", $bid));
+ return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = %d", $bid));
}
function block_box_form($edit = array()) {
@@ -243,18 +243,18 @@ function block_box_save($edit) {
}
if ($edit["bid"]) {
- db_query("UPDATE boxes SET title = '%s', body = '%s', info = '%s', type = '%s' WHERE bid = '%d'", $edit["title"], $edit["body"], $edit["info"], $edit["type"], $edit["bid"]);
+ db_query("UPDATE boxes SET title = '%s', body = '%s', info = '%s', type = %d WHERE bid = %d", $edit["title"], $edit["body"], $edit["info"], $edit["type"], $edit["bid"]);
return t("the block has been updated.");
}
else {
- db_query("INSERT INTO boxes (title, body, info, type) VALUES ('%s', '%s', '%s', '%s')", $edit["title"], $edit["body"], $edit["info"], $edit["type"]);
+ db_query("INSERT INTO boxes (title, body, info, type) VALUES ('%s', '%s', '%s', %d)", $edit["title"], $edit["body"], $edit["info"], $edit["type"]);
return t("the new block has been added.");
}
}
function block_box_delete($bid) {
if ($bid) {
- db_query("DELETE FROM boxes WHERE bid = '%d'", $bid);
+ db_query("DELETE FROM boxes WHERE bid = %d", $bid);
return t("the block has been deleted.");
}
}
@@ -304,7 +304,7 @@ function block_admin() {
function block_user($type, &$edit, &$user) {
switch ($type) {
case "register_form":
- $result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY module, delta", 1);
+ $result = db_query("SELECT * FROM blocks WHERE custom = %d ORDER BY module, delta", 1);
while ($block = db_fetch_object($result)) {
$form .= form_hidden("block][$block->module][$block->delta", $block->status);
@@ -312,7 +312,7 @@ function block_user($type, &$edit, &$user) {
return $form;
case "edit_form":
- $result = db_query("SELECT * FROM blocks WHERE custom = '%d' ORDER BY module, delta", 1);
+ $result = db_query("SELECT * FROM blocks WHERE custom = %d ORDER BY module, delta", 1);
while ($block = db_fetch_object($result)) {
$data = module_invoke($block->module, "block", "list");
diff --git a/modules/blog.module b/modules/blog.module
index dc90b99cd..a3cd7145e 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -88,7 +88,7 @@ function blog_feed_user($uid = 0) {
$account = $user;
}
- $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '%d' AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15);
+ $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15);
$channel["title"] = $account->name. "'s blog";
$channel["link"] = url("blog/view/$uid");
$channel["description"] = $term->description;
@@ -153,7 +153,7 @@ function blog_form(&$node, &$help, &$error) {
$node->body = "<i>". $blog->body ."</i> [". l($blog->name, "node/view/$nid") ."]";
}
- if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%d' AND i.fid = f.fid", $iid))) {
+ if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = %d AND i.fid = f.fid", $iid))) {
$node->title = $item->title;
$node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n";
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index dc90b99cd..a3cd7145e 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -88,7 +88,7 @@ function blog_feed_user($uid = 0) {
$account = $user;
}
- $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '%d' AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15);
+ $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15);
$channel["title"] = $account->name. "'s blog";
$channel["link"] = url("blog/view/$uid");
$channel["description"] = $term->description;
@@ -153,7 +153,7 @@ function blog_form(&$node, &$help, &$error) {
$node->body = "<i>". $blog->body ."</i> [". l($blog->name, "node/view/$nid") ."]";
}
- if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%d' AND i.fid = f.fid", $iid))) {
+ if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = %d AND i.fid = f.fid", $iid))) {
$node->title = $item->title;
$node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n";
}
diff --git a/modules/bloggerapi.module b/modules/bloggerapi.module
index 937c666c1..a215a6cbe 100644
--- a/modules/bloggerapi.module
+++ b/modules/bloggerapi.module
@@ -267,7 +267,7 @@ function bloggerapi_node_recent($num) {
global $user;
if (($num == 0) or ($num > 100)) $num = 50;
- $result = db_query_range("SELECT n.*, u.name FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.uid = '%d' ORDER BY n.nid DESC", $user->uid, 0, $num);
+ $result = db_query_range("SELECT n.*, u.name FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.uid = %d ORDER BY n.nid DESC", $user->uid, 0, $num);
if ($result) {
while ($blog = db_fetch_object($result)) {
$body = "<title>$blog->title</title>\n". $blog->body;
diff --git a/modules/book.module b/modules/book.module
index ad9c23870..dd44b6b82 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -96,7 +96,7 @@ function book_link($type, $node = 0, $main = 0) {
function book_load($node) {
global $user;
- $book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '%d'", $node->nid));
+ $book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = %d", $node->nid));
if (strstr(request_uri(), "node/edit")) {
@@ -129,15 +129,15 @@ function book_load($node) {
}
function book_insert($node) {
- db_query("INSERT INTO book (nid, format, parent, weight, log) VALUES ('%d', '%d', '%d', '%d', '%s')", $node->nid, $node->format, $node->parent, $node->weight, $node->log);
+ db_query("INSERT INTO book (nid, format, parent, weight, log) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $node->format, $node->parent, $node->weight, $node->log);
}
function book_update($node) {
- db_query("UPDATE book SET format = '%d', parent = '%d', weight = '%d', log = '%s' WHERE nid = '%d'", $node->format, $node->parent, $node->weight, $node->log, $node->nid);
+ db_query("UPDATE book SET format = %d, parent = %d, weight = %d, log = '%s' WHERE nid = %d", $node->format, $node->parent, $node->weight, $node->log, $node->nid);
}
function book_delete(&$node) {
- db_query("DELETE FROM book WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM book WHERE nid = %d", $node->nid);
}
function book_validate(&$node) {
@@ -206,24 +206,24 @@ function book_node_link($node = 0) {
}
if ($op == t("Add to book outline")) {
- db_query("INSERT INTO book (nid, parent, weight) VALUES ('%d', '%s', '%s')", $node->nid, $edit["parent"], $edit["weight"]);
+ db_query("INSERT INTO book (nid, parent, weight) VALUES (%d, %d, %d)", $node->nid, $edit["parent"], $edit["weight"]);
$output .= status(t("added the node to the book."));
}
if ($op == t("Update book outline")) {
- db_query("UPDATE book SET parent = '%s', weight = '%s' WHERE nid = '%d'", $edit["parent"], $edit["weight"], $node->nid);
+ db_query("UPDATE book SET parent = %d, weight = %d WHERE nid = %d", $edit["parent"], $edit["weight"], $node->nid);
$output .= status(t("updated the book outline."));
}
if ($op == t("Remove from book outline")) {
- db_query("DELETE FROM book WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM book WHERE nid = %d", $node->nid);
$output .= status(t("removed the node form the book."));
}
$output .= "<h3>". t("Edit book outline for node <i>") . "$node->title</i></h3>";
if ($edit["nid"]) {
- $page = db_fetch_object(db_query("SELECT * FROM book WHERE nid = '%d'", $node->nid));
+ $page = db_fetch_object(db_query("SELECT * FROM book WHERE nid = %d", $node->nid));
$output .= form_select(t("Parent"), "parent", $page->parent, book_toc(), t("The parent subject or category the page belongs in."));
$output .= form_weight(t("Weight"), "weight", $node->weight, 15, t("The heavier pages will sink and the lighter pages will be positioned nearer the top."));
@@ -286,7 +286,7 @@ function book_revision_load($page, $conditions = array()) {
** Return the path (call stack) to a certain book page.
*/
function book_location($node, $nodes = array()) {
- $parent = db_fetch_object(db_query("SELECT n.nid, n.title, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.nid = '%d'", $node->parent));
+ $parent = db_fetch_object(db_query("SELECT n.nid, n.title, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.nid = %d", $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
array_push($nodes, $parent);
@@ -561,7 +561,7 @@ function book_page() {
}
function book_print($id = "", $depth = 1) {
- $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%d' AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id);
+ $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = %d AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id);
while ($page = db_fetch_object($result)) {
// load the node:
@@ -622,7 +622,7 @@ function book_admin_view_line($node, $depth = 0) {
}
function book_admin_view_book($nid, $depth = 1) {
- $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = '%d' ORDER BY b.weight, n.title", $nid);
+ $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = %d ORDER BY b.weight, n.title", $nid);
while ($node = db_fetch_object($result)) {
$node = node_load(array("nid" => $node->nid));
@@ -658,18 +658,18 @@ function book_admin_save($nid, $edit = array()) {
** Check to see whether the title needs updating:
*/
- $title = db_result(db_query("SELECT title FROM node WHERE nid = '%d'", $nid));
+ $title = db_result(db_query("SELECT title FROM node WHERE nid = %d", $nid));
if ($title != $value["title"]) {
- db_query("UPDATE node SET title = '%s' WHERE nid = '%d'", $value["title"], $nid);
+ db_query("UPDATE node SET title = '%s' WHERE nid = %d", $value["title"], $nid);
}
/*
** Check to see whether the weight needs updating:
*/
- $weight = db_result(db_query("SELECT weight FROM book WHERE nid = '%d'", $nid));
+ $weight = db_result(db_query("SELECT weight FROM book WHERE nid = %d", $nid));
if ($weight != $value["weight"]) {
- db_query("UPDATE book SET weight = '%d' WHERE nid = '%d'", $value["weight"], $nid);
+ db_query("UPDATE book SET weight = %d WHERE nid = %d", $value["weight"], $nid);
}
}
diff --git a/modules/book/book.module b/modules/book/book.module
index ad9c23870..dd44b6b82 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -96,7 +96,7 @@ function book_link($type, $node = 0, $main = 0) {
function book_load($node) {
global $user;
- $book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '%d'", $node->nid));
+ $book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = %d", $node->nid));
if (strstr(request_uri(), "node/edit")) {
@@ -129,15 +129,15 @@ function book_load($node) {
}
function book_insert($node) {
- db_query("INSERT INTO book (nid, format, parent, weight, log) VALUES ('%d', '%d', '%d', '%d', '%s')", $node->nid, $node->format, $node->parent, $node->weight, $node->log);
+ db_query("INSERT INTO book (nid, format, parent, weight, log) VALUES (%d, %d, %d, %d, '%s')", $node->nid, $node->format, $node->parent, $node->weight, $node->log);
}
function book_update($node) {
- db_query("UPDATE book SET format = '%d', parent = '%d', weight = '%d', log = '%s' WHERE nid = '%d'", $node->format, $node->parent, $node->weight, $node->log, $node->nid);
+ db_query("UPDATE book SET format = %d, parent = %d, weight = %d, log = '%s' WHERE nid = %d", $node->format, $node->parent, $node->weight, $node->log, $node->nid);
}
function book_delete(&$node) {
- db_query("DELETE FROM book WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM book WHERE nid = %d", $node->nid);
}
function book_validate(&$node) {
@@ -206,24 +206,24 @@ function book_node_link($node = 0) {
}
if ($op == t("Add to book outline")) {
- db_query("INSERT INTO book (nid, parent, weight) VALUES ('%d', '%s', '%s')", $node->nid, $edit["parent"], $edit["weight"]);
+ db_query("INSERT INTO book (nid, parent, weight) VALUES (%d, %d, %d)", $node->nid, $edit["parent"], $edit["weight"]);
$output .= status(t("added the node to the book."));
}
if ($op == t("Update book outline")) {
- db_query("UPDATE book SET parent = '%s', weight = '%s' WHERE nid = '%d'", $edit["parent"], $edit["weight"], $node->nid);
+ db_query("UPDATE book SET parent = %d, weight = %d WHERE nid = %d", $edit["parent"], $edit["weight"], $node->nid);
$output .= status(t("updated the book outline."));
}
if ($op == t("Remove from book outline")) {
- db_query("DELETE FROM book WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM book WHERE nid = %d", $node->nid);
$output .= status(t("removed the node form the book."));
}
$output .= "<h3>". t("Edit book outline for node <i>") . "$node->title</i></h3>";
if ($edit["nid"]) {
- $page = db_fetch_object(db_query("SELECT * FROM book WHERE nid = '%d'", $node->nid));
+ $page = db_fetch_object(db_query("SELECT * FROM book WHERE nid = %d", $node->nid));
$output .= form_select(t("Parent"), "parent", $page->parent, book_toc(), t("The parent subject or category the page belongs in."));
$output .= form_weight(t("Weight"), "weight", $node->weight, 15, t("The heavier pages will sink and the lighter pages will be positioned nearer the top."));
@@ -286,7 +286,7 @@ function book_revision_load($page, $conditions = array()) {
** Return the path (call stack) to a certain book page.
*/
function book_location($node, $nodes = array()) {
- $parent = db_fetch_object(db_query("SELECT n.nid, n.title, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.nid = '%d'", $node->parent));
+ $parent = db_fetch_object(db_query("SELECT n.nid, n.title, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.nid = %d", $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
array_push($nodes, $parent);
@@ -561,7 +561,7 @@ function book_page() {
}
function book_print($id = "", $depth = 1) {
- $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%d' AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id);
+ $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = %d AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id);
while ($page = db_fetch_object($result)) {
// load the node:
@@ -622,7 +622,7 @@ function book_admin_view_line($node, $depth = 0) {
}
function book_admin_view_book($nid, $depth = 1) {
- $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = '%d' ORDER BY b.weight, n.title", $nid);
+ $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = %d ORDER BY b.weight, n.title", $nid);
while ($node = db_fetch_object($result)) {
$node = node_load(array("nid" => $node->nid));
@@ -658,18 +658,18 @@ function book_admin_save($nid, $edit = array()) {
** Check to see whether the title needs updating:
*/
- $title = db_result(db_query("SELECT title FROM node WHERE nid = '%d'", $nid));
+ $title = db_result(db_query("SELECT title FROM node WHERE nid = %d", $nid));
if ($title != $value["title"]) {
- db_query("UPDATE node SET title = '%s' WHERE nid = '%d'", $value["title"], $nid);
+ db_query("UPDATE node SET title = '%s' WHERE nid = %d", $value["title"], $nid);
}
/*
** Check to see whether the weight needs updating:
*/
- $weight = db_result(db_query("SELECT weight FROM book WHERE nid = '%d'", $nid));
+ $weight = db_result(db_query("SELECT weight FROM book WHERE nid = %d", $nid));
if ($weight != $value["weight"]) {
- db_query("UPDATE book SET weight = '%d' WHERE nid = '%d'", $value["weight"], $nid);
+ db_query("UPDATE book SET weight = %d WHERE nid = %d", $value["weight"], $nid);
}
}
diff --git a/modules/cloud.module b/modules/cloud.module
index 890ccca05..71e49b7bb 100644
--- a/modules/cloud.module
+++ b/modules/cloud.module
@@ -109,18 +109,18 @@ function cloud_form($edit = array()) {
}
function cloud_get_site($sid) {
- return db_fetch_array(db_query("SELECT * FROM site WHERE sid = '%d'", $sid));
+ return db_fetch_array(db_query("SELECT * FROM site WHERE sid = %d", $sid));
}
function cloud_save($edit) {
if ($edit["sid"] && $edit["name"]) {
- db_query("UPDATE site SET name = '%s', link = '%s', feed = '%s', refresh = '%s', threshold = '%s' WHERE sid = '%d'", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"], $edit["sid"]);
+ db_query("UPDATE site SET name = '%s', link = '%s', feed = '%s', refresh = %d, threshold = %d WHERE sid = %d", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"], $edit["sid"]);
}
else if ($edit["sid"]) {
- db_query("DELETE FROM site WHERE sid = '%d'", $edit["sid"]);
+ db_query("DELETE FROM site WHERE sid = %d", $edit["sid"]);
}
else {
- db_query("INSERT INTO site (name, link, feed, refresh, threshold) VALUES ('%s', '%s', '%s', '%s', '%s')", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"]);
+ db_query("INSERT INTO site (name, link, feed, refresh, threshold) VALUES ('%s', '%s', '%s', %d, %d)", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"]);
}
}
diff --git a/modules/comment.module b/modules/comment.module
index 9af8c2a7f..7d2dde4b9 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -270,7 +270,7 @@ function comment_post($edit) {
$edit["cid"] = db_next_id("comments_cid");
- db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, users) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["cid"], $edit["nid"], $edit["pid"], $user->uid, $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time(), $status, $score, $users);
+ db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, users) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s')", $edit["cid"], $edit["nid"], $edit["pid"], $user->uid, $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time(), $status, $score, $users);
/*
** Tell the other modules a new comment has been submitted:
@@ -790,7 +790,7 @@ function comment_delete($edit) {
}
function comment_save($id, $edit) {
- db_query("UPDATE comments SET subject = '%s', comment = '%s', status = '%s' WHERE cid = %d", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
+ db_query("UPDATE comments SET subject = '%s', comment = '%s', status = %d WHERE cid = %d", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
watchdog("special", "comment: modified '". $edit["subject"] ."'");
return "updated comment.";
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 9af8c2a7f..7d2dde4b9 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -270,7 +270,7 @@ function comment_post($edit) {
$edit["cid"] = db_next_id("comments_cid");
- db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, users) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["cid"], $edit["nid"], $edit["pid"], $user->uid, $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time(), $status, $score, $users);
+ db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, users) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s')", $edit["cid"], $edit["nid"], $edit["pid"], $user->uid, $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time(), $status, $score, $users);
/*
** Tell the other modules a new comment has been submitted:
@@ -790,7 +790,7 @@ function comment_delete($edit) {
}
function comment_save($id, $edit) {
- db_query("UPDATE comments SET subject = '%s', comment = '%s', status = '%s' WHERE cid = %d", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
+ db_query("UPDATE comments SET subject = '%s', comment = '%s', status = %d WHERE cid = %d", filter($edit["subject"]), filter($edit["comment"]), $edit["status"], $id);
watchdog("special", "comment: modified '". $edit["subject"] ."'");
return "updated comment.";
}
diff --git a/modules/drupal.module b/modules/drupal.module
index e54e9f22d..f9306dbff 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -72,7 +72,7 @@ function drupal_directory_ping($arguments) {
if ($link && $name && $mail && $slogan && $mission) {
db_query("DELETE FROM directory WHERE link = '%s' OR mail = '%s'", $link, $mail);
- db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $link, $name, $mail, $slogan, $mission, time());
+ db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $mission, time());
watchdog("message", "directory: ping from '$name' ($link)");
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index e54e9f22d..f9306dbff 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -72,7 +72,7 @@ function drupal_directory_ping($arguments) {
if ($link && $name && $mail && $slogan && $mission) {
db_query("DELETE FROM directory WHERE link = '%s' OR mail = '%s'", $link, $mail);
- db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $link, $name, $mail, $slogan, $mission, time());
+ db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $link, $name, $mail, $slogan, $mission, time());
watchdog("message", "directory: ping from '$name' ($link)");
diff --git a/modules/forum.module b/modules/forum.module
index 9f7d4e881..814b07c69 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -70,7 +70,7 @@ function forum_taxonomy($op, $type, $object) {
}
function forum_load($node) {
- $forum = db_fetch_object(db_query("SELECT * FROM forum WHERE nid = '%d'", $node->nid));
+ $forum = db_fetch_object(db_query("SELECT * FROM forum WHERE nid = %d", $node->nid));
return $forum;
}
@@ -121,7 +121,7 @@ function forum_link($type, $node = 0, $main = 0) {
if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
- $result = db_query("SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = f.nid AND f.tid = '%d' AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
+ $result = db_query("SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
@@ -240,12 +240,12 @@ function forum_form(&$node, &$help, &$error) {
function forum_insert($node) {
$node->icon = _forum_decode_icon($node);
- db_query("INSERT INTO forum (nid, icon, shadow, tid) VALUES ('%d', '%s', '%d', '%d')", $node->nid, $node->icon, $node->shadow, $node->tid[0]);
+ db_query("INSERT INTO forum (nid, icon, shadow, tid) VALUES (%d, '%s', %d, %d)", $node->nid, $node->icon, $node->shadow, $node->tid[0]);
}
function forum_update($node) {
$node->icon = _forum_decode_icon($node);
- db_query("UPDATE forum SET icon = '%s', shadow = '%d', tid = '%d' WHERE nid = '%d'", $node->icon, $node->shadow, $node->tid[0], $node->nid);
+ db_query("UPDATE forum SET icon = '%s', shadow = %d, tid = %d WHERE nid = %d", $node->icon, $node->shadow, $node->tid[0], $node->nid);
}
function _forum_decode_icon($node) {
@@ -265,21 +265,21 @@ function _forum_decode_icon($node) {
}
function forum_delete(&$node) {
- db_query("DELETE FROM forum WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM forum WHERE nid = %d", $node->nid);
}
function _forum_num_comments($nid) {
- $value = db_fetch_object(db_query("SELECT COUNT(cid) AS count FROM comments WHERE nid = '%d' AND status = 0", $nid));
+ $value = db_fetch_object(db_query("SELECT COUNT(cid) AS count FROM comments WHERE nid = %d AND status = 0", $nid));
return ($value) ? $value->count : 0;
}
function _forum_last_comment($nid) {
- $value = db_fetch_object(db_query_range("SELECT timestamp FROM comments WHERE nid = '%d' AND status = 0 ORDER BY timestamp DESC", $nid, 0, 1));
+ $value = db_fetch_object(db_query_range("SELECT timestamp FROM comments WHERE nid = %d AND status = 0 ORDER BY timestamp DESC", $nid, 0, 1));
return ($value) ? format_date($value->timestamp, "small") : "&nbsp;";
}
function _forum_last_reply($nid) {
- $value = db_fetch_object(db_query_range("SELECT c.timestamp, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = '%d' AND c.status = 0 ORDER BY c.timestamp DESC", $nid, 0, 1));
+ $value = db_fetch_object(db_query_range("SELECT c.timestamp, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY c.timestamp DESC", $nid, 0, 1));
return $value;
}
@@ -348,17 +348,17 @@ function forum_get_parents($tid) {
}
function _forum_num_topics($term) {
- $value = db_fetch_object(db_query("SELECT COUNT(n.nid) AS count FROM node n, forum f WHERE f.tid = '%d' AND n.nid = f.nid AND n.status = 1 AND n.type = 'forum'", $term));
+ $value = db_fetch_object(db_query("SELECT COUNT(n.nid) AS count FROM node n, forum f WHERE f.tid = %d AND n.nid = f.nid AND n.status = 1 AND n.type = 'forum'", $term));
return ($value) ? $value->count : 0;
}
function _forum_num_replies($term) {
- $value = db_fetch_object(db_query("SELECT COUNT(*) AS count FROM comments c, node n, forum f WHERE f.tid = '%d' AND n.nid = f.nid AND n.nid = c.nid AND n.status = 1 AND c.status = 0 AND n.type = 'forum'", $term));
+ $value = db_fetch_object(db_query("SELECT COUNT(*) AS count FROM comments c, node n, forum f WHERE f.tid = %d AND n.nid = f.nid AND n.nid = c.nid AND n.status = 1 AND c.status = 0 AND n.type = 'forum'", $term));
return ($value) ? $value->count : 0;
}
function _forum_topics_read($uid) {
- $result = db_query("SELECT tid, count(*) AS c FROM history h, node n, forum f WHERE f.nid = n.nid AND n.nid = h.nid AND n.type = 'forum' AND n.status = 1 AND h.uid = '%d' GROUP BY tid", $uid);
+ $result = db_query("SELECT tid, count(*) AS c FROM history h, node n, forum f WHERE f.nid = n.nid AND n.nid = h.nid AND n.type = 'forum' AND n.status = 1 AND h.uid = %d GROUP BY tid", $uid);
while ($obj = db_fetch_object($result)) {
$topics_read[$obj->tid] = $obj->c;
@@ -368,9 +368,9 @@ function _forum_topics_read($uid) {
}
function _forum_last_post($term) {
- $topic = db_fetch_object(db_query_range("SELECT n.nid, n.created AS timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN users u ON n.uid = u.uid WHERE f.tid = '%d' AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 ORDER BY timestamp DESC", $term, 0, 1));
+ $topic = db_fetch_object(db_query_range("SELECT n.nid, n.created AS timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN users u ON n.uid = u.uid WHERE f.tid = %d AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 ORDER BY timestamp DESC", $term, 0, 1));
- $reply = db_fetch_object(db_query_range("SELECT n.nid, c.timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN comments c ON n.nid = c.nid LEFT JOIN users u ON c.uid = u.uid WHERE f.tid = '%d' AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 AND c.status = 0 ORDER BY c.timestamp DESC", $term, 0, 1));
+ $reply = db_fetch_object(db_query_range("SELECT n.nid, c.timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN comments c ON n.nid = c.nid LEFT JOIN users u ON c.uid = u.uid WHERE f.tid = %d AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 AND c.status = 0 ORDER BY c.timestamp DESC", $term, 0, 1));
$value = ($topic->timestamp > $reply->timestamp) ? $topic : $reply;
@@ -434,12 +434,12 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
function _forum_new($tid) {
global $user;
- $result = db_query("SELECT n.nid FROM node n, history h, forum f WHERE n.type = 'forum' AND n.status = 1 AND h.nid = n.nid AND f.nid = h.nid AND f.tid = '%d' AND h.uid = '%d'", $tid, $user->uid);
+ $result = db_query("SELECT n.nid FROM node n, history h, forum f WHERE n.type = 'forum' AND n.status = 1 AND h.nid = n.nid AND f.nid = h.nid AND f.tid = %d AND h.uid = %d", $tid, $user->uid);
while ($r = db_fetch_object($result)) {
$read[] = $r->nid;
}
- $nid = db_result(db_query_range("SELECT n.nid FROM node n, forum f WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = '%d' ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1));
+ $nid = db_result(db_query_range("SELECT n.nid FROM node n, forum f WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1));
return $nid ? $nid : 0;
}
@@ -685,7 +685,7 @@ function _forum_user_last_visit($nid) {
global $user;
static $history;
if (!$history) {
- $result = db_query("SELECT nid, timestamp FROM history WHERE uid = '%d'", $user->uid);
+ $result = db_query("SELECT nid, timestamp FROM history WHERE uid = %d", $user->uid);
while ($t = db_fetch_object($result)) {
$history[$t->nid] = $t->timestamp;
}
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 9f7d4e881..814b07c69 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -70,7 +70,7 @@ function forum_taxonomy($op, $type, $object) {
}
function forum_load($node) {
- $forum = db_fetch_object(db_query("SELECT * FROM forum WHERE nid = '%d'", $node->nid));
+ $forum = db_fetch_object(db_query("SELECT * FROM forum WHERE nid = %d", $node->nid));
return $forum;
}
@@ -121,7 +121,7 @@ function forum_link($type, $node = 0, $main = 0) {
if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
- $result = db_query("SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = f.nid AND f.tid = '%d' AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
+ $result = db_query("SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1)), $node->tid);
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
@@ -240,12 +240,12 @@ function forum_form(&$node, &$help, &$error) {
function forum_insert($node) {
$node->icon = _forum_decode_icon($node);
- db_query("INSERT INTO forum (nid, icon, shadow, tid) VALUES ('%d', '%s', '%d', '%d')", $node->nid, $node->icon, $node->shadow, $node->tid[0]);
+ db_query("INSERT INTO forum (nid, icon, shadow, tid) VALUES (%d, '%s', %d, %d)", $node->nid, $node->icon, $node->shadow, $node->tid[0]);
}
function forum_update($node) {
$node->icon = _forum_decode_icon($node);
- db_query("UPDATE forum SET icon = '%s', shadow = '%d', tid = '%d' WHERE nid = '%d'", $node->icon, $node->shadow, $node->tid[0], $node->nid);
+ db_query("UPDATE forum SET icon = '%s', shadow = %d, tid = %d WHERE nid = %d", $node->icon, $node->shadow, $node->tid[0], $node->nid);
}
function _forum_decode_icon($node) {
@@ -265,21 +265,21 @@ function _forum_decode_icon($node) {
}
function forum_delete(&$node) {
- db_query("DELETE FROM forum WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM forum WHERE nid = %d", $node->nid);
}
function _forum_num_comments($nid) {
- $value = db_fetch_object(db_query("SELECT COUNT(cid) AS count FROM comments WHERE nid = '%d' AND status = 0", $nid));
+ $value = db_fetch_object(db_query("SELECT COUNT(cid) AS count FROM comments WHERE nid = %d AND status = 0", $nid));
return ($value) ? $value->count : 0;
}
function _forum_last_comment($nid) {
- $value = db_fetch_object(db_query_range("SELECT timestamp FROM comments WHERE nid = '%d' AND status = 0 ORDER BY timestamp DESC", $nid, 0, 1));
+ $value = db_fetch_object(db_query_range("SELECT timestamp FROM comments WHERE nid = %d AND status = 0 ORDER BY timestamp DESC", $nid, 0, 1));
return ($value) ? format_date($value->timestamp, "small") : "&nbsp;";
}
function _forum_last_reply($nid) {
- $value = db_fetch_object(db_query_range("SELECT c.timestamp, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = '%d' AND c.status = 0 ORDER BY c.timestamp DESC", $nid, 0, 1));
+ $value = db_fetch_object(db_query_range("SELECT c.timestamp, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY c.timestamp DESC", $nid, 0, 1));
return $value;
}
@@ -348,17 +348,17 @@ function forum_get_parents($tid) {
}
function _forum_num_topics($term) {
- $value = db_fetch_object(db_query("SELECT COUNT(n.nid) AS count FROM node n, forum f WHERE f.tid = '%d' AND n.nid = f.nid AND n.status = 1 AND n.type = 'forum'", $term));
+ $value = db_fetch_object(db_query("SELECT COUNT(n.nid) AS count FROM node n, forum f WHERE f.tid = %d AND n.nid = f.nid AND n.status = 1 AND n.type = 'forum'", $term));
return ($value) ? $value->count : 0;
}
function _forum_num_replies($term) {
- $value = db_fetch_object(db_query("SELECT COUNT(*) AS count FROM comments c, node n, forum f WHERE f.tid = '%d' AND n.nid = f.nid AND n.nid = c.nid AND n.status = 1 AND c.status = 0 AND n.type = 'forum'", $term));
+ $value = db_fetch_object(db_query("SELECT COUNT(*) AS count FROM comments c, node n, forum f WHERE f.tid = %d AND n.nid = f.nid AND n.nid = c.nid AND n.status = 1 AND c.status = 0 AND n.type = 'forum'", $term));
return ($value) ? $value->count : 0;
}
function _forum_topics_read($uid) {
- $result = db_query("SELECT tid, count(*) AS c FROM history h, node n, forum f WHERE f.nid = n.nid AND n.nid = h.nid AND n.type = 'forum' AND n.status = 1 AND h.uid = '%d' GROUP BY tid", $uid);
+ $result = db_query("SELECT tid, count(*) AS c FROM history h, node n, forum f WHERE f.nid = n.nid AND n.nid = h.nid AND n.type = 'forum' AND n.status = 1 AND h.uid = %d GROUP BY tid", $uid);
while ($obj = db_fetch_object($result)) {
$topics_read[$obj->tid] = $obj->c;
@@ -368,9 +368,9 @@ function _forum_topics_read($uid) {
}
function _forum_last_post($term) {
- $topic = db_fetch_object(db_query_range("SELECT n.nid, n.created AS timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN users u ON n.uid = u.uid WHERE f.tid = '%d' AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 ORDER BY timestamp DESC", $term, 0, 1));
+ $topic = db_fetch_object(db_query_range("SELECT n.nid, n.created AS timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN users u ON n.uid = u.uid WHERE f.tid = %d AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 ORDER BY timestamp DESC", $term, 0, 1));
- $reply = db_fetch_object(db_query_range("SELECT n.nid, c.timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN comments c ON n.nid = c.nid LEFT JOIN users u ON c.uid = u.uid WHERE f.tid = '%d' AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 AND c.status = 0 ORDER BY c.timestamp DESC", $term, 0, 1));
+ $reply = db_fetch_object(db_query_range("SELECT n.nid, c.timestamp, u.name AS name, u.uid AS uid FROM forum f, node n LEFT JOIN comments c ON n.nid = c.nid LEFT JOIN users u ON c.uid = u.uid WHERE f.tid = %d AND n.nid = f.nid AND n.type = 'forum' AND n.status = 1 AND c.status = 0 ORDER BY c.timestamp DESC", $term, 0, 1));
$value = ($topic->timestamp > $reply->timestamp) ? $topic : $reply;
@@ -434,12 +434,12 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
function _forum_new($tid) {
global $user;
- $result = db_query("SELECT n.nid FROM node n, history h, forum f WHERE n.type = 'forum' AND n.status = 1 AND h.nid = n.nid AND f.nid = h.nid AND f.tid = '%d' AND h.uid = '%d'", $tid, $user->uid);
+ $result = db_query("SELECT n.nid FROM node n, history h, forum f WHERE n.type = 'forum' AND n.status = 1 AND h.nid = n.nid AND f.nid = h.nid AND f.tid = %d AND h.uid = %d", $tid, $user->uid);
while ($r = db_fetch_object($result)) {
$read[] = $r->nid;
}
- $nid = db_result(db_query_range("SELECT n.nid FROM node n, forum f WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = '%d' ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1));
+ $nid = db_result(db_query_range("SELECT n.nid FROM node n, forum f WHERE n.type = 'forum' AND f.nid = n.nid AND n.status = 1 AND f.tid = %d ".($read ? "AND NOT (n.nid IN (".implode(",", $read).")) " : "") ."ORDER BY created", $tid, 0, 1));
return $nid ? $nid : 0;
}
@@ -685,7 +685,7 @@ function _forum_user_last_visit($nid) {
global $user;
static $history;
if (!$history) {
- $result = db_query("SELECT nid, timestamp FROM history WHERE uid = '%d'", $user->uid);
+ $result = db_query("SELECT nid, timestamp FROM history WHERE uid = %d", $user->uid);
while ($t = db_fetch_object($result)) {
$history[$t->nid] = $t->timestamp;
}
diff --git a/modules/import.module b/modules/import.module
index 4e5af2f5e..69abf97bf 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -359,7 +359,7 @@ function import_save_item($edit) {
db_query("DELETE FROM item WHERE iid = %d", $edit["iid"]);
}
else if ($edit["title"] && $edit["link"]) {
- db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
+ db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d)", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
}
}
@@ -417,7 +417,7 @@ function import_form_feed($edit = array()) {
function import_save_feed($edit) {
if ($edit["fid"] && $edit["title"]) {
- db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
+ db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = %d WHERE fid = %d", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
db_query("DELETE FROM item WHERE fid = %d", $edit["fid"]);
}
else if ($edit["fid"]) {
@@ -427,7 +427,7 @@ function import_save_feed($edit) {
else if ($edit["title"]) {
// a single unique id for bundles and feeds, to use in blocks
$next_id = db_next_id("feed_fid");
- db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', '%s')", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
+ db_query("INSERT INTO feed (fid, title, url, attributes, refresh) VALUES (%d, '%s', '%s', '%s', %d)", $next_id, $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
}
}
diff --git a/modules/locale.module b/modules/locale.module
index 857d94174..09453e86c 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -65,7 +65,7 @@ function locale_link($type) {
}
function locale_delete($lid) {
- db_query("DELETE FROM locales WHERE lid = '%d'", $lid);
+ db_query("DELETE FROM locales WHERE lid = %d", $lid);
locale_refresh_cache();
return t("deleted string");
@@ -74,7 +74,7 @@ function locale_delete($lid) {
function locale_save($lid) {
global $edit;
foreach ($edit as $key=>$value) {
- db_query("UPDATE locales SET $key = '%s' WHERE lid = '%d'", $value, $lid);
+ db_query("UPDATE locales SET $key = '%s' WHERE lid = %d", $value, $lid);
}
locale_refresh_cache();
// delete form data so it will remember where it came from
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 857d94174..09453e86c 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -65,7 +65,7 @@ function locale_link($type) {
}
function locale_delete($lid) {
- db_query("DELETE FROM locales WHERE lid = '%d'", $lid);
+ db_query("DELETE FROM locales WHERE lid = %d", $lid);
locale_refresh_cache();
return t("deleted string");
@@ -74,7 +74,7 @@ function locale_delete($lid) {
function locale_save($lid) {
global $edit;
foreach ($edit as $key=>$value) {
- db_query("UPDATE locales SET $key = '%s' WHERE lid = '%d'", $value, $lid);
+ db_query("UPDATE locales SET $key = '%s' WHERE lid = %d", $value, $lid);
}
locale_refresh_cache();
// delete form data so it will remember where it came from
diff --git a/modules/page.module b/modules/page.module
index 33145fcb7..178c7c4e8 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -53,19 +53,19 @@ function page_save($op, $node) {
}
function page_insert($node) {
- db_query("INSERT INTO page (nid, format, link, description) VALUES ('%d', '%d', '%s', '%s')", $node->nid, $node->format, $node->link, $node->description);
+ db_query("INSERT INTO page (nid, format, link, description) VALUES (%d, %d, '%s', '%s')", $node->nid, $node->format, $node->link, $node->description);
}
function page_update($node) {
-db_query("UPDATE page SET format = '%d', link = '%s', description = '%s' WHERE nid = '%d'", $node->format, $node->link, $node->description, $node->nid);
+db_query("UPDATE page SET format = %d, link = '%s', description = '%s' WHERE nid = %d", $node->format, $node->link, $node->description, $node->nid);
}
function page_delete(&$node) {
- db_query("DELETE FROM page WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM page WHERE nid = %d", $node->nid);
}
function page_load($node) {
- $page = db_fetch_object(db_query("SELECT format, link, description FROM page WHERE nid = '%d'", $node->nid));
+ $page = db_fetch_object(db_query("SELECT format, link, description FROM page WHERE nid = %d", $node->nid));
return $page;
}
diff --git a/modules/page/page.module b/modules/page/page.module
index 33145fcb7..178c7c4e8 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -53,19 +53,19 @@ function page_save($op, $node) {
}
function page_insert($node) {
- db_query("INSERT INTO page (nid, format, link, description) VALUES ('%d', '%d', '%s', '%s')", $node->nid, $node->format, $node->link, $node->description);
+ db_query("INSERT INTO page (nid, format, link, description) VALUES (%d, %d, '%s', '%s')", $node->nid, $node->format, $node->link, $node->description);
}
function page_update($node) {
-db_query("UPDATE page SET format = '%d', link = '%s', description = '%s' WHERE nid = '%d'", $node->format, $node->link, $node->description, $node->nid);
+db_query("UPDATE page SET format = %d, link = '%s', description = '%s' WHERE nid = %d", $node->format, $node->link, $node->description, $node->nid);
}
function page_delete(&$node) {
- db_query("DELETE FROM page WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM page WHERE nid = %d", $node->nid);
}
function page_load($node) {
- $page = db_fetch_object(db_query("SELECT format, link, description FROM page WHERE nid = '%d'", $node->nid));
+ $page = db_fetch_object(db_query("SELECT format, link, description FROM page WHERE nid = %d", $node->nid));
return $page;
}
diff --git a/modules/poll.module b/modules/poll.module
index 45188c78a..0fc1db8a9 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -66,13 +66,13 @@ function poll_cron() {
// Close polls that have exceeded their allowed runtime
$result = db_query("SELECT p.nid FROM poll p LEFT 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);
+ db_query("UPDATE poll SET active='0' WHERE nid = %d", $poll->nid);
}
}
function poll_delete($node) {
- db_query("DELETE FROM poll WHERE nid='%d'", $node->nid);
- db_query("DELETE FROM poll_choices WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM poll WHERE nid=%d", $node->nid);
+ db_query("DELETE FROM poll_choices WHERE nid = %d", $node->nid);
}
function poll_form(&$node, &$help, &$error) {
@@ -142,11 +142,11 @@ function poll_insert($node) {
$node->active = 1;
}
- db_query("INSERT INTO poll (nid, runtime, voters, active) VALUES ('%d', '%d', '', '%d')", $node->nid, $node->runtime, $node->active);
+ db_query("INSERT INTO poll (nid, runtime, voters, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active);
for ($i = 0; $i < $node->choices; $i++) {
if ($node->choice[$i] != "") {
- db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES ('%d', '%s', '%d', '%d')", $node->nid, filter($node->choice[$i]), $node->chvotes[$i], $i);
+ db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, filter($node->choice[$i]), $node->chvotes[$i], $i);
}
}
}
@@ -198,9 +198,9 @@ function poll_link($type, $node = 0, $main) {
function poll_load($node) {
// Load the appropriate choices into the $node object
- $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM poll WHERE nid = '%d'", $node->nid));
+ $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM poll WHERE nid = %d", $node->nid));
- $result = db_query("SELECT chtext, chvotes, chorder FROM poll_choices WHERE nid='%d' ORDER BY chorder", $node->nid);
+ $result = db_query("SELECT chtext, chvotes, chorder FROM poll_choices WHERE nid=%d ORDER BY chorder", $node->nid);
while ($choice = db_fetch_object($result)) {
$poll->choice[$choice->chorder] = $choice->chtext;
$poll->chvotes[$choice->chorder] = $choice->chvotes;
@@ -326,8 +326,8 @@ function poll_view_processvote(&$node) {
if (isset($pollvote[$node->nid]) && ($node->allowvotes == 1)) {
if (!empty($node->choice[$pollvote[$node->nid]])) {
$node->voters = $node->voters ? ($node->voters ." ". $node->polluserid) : $node->polluserid;
- db_query("UPDATE poll SET voters='%s' WHERE nid = '%d'", $node->voters, $node->nid);
- db_query("UPDATE poll_choices SET chvotes = chvotes + 1 WHERE nid = '%d' AND chorder = '%d'", $node->nid, $pollvote[$node->nid]);
+ db_query("UPDATE poll SET voters='%s' WHERE nid = %d", $node->voters, $node->nid);
+ db_query("UPDATE poll_choices SET chvotes = chvotes + 1 WHERE nid = %d AND chorder = %d", $node->nid, $pollvote[$node->nid]);
$node->allowvotes = 0;
$node->chvotes[$pollvote[$node->nid]]++;
}
@@ -375,16 +375,16 @@ function poll_view(&$node, $main = 0, $block = 0) {
}
function poll_update($node) {
- db_query("UPDATE poll SET runtime = '%d', active = '%d' WHERE nid = '%d'", $node->runtime, $node->active, $node->nid);
+ db_query("UPDATE poll SET runtime = %d, active = %d WHERE nid = %d", $node->runtime, $node->active, $node->nid);
- db_query("DELETE FROM poll_choices WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM poll_choices WHERE nid = %d", $node->nid);
for ($i = 0; $i < $node->choices; $i++) {
$choice->chtext = filter($node->choice[$i]);
$choice->chvotes = (int)$node->chvotes[$i];
$choice->chorder = $i;
if ($choice->chtext != "") {
- db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES ('%d', '%s', '%d', '%d')", $node->nid, $choice->chtext, $choice->chvotes, $choice->chorder);
+ db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, $choice->chtext, $choice->chvotes, $choice->chorder);
}
}
}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 45188c78a..0fc1db8a9 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -66,13 +66,13 @@ function poll_cron() {
// Close polls that have exceeded their allowed runtime
$result = db_query("SELECT p.nid FROM poll p LEFT 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);
+ db_query("UPDATE poll SET active='0' WHERE nid = %d", $poll->nid);
}
}
function poll_delete($node) {
- db_query("DELETE FROM poll WHERE nid='%d'", $node->nid);
- db_query("DELETE FROM poll_choices WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM poll WHERE nid=%d", $node->nid);
+ db_query("DELETE FROM poll_choices WHERE nid = %d", $node->nid);
}
function poll_form(&$node, &$help, &$error) {
@@ -142,11 +142,11 @@ function poll_insert($node) {
$node->active = 1;
}
- db_query("INSERT INTO poll (nid, runtime, voters, active) VALUES ('%d', '%d', '', '%d')", $node->nid, $node->runtime, $node->active);
+ db_query("INSERT INTO poll (nid, runtime, voters, active) VALUES (%d, %d, '', %d)", $node->nid, $node->runtime, $node->active);
for ($i = 0; $i < $node->choices; $i++) {
if ($node->choice[$i] != "") {
- db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES ('%d', '%s', '%d', '%d')", $node->nid, filter($node->choice[$i]), $node->chvotes[$i], $i);
+ db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, filter($node->choice[$i]), $node->chvotes[$i], $i);
}
}
}
@@ -198,9 +198,9 @@ function poll_link($type, $node = 0, $main) {
function poll_load($node) {
// Load the appropriate choices into the $node object
- $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM poll WHERE nid = '%d'", $node->nid));
+ $poll = db_fetch_object(db_query("SELECT runtime, voters, active FROM poll WHERE nid = %d", $node->nid));
- $result = db_query("SELECT chtext, chvotes, chorder FROM poll_choices WHERE nid='%d' ORDER BY chorder", $node->nid);
+ $result = db_query("SELECT chtext, chvotes, chorder FROM poll_choices WHERE nid=%d ORDER BY chorder", $node->nid);
while ($choice = db_fetch_object($result)) {
$poll->choice[$choice->chorder] = $choice->chtext;
$poll->chvotes[$choice->chorder] = $choice->chvotes;
@@ -326,8 +326,8 @@ function poll_view_processvote(&$node) {
if (isset($pollvote[$node->nid]) && ($node->allowvotes == 1)) {
if (!empty($node->choice[$pollvote[$node->nid]])) {
$node->voters = $node->voters ? ($node->voters ." ". $node->polluserid) : $node->polluserid;
- db_query("UPDATE poll SET voters='%s' WHERE nid = '%d'", $node->voters, $node->nid);
- db_query("UPDATE poll_choices SET chvotes = chvotes + 1 WHERE nid = '%d' AND chorder = '%d'", $node->nid, $pollvote[$node->nid]);
+ db_query("UPDATE poll SET voters='%s' WHERE nid = %d", $node->voters, $node->nid);
+ db_query("UPDATE poll_choices SET chvotes = chvotes + 1 WHERE nid = %d AND chorder = %d", $node->nid, $pollvote[$node->nid]);
$node->allowvotes = 0;
$node->chvotes[$pollvote[$node->nid]]++;
}
@@ -375,16 +375,16 @@ function poll_view(&$node, $main = 0, $block = 0) {
}
function poll_update($node) {
- db_query("UPDATE poll SET runtime = '%d', active = '%d' WHERE nid = '%d'", $node->runtime, $node->active, $node->nid);
+ db_query("UPDATE poll SET runtime = %d, active = %d WHERE nid = %d", $node->runtime, $node->active, $node->nid);
- db_query("DELETE FROM poll_choices WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM poll_choices WHERE nid = %d", $node->nid);
for ($i = 0; $i < $node->choices; $i++) {
$choice->chtext = filter($node->choice[$i]);
$choice->chvotes = (int)$node->chvotes[$i];
$choice->chorder = $i;
if ($choice->chtext != "") {
- db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES ('%d', '%s', '%d', '%d')", $node->nid, $choice->chtext, $choice->chvotes, $choice->chorder);
+ db_query("INSERT INTO poll_choices (nid, chtext, chvotes, chorder) VALUES (%d, '%s', %d, %d)", $node->nid, $choice->chtext, $choice->chvotes, $choice->chorder);
}
}
}
diff --git a/modules/queue.module b/modules/queue.module
index 465a1b89d..7d4f1d274 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -37,7 +37,7 @@ function queue_count() {
}
function queue_score($id) {
- $result = db_query("SELECT score FROM node WHERE nid = '%d'", $id);
+ $result = db_query("SELECT score FROM node WHERE nid = %d", $id);
return ($result) ? db_result($result, 0) : 0;
}
diff --git a/modules/search.module b/modules/search.module
index fdbc0d293..c87372241 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -263,7 +263,7 @@ function update_index($search_array) {
** the search index
*/
foreach ($newwords as $key => $value) {
- db_query("INSERT INTO search_index VALUES('%s', '%s', '%s', '%s')", $key, $node["lno"], $node_type, $value);
+ db_query("INSERT INTO search_index VALUES('%s', %d, '%s', %d)", $key, $node["lno"], $node_type, $value);
}
// Zap the weighted words array, so we don't add multiples.
diff --git a/modules/search/search.module b/modules/search/search.module
index fdbc0d293..c87372241 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -263,7 +263,7 @@ function update_index($search_array) {
** the search index
*/
foreach ($newwords as $key => $value) {
- db_query("INSERT INTO search_index VALUES('%s', '%s', '%s', '%s')", $key, $node["lno"], $node_type, $value);
+ db_query("INSERT INTO search_index VALUES('%s', %d, '%s', %d)", $key, $node["lno"], $node_type, $value);
}
// Zap the weighted words array, so we don't add multiples.
diff --git a/modules/statistics.module b/modules/statistics.module
index b0771d3aa..4c6a6fb77 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -42,11 +42,11 @@ function statistics_exit() {
// node view counters are enabled
if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) {
// a node has been viewed, so updated the node's counters
- db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%d' WHERE nid = '%d'", time(), arg(2));
+ db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d", time(), arg(2));
// if we affected 0 rows, this is the first time viewing the node
if (!db_affected_rows()) {
// must create a new row to store counter's for new node
- db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%d', daycount + 1, totalcount + 1)", arg(2));
+ db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES(%d, daycount + 1, totalcount + 1)", arg(2));
}
}
}
@@ -57,10 +57,10 @@ function statistics_exit() {
$hostname = getenv("REMOTE_ADDR");
// log this page access
if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) {
- db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%d', '%s', '%s', '%d', '%d')", arg(2), $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values(%d, '%s', '%s', %d, %d)", arg(2), $referrer, $hostname, $user->uid, time());
}
else {
- db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%d', '%d')", $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', %d, %d)", $referrer, $hostname, $user->uid, time());
}
}
}
@@ -736,7 +736,7 @@ function statistics_display_online_block() {
** This call gathers all the info we need on users/guests in a single
** database call, thus is quite efficient.
*/
- $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE timestamp >= '%d' GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
+ $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE timestamp >= %d GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
$users = $guests = 0;
/* Count number of users & guests currently online based on db query */
@@ -800,7 +800,7 @@ function statistics_get($nid) {
if ($nid > 0) {
/* retrieves an array with both totalcount and daycount */
- $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM statistics WHERE nid = '%d'", $nid));
+ $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM statistics WHERE nid = %d", $nid));
}
return $statistics;
@@ -904,7 +904,7 @@ function statistics_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case "delete":
// clean up statistics table when node is deleted
- db_query("DELETE FROM statistics WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM statistics WHERE nid = %d", $node->nid);
}
}
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index b0771d3aa..4c6a6fb77 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -42,11 +42,11 @@ function statistics_exit() {
// node view counters are enabled
if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) {
// a node has been viewed, so updated the node's counters
- db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = '%d' WHERE nid = '%d'", time(), arg(2));
+ db_query("UPDATE statistics SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d", time(), arg(2));
// if we affected 0 rows, this is the first time viewing the node
if (!db_affected_rows()) {
// must create a new row to store counter's for new node
- db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES('%d', daycount + 1, totalcount + 1)", arg(2));
+ db_query("INSERT INTO statistics (nid, daycount, totalcount) VALUES(%d, daycount + 1, totalcount + 1)", arg(2));
}
}
}
@@ -57,10 +57,10 @@ function statistics_exit() {
$hostname = getenv("REMOTE_ADDR");
// log this page access
if ((arg(0) == "node") && (arg(1) == "view") && arg(2)) {
- db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values('%d', '%s', '%s', '%d', '%d')", arg(2), $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO accesslog (nid, url, hostname, uid, timestamp) values(%d, '%s', '%s', %d, %d)", arg(2), $referrer, $hostname, $user->uid, time());
}
else {
- db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', '%d', '%d')", $referrer, $hostname, $user->uid, time());
+ db_query("INSERT INTO accesslog (url, hostname, uid, timestamp) values('%s', '%s', %d, %d)", $referrer, $hostname, $user->uid, time());
}
}
}
@@ -736,7 +736,7 @@ function statistics_display_online_block() {
** This call gathers all the info we need on users/guests in a single
** database call, thus is quite efficient.
*/
- $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE timestamp >= '%d' GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
+ $result = db_query("SELECT COUNT(DISTINCT hostname) AS count, uid, MAX(timestamp) AS max_timestamp FROM accesslog WHERE timestamp >= %d GROUP BY uid ORDER BY max_timestamp DESC", (time() - $time_period));
$users = $guests = 0;
/* Count number of users & guests currently online based on db query */
@@ -800,7 +800,7 @@ function statistics_get($nid) {
if ($nid > 0) {
/* retrieves an array with both totalcount and daycount */
- $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM statistics WHERE nid = '%d'", $nid));
+ $statistics = db_fetch_array(db_query("SELECT totalcount, daycount, timestamp FROM statistics WHERE nid = %d", $nid));
}
return $statistics;
@@ -904,7 +904,7 @@ function statistics_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case "delete":
// clean up statistics table when node is deleted
- db_query("DELETE FROM statistics WHERE nid = '%d'", $node->nid);
+ db_query("DELETE FROM statistics WHERE nid = %d", $node->nid);
}
}
diff --git a/modules/system.module b/modules/system.module
index ae597b169..a0e69bbea 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -168,7 +168,7 @@ function system_save_settings($edit = array()) {
if ($edit["type"]) {
db_query("UPDATE system SET status = '0' WHERE type = '%s'", $edit["type"]);
foreach ($edit["status"] as $filename => $status) {
- db_query("UPDATE system SET status = '%d' WHERE filename = '$filename'", $status);
+ db_query("UPDATE system SET status = %d WHERE filename = '$filename'", $status);
}
if ($edit["type"] == "theme") {
variable_set("theme_default", $edit["theme_default"]);
diff --git a/modules/system/system.module b/modules/system/system.module
index ae597b169..a0e69bbea 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -168,7 +168,7 @@ function system_save_settings($edit = array()) {
if ($edit["type"]) {
db_query("UPDATE system SET status = '0' WHERE type = '%s'", $edit["type"]);
foreach ($edit["status"] as $filename => $status) {
- db_query("UPDATE system SET status = '%d' WHERE filename = '$filename'", $status);
+ db_query("UPDATE system SET status = %d WHERE filename = '$filename'", $status);
}
if ($edit["type"] == "theme") {
variable_set("theme_default", $edit["theme_default"]);
diff --git a/modules/tracker.module b/modules/tracker.module
index e4511d5b0..a48234707 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -35,10 +35,10 @@ function tracker_posts($id = 0) {
while ($node = db_fetch_object($sresult)) {
if ($id) {
- $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.uid = '%d' AND c.nid = '%d' AND c.status = 0 ORDER BY cid DESC", $id, $node->nid);
+ $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.uid = %d AND c.nid = %d AND c.status = 0 ORDER BY cid DESC", $id, $node->nid);
}
else {
- $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = '%d' AND c.status = 0 ORDER BY cid DESC", $node->nid);
+ $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY cid DESC", $node->nid);
}
$type = ucfirst(module_invoke($node->type, "node", "name"));
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index e4511d5b0..a48234707 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -35,10 +35,10 @@ function tracker_posts($id = 0) {
while ($node = db_fetch_object($sresult)) {
if ($id) {
- $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.uid = '%d' AND c.nid = '%d' AND c.status = 0 ORDER BY cid DESC", $id, $node->nid);
+ $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.uid = %d AND c.nid = %d AND c.status = 0 ORDER BY cid DESC", $id, $node->nid);
}
else {
- $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = '%d' AND c.status = 0 ORDER BY cid DESC", $node->nid);
+ $cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY cid DESC", $node->nid);
}
$type = ucfirst(module_invoke($node->type, "node", "name"));
diff --git a/modules/user.module b/modules/user.module
index 2c393d977..8db17ffb5 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -29,7 +29,7 @@ function sess_read($key) {
function sess_write($key, $value) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = '%s' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
+ db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = %d WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
return '';
}
@@ -37,7 +37,7 @@ function sess_write($key, $value) {
function sess_destroy($key) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE users SET hostname = '%s', timestamp = '%s', sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
+ db_query("UPDATE users SET hostname = '%s', timestamp = %d, sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
}
function sess_gc($lifetime) {
@@ -95,7 +95,7 @@ function user_save($account, $array = array()) {
$user_fields = user_fields();
if ($account->uid) {
- $data = unserialize(db_result(db_query("SELECT data FROM users WHERE uid = '%d'", $account->uid)));
+ $data = unserialize(db_result(db_query("SELECT data FROM users WHERE uid = %d", $account->uid)));
foreach ($array as $key => $value) {
if ($key == "pass") {
$query .= "$key = '". md5($value) ."', ";
@@ -111,7 +111,7 @@ function user_save($account, $array = array()) {
}
$query .= "data = '". check_query(serialize($data)) ."', ";
- db_query("UPDATE users SET $query timestamp = '%s' WHERE uid = '%d'", time(), $account->uid);
+ db_query("UPDATE users SET $query timestamp = %d WHERE uid = %d", time(), $account->uid);
$user = user_load(array("uid" => $account->uid));
}
@@ -188,7 +188,7 @@ function user_validate_mail($mail) {
}
function user_validate_authmap($account, $authname, $module) {
- $result = db_query("SELECT COUNT(*) from authmap WHERE uid != '%d' AND authname = '%s'", $account->uid, $authname);
+ $result = db_query("SELECT COUNT(*) from authmap WHERE uid != %d AND authname = '%s'", $account->uid, $authname);
if (db_result($result) > 0) {
$name = module_invoke($module, "info", "name");
return t("The %u ID %s is already taken.", array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
@@ -449,7 +449,7 @@ function user_get_authname($account, $module) {
** Called by authentication modules in order to edit/view their authmap information.
*/
- $result = db_query("SELECT authname FROM authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module);
+ $result = db_query("SELECT authname FROM authmap WHERE uid = %d AND module = '%s'", $account->uid, $module);
return db_result($result);
}
@@ -477,16 +477,16 @@ function user_set_authmaps($account, $authmaps) {
foreach ($authmaps as $key => $value) {
$module = explode("_", $key, 2);
if ($value) {
- $result = db_query("SELECT COUNT(*) from authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module["1"]);
+ $result = db_query("SELECT COUNT(*) from authmap WHERE uid = %d AND module = '%s'", $account->uid, $module["1"]);
if (db_result($result) == 0) {
- $result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', '%d', '%s')", $value, $account->uid, $module[1]);
+ $result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', %d, '%s')", $value, $account->uid, $module[1]);
}
else {
- $result = db_query("UPDATE authmap SET authname = '%s' WHERE uid = '%d' AND module = '%s'", $value, $account->uid, $module["1"]);
+ $result = db_query("UPDATE authmap SET authname = '%s' WHERE uid = %d AND module = '%s'", $value, $account->uid, $module["1"]);
}
}
else {
- $result = db_query("DELETE FROM authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module["1"]);
+ $result = db_query("DELETE FROM authmap WHERE uid = %d AND module = '%s'", $account->uid, $module["1"]);
}
}
return $result;
@@ -875,7 +875,7 @@ function user_delete() {
if ($edit["confirm"]) {
watchdog("user","$user->name deactivated her own account.");
- db_query("UPDATE users SET mail = 'deleted', status = '0' WHERE uid = '%d'", $user->uid);
+ db_query("UPDATE users SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid);
$output .= t("Your account has been deactivated.");
}
else {
@@ -1203,7 +1203,7 @@ function user_admin_access($edit = array()) {
}
if ($op == t("Add rule")) {
- db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', '%s')", $edit["mask"], $type, $edit["status"]);
+ db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', %d)", $edit["mask"], $type, $edit["status"]);
}
else if ($op == t("Check")) {
if (user_deny($type, $edit["test"])) {
@@ -1214,7 +1214,7 @@ function user_admin_access($edit = array()) {
}
}
else if ($id) {
- db_query("DELETE FROM access WHERE aid = '%d'", $id);
+ db_query("DELETE FROM access WHERE aid = %d", $id);
}
$header = array(t("type"), t("mask"), t("operations"));
@@ -1271,10 +1271,10 @@ function user_admin_perm($edit = array()) {
while ($role = db_fetch_object($result)) {
// delete, so if we clear every checkbox we reset that role;
// otherwise permissions are active and denied everywhere
- db_query("DELETE FROM permission WHERE rid = '%d'", $role->rid);
+ db_query("DELETE FROM permission WHERE rid = %d", $role->rid);
$perm = $edit[$role->rid] ? implode(", ", array_keys($edit[$role->rid])) : "";
if ($perm) {
- db_query("INSERT INTO permission (rid, perm) VALUES ('%s', '%s')", $role->rid, $perm);
+ db_query("INSERT INTO permission (rid, perm) VALUES (%d, '%s')", $role->rid, $perm);
}
}
@@ -1334,11 +1334,11 @@ function user_admin_role($edit = array()) {
$id = arg(3);
if ($op == t("Save role")) {
- db_query("UPDATE role SET name = '%s' WHERE rid = '%d'", $edit["name"], $id);
+ db_query("UPDATE role SET name = '%s' WHERE rid = %d", $edit["name"], $id);
}
else if ($op == t("Delete role")) {
- db_query("DELETE FROM role WHERE rid = '%d'", $id);
- db_query("DELETE FROM permission WHERE rid = '%d'", $id);
+ db_query("DELETE FROM role WHERE rid = %d", $id);
+ db_query("DELETE FROM permission WHERE rid = %d", $id);
}
else if ($op == t("Add role")) {
db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
@@ -1348,7 +1348,7 @@ function user_admin_role($edit = array()) {
** Display role form:
*/
- $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%d'", $id));
+ $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = %d", $id));
$output .= form_textfield(t("Role name"), "name", $role->name, 32, 64, t("The name for this role. Example: 'moderator', 'editorial board', 'site architect'."));
$output .= form_submit(t("Save role"));
@@ -1405,10 +1405,10 @@ function user_admin_edit($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '%d' AND LOWER(name) = LOWER('%s')", $account->uid, $edit["name"])) > 0) {
+ else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != %d AND LOWER(name) = LOWER('%s')", $account->uid, $edit["name"])) > 0) {
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
}
- else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '%d' AND LOWER(mail) = LOWER('%s')", $account->uid, $edit["mail"])) > 0) {
+ else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $account->uid, $edit["mail"])) > 0) {
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
@@ -1437,8 +1437,8 @@ function user_admin_edit($edit = array()) {
}
else if ($op == t("Delete account")) {
if ($edit["status"] == 0) {
- db_query("DELETE FROM users WHERE uid = '%d'", $account->uid);
- db_query("DELETE FROM authmap WHERE uid = '%d'", $account->uid);
+ db_query("DELETE FROM users WHERE uid = %d", $account->uid);
+ db_query("DELETE FROM authmap WHERE uid = %d", $account->uid);
$output .= t("The account has been deleted.");
}
else {
diff --git a/modules/user/user.module b/modules/user/user.module
index 2c393d977..8db17ffb5 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -29,7 +29,7 @@ function sess_read($key) {
function sess_write($key, $value) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = '%s' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
+ db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = %d WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
return '';
}
@@ -37,7 +37,7 @@ function sess_write($key, $value) {
function sess_destroy($key) {
global $HTTP_SERVER_VARS;
- db_query("UPDATE users SET hostname = '%s', timestamp = '%s', sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
+ db_query("UPDATE users SET hostname = '%s', timestamp = %d, sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
}
function sess_gc($lifetime) {
@@ -95,7 +95,7 @@ function user_save($account, $array = array()) {
$user_fields = user_fields();
if ($account->uid) {
- $data = unserialize(db_result(db_query("SELECT data FROM users WHERE uid = '%d'", $account->uid)));
+ $data = unserialize(db_result(db_query("SELECT data FROM users WHERE uid = %d", $account->uid)));
foreach ($array as $key => $value) {
if ($key == "pass") {
$query .= "$key = '". md5($value) ."', ";
@@ -111,7 +111,7 @@ function user_save($account, $array = array()) {
}
$query .= "data = '". check_query(serialize($data)) ."', ";
- db_query("UPDATE users SET $query timestamp = '%s' WHERE uid = '%d'", time(), $account->uid);
+ db_query("UPDATE users SET $query timestamp = %d WHERE uid = %d", time(), $account->uid);
$user = user_load(array("uid" => $account->uid));
}
@@ -188,7 +188,7 @@ function user_validate_mail($mail) {
}
function user_validate_authmap($account, $authname, $module) {
- $result = db_query("SELECT COUNT(*) from authmap WHERE uid != '%d' AND authname = '%s'", $account->uid, $authname);
+ $result = db_query("SELECT COUNT(*) from authmap WHERE uid != %d AND authname = '%s'", $account->uid, $authname);
if (db_result($result) > 0) {
$name = module_invoke($module, "info", "name");
return t("The %u ID %s is already taken.", array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
@@ -449,7 +449,7 @@ function user_get_authname($account, $module) {
** Called by authentication modules in order to edit/view their authmap information.
*/
- $result = db_query("SELECT authname FROM authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module);
+ $result = db_query("SELECT authname FROM authmap WHERE uid = %d AND module = '%s'", $account->uid, $module);
return db_result($result);
}
@@ -477,16 +477,16 @@ function user_set_authmaps($account, $authmaps) {
foreach ($authmaps as $key => $value) {
$module = explode("_", $key, 2);
if ($value) {
- $result = db_query("SELECT COUNT(*) from authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module["1"]);
+ $result = db_query("SELECT COUNT(*) from authmap WHERE uid = %d AND module = '%s'", $account->uid, $module["1"]);
if (db_result($result) == 0) {
- $result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', '%d', '%s')", $value, $account->uid, $module[1]);
+ $result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', %d, '%s')", $value, $account->uid, $module[1]);
}
else {
- $result = db_query("UPDATE authmap SET authname = '%s' WHERE uid = '%d' AND module = '%s'", $value, $account->uid, $module["1"]);
+ $result = db_query("UPDATE authmap SET authname = '%s' WHERE uid = %d AND module = '%s'", $value, $account->uid, $module["1"]);
}
}
else {
- $result = db_query("DELETE FROM authmap WHERE uid = '%d' AND module = '%s'", $account->uid, $module["1"]);
+ $result = db_query("DELETE FROM authmap WHERE uid = %d AND module = '%s'", $account->uid, $module["1"]);
}
}
return $result;
@@ -875,7 +875,7 @@ function user_delete() {
if ($edit["confirm"]) {
watchdog("user","$user->name deactivated her own account.");
- db_query("UPDATE users SET mail = 'deleted', status = '0' WHERE uid = '%d'", $user->uid);
+ db_query("UPDATE users SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid);
$output .= t("Your account has been deactivated.");
}
else {
@@ -1203,7 +1203,7 @@ function user_admin_access($edit = array()) {
}
if ($op == t("Add rule")) {
- db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', '%s')", $edit["mask"], $type, $edit["status"]);
+ db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', %d)", $edit["mask"], $type, $edit["status"]);
}
else if ($op == t("Check")) {
if (user_deny($type, $edit["test"])) {
@@ -1214,7 +1214,7 @@ function user_admin_access($edit = array()) {
}
}
else if ($id) {
- db_query("DELETE FROM access WHERE aid = '%d'", $id);
+ db_query("DELETE FROM access WHERE aid = %d", $id);
}
$header = array(t("type"), t("mask"), t("operations"));
@@ -1271,10 +1271,10 @@ function user_admin_perm($edit = array()) {
while ($role = db_fetch_object($result)) {
// delete, so if we clear every checkbox we reset that role;
// otherwise permissions are active and denied everywhere
- db_query("DELETE FROM permission WHERE rid = '%d'", $role->rid);
+ db_query("DELETE FROM permission WHERE rid = %d", $role->rid);
$perm = $edit[$role->rid] ? implode(", ", array_keys($edit[$role->rid])) : "";
if ($perm) {
- db_query("INSERT INTO permission (rid, perm) VALUES ('%s', '%s')", $role->rid, $perm);
+ db_query("INSERT INTO permission (rid, perm) VALUES (%d, '%s')", $role->rid, $perm);
}
}
@@ -1334,11 +1334,11 @@ function user_admin_role($edit = array()) {
$id = arg(3);
if ($op == t("Save role")) {
- db_query("UPDATE role SET name = '%s' WHERE rid = '%d'", $edit["name"], $id);
+ db_query("UPDATE role SET name = '%s' WHERE rid = %d", $edit["name"], $id);
}
else if ($op == t("Delete role")) {
- db_query("DELETE FROM role WHERE rid = '%d'", $id);
- db_query("DELETE FROM permission WHERE rid = '%d'", $id);
+ db_query("DELETE FROM role WHERE rid = %d", $id);
+ db_query("DELETE FROM permission WHERE rid = %d", $id);
}
else if ($op == t("Add role")) {
db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
@@ -1348,7 +1348,7 @@ function user_admin_role($edit = array()) {
** Display role form:
*/
- $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%d'", $id));
+ $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = %d", $id));
$output .= form_textfield(t("Role name"), "name", $role->name, 32, 64, t("The name for this role. Example: 'moderator', 'editorial board', 'site architect'."));
$output .= form_submit(t("Save role"));
@@ -1405,10 +1405,10 @@ function user_admin_edit($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '%d' AND LOWER(name) = LOWER('%s')", $account->uid, $edit["name"])) > 0) {
+ else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != %d AND LOWER(name) = LOWER('%s')", $account->uid, $edit["name"])) > 0) {
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
}
- else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '%d' AND LOWER(mail) = LOWER('%s')", $account->uid, $edit["mail"])) > 0) {
+ else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $account->uid, $edit["mail"])) > 0) {
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
@@ -1437,8 +1437,8 @@ function user_admin_edit($edit = array()) {
}
else if ($op == t("Delete account")) {
if ($edit["status"] == 0) {
- db_query("DELETE FROM users WHERE uid = '%d'", $account->uid);
- db_query("DELETE FROM authmap WHERE uid = '%d'", $account->uid);
+ db_query("DELETE FROM users WHERE uid = %d", $account->uid);
+ db_query("DELETE FROM authmap WHERE uid = %d", $account->uid);
$output .= t("The account has been deleted.");
}
else {
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 712c6e372..9337d4bbf 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -65,7 +65,7 @@ function watchdog_overview($type) {
function watchdog_view($id) {
- $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '%d'", $id);
+ $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = %d", $id);
if ($watchdog = db_fetch_object($result)) {
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 712c6e372..9337d4bbf 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -65,7 +65,7 @@ function watchdog_overview($type) {
function watchdog_view($id) {
- $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = '%d'", $id);
+ $result = db_query("SELECT w.*, u.name, u.uid FROM watchdog w LEFT JOIN users u ON w.uid = u.uid WHERE w.wid = %d", $id);
if ($watchdog = db_fetch_object($result)) {
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";