diff options
Diffstat (limited to 'modules/comment.module')
-rw-r--r-- | modules/comment.module | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/comment.module b/modules/comment.module index e4a8ca9ac..bd6594dbc 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1,6 +1,16 @@ <? -$module = array("admin" => "comment_admin"); +$module = array("find" => "comment_find", + "admin" => "comment_admin"); + +function comment_find($keys) { + $find = array(); + $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.subject LIKE '%". check_input($keys) ."%' OR c.comment LIKE '%". check_input($keys) ."%' ORDER BY c.timestamp DESC LIMIT 20"); + while ($comment = db_fetch_object($result)) { + array_push($find, array("subject" => check_output($comment->subject), "link" => "story.php?id=$comment->lid&cid=$comment->cid", "user" => $story->userid, "date" => $comment->timestamp)); + } + return $find; +} function comment_edit($id) { $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = $id"); |