- Applied Michael Caerwyn's "%s -> %d" patch.
- Changed all occurences of '%d' to %d as suggested on the mailing list.4.2.x
parent
9a62873a4b
commit
a161110a6b
|
@ -38,7 +38,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
|
|||
|
||||
function watchdog($type, $message, $link = NULL) {
|
||||
global $user;
|
||||
db_query("INSERT INTO watchdog (uid, type, message, link, location, hostname, timestamp) VALUES ('%d', '%s', '%s', '%s', '%s', '%s', '%s')", $user->uid, $type, $message, $link, request_uri(), getenv("REMOTE_ADDR"), time());
|
||||
db_query("INSERT INTO watchdog (uid, type, message, link, location, hostname, timestamp) VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $link, request_uri(), getenv("REMOTE_ADDR"), time());
|
||||
}
|
||||
|
||||
function throttle($type, $rate) {
|
||||
|
@ -659,7 +659,7 @@ function cache_clear_all($cid = NULL) {
|
|||
db_query("DELETE FROM cache WHERE expire <> 0");
|
||||
}
|
||||
else {
|
||||
db_query("DELETE FROM cache WHERE cid = '%d'", $cid);
|
||||
db_query("DELETE FROM cache WHERE cid = %d", $cid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ function db_next_id($name) {
|
|||
|
||||
db_query("LOCK TABLES sequences WRITE");
|
||||
$id = db_result(db_query("SELECT id FROM sequences WHERE name = '%s'", $name)) + 1;
|
||||
db_query("REPLACE INTO sequences VALUES ('%s', '%d')", $name, $id);
|
||||
db_query("REPLACE INTO sequences VALUES ('%s', %d)", $name, $id);
|
||||
db_query("UNLOCK TABLES");
|
||||
|
||||
return $id;
|
||||
|
|
|
@ -181,7 +181,7 @@ function theme_init() {
|
|||
function theme_blocks($region) {
|
||||
global $user, $REQUEST_URI;
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = '%s' " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1);
|
||||
$result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = %d " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1);
|
||||
|
||||
while ($result && ($block = db_fetch_object($result))) {
|
||||
if ((($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->module][$block->delta])) && (!$block->path || preg_match('/'. str_replace('/', '\/', $block->path) .'/', request_uri()))) {
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.";
|
||||
}
|
||||
|
|
|
@ -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.";
|
||||
}
|
||||
|
|
|
@ -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)");
|
||||
|
||||
|
|
|
@ -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)");
|
||||
|
||||
|
|
|
@ -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") : " ";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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") : " ";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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\">";
|
||||
|
|
|
@ -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\">";
|
||||
|
|
|
@ -676,7 +676,7 @@ function update_50() {
|
|||
update_sql("ALTER TABLE forum ADD tid INT UNSIGNED NOT NULL");
|
||||
$result = db_queryd("SELECT n.nid, t.tid FROM node n, term_node t WHERE n.nid = t.nid AND type = 'forum'");
|
||||
while ($node = db_fetch_object($result)) {
|
||||
db_queryd("UPDATE forum SET tid = '%d' WHERE nid = '%d'", $node->tid, $node->nid);
|
||||
db_queryd("UPDATE forum SET tid = %d WHERE nid = %d", $node->tid, $node->nid);
|
||||
}
|
||||
update_sql("ALTER TABLE forum ADD INDEX (tid)");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue