"comment_find", "admin" => "comment_admin"); function comment_find($keys) { global $user; $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 '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20"); while ($comment = db_fetch_object($result)) { array_push($find, array("title" => check_output($comment->subject), "link" => (user_access($user, "comment") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->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'"); $comment = db_fetch_object($result); $output .= "
\n"; $output .= "Author:
\n"; $output .= format_username($comment->userid) ."

\n"; $output .= "Subject:
\n"; $output .= "subject) ."\">

\n"; $output .= "Comment:
\n"; $output .= "

\n"; $output .= "\n"; $output .= "

\n"; print $output; } function comment_save($id, $subject, $comment) { db_query("UPDATE comments SET subject = '$subject', comment = '$comment' WHERE cid = '$id'"); watchdog("message", "comment: modified '$subject'"); } function comment_display($order = "date") { // Initialize variables: $fields = array("author" => "author", "date" => "timestamp DESC", "subject" => "subject"); // Perform SQL query: $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY c.$fields[$order] LIMIT 50"); // Display comments: $output .= "\n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; while ($comment = db_fetch_object($result)) { $output .= " \n"; } $output .= "
\n"; $output .= "
\n"; $output .= " \n"; $output .= " \n"; $output .= "
\n"; $output .= "
subjectauthoroperations
lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."". format_username($comment->userid) ."cid\">edit
\n"; print $output; } function comment_admin() { global $op, $id, $mod, $keys, $subject, $comment, $order; print "overview | search comment
\n"; switch ($op) { case "edit": comment_edit($id); break; case "search": print search_form($keys); print search_data($keys, $mod); break; case "Save comment": comment_save(check_input($id), check_input($subject), check_input($comment)); comment_display(); break; case "Update": comment_display(check_input($order)); break; default: comment_display(); } } ?>