abstract = $story[abstract]; $this->body = $story[body]; } } function story_status() { return array(dumped, queued, posted); } function story_search($keys) { global $status, $user; $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)) { $find[$i++] = 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); } return $find; } function story_help() { ?>
Queued stories: user-contributed stories are automatically whisked away to a submission queue for moderators (i.e. registered user) to frown at. Moderators vote whether or not a story should be posted to the front page for discussion.
Posted stories: published stories accessible to all visitors.
Dumped stories: rejected stories that are no longer available to visitors.
story($node, $main); } function story_form($edit = array()) { global $REQUEST_URI, $user; $form .= form_item(t("Your name"), format_username(($edit[userid] ? $edit[userid] : $user->userid))); $form .= form_hidden("userid", $edit[userid]); $form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64); $form .= structure_form("story", $edit); $form .= form_textarea(t("Abstract"), "abstract", $edit[abstract], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); $form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); // hidden fields: if ($edit[nid] > 0) { $form .= form_hidden("nid", $edit[nid]); } if (!$edit) { $form .= form_submit(t("Preview")); } else if (!$edit[title]) { $form .= "". t("Warning: you did not supply a subject.") ."\n"; $form .= form_submit(t("Preview")); } else if (!$edit[abstract]) { $form .= "". t("Warning: you did not supply an abstract.") ."
\n"; $form .= form_submit(t("Preview")); } else { $form .= form_submit(t("Preview")); $form .= form_submit(t("Submit")); } return form($REQUEST_URI, $form); } function story_save($edit) { global $status, $user; if (!$edit[nid]) { node_save($edit, array(abstract, author => $user->id, body, cid, comment => category_comment($edit[cid]), moderate => topic_moderate($edit[tid]), promote => category_promote($edit[cid]), score => 0, status => (category_submission($edit[cid]) ? $status[queued] : $status[posted]), tid, timestamp => time(), title, type => "story", votes => 0)); } else if (user_access($user)) { node_save($edit, array(abstract, body, cid, tid, title, type => "story")); } } function story_block() { /* // // disabled for now // global $status; $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 .= "