From 33a3502dfee073325f5046baee655e6a2bdb29ec Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 16 Oct 2001 20:13:22 +0000 Subject: - Removed a node's link ID (lid) as discussed on the mailing list. See 'updates/3.00-to.x.xx.mysql' for the required MySQL updates. - Renamed some "author" fields to "uid" fields for sake of consistency. - Fixed the coding style of some PHP files. - Fixed the moderation queue (fairly untested though). - Re-introduced the temporary SQL table in _node_get(). - Added a missing 'auto_increment' to 'updates/3.00-to-x.xx.mysql'. --- admin.php | 12 +++++++++--- error.php | 6 +----- includes/comment.inc | 12 ++++++------ includes/module.inc | 10 ++++++---- includes/node.inc | 22 +++++++++------------- modules/aggregator.module | 4 ++-- modules/aggregator/aggregator.module | 4 ++-- modules/block.module | 1 + modules/block/block.module | 1 + modules/blog.module | 20 +++++++++++--------- modules/blog/blog.module | 20 +++++++++++--------- modules/book.module | 22 +++++++++++----------- modules/book/book.module | 22 +++++++++++----------- modules/comment.module | 6 +++--- modules/comment/comment.module | 6 +++--- modules/forum.module | 2 +- modules/forum/forum.module | 2 +- modules/import.module | 4 ++-- modules/node.module | 2 +- modules/node/node.module | 2 +- modules/page.module | 2 +- modules/page/page.module | 2 +- modules/queue.module | 6 +++--- modules/rating.module | 8 ++++---- modules/story.module | 4 ++-- modules/story/story.module | 4 ++-- modules/tracker.module | 4 ++-- modules/tracker/tracker.module | 4 ++-- modules/user.module | 2 +- modules/user/user.module | 2 +- node.php | 4 ++-- submit.php | 4 +++- updates/3.00-to-x.xx.mysql | 35 +++++++++++++++++++++++++++++++++-- xmlrpc.php | 2 +- 34 files changed, 151 insertions(+), 112 deletions(-) diff --git a/admin.php b/admin.php index f8176d9c6..1c9b0b26f 100644 --- a/admin.php +++ b/admin.php @@ -3,7 +3,9 @@ include_once "includes/common.inc"; function status($message) { - if ($message) return "Status: $message
\n"; + if ($message) { + return "Status: $message
\n"; + } } function admin_page($mod) { @@ -29,12 +31,16 @@ function admin_page($mod) { $links[] = "home"; foreach (module_list() as $name) { - if (module_hook($name, "link")) $links = array_merge($links, module_invoke($name, "link", "admin")); + if (module_hook($name, "link")) { + $links = array_merge($links, module_invoke($name, "link", "admin")); + } } print implode(" | ", $links) ."
"; - if ($mod) module_invoke($mod, "admin"); + if ($mod) { + module_invoke($mod, "admin"); + } ?> diff --git a/error.php b/error.php index c4db050d0..b87c425ef 100644 --- a/error.php +++ b/error.php @@ -2,11 +2,7 @@ include_once "includes/common.inc"; -$errors = array(500 => "500 error: internal server error", - 404 => "404 error: `$REDIRECT_URL' not found", - 403 => "403 error: access denied - forbidden", - 401 => "401 error: authorization required", - 400 => "400 error: bad request"); +$errors = array(500 => "500 error: internal server error", 404 => "404 error: `$REDIRECT_URL' not found", 403 => "403 error: access denied - forbidden", 401 => "401 error: authorization required", 400 => "400 error: bad request"); watchdog("httpd", $errors[$REDIRECT_STATUS]); diff --git a/includes/comment.inc b/includes/comment.inc index 8ac81fbfa..a41489651 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -78,7 +78,7 @@ function comment_reply($pid, $id) { global $theme; if ($pid) { - $item = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$pid'")); + $item = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$pid'")); comment_view(new Comment($item->uid, $item->name, $item->subject, $item->comment, $item->timestamp, $item->url, $item->cid, $item->lid), t("reply to this comment")); } else { @@ -124,7 +124,7 @@ function comment_post($edit) { watchdog("special", "comment: added '$edit[subject]'"); // add comment to database: - db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp) VALUES ('". check_input($edit[id]) ."', '". check_input($edit[pid]) ."', '$user->uid', '". check_input($edit[subject]) ."', '". check_input($edit[comment]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); + db_query("INSERT INTO comments (lid, pid, uid, subject, comment, hostname, timestamp) VALUES ('". check_input($edit[id]) ."', '". check_input($edit[pid]) ."', '$user->uid', '". check_input($edit[subject]) ."', '". check_input($edit[comment]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); // clear cache: cache_clear(); @@ -176,7 +176,7 @@ function comment_order($order) { function comment_query($lid, $order, $pid = -1) { - $query .= "SELECT c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name, AVG(m.score) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'"; + $query .= "SELECT c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name, AVG(m.score) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.uid = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.lid = '$lid'"; if ($pid >= 0) { $query .= " AND pid = '$pid'"; @@ -235,7 +235,7 @@ function comment_view($comment, $folded = 0) { function comment_thread_min($cid, $threshold) { global $user; - $result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name, AVG(m.score) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.author = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name ORDER BY c.timestamp"); + $result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name, AVG(m.score) AS score, COUNT(m.cid) AS votes FROM comments c LEFT JOIN users u ON c.uid = u.uid LEFT JOIN moderate m ON c.cid = m.cid WHERE c.pid = '$cid' GROUP BY c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name ORDER BY c.timestamp"); while ($comment = db_fetch_object($result)) { print "