diff options
Diffstat (limited to 'modules/story.module')
-rw-r--r-- | modules/story.module | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/story.module b/modules/story.module index 130ae42e3..e71f74bba 100644 --- a/modules/story.module +++ b/modules/story.module @@ -2,8 +2,9 @@ $module = array("cron" => "story_cron", "help" => "story_help", - "block" => "story_block", - "admin" => "story_admin"); + "find" => "story_find", + "admin" => "story_admin", + "block" => "story_block"); include_once "includes/section.inc"; @@ -14,6 +15,15 @@ function story_cron() { } } +function story_find($keys) { + $find = array(); + $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status = 2 AND (s.subject LIKE '%". check_input($keys) ."%' OR s.abstract LIKE '%". check_input($keys) ."%' OR s.article LIKE '%". check_input($keys) ."%') ORDER BY s.timestamp DESC LIMIT 20"); + while ($story = db_fetch_object($result)) { + array_push($find, array("subject" => check_output($story->subject), "link" => "story.php?id=$story->id", "user" => $story->userid, "date" => $story->timestamp)); + } + return $find; +} + function story_help() { ?> <P>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.</P> |