diff options
34 files changed, 151 insertions, 112 deletions
@@ -3,7 +3,9 @@ include_once "includes/common.inc"; function status($message) { - if ($message) return "<B>Status:</B> $message<HR>\n"; + if ($message) { + return "<B>Status:</B> $message<HR>\n"; + } } function admin_page($mod) { @@ -29,12 +31,16 @@ function admin_page($mod) { $links[] = "<a href=\"index.php\">home</a>"; 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) ."<hr />"; - if ($mod) module_invoke($mod, "admin"); + if ($mod) { + module_invoke($mod, "admin"); + } ?> </body> </html> @@ -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 "<ul>"; @@ -257,7 +257,7 @@ function comment_thread_max($cid, $mode, $threshold, $level = 0, $dummy = 0) { ** in terms of speed and size. */ - $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 "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td width=\"". ($level * 25) ."\"> </td><td>\n"; @@ -307,7 +307,7 @@ function comment_render($lid, $cid) { $theme->box(t("Control panel"), $theme->comment_controls($threshold, $mode, $order)); if ($cid > 0) { - $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.cid = '$cid' GROUP BY c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name"); + $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.cid = '$cid' GROUP BY c.cid, c.pid, c.lid, c.subject, c.comment, c.timestamp, u.uid, u.name"); if ($comment = db_fetch_object($result)) { comment_view($comment, comment_links($comment)); } diff --git a/includes/module.inc b/includes/module.inc index 4b6959c34..479dcde3f 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -53,19 +53,21 @@ function module_hook($name, $hook) { // rehash module-exported blocks: function module_rehash_blocks($name) { db_query("UPDATE blocks SET remove = '1' WHERE module = '$name'"); + if ($blocks = module_invoke($name, "block")) { - foreach ($blocks as $offset=>$block) { - foreach ($block as $item=>$data) { + foreach ($blocks as $delta => $block) { + foreach ($block as $item => $data) { $block[$item] = addslashes($data); } if (!db_fetch_object(db_query("SELECT * FROM blocks WHERE module = '$name' AND name = '$block[info]'"))) { - db_query("INSERT INTO blocks (name, module, delta) VALUES ('$block[info]', '$name', '$offset')"); + db_query("INSERT INTO blocks (name, module, delta) VALUES ('$block[info]', '$name', '$delta')"); } else { - db_query("UPDATE blocks SET delta = '$offset', remove = '0' WHERE module = '$name' AND name = '$block[info]'"); + db_query("UPDATE blocks SET delta = '$delta', remove = '0' WHERE module = '$name' AND name = '$block[info]'"); } } } + db_query("DELETE FROM blocks WHERE module = '$name' AND remove = '1'"); } diff --git a/includes/node.inc b/includes/node.inc index 07781de26..3f15fa59d 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -18,18 +18,15 @@ function _node_get($conditions) { } if ($type) { - $result = db_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC"); -/* - db_query ("BEGIN"); - db_query ("CREATE TEMPORARY TABLE modhole AS SELECT n.nid, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid"); - $result = db_query ("SELECT n.*, l.*, u.uid, u.name, m.score AS score, m.votes AS votes FROM node n INNER JOIN modhole m ON m.nid = n.nid LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC"); + // $result = db_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.nid = l.nid LEFT JOIN users u ON n.uid = u.uid WHERE $where ORDER BY n.timestamp DESC"); + + db_query("BEGIN"); + db_query("CREATE TEMPORARY TABLE modhole AS SELECT n.nid FROM node n LEFT JOIN $type l ON n.nid = l.nid LEFT JOIN users u ON n.uid = u.uid WHERE $where GROUP BY n.nid"); + $result = db_query("SELECT n.*, l.*, u.uid, u.name FROM node n INNER JOIN modhole m ON m.nid = n.nid LEFT JOIN $type l ON n.nid = l.nid LEFT JOIN users u ON n.uid = u.uid WHERE $where ORDER BY n.timestamp DESC"); db_query("DROP TABLE modhole"); db_query("COMMIT"); - 'score' isn't in GROUP BY -*/ - return $result; } } @@ -62,7 +59,7 @@ function node_del($conditions) { if ($node = node_get_object($conditions)) { module_invoke($node->type, "delete", $node); db_query("DELETE FROM node WHERE nid = '$node->nid'"); - db_query("DELETE FROM $node->type WHERE lid = '$node->lid' AND nid = '$node->nid'"); + db_query("DELETE FROM $node->type WHERE nid = '$node->nid'"); db_query("DELETE FROM comments WHERE lid = '$node->nid'"); db_query("DELETE FROM moderate WHERE nid = '$node->nid'"); watchdog("special", "node: deleted '$node->title'"); @@ -78,7 +75,7 @@ function node_get_comments($nid) { function node_save($node, $filter) { global $db_handle; - $rows = array(nid, lid, cid, tid, type, title, score, votes, author, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden); + $rows = array(nid, cid, tid, type, title, score, votes, uid, status, comment, promote, moderate, attributes, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden); if ($node[nid] > 0) { $n = node_get_object(array("nid" => $node[nid])); @@ -141,15 +138,14 @@ function node_save($node, $filter) { else { $nid = $db_handle->nextId("node"); - $lid = $db_handle->nextId($filter[type]); - $result = db_query("INSERT INTO node ($f1, nid, lid) VALUES ($v1, '$nid', '$lid')"); + $result = db_query("INSERT INTO node ($f1, nid) VALUES ($v1, '$nid')"); if (db_error($result)) { watchdog("warning", "node: added $filter[type] '$node[title]' - failed"); $db_handle->rollback(); } else { - $result = db_query("INSERT INTO $filter[type] ($f2, nid, lid) VALUES ($v2, '$nid', '$lid')"); + $result = db_query("INSERT INTO $filter[type] ($f2, nid) VALUES ($v2, '$nid')"); if (db_error($result)) { watchdog("warning", "node: added $filter[type] '$node[title]' - failed"); $db_handle->rollback(); diff --git a/modules/aggregator.module b/modules/aggregator.module index 7798d1f5f..2ac1b690c 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -95,7 +95,7 @@ function import_get_bundles($attributes = 0) { $i = 0; while ($bundle = db_fetch_object($result)) { $block[$i][subject] = $bundle->title; - $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$bundle->title bundle"; $i++; @@ -110,7 +110,7 @@ function import_get_feeds($attributes = 0) { $i = 0; while ($feed = db_fetch_object($result)) { $block[$i][subject] = $feed->title; - $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$feed->title feed"; $i++; diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 7798d1f5f..2ac1b690c 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -95,7 +95,7 @@ function import_get_bundles($attributes = 0) { $i = 0; while ($bundle = db_fetch_object($result)) { $block[$i][subject] = $bundle->title; - $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$bundle->title bundle"; $i++; @@ -110,7 +110,7 @@ function import_get_feeds($attributes = 0) { $i = 0; while ($feed = db_fetch_object($result)) { $block[$i][subject] = $feed->title; - $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$feed->title feed"; $i++; diff --git a/modules/block.module b/modules/block.module index ef576b95f..529dc4c8f 100644 --- a/modules/block.module +++ b/modules/block.module @@ -111,6 +111,7 @@ function block_admin_preview() { } function block_init() { + $result = db_query("SELECT * FROM modules"); while ($module = db_fetch_object($result)) { module_rehash($module->name); diff --git a/modules/block/block.module b/modules/block/block.module index ef576b95f..529dc4c8f 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -111,6 +111,7 @@ function block_admin_preview() { } function block_init() { + $result = db_query("SELECT * FROM modules"); while ($module = db_fetch_object($result)) { module_rehash($module->name); diff --git a/modules/blog.module b/modules/blog.module index 732da9fa7..1365d4d90 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -40,7 +40,7 @@ function blog_feed_user($uid = 0, $date = 0) { $date = time(); } - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.nid DESC LIMIT 15"); while ($blog = db_fetch_object($result)) { $items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->body); } @@ -59,7 +59,7 @@ function blog_feed_user($uid = 0, $date = 0) { } function blog_feed_last() { - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid ORDER BY b.nid DESC LIMIT 15"); while ($blog = db_fetch_object($result)) { $items .= format_rss_item($blog->title, path_uri() ."module.php?mod=blog&op=view&id=$blog->uid", $blog->body); } @@ -89,7 +89,7 @@ function blog_page_user($uid = 0, $date = 0) { $date = time(); } - $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; @@ -128,7 +128,7 @@ function blog_page_user($uid = 0, $date = 0) { function blog_page_last() { global $theme, $user; - $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; @@ -239,7 +239,7 @@ function blog_save($edit) { node_save($edit, array(title, body, type => "blog")); } else { - node_save($edit, array(attributes => node_attributes_save("blog", $edit), author => $user->uid, body, comment => variable_get("blog_comment", 0), moderate => variable_get("blog_moderate", ""), promote => variable_get("blog_promote", 0), score => 0, status => variable_get("blog_status", $status[posted]), timestamp => time(), title, type => "blog", votes => 0)); + node_save($edit, array(attributes => node_attributes_save("blog", $edit), uid => $user->uid, body, comment => variable_get("blog_comment", 0), moderate => variable_get("blog_moderate", ""), promote => variable_get("blog_promote", 0), score => 0, status => variable_get("blog_status", $status[posted]), timestamp => time(), title, type => "blog", votes => 0)); } } } @@ -247,7 +247,7 @@ function blog_save($edit) { function blog_edit_history($nid) { global $user; - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid WHERE n.author = '$user->uid' AND n.nid <= '". check_input($nid) ."' ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid WHERE n.uid = '$user->uid' AND n.nid <= '". check_input($nid) ."' ORDER BY b.nid DESC LIMIT 15"); $output .= "<table cellpadding=\"3\" cellspacing=\"3\" border=\"0\" width=\"100%\">"; while ($blog = db_fetch_object($result)) { @@ -340,13 +340,15 @@ function blog_link($type, $node = 0) { function blog_block() { global $user; - $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10"); + $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10"); while ($node = db_fetch_object($result)) { $output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n"; } - $block[0]["subject"] = "<a href=\"module.php?mod=blog\">". t("User blogs") ."</a>"; + $output .= "<br /><div align=\"right\"><a href=\"module.php?mod=blog\">". t("more") ."</a></div>"; + + $block[0]["subject"] = t("User blogs"); $block[0]["content"] = $output; $block[0]["info"] = t("User blogs"); $block[0]["link"] = "module.php?mod=blog"; @@ -358,7 +360,7 @@ function blog_block() { function blog_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); while ($blog = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($blog->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp); } diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 732da9fa7..1365d4d90 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -40,7 +40,7 @@ function blog_feed_user($uid = 0, $date = 0) { $date = time(); } - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid WHERE u.uid = '$uid' AND n.timestamp > '". ($date - 2592000) ."' ORDER BY b.nid DESC LIMIT 15"); while ($blog = db_fetch_object($result)) { $items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->body); } @@ -59,7 +59,7 @@ function blog_feed_user($uid = 0, $date = 0) { } function blog_feed_last() { - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body, u.name, u.uid FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid ORDER BY b.nid DESC LIMIT 15"); while ($blog = db_fetch_object($result)) { $items .= format_rss_item($blog->title, path_uri() ."module.php?mod=blog&op=view&id=$blog->uid", $blog->body); } @@ -89,7 +89,7 @@ function blog_page_user($uid = 0, $date = 0) { $date = time(); } - $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid LEFT JOIN comments c ON n.nid = c.lid WHERE u.uid = '$account->uid' AND n.timestamp <= '$date' AND n.timestamp >= '". ($date - 2592000) ."' GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; @@ -128,7 +128,7 @@ function blog_page_user($uid = 0, $date = 0) { function blog_page_last() { global $theme, $user; - $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.author = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); + $result = db_query("SELECT n.nid, n.title, n.comment, COUNT(c.cid) AS comments, n.timestamp, b.body, u.uid, u.name FROM blog b LEFT JOIN node n ON b.nid = n.nid LEFT JOIN users u ON n.uid = u.uid LEFT JOIN comments c ON n.nid = c.lid GROUP BY n.nid, n.title, n.comment, n.timestamp, b.body, u.uid, u.name ORDER BY n.nid DESC LIMIT 20"); $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\">"; @@ -239,7 +239,7 @@ function blog_save($edit) { node_save($edit, array(title, body, type => "blog")); } else { - node_save($edit, array(attributes => node_attributes_save("blog", $edit), author => $user->uid, body, comment => variable_get("blog_comment", 0), moderate => variable_get("blog_moderate", ""), promote => variable_get("blog_promote", 0), score => 0, status => variable_get("blog_status", $status[posted]), timestamp => time(), title, type => "blog", votes => 0)); + node_save($edit, array(attributes => node_attributes_save("blog", $edit), uid => $user->uid, body, comment => variable_get("blog_comment", 0), moderate => variable_get("blog_moderate", ""), promote => variable_get("blog_promote", 0), score => 0, status => variable_get("blog_status", $status[posted]), timestamp => time(), title, type => "blog", votes => 0)); } } } @@ -247,7 +247,7 @@ function blog_save($edit) { function blog_edit_history($nid) { global $user; - $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid WHERE n.author = '$user->uid' AND n.nid <= '". check_input($nid) ."' ORDER BY b.lid DESC LIMIT 15"); + $result = db_query("SELECT n.nid, n.title, n.timestamp, b.body FROM blog b LEFT JOIN node n ON b.nid = n.nid WHERE n.uid = '$user->uid' AND n.nid <= '". check_input($nid) ."' ORDER BY b.nid DESC LIMIT 15"); $output .= "<table cellpadding=\"3\" cellspacing=\"3\" border=\"0\" width=\"100%\">"; while ($blog = db_fetch_object($result)) { @@ -340,13 +340,15 @@ function blog_link($type, $node = 0) { function blog_block() { global $user; - $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10"); + $result = db_query("SELECT u.uid, u.name, n.timestamp, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10"); while ($node = db_fetch_object($result)) { $output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n"; } - $block[0]["subject"] = "<a href=\"module.php?mod=blog\">". t("User blogs") ."</a>"; + $output .= "<br /><div align=\"right\"><a href=\"module.php?mod=blog\">". t("more") ."</a></div>"; + + $block[0]["subject"] = t("User blogs"); $block[0]["content"] = $output; $block[0]["info"] = t("User blogs"); $block[0]["link"] = "module.php?mod=blog"; @@ -358,7 +360,7 @@ function blog_block() { function blog_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid AND n.lid = b.lid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, b.* FROM blog b LEFT JOIN node n ON n.nid = b.nid WHERE (n.title LIKE '%$keys%' OR b.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); while ($blog = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($blog->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=blog&op=edit&id=$blog->nid" : "node.php?id=$blog->nid"), "user" => $blog->name, "date" => $blog->timestamp); } diff --git a/modules/book.module b/modules/book.module index 6d7d9f536..cd2beb0ac 100644 --- a/modules/book.module +++ b/modules/book.module @@ -30,7 +30,7 @@ function book_status() { } 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 AND n.lid = b.lid WHERE n.nid = '$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 = '$node->parent'")); if ($parent->title) { $nodes = book_location($parent, $nodes); array_push($nodes, $parent); @@ -47,8 +47,8 @@ function book_view($node, $main = 0) { else { if ($node->nid && $node->parent) { $list = book_parent_query($node->parent); - $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.status = '$status[posted]' AND $list AND (b.weight > '$node->weight' OR (b.weight = '$node->weight' AND n.title > '". check_query($node->title) ."')) ORDER BY b.weight ASC,n.title ASC")); - $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.status = '$status[posted]' AND $list AND (b.weight < '$node->weight' OR (b.weight = '$node->weight' AND n.title < '". check_query($node->title) ."')) ORDER BY b.weight DESC,n.title DESC")); + $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = '$status[posted]' AND $list AND (b.weight > '$node->weight' OR (b.weight = '$node->weight' AND n.title > '". check_query($node->title) ."')) ORDER BY b.weight ASC,n.title ASC")); + $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = '$status[posted]' AND $list AND (b.weight < '$node->weight' OR (b.weight = '$node->weight' AND n.title < '". check_query($node->title) ."')) ORDER BY b.weight DESC,n.title DESC")); } $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" WIDTH=\"100%\">\n"; @@ -83,7 +83,7 @@ function book_view($node, $main = 0) { function book_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20"); while ($node = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($node->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp); } @@ -105,7 +105,7 @@ function book_toc($parent = "", $indent = "", $toc = array()) { global $status; // select all child nodes: - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight"); // add root node: if (user_access("administer nodes")) { @@ -168,7 +168,7 @@ function book_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(author => $user->uid, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight)); + node_save($edit, array(uid => $user->uid, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight)); } else if (user_access("administer nodes")) { node_save($edit, array(body, log, parent, title, type => "book", weight)); @@ -209,7 +209,7 @@ function book_tree($parent = "", $depth = 0) { if ($depth < 3 || strstr($PHP_SELF,"admin.php")) { // select all child nodes: - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight, n.title"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight, n.title"); // render output: while ($node = db_fetch_object($result)) { @@ -233,7 +233,7 @@ function book_admin() { function book_render() { global $status, $theme; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight"); while ($node = db_fetch_object($result)) { $output .= "<DT><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></DT><DD>". check_output($node->body, 1) ."<BR><BR></DD>"; @@ -271,7 +271,7 @@ function book_edit($id) { if ($node->status != $status[posted]) { return t("You can only update accepted pages: pages that are still queued or already expired can not be updated."); } - else if (db_result(db_query("SELECT COUNT(n.nid) FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.pid = '$node->nid' AND n.status = '$status[queued]'"))) { + else if (db_result(db_query("SELECT COUNT(n.nid) FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.pid = '$node->nid' AND n.status = '$status[queued]'"))) { return t("There is already an update for this node in the queue: we can only process one update at once."); } else { @@ -304,7 +304,7 @@ function book_user() { function book_export_html($id = "", $depth = 1) { global $status; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND n.nid = '". check_input($id) ."'"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND n.nid = '". check_input($id) ."'"); while ($node = db_fetch_object($result)) { $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; @@ -318,7 +318,7 @@ function book_export_html($id = "", $depth = 1) { function book_export_html_recursive($parent = "", $depth = 1) { global $status; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); while ($node = db_fetch_object($result)) { $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; diff --git a/modules/book/book.module b/modules/book/book.module index 6d7d9f536..cd2beb0ac 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -30,7 +30,7 @@ function book_status() { } 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 AND n.lid = b.lid WHERE n.nid = '$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 = '$node->parent'")); if ($parent->title) { $nodes = book_location($parent, $nodes); array_push($nodes, $parent); @@ -47,8 +47,8 @@ function book_view($node, $main = 0) { else { if ($node->nid && $node->parent) { $list = book_parent_query($node->parent); - $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.status = '$status[posted]' AND $list AND (b.weight > '$node->weight' OR (b.weight = '$node->weight' AND n.title > '". check_query($node->title) ."')) ORDER BY b.weight ASC,n.title ASC")); - $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.status = '$status[posted]' AND $list AND (b.weight < '$node->weight' OR (b.weight = '$node->weight' AND n.title < '". check_query($node->title) ."')) ORDER BY b.weight DESC,n.title DESC")); + $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = '$status[posted]' AND $list AND (b.weight > '$node->weight' OR (b.weight = '$node->weight' AND n.title > '". check_query($node->title) ."')) ORDER BY b.weight ASC,n.title ASC")); + $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = '$status[posted]' AND $list AND (b.weight < '$node->weight' OR (b.weight = '$node->weight' AND n.title < '". check_query($node->title) ."')) ORDER BY b.weight DESC,n.title DESC")); } $output .= "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" WIDTH=\"100%\">\n"; @@ -83,7 +83,7 @@ function book_view($node, $main = 0) { function book_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN users u ON n.author = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, u.name FROM node n LEFT JOIN book b ON n.nid = b.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'book' AND n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR b.body LIKE '%". check_input($keys) ."%') ORDER BY n.timestamp DESC LIMIT 20"); while ($node = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($node->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp); } @@ -105,7 +105,7 @@ function book_toc($parent = "", $indent = "", $toc = array()) { global $status; // select all child nodes: - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight"); // add root node: if (user_access("administer nodes")) { @@ -168,7 +168,7 @@ function book_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(author => $user->uid, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight)); + node_save($edit, array(uid => $user->uid, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight)); } else if (user_access("administer nodes")) { node_save($edit, array(body, log, parent, title, type => "book", weight)); @@ -209,7 +209,7 @@ function book_tree($parent = "", $depth = 0) { if ($depth < 3 || strstr($PHP_SELF,"admin.php")) { // select all child nodes: - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight, n.title"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND ". book_parent_query($parent) ." ORDER BY b.weight, n.title"); // render output: while ($node = db_fetch_object($result)) { @@ -233,7 +233,7 @@ function book_admin() { function book_render() { global $status, $theme; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight"); while ($node = db_fetch_object($result)) { $output .= "<DT><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></DT><DD>". check_output($node->body, 1) ."<BR><BR></DD>"; @@ -271,7 +271,7 @@ function book_edit($id) { if ($node->status != $status[posted]) { return t("You can only update accepted pages: pages that are still queued or already expired can not be updated."); } - else if (db_result(db_query("SELECT COUNT(n.nid) FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.pid = '$node->nid' AND n.status = '$status[queued]'"))) { + else if (db_result(db_query("SELECT COUNT(n.nid) FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.pid = '$node->nid' AND n.status = '$status[queued]'"))) { return t("There is already an update for this node in the queue: we can only process one update at once."); } else { @@ -304,7 +304,7 @@ function book_user() { function book_export_html($id = "", $depth = 1) { global $status; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND n.nid = '". check_input($id) ."'"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND n.nid = '". check_input($id) ."'"); while ($node = db_fetch_object($result)) { $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; @@ -318,7 +318,7 @@ function book_export_html($id = "", $depth = 1) { function book_export_html_recursive($parent = "", $depth = 1) { global $status; - $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); while ($node = db_fetch_object($result)) { $output .= "<H$depth>". check_output($node->title) ."</H$depth>"; diff --git a/modules/comment.module b/modules/comment.module index d87b89724..c1a3e617c 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -2,7 +2,7 @@ function comment_search($keys) { global $PHP_SELF; - $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20"); + $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20"); while ($comment = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp); } @@ -23,7 +23,7 @@ function comment_link($type) { function comment_edit($id) { - $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$id'"); + $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$id'"); $comment = db_fetch_object($result); $form .= form_item(t("Author"), format_name($comment)); @@ -40,7 +40,7 @@ function comment_save($id, $edit) { } function comment_overview() { - $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50"); + $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid ORDER BY timestamp DESC LIMIT 50"); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n"; diff --git a/modules/comment/comment.module b/modules/comment/comment.module index d87b89724..c1a3e617c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2,7 +2,7 @@ function comment_search($keys) { global $PHP_SELF; - $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20"); + $result = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20"); while ($comment = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($comment->subject), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->name, "date" => $comment->timestamp); } @@ -23,7 +23,7 @@ function comment_link($type) { function comment_edit($id) { - $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.author = u.uid WHERE c.cid = '$id'"); + $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$id'"); $comment = db_fetch_object($result); $form .= form_item(t("Author"), format_name($comment)); @@ -40,7 +40,7 @@ function comment_save($id, $edit) { } function comment_overview() { - $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.author ORDER BY timestamp DESC LIMIT 50"); + $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid ORDER BY timestamp DESC LIMIT 50"); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n"; diff --git a/modules/forum.module b/modules/forum.module index 984832c9f..4d4d9811b 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -31,7 +31,7 @@ function forum_form($edit = array()) { function forum_save($edit) { global $user, $status; - node_save($edit, array(author => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0)); + node_save($edit, array(uid => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0)); } function forum_num_comments($nid) { diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 984832c9f..4d4d9811b 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -31,7 +31,7 @@ function forum_form($edit = array()) { function forum_save($edit) { global $user, $status; - node_save($edit, array(author => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0)); + node_save($edit, array(uid => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0)); } function forum_num_comments($nid) { diff --git a/modules/import.module b/modules/import.module index 7798d1f5f..2ac1b690c 100644 --- a/modules/import.module +++ b/modules/import.module @@ -95,7 +95,7 @@ function import_get_bundles($attributes = 0) { $i = 0; while ($bundle = db_fetch_object($result)) { $block[$i][subject] = $bundle->title; - $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$bundle->title bundle"; $i++; @@ -110,7 +110,7 @@ function import_get_feeds($attributes = 0) { $i = 0; while ($feed = db_fetch_object($result)) { $block[$i][subject] = $feed->title; - $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("details") ."</a></div></p>"; + $block[$i][content] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\">". t("more") ."</a></div></p>"; $block[$i][info] = "$feed->title feed"; $i++; diff --git a/modules/node.module b/modules/node.module index bc40e6ba5..4c0767db0 100644 --- a/modules/node.module +++ b/modules/node.module @@ -114,7 +114,7 @@ function node_overview($query) { $color = array("#ffffff", "#e5e5e5"); $query = node_query($query ? $query : 0); - $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid $query[1] LIMIT 50"); + $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid $query[1] LIMIT 50"); $output .= status($query[0]); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; diff --git a/modules/node/node.module b/modules/node/node.module index bc40e6ba5..4c0767db0 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -114,7 +114,7 @@ function node_overview($query) { $color = array("#ffffff", "#e5e5e5"); $query = node_query($query ? $query : 0); - $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid $query[1] LIMIT 50"); + $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid $query[1] LIMIT 50"); $output .= status($query[0]); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; diff --git a/modules/page.module b/modules/page.module index 01deece17..4b46a99c2 100644 --- a/modules/page.module +++ b/modules/page.module @@ -72,7 +72,7 @@ function page_form($edit = array()) { function page_save($edit) { global $status, $user; - node_save($edit, array(author => $user->uid, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status["posted"], timestamp => time(), title, type => "page", votes => 0)); + node_save($edit, array(uid => $user->uid, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status["posted"], timestamp => time(), title, type => "page", votes => 0)); } ?>
\ No newline at end of file diff --git a/modules/page/page.module b/modules/page/page.module index 01deece17..4b46a99c2 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -72,7 +72,7 @@ function page_form($edit = array()) { function page_save($edit) { global $status, $user; - node_save($edit, array(author => $user->uid, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status["posted"], timestamp => time(), title, type => "page", votes => 0)); + node_save($edit, array(uid => $user->uid, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status["posted"], timestamp => time(), title, type => "page", votes => 0)); } ?>
\ No newline at end of file diff --git a/modules/queue.module b/modules/queue.module index 2ea116f8c..b1b08b115 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -64,12 +64,12 @@ function queue_vote($id, $vote) { function queue_overview() { global $status, $theme, $user; - $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.author = u.uid WHERE n.status = '$status[queued]'"); + $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.status = '$status[queued]'"); $content .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n"; $content .= " <TR><TH>". t("Subject") ."</TH><TH>". t("Author") ."</TH><TH>". t("Type") ."</TH><TH>". t("Score") ."</TH></TR>\n"; while ($node = db_fetch_object($result)) { - if ($user->uid == $node->author || field_get($node->users, $user->uid)) $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_name($node) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". queue_score($node->nid) ."</TD></TR>\n"; + if ($user->uid == $node->uid || field_get($node->users, $user->uid)) $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_name($node) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". queue_score($node->nid) ."</TD></TR>\n"; else $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_name($node) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\"><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". t("vote") ."</A></TD></TR>\n"; } $content .= "</TABLE>\n"; @@ -85,7 +85,7 @@ function queue_node($id) { $node = node_get_object(array(nid => $id)); - if ($user->uid == $node->author || field_get($node->users, $user->uid)) { + if ($user->uid == $node->uid || field_get($node->users, $user->uid)) { drupal_goto("node.php?id=$node->nid"); } else { diff --git a/modules/rating.module b/modules/rating.module index dd00aafb9..7c17a34e7 100644 --- a/modules/rating.module +++ b/modules/rating.module @@ -50,24 +50,24 @@ function rating_help() { <? } -function rating_gravity($id) { +function rating_gravity($uid) { global $status; $period = 5184000; // maximum 60 days $number = 30; // maximum 30 comments - $r1 = db_query("SELECT nid, type FROM node WHERE author = '$id' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'"); + $r1 = db_query("SELECT nid, type FROM node WHERE uid = '$uid' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'"); while ($node = db_fetch_object($r1)) { $bonus += variable_get("rating_weight_$node->type", 0); } - $r2 = db_query("SELECT nid, type FROM node WHERE author = '$id' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'"); + $r2 = db_query("SELECT nid, type FROM node WHERE uid = '$uid' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'"); while ($node = db_fetch_object($r1)) { $bonus -= variable_get("rating_weight_$node->type", 0); } /* - $r3 = db_query("SELECT score, votes FROM comments WHERE author = '$id' AND votes > 0 AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); + $r3 = db_query("SELECT score, votes FROM comments WHERE uid = '$uid' AND votes > 0 AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); while ($comment = db_fetch_object($r3)) { $weight++; $score += $weight * $comment->score; diff --git a/modules/story.module b/modules/story.module index c068f05ce..e7190b4fd 100644 --- a/modules/story.module +++ b/modules/story.module @@ -14,7 +14,7 @@ function story_status() { function story_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); while ($story = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($story->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp); } @@ -80,7 +80,7 @@ function story_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), author => $user->uid, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); + node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), uid => $user->uid, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); } else if (user_access("administer nodes")) { node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), body, title, type => "story")); diff --git a/modules/story/story.module b/modules/story/story.module index c068f05ce..e7190b4fd 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -14,7 +14,7 @@ function story_status() { function story_search($keys) { global $PHP_SELF, $status; - $result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid AND n.lid = s.lid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); + $result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN node n ON n.nid = s.nid WHERE n.status = '$status[posted]' AND (n.title LIKE '%$keys%' OR s.abstract LIKE '%$keys%' OR s.body LIKE '%$keys%') ORDER BY n.timestamp DESC LIMIT 20"); while ($story = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($story->title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->name, "date" => $story->timestamp); } @@ -80,7 +80,7 @@ function story_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), author => $user->uid, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); + node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), uid => $user->uid, body, comment => variable_get("story_comment", 0), moderate => variable_get("story_moderate", ""), promote => variable_get("story_promote", 0), score => 0, status => variable_get("story_status", $status[queued]), timestamp => time(), title, type => "story", votes => 0)); } else if (user_access("administer nodes")) { node_save($edit, array(abstract, attributes => node_attributes_save("story", $edit), body, title, type => "story")); diff --git a/modules/tracker.module b/modules/tracker.module index 462a649b4..d3f113e19 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -13,7 +13,7 @@ function tracker_comments($id = 0) { global $theme, $user; if ($id) { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } else { $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); @@ -23,7 +23,7 @@ function tracker_comments($id = 0) { $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n"; if ($id) { - $cresult = db_query("SELECT * FROM comments WHERE author = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); } else { $cresult = db_query("SELECT * FROM comments WHERE lid = '$node->nid' ORDER BY cid DESC"); diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 462a649b4..d3f113e19 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -13,7 +13,7 @@ function tracker_comments($id = 0) { global $theme, $user; if ($id) { - $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); + $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); } else { $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.lid = n.nid GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10"); @@ -23,7 +23,7 @@ function tracker_comments($id = 0) { $output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n"; if ($id) { - $cresult = db_query("SELECT * FROM comments WHERE author = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); + $cresult = db_query("SELECT * FROM comments WHERE uid = '". check_input($id) ."' AND lid = '$node->nid' ORDER BY cid DESC"); } else { $cresult = db_query("SELECT * FROM comments WHERE lid = '$node->nid' ORDER BY cid DESC"); diff --git a/modules/user.module b/modules/user.module index 2f4a13241..d812354d2 100644 --- a/modules/user.module +++ b/modules/user.module @@ -251,7 +251,7 @@ function user_link($type) { } if ($type == "admin") { - $links[] = "<a href=\"admin.php?mod=user\">user system</a>"; + $links[] = "<a href=\"admin.php?mod=user\">user management</a>"; } return $links ? $links : array(); diff --git a/modules/user/user.module b/modules/user/user.module index 2f4a13241..d812354d2 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -251,7 +251,7 @@ function user_link($type) { } if ($type == "admin") { - $links[] = "<a href=\"admin.php?mod=user\">user system</a>"; + $links[] = "<a href=\"admin.php?mod=user\">user management</a>"; } return $links ? $links : array(); @@ -88,11 +88,11 @@ function node_history($node) { $number = ($title ? db_num_rows(db_query("SELECT nid FROM node WHERE title = '$title' AND status = '". node_status("posted") ."'")) : 1); if ($number > 1) { - $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.author = u.uid WHERE n.title = '$title' AND n.status = '". node_status("posted") ."' ORDER BY timestamp DESC"); + $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN user u ON n.uid = u.uid WHERE n.title = '$title' AND n.status = '". node_status("posted") ."' ORDER BY timestamp DESC"); while ($node = db_fetch_object($result)) { if (node_access($node)) { - $output .= "<P><B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B><BR><SMALL>$node->type - ". format_name($node) ." - ". format_date($node->timestamp, "small") ."</SMALL></P>"; + $output .= "<p><b><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></b><br /><small>$node->type - ". format_name($node) ." - ". format_date($node->timestamp, "small") ."</small></p>"; } } diff --git a/submit.php b/submit.php index 35c8fe7be..acd4b6b1c 100644 --- a/submit.php +++ b/submit.php @@ -12,7 +12,9 @@ if (user_access("post content")) { } else { foreach (module_list() as $name) { - if (module_hook($name, "user")) $options .= "<option value=\"$name\">". t($name) ."</option>"; + if (module_hook($name, "user")) { + $options .= "<option value=\"$name\">". t($name) ."</option>"; + } } $form .= form_item(t("Submission type"), "<SELECT NAME=\"mod\">$options</SELECT>"); diff --git a/updates/3.00-to-x.xx.mysql b/updates/3.00-to-x.xx.mysql index 9d29dfb03..b93fbe39a 100644 --- a/updates/3.00-to-x.xx.mysql +++ b/updates/3.00-to-x.xx.mysql @@ -56,10 +56,41 @@ ALTER TABLE rating CHANGE user userid int(10) DEFAULT '0' NOT NULL; ALTER TABLE layout CHANGE user userid int(10) DEFAULT '0' NOT NULL; ALTER TABLE blocks CHANGE offset delta tinyint(2) DEFAULT '0' NOT NULL; -# 14/10/01 +# 14/10/01 (updated 16/10/01!) ALTER TABLE watchdog CHANGE id wid int(5) DEFAULT '0' NOT NULL auto_increment; +ALTER TABLE locales CHANGE id lid int(10) DEFAULT '0' NOT NULL auto_increment; ALTER TABLE watchdog CHANGE userid uid int(10) DEFAULT '0' NOT NULL; ALTER TABLE layout CHANGE userid uid int(10) DEFAULT '0' NOT NULL; ALTER TABLE rating CHANGE userid uid int(10) DEFAULT '0' NOT NULL; -ALTER TABLE locales CHANGE id lid int(10) DEFAULT '0' NOT NULL; + +## 16/10/01 + +# remove the "auto_increment"s: +ALTER TABLE story CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL; +ALTER TABLE blog CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL; +ALTER TABLE page CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL; +ALTER TABLE forum CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL; +ALTER TABLE book CHANGE nid nid int(10) unsigned DEFAULT '0' NOT NULL; + +# drop the "lid"s: +ALTER TABLE story DROP lid; +ALTER TABLE blog DROP lid; +ALTER TABLE page DROP lid; +ALTER TABLE forum DROP lid; +ALTER TABLE book DROP lid; + +# rename "author" to "uid": +ALTER TABLE comments CHANGE author uid int(10) DEFAULT '0' NOT NULL; +ALTER TABLE node CHANGE author uid int(10) DEFAULT '0' NOT NULL; +ALTER TABLE node DROP KEY author; +ALTER TABLE node ADD KEY uid (uid); + +# resize some "id"s: +ALTER TABLE feed CHANGE fid fid int(10) NOT NULL auto_increment; +ALTER TABLE bundle CHANGE bid bid int(10) NOT NULL auto_increment; +ALTER TABLE item CHANGE iid iid int(10) NOT NULL auto_increment; +ALTER TABLE item CHANGE fid fid int(10) NOT NULL; +ALTER TABLE comments CHANGE cid cid int(10) NOT NULL auto_increment; +ALTER TABLE comments CHANGE pid pid int(10) NOT NULL; +ALTER TABLE comments CHANGE lid lid int(10) NOT NULL; diff --git a/xmlrpc.php b/xmlrpc.php index 7bc237d40..c6a2466aa 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1,6 +1,6 @@ <?php -include_once("includes/xmlrpcs.inc"); +include_once "includes/xmlrpcs.inc"; include_once "includes/common.inc"; $functions = array(); |