From 864b3de476fbc7ad318d29670a569403ec9f888b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 1 Apr 2001 12:08:15 +0000 Subject: - undid some changes --- modules/story.module | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'modules/story.module') diff --git a/modules/story.module b/modules/story.module index a2912b645..81f46be78 100644 --- a/modules/story.module +++ b/modules/story.module @@ -1,6 +1,7 @@ "story_help", +$module = array("cron" => "story_cron", + "help" => "story_help", "find" => "story_find", "user" => "story_user", "queue" => "story_queue", @@ -19,6 +20,14 @@ class Story { } } +function story_cron() { + global $status; + $result = db_query("SELECT * FROM node WHERE status = '$status[scheduled]' AND timestamp <= ". time() .""); + while ($story = db_fetch_object($result)) { + 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(); @@ -37,6 +46,7 @@ function story_search() { function story_help() { ?> +

Scheduled stories: stories that are scheduled to be automatically published at a given date and time. Useful when you have to leave the site alone for a while or when you want to regulate the flow of new content.

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.

@@ -101,39 +111,37 @@ function story_form($edit = array()) { $output .= "
\n"; - // nid: - $node = node_get_object("nid", $edit[nid]); - if ($node) $output .= "\n"; - - // author: - $output .= node_form_author($edit); + $output .= "". t("Your name") .":
\n"; + $output .= "\n"; + $output .= format_username(($edit[userid] ? $edit[userid] : $user->userid)) ."

"; - // date: - if ($node) $output .= node_form_date($edit, array($node->timestamp, time())); + $output .= "". t("Subject") .":
\n"; + $output .= "

\n"; - // subject: - $output .= node_form_title($edit); - - // section: $output .= "". t("Section") .":
\n"; foreach ($sections = section_get() as $value) $options .= " \n"; $output .= "

\n"; - // abstract: $output .= "". t("Abstract") .":
\n"; $output .= "
\n"; $output .= "". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".

\n"; - // body: $output .= "". t("Body") .":
\n"; $output .= "
\n"; $output .= "". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".

\n"; - // status: - if (user_access($user, "story")) $output .= node_form_status($edit, array(dumped, queued, posted)); + if (user_access($user, "story")) { + $output .= "". t("Status") .":
\n"; + $output .= " scheduled for
\n"; + $output .= " dumped
\n"; + $output .= " queued
\n"; + $output .= " posted
\n"; + $output .= "The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...

\n"; + $output .= "\n"; + $output .= "\n"; + } - // error checking: $duplicate = db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title'")); if (!$edit) { @@ -166,6 +174,7 @@ function story_form($edit = array()) { function story_save($edit) { global $status; + $edit[timestamp] = ($edit[status] == $status[scheduled] && strtotime($edit[timestamp]) > time()) ? strtotime($edit[timestamp]) : ($node[timestamp] ? $node[timestamp] : time()); node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); } -- cgit v1.2.3