Commit 04ad9b8a authored by Dries's avatar Dries

- fixed issue depricated call-by-reference issues
- fixed small visual glitch in includes/function.inc
- changed SQL tables around a bit to be more consistent
  (result: small changes to a lot of different files)
- improved robustness of includes/node.inc
- improved output of cron.module
- improved output of node.php
parent 57eb908a
drupal x.xx, xx/xx/xxxx
-----------------------
- major overhaul of the underlying design:
- major overhaul of the entire underlying design:
* everything is based on nodes
* introduced links / drupal tags
- refactored submission / moderation queue
- added a "wiki module"
* introduced links/drupal tags
- rewrote submission/moderation queue:
* renamed submission.module to moderation.module
* updated submission forms
- added a "book module":
* merged documentation and FAQ module into a book module
- various updates:
* added preview functionality when submitting new content (such as a story) from the administration pages.
* made the administration section only show those links a user has access to.
* improved account module
* improved comment module
* improved story module:
+ stories can now be permanently deleted
* improved themes:
+ W3C validation on a best effort basis
+ added goofy theme
- revised documentation
drupal 2.00, 15/03/2001
-----------------------
......@@ -45,7 +56,7 @@ drupal 2.00, 15/03/2001
* improved database abstraction layer
* improved themes:
+ W3C validation on a best effort basis
+ added example theme for theme designers
+ added example theme
* added CREDITS file
* added directory "misc"
* added new scripts to directory "scripts"
......
......@@ -254,7 +254,7 @@ function module($name, $module, $username) {
$block1 .= "</TABLE>\n";
/*
$result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, n.title AS node FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN nodes ON n.id = c.lid WHERE u.userid = '$uname' AND n.status = '$status[posted]' AND s.timestamp > ". (time() - 1209600) ." ORDER BY cid DESC LIMIT 10");
$result = db_query("SELECT c.cid, c.pid, c.lid, c.subject, c.timestamp, n.title AS node FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN node ON n.id = c.lid WHERE u.userid = '$uname' AND n.status = '$status[posted]' AND s.timestamp > ". (time() - 1209600) ." ORDER BY cid DESC LIMIT 10");
while ($comment = db_fetch_object($result)) {
$block2 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
$block2 .= " <TR><TD ALIGN=\"right\"><B>". t("Comment") .":</B></TD><TD><A HREF=\"node.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD></TR>\n";
......@@ -406,7 +406,7 @@ function account_password($min_length=6) {
function account_track_comments() {
global $theme, $user;
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN nodes n ON c.lid = n.nid WHERE c.author = '$user->id' GROUP BY n.nid DESC LIMIT 5");
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.author = '$user->id' GROUP BY n.nid DESC LIMIT 5");
while ($node = db_fetch_object($sresult)) {
$output .= "<LI>". format_plural($node->count, "comment", "comments") ." ". t("attached to node") ." `<A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A>`:</LI>\n";
......@@ -427,7 +427,7 @@ function account_track_comments() {
function account_track_nodes() {
global $status, $theme, $user;
$result = db_query("SELECT n.nid, n.type, n.title, n.timestamp, COUNT(c.cid) AS count FROM nodes n LEFT JOIN comments c ON c.lid = n.nid WHERE n.status = '$status[posted]' AND n.author = '$user->id' GROUP BY n.nid DESC LIMIT 25");
$result = db_query("SELECT n.nid, n.type, n.title, n.timestamp, COUNT(c.cid) AS count FROM node n LEFT JOIN comments c ON c.lid = n.nid WHERE n.status = '$status[posted]' AND n.author = '$user->id' GROUP BY n.nid DESC LIMIT 25");
while ($node = db_fetch_object($result)) {
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
......@@ -448,7 +448,7 @@ function account_track_site() {
$period = 259200; // 3 days
$sresult = db_query("SELECT n.title, n.nid, COUNT(c.lid) AS count FROM comments c LEFT JOIN nodes n ON c.lid = n.nid WHERE n.status = '$status[posted]' AND ". time() ." - n.timestamp < $period GROUP BY c.lid ORDER BY n.timestamp DESC LIMIT 10");
$sresult = db_query("SELECT n.title, n.nid, COUNT(c.lid) AS count FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE n.status = '$status[posted]' AND ". time() ." - n.timestamp < $period GROUP BY c.lid ORDER BY n.timestamp DESC LIMIT 10");
while ($node = db_fetch_object($sresult)) {
$output .= "<LI>". format_plural($node->count, "comment", "comments") ." ". t("attached to node") ." '<A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A>':</LI>";
......
......@@ -10,10 +10,7 @@ function cron_run() {
$result = db_query("SELECT * FROM crons WHERE $time - timestamp > scheduled");
while ($task = db_fetch_object($result)) {
if ($repository[$task->module]["cron"]) {
watchdog("message", "cron: executed '". $task->module ."_cron()'");
$repository[$task->module]["cron"]();
}
if ($repository[$task->module]["cron"]) $repository[$task->module]["cron"]();
}
db_query("UPDATE crons SET timestamp = $time WHERE $time - timestamp > scheduled");
......
......@@ -18,7 +18,8 @@ function ban_match($mask, $category) {
return db_fetch_object($result);
}
function ban_add($mask, $category, $reason, $message = "") {
// TODO --> $message by reference
function ban_add($mask, $category, $reason, $message = 0) {
global $index2type;
if (empty($mask)) {
......
......@@ -128,14 +128,14 @@ function comment_post($pid, $id, $subject, $comment) {
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '$pid' AND lid = '$id' AND subject = '$subject' AND comment = '$comment'"), 0);
if ($duplicate != 0) {
watchdog("error", "comment: attempt to insert duplicate comment");
watchdog("warning", "comment: duplicate '$subject'");
}
else {
// Validate subject:
$subject = ($subject) ? $subject : substr($comment, 0, 29);
// Add watchdog entry:
watchdog("comment", "comment: added comment with subject '$subject'");
watchdog("comment", "comment: added '$subject'");
// Add comment to database:
db_query("INSERT INTO comments (lid, pid, author, subject, comment, hostname, timestamp, score) VALUES ('$id', '$pid', '$user->id', '$subject', '$comment', '". getenv("REMOTE_ADDR") ."', '". time() ."', '". ($user->userid ? 1 : 0) ."')");
......
......@@ -48,7 +48,7 @@ function format_interval($timestamp) {
$timestamp = $timestamp % 3600;
}
if ($timestamp >= 60) {
$output .= " ". floor($timestamp / 60) ."min";
$output .= " ". floor($timestamp / 60) ." min";
$timestamp = $timestamp % 60;
}
if ($timestamp > 0) {
......
......@@ -3,9 +3,9 @@
$status = array(dumped => 0, expired => 1, queued => 2, posted => 3, scheduled => 4);
function _node_get($field, $value) {
$result = db_query("SELECT lid, type FROM nodes WHERE $field = '$value'");
$result = db_query("SELECT lid, type FROM node WHERE $field = '$value'");
if ($node = db_fetch_object($result)) {
return db_query("SELECT n.*, l.*, u.userid FROM nodes n LEFT JOIN $node->type l ON n.lid = l.id AND l.node = n.nid LEFT JOIN users u ON n.author = u.id WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
return db_query("SELECT n.*, l.*, u.userid FROM node n LEFT JOIN $node->type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN users u ON n.author = u.id WHERE n.$field = '$value' ORDER BY n.timestamp DESC");
}
}
......@@ -21,8 +21,9 @@ function node_del($field, $value) {
global $status;
if ($node = node_get_object($field, $value)) {
if ($node->status == $status[dumped]) {
db_query("DELETE FROM nodes WHERE nid = '$node->nid'");
db_query("DELETE FROM $node->type WHERE node = '$node->nid'");
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 comments WHERE lid = '$node->nid'");
watchdog("message", "node: deleted '$node->title'");
return $node;
}
......@@ -50,8 +51,8 @@ function node_save($node) {
$u1 = implode(", ", $u1);
$u2 = implode(", ", $u2);
db_query("UPDATE nodes SET $u1 WHERE nid = '$node[nid]'");
db_query("UPDATE $node[type] SET $u2 WHERE node = '$node[nid]'");
db_query("UPDATE node SET $u1 WHERE nid = '$node[nid]'");
db_query("UPDATE $node[type] SET $u2 WHERE nid = '$node[nid]'");
watchdog("message", "node: modified '$node[title]'");
}
......@@ -59,7 +60,7 @@ function node_save($node) {
$duplicate = node_get_object("title", $node[title]);
if ($duplicate && (time() - $duplicate->timestamp < 300)) {
watchdog("warning", "node: duplicate node '$node[title]'");
watchdog("warning", "node: duplicate '$node[title]'");
}
else {
// setup default values:
......@@ -87,14 +88,14 @@ function node_save($node) {
$f2 = implode(", ", $f2);
$v2 = implode(", ", $v2);
db_query("INSERT INTO nodes ($f1) VALUES ($v1)");
db_query("INSERT INTO node ($f1) VALUES ($v1)");
if ($nid = db_insert_id()) {
$lid = db_query("INSERT INTO $node[type] ($f2, node) VALUES ($v2, $nid)");
$lid = db_query("INSERT INTO $node[type] ($f2, nid) VALUES ($v2, $nid)");
if ($lid = db_insert_id()) {
db_query("UPDATE nodes SET lid = '$lid' WHERE nid = '$nid'");
db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'");
}
else {
db_query("DELETE FROM nodes WHERE nid = '$nid'");
db_query("DELETE FROM node WHERE nid = '$nid'");
}
}
......@@ -103,7 +104,7 @@ function node_save($node) {
}
if (($node[pid]) && ($node[status] == $status[posted])) {
db_query("UPDATE nodes SET status = '$status[expired]' WHERE nid = '$node[pid]'");
db_query("UPDATE node SET status = '$status[expired]' WHERE nid = '$node[pid]'");
}
}
......
......@@ -11,7 +11,7 @@ function search_form($keys) {
function search_data($keys, $type) {
if ($keys && $type) {
$result = module_execute($type, "find", $keys);
$result = module_execute($type, "find", check_input($keys));
foreach ($result as $entry) {
$output .= "<P>\n";
$output .= " <B><U><A HREF=\"$entry[link]\">$entry[title]</A></U></B><BR>";
......
......@@ -18,7 +18,7 @@ function theme_link($separator = " | ") {
"<A HREF=\"submit.php\">". t("submit") ."</A>",
"<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>",
"<A HREF=\"account.php\">". t("account") ."</A>",
"<A HREF=\"module.php?mod=book\">". t("help") ."</A>");
"<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>");
return implode($separator, $links);
}
......@@ -80,7 +80,7 @@ function theme_blocks($region, $theme) {
switch (strrchr($PHP_SELF, "/")) {
case "/node.php":
if ($region != "left") {
if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM nodes WHERE nid = '$id'"));
if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'"));
if ($node->status == $status[queued]) theme_moderation_results($theme, $node);
// else theme_new_headlines($theme);
}
......@@ -118,7 +118,7 @@ function theme_moderation_results($theme, $node) {
// depricated -> new block strategy
//
function theme_new_headlines($theme, $num = 10) {
$result = db_query("SELECT nid, title FROM nodes WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num");
$result = db_query("SELECT nid, title FROM node WHERE status = 2 AND type = 'story' ORDER BY nid DESC LIMIT $num");
while ($node = db_fetch_object($result)) $content .= "<LI><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></LI>\n";
$theme->box(t("Latest headlines"), $content);
}
......
......@@ -7,7 +7,7 @@
$date = ($date > 0) ? $date : time();
// Perform query:
$result = db_query("SELECT n.*, s.*, u.userid, COUNT(c.lid) AS comments FROM nodes n LEFT JOIN story s ON n.nid = s.node LEFT JOIN comments c ON n.nid = c.lid LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[posted]' AND n.type = 'story' ". ($section ? "AND s.section = '$section' " : "") ."AND n.timestamp <= $date GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT $number");
$result = db_query("SELECT n.*, s.*, u.userid, COUNT(c.lid) AS comments FROM node n LEFT JOIN story s ON n.nid = s.nid LEFT JOIN comments c ON n.nid = c.lid LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[posted]' AND n.type = 'story' ". ($section ? "AND s.section = '$section' " : "") ."AND n.timestamp <= $date GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT $number");
// Display nodes:
$theme->header();
......
......@@ -59,7 +59,7 @@ function account_blocks($id) {
}
function account_nodes($id) {
$result = db_query("SELECT * FROM nodes WHERE author = $id ORDER BY timestamp DESC");
$result = db_query("SELECT * FROM node WHERE author = $id ORDER BY timestamp DESC");
while ($node = db_fetch_object($result)) {
$output .= "<LI><A HREF=\"node.php?id=$node->nid\">$node->title</A> ($node->type)</LI>\n";
}
......
......@@ -53,7 +53,7 @@ class backend {
$url = parse_url($this->file);
// Retrieve data from website:
$fp = fsockopen($url[host], ($url[port] ? $url[port] : 80), &$errno, &$errstr, $timout);
$fp = fsockopen($url[host], ($url[port] ? $url[port] : 80), $errno, $errstr, $timout);
if ($fp) {
// Request data via URL:
......
......@@ -29,7 +29,7 @@ function ban_help() {
}
function ban_admin_new($mask, $category, $reason) {
ban_add($mask, $category, $reason, &$message);
ban_add($mask, $category, $reason, $message);
$output .= "$message\n";
print $output;
}
......
......@@ -19,8 +19,8 @@ function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) {
function book_navigation($node) {
if ($node->nid) {
$next = db_fetch_object(db_query("SELECT n.nid, n.title FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight ASC"));
$prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC"));
$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 b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight 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 b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC"));
}
$output .= "<HR>";
......@@ -62,7 +62,7 @@ function book_view($node, $page = 1) {
function book_find($keys) {
global $status, $user;
$find = array();
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN book b ON n.nid = b.node LEFT JOIN users u ON n.author = u.id 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.userid 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.id 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)) {
array_push($find, array("title" => check_output($node->title), "link" => (user_access($user, "book") ? "admin.php?mod=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp));
}
......@@ -77,7 +77,7 @@ function book_search() {
function book_toc($parent = 0, $offset = 0, $toc = array()) {
global $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node 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 AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
while ($node = db_fetch_object($result)) {
$toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
$toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc);
......@@ -165,7 +165,7 @@ function book_delete($id) {
function book_overview($parent = "", $offset = "") {
global $PHP_SELF, $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node 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 AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
$output .= "<DL>";
while ($node = db_fetch_object($result)) {
......@@ -182,7 +182,7 @@ function book_overview($parent = "", $offset = "") {
function book_history() {
global $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status != '$status[expired]' ORDER BY n.timestamp DESC");
$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[expired]' ORDER BY n.timestamp DESC");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>node</TH><TH>status</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n";
......
......@@ -19,8 +19,8 @@ function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) {
function book_navigation($node) {
if ($node->nid) {
$next = db_fetch_object(db_query("SELECT n.nid, n.title FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight ASC"));
$prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC"));
$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 b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight 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 b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC"));
}
$output .= "<HR>";
......@@ -62,7 +62,7 @@ function book_view($node, $page = 1) {
function book_find($keys) {
global $status, $user;
$find = array();
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN book b ON n.nid = b.node LEFT JOIN users u ON n.author = u.id 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.userid 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.id 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)) {
array_push($find, array("title" => check_output($node->title), "link" => (user_access($user, "book") ? "admin.php?mod=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->userid, "date" => $node->timestamp));
}
......@@ -77,7 +77,7 @@ function book_search() {
function book_toc($parent = 0, $offset = 0, $toc = array()) {
global $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node 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 AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
while ($node = db_fetch_object($result)) {
$toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title";
$toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc);
......@@ -165,7 +165,7 @@ function book_delete($id) {
function book_overview($parent = "", $offset = "") {
global $PHP_SELF, $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node 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 AND n.lid = b.lid WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight");
$output .= "<DL>";
while ($node = db_fetch_object($result)) {
......@@ -182,7 +182,7 @@ function book_overview($parent = "", $offset = "") {
function book_history() {
global $status;
$result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status != '$status[expired]' ORDER BY n.timestamp DESC");
$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[expired]' ORDER BY n.timestamp DESC");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>node</TH><TH>status</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n";
......
......@@ -33,10 +33,10 @@ function cron_display() {
// Generate output:
$output .= "<FORM ACTION=\"admin.php?mod=cron\" METHOD=\"post\">\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>module</TH><TH>period</TH><TH>last execution</TH><TH>operations</TH></TR>\n";
$output .= " <TR><TH>module</TH><TH>period</TH><TH>last run</TH><TH>next run</TH><TH>operations</TH></TR>\n";
while ($cron = db_fetch_object($result)) {
foreach ($intervals as $value) $period .= "<OPTION VALUE=\"$value\"". (($cron->scheduled == $value) ? " SELECTED" : "") .">every ". format_interval($value) ."</OPTION>\n";
$output .= " <TR><TD>". check_output($cron->module) ."</TD><TD><SELECT NAME=\"edit[$cron->module]\">$period</SELECT></TD><TD ALIGN=\"center\">". ($cron->timestamp ? format_interval(time() - $cron->timestamp) ." ago" : "never" )."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=cron&op=execute&name=$cron->module\">execute</A></TD></TR>\n";
$output .= " <TR><TD>". check_output($cron->module) ."</TD><TD><SELECT NAME=\"edit[$cron->module]\">$period</SELECT></TD><TD>". ($cron->timestamp ? format_interval(time() - $cron->timestamp) ." ago" : "never") ."</TD><TD>". ($cron->timestamp ? format_interval($cron->timestamp + $cron->scheduled - time()) ." left" : "never") ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=cron&op=execute&name=$cron->module\">execute</A></TD></TR>\n";
unset($period);
}
$output .= "</TABLE>\n";
......
......@@ -207,7 +207,7 @@ function headline_export($uri) {
print " <description>$site_name</description>\n";
print "</channel>\n";
$result = db_query("SELECT * FROM nodes WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
$result = db_query("SELECT * FROM node WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
print "<item>\n";
......
......@@ -32,7 +32,7 @@ function headlineRSS10_export($uri) {
print " <items>\n";
print " <rdf:Seq>\n";
$result = db_query("SELECT * FROM nodes WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
$result = db_query("SELECT * FROM node WHERE type = 'story' AND status = '$status[posted]' ORDER BY timestamp DESC LIMIT 10");
while ($node = db_fetch_object($result)) {
print " <rdf:li resource=\"". $site_url ."node.php?id=$node->nid\" />\n";
......
......@@ -12,12 +12,12 @@ function moderation_menu() {
function moderation_count() {
global $status;
$result = db_query("SELECT COUNT(nid) FROM nodes WHERE status = '$status[queued]'");
$result = db_query("SELECT COUNT(nid) FROM node WHERE status = '$status[queued]'");
return ($result) ? db_result($result, 0) : 0;
}
function moderation_score($id) {
$result = db_query("SELECT score FROM nodes WHERE nid = '$id'");
$result = db_query("SELECT score FROM node WHERE nid = '$id'");
return ($result) ? db_result($result, 0) : 0;
}
......@@ -26,7 +26,7 @@ function moderation_vote($id, $vote) {
if (!user_get($user, "history", "n$id")) {
// Update submission's score- and votes-field:
db_query("UPDATE nodes SET score = score $vote, votes = votes + 1 WHERE nid = $id");
db_query("UPDATE node SET score = score $vote, votes = votes + 1 WHERE nid = $id");
// Update user's history record:
$user = user_set($user, "history", "n$id", $vote);
......@@ -51,7 +51,7 @@ function moderation_vote($id, $vote) {
function moderation_overview() {
global $status, $theme, $user;
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'");
$content .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$content .= " <TR BGCOLOR=\"$bgcolor1\"><TH>". t("Subject") ."</TH><TH>". t("Author") ."</TH><TH>". t("Type") ."</TH><TH>". t("Score") ."</TH></TR>\n";
......
......@@ -16,12 +16,12 @@ function rating_cron() {
while ($rating = db_fetch_object($r1)) {
unset($bonus); unset($votes); unset($score); unset($value); unset($weight);
$r2 = db_query("SELECT COUNT(nid) AS number FROM nodes WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'");
$r2 = db_query("SELECT COUNT(nid) AS number FROM node WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'");
if ($story = db_fetch_object($r2)) {
$bonus += $story->number / 2;
}
$r3 = db_query("SELECT COUNT(nid) AS number FROM nodes WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'");
$r3 = db_query("SELECT COUNT(nid) AS number FROM node WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'");
if ($story = db_fetch_object($r3)) {
$bonus -= $story->number / 2;
}
......
......@@ -22,16 +22,16 @@ function Story($userid, $title, $abstract, $body, $section, $timestamp) { $th
function story_cron() {
global $status;
$result = db_query("SELECT * FROM nodes WHERE status = '$status[scheduled]' AND timestamp <= ". time() ."");
$result = db_query("SELECT * FROM node WHERE status = '$status[scheduled]' AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
db_query("UPDATE nodes SET status = '$status[queued]', timestamp = '". time() ."' WHERE nid = '$story->nid' AND type = 'story'");
db_query("UPDATE node SET status = '$status[queued]', timestamp = '". time() ."' WHERE nid = '$story->nid' AND type = 'story'");
}
}
function story_find($keys) {
global $status, $user;
$find = array();
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN nodes n ON s.node = n.nid WHERE n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR s.abstract LIKE '%". check_input($keys) ."%' OR s.body LIKE '%$keys%') LIMIT 20");
$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%') LIMIT 20");
while ($story = db_fetch_object($result)) {
array_push($find, array("title" => check_output($story->title), "link" => (user_access($user, "story") ? "admin.php?mod=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp));
}
......@@ -142,7 +142,7 @@ function story_form($edit = array()) {
$output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n";
}
$duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'"));
$duplicate = db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title'"));
if (!$edit) {
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n";
......@@ -188,7 +188,7 @@ function story_block() {
// disabled for now
//
global $status;
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.lid, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.lid = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' GROUP BY s.lid ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
......@@ -199,7 +199,7 @@ function story_block() {
unset($content);
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.lid, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.lid = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.lid ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
......@@ -218,28 +218,28 @@ function story_overview() {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
// Queued stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY timestamp DESC");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY timestamp DESC");
$output .= " <TR><TH COLSPAN=\"6\">queued stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>votes: $node->votes, score: $node->score</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Scheduled stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[scheduled]' ORDER BY timestamp DESC");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[scheduled]' ORDER BY timestamp DESC");
$output .= " <TR><TH COLSPAN=\"6\">scheduled stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."<BR><SMALL>(". format_interval($node->timestamp - time()) ." left)</SMALL></TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Dumped stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY timestamp DESC LIMIT 5");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY timestamp DESC LIMIT 5");
$output .= " <TR><TH COLSPAN=\"6\">dumped stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Posted stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY timestamp DESC LIMIT 15");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY timestamp DESC LIMIT 15");
$output .= " <TR><TH COLSPAN=\"6\">posted stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
......
......@@ -22,16 +22,16 @@ function Story($userid, $title, $abstract, $body, $section, $timestamp) { $th
function story_cron() {
global $status;
$result = db_query("SELECT * FROM nodes WHERE status = '$status[scheduled]' AND timestamp <= ". time() ."");
$result = db_query("SELECT * FROM node WHERE status = '$status[scheduled]' AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
db_query("UPDATE nodes SET status = '$status[queued]', timestamp = '". time() ."' WHERE nid = '$story->nid' AND type = 'story'");
db_query("UPDATE node SET status = '$status[queued]', timestamp = '". time() ."' WHERE nid = '$story->nid' AND type = 'story'");
}
}
function story_find($keys) {
global $status, $user;
$find = array();
$result = db_query("SELECT n.*, s.* FROM story s LEFT JOIN nodes n ON s.node = n.nid WHERE n.status = '$status[posted]' AND (n.title LIKE '%". check_input($keys) ."%' OR s.abstract LIKE '%". check_input($keys) ."%' OR s.body LIKE '%$keys%') LIMIT 20");
$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%') LIMIT 20");
while ($story = db_fetch_object($result)) {
array_push($find, array("title" => check_output($story->title), "link" => (user_access($user, "story") ? "admin.php?mod=story&op=edit&id=$story->nid" : "node.php?id=$story->nid"), "user" => $story->userid, "date" => $story->timestamp));
}
......@@ -142,7 +142,7 @@ function story_form($edit = array()) {
$output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n";
}
$duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'"));
$duplicate = db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title'"));
if (!$edit) {
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n";
......@@ -188,7 +188,7 @@ function story_block() {
// disabled for now
//
global $status;
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.lid, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.lid = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' GROUP BY s.lid ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
......@@ -199,7 +199,7 @@ function story_block() {
unset($content);
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.lid, COUNT(c.cid) AS comments, s.title FROM story s LEFT JOIN comments c ON s.lid = c.lid WHERE s.status = '$status[posted]' AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.lid ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"node.php?id=$story->id\">". check_output($story->title) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
......@@ -218,28 +218,28 @@ function story_overview() {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
// Queued stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY timestamp DESC");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[queued]' ORDER BY timestamp DESC");
$output .= " <TR><TH COLSPAN=\"6\">queued stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>votes: $node->votes, score: $node->score</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Scheduled stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[scheduled]' ORDER BY timestamp DESC");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[scheduled]' ORDER BY timestamp DESC");
$output .= " <TR><TH COLSPAN=\"6\">scheduled stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."<BR><SMALL>(". format_interval($node->timestamp - time()) ." left)</SMALL></TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Dumped stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY timestamp DESC LIMIT 5");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[dumped]' ORDER BY timestamp DESC LIMIT 5");
$output .= " <TR><TH COLSPAN=\"6\">dumped stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
}
// Posted stories:
$result = db_query("SELECT n.*, u.userid FROM nodes n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY timestamp DESC LIMIT 15");
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.type = 'story' AND n.status = '$status[posted]' ORDER BY timestamp DESC LIMIT 15");
$output .= " <TR><TH COLSPAN=\"6\">posted stories</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"node.php?id=$node->nid\">view</A></TD><TD><A HREF=\"admin.php?mod=story&op=edit&id=$node->nid\">edit</A></TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=delete&id=$node->nid\">delete</A></TD></TR>\n";
......
......@@ -2,6 +2,13 @@
include "includes/common.inc";
function node_failure() {
global $theme;
$theme->header();
$theme->box(t("Warning: not found"), t("The content or data you requested does not exist or is not accessible."));
$theme->footer();
}
function node_history($node) {
global $status;
if ($node->status == $status[expired] || $node->status == $status[posted]) {
......@@ -13,13 +20,24 @@ function node_history($node) {
return $output;
}
function node_refers($node) {
print "under construction";
}
$number = ($title ? db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title' AND status = $status[posted]", 1)) : 1);
if ($number > 1) {
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.title = '$title'");
$node = ($title ? node_get_object(title, check_input($title)) : node_get_object(nid, check_input($id)));
while ($node = db_fetch_object($result)) {
if (node_visible($node)) {
$output .= "<P><B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B><BR><SMALL>$node->type - ". format_username($node->userid) ." - ". format_date($node->timestamp, "small") ."</SMALL></P>";
}
}
if ($node && node_visible($node)) {
$theme->header();
$theme->box(t("Result"), $output);
$theme->footer();
}
elseif ($number) {
$node = ($title ? node_get_object(title, check_input($title)) : node_get_object(nid, check_input($id)));
if ($node && node_visible($node)) {
switch ($op) {
case "history":
$theme->header();
......@@ -30,11 +48,9 @@ function node_refers($node) {
if ($user->id) user_load($user->userid);
node_view($node, 1);
}
}
else node_failure();