$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);
@@ -215,7 +215,7 @@ function block_admin_preview() {
}
functionblock_box_get($bid){
returndb_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '%d'",$bid));
returndb_fetch_array(db_query("SELECT * FROM boxes WHERE bid = %d",$bid));
}
functionblock_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"]);
@@ -215,7 +215,7 @@ function block_admin_preview() {
}
functionblock_box_get($bid){
returndb_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '%d'",$bid));
returndb_fetch_array(db_query("SELECT * FROM boxes WHERE bid = %d",$bid));
}
functionblock_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"]);
@@ -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) {
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))){
@@ -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) {
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))){
$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) {
}
functionbook_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);
}
functionbook_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);
}
functionbook_delete(&$node){
db_query("DELETE FROM book WHERE nid = '%d'",$node->nid);
db_query("DELETE FROM book WHERE nid = %d",$node->nid);
}
functionbook_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.
*/
functionbook_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() {
}
functionbook_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) {
}
functionbook_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);
$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) {
}
functionbook_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);
}
functionbook_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);
}
functionbook_delete(&$node){
db_query("DELETE FROM book WHERE nid = '%d'",$node->nid);
db_query("DELETE FROM book WHERE nid = %d",$node->nid);
}
functionbook_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.
*/
functionbook_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() {
}
functionbook_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) {
}
functionbook_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()) {
}
functioncloud_get_site($sid){
returndb_fetch_array(db_query("SELECT * FROM site WHERE sid = '%d'",$sid));
returndb_fetch_array(db_query("SELECT * FROM site WHERE sid = %d",$sid));
}
functioncloud_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"]);
}
elseif($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"]);
$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 ".