diff options
Diffstat (limited to 'modules/book.module')
-rw-r--r-- | modules/book.module | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/book.module b/modules/book.module index 8b70a166a..f2cd01153 100644 --- a/modules/book.module +++ b/modules/book.module @@ -61,7 +61,7 @@ function book_view($node, $main = 0) { $output .= " <TR><TD COLSPAN=\"2\">$location</TD><TD ALIGN=\"right\">". node_control($node) ."</TD></TR>\n"; $output .= " <TR><TD COLSPAN=\"3\"><HR></TD></TR>"; - $output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_name($node->name) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n"; + $output .= " <TR><TD COLSPAN=\"3\"><B><BIG>". check_output($node->title) ."</BIG></B>". ($node->body ? "<BR><SMALL><I>Last updated by ". format_name($node) ." on ". format_date($node->timestamp) ."</I></SMALL> " : "") ."</TD></TR>\n"; } if ($node->body) { @@ -83,7 +83,7 @@ function book_view($node, $main = 0) { function book_search($keys) { global $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.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.name FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid LEFT JOIN user 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"); while ($node = db_fetch_object($result)) { $find[$i++] = array("title" => check_output($node->title), "link" => (user_access("administer nodes") ? "admin.php?mod=node&type=book&op=edit&id=$node->nid" : "node.php?id=$node->nid"), "user" => $node->name, "date" => $node->timestamp); } @@ -128,7 +128,7 @@ function book_form($edit = array()) { $form .= book_view(new Book(node_preview($edit))); } - $form .= form_item(t("Author"), format_name(($edit[name] ? $edit[name] : $user->name))); + $form .= form_item(t("Author"), ($edit[name] ? $edit[name] : ($user->name ? $user->name : variable_get(anonymous, "Anonymous")))); $form .= form_hidden(name, $edit[name]); $form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64); @@ -168,7 +168,7 @@ function book_save($edit) { global $status, $user; if (!$edit[nid]) { - node_save($edit, array(author => $user->id, 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(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)); } else if (user_access("administer nodes")) { node_save($edit, array(body, log, parent, title, type => "book", weight)); |