Add this into a custom page to view all submitted comments to your site. Set for Admins only.
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2011 Nick Jones
| \http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: comments_view.php
| Author: PHPFusion Addons Team
| Spam Rate by kneekoo
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at \www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!iADMIN) { redirect(BASEDIR."index.php"
![wink](../../images/smiley/wink.png)
; }
require_once INCLUDES."bbcode_include.php";
include LOCALE.LOCALESET."comments.php";
$counter = (dbcount("(comment_id)", DB_COMMENTS));
if (!function_exists("spam_rating"
![wink](../../images/smiley/wink.png)
) {
function spam_rating($text) {
global $settings;
$hits = 0;
$word_list = array("href=", "url=", "[url]", "buy", "viagra", "cialis", "granite", "sex", "amateur", "hire", "outdoor", "online", "estate", "realtor", "alcohol", "drug", "pizza", "trade", "trading", "lawyer", "grow", "backlink", "internet", "build", "packet", "rapid", "sell", "sale", "market", "loan", "credit", "mortgage", "degree", "diploma", "consult", "affiliat", "download", "advert", "promo", "prosper", "poker"
![wink](../../images/smiley/wink.png)
;
if ($settings['bad_words_enabled'] == "1" && $settings['bad_words'] != "" ) {
foreach (explode("\r\n", $settings['bad_words']) as $word)
$word_list[] = $word;
}
$count = count($word_list);
for ($i=0; $i < $count; $i++) {
preg_match_all("#".$word_list[$i]."#i", $text, $matches);
$hits += count($matches[0]);
}
return $hits;
}
}
if (isset($_GET['rowstart']) && isnum($_GET['rowstart'])) {
$rowstart = $_GET['rowstart'];
} else {
$rowstart = 0;
}
$result = dbquery("SELECT comment_id,
comment_type,
comment_item_id,
comment_name,
comment_message
FROM ".DB_COMMENTS."
ORDER BY comment_datestamp
DESC LIMIT $rowstart,50
"
![wink](../../images/smiley/wink.png)
;
if (dbrows($result) != 0) {
echo "<table class='tbl-border' width='100%'>\n<tr>\n";
echo "<td class='tbl2'><b>ID</b></td>\n";
if (iADMIN && checkrights("M"
![wink](../../images/smiley/wink.png)
) {
echo "<td class='tbl2'><b>Admin</b></td>\n";
}
echo "<td class='tbl2'><b>User</b></td>\n";
echo "<td class='tbl2'><b>View</b></td>\n";
echo "<td class='tbl2'><b>Message</b></td>\n";
echo "<td class='tbl2'><b>Spam Rate</b></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"
![wink](../../images/smiley/wink.png)
;
echo "<tr>\n";
echo "<td class='$cell_color' align='center' valign='top'>".$data['comment_id']."</td>\n";
$user = $data['comment_name'];
$user_details = dbarray(dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." WHERE user_id = '$user'"
![wink](../../images/smiley/wink.png)
);
if (iADMIN && checkrights("M"
![wink](../../images/smiley/wink.png)
)
{ echo "<td class='$cell_color' align='center' valign='top'><a href='".ADMIN."members.php".$aidlink."&step=view&user_id=".$data['comment_name']."' title='Members Admin' />
<img src='".IMAGES."admin.png' alt='' /></a></td>\n";
}
echo "<td class='$cell_color' valign='top'>".profile_link($data['comment_name'], $user_details['user_name'], $user_details['user_status'])."</td>\n";
if ($data['comment_type'] == 'A'
![wink](../../images/smiley/wink.png)
{ $comment_file = "articles"; $file_id = "article_id";}
elseif ($data['comment_type'] == 'N'
![wink](../../images/smiley/wink.png)
{$comment_file = "news"; $file_id = "readmore"; }
elseif ($data['comment_type'] == 'P'
![wink](../../images/smiley/wink.png)
{$comment_file = "photogallery"; $file_id = "photo_id"; }
elseif ($data['comment_type'] == 'C'
![wink](../../images/smiley/wink.png)
{$comment_file = "viewpage"; $file_id = "page_id"; }
elseif ($data['comment_type'] == 'M'
![wink](../../images/smiley/wink.png)
{$comment_file = "infusions/addondb/view"; $file_id = "addon_id"; }
elseif ($data['comment_type'] == 'AL'
![wink](../../images/smiley/wink.png)
{$comment_file = "infusions/sf_admin_log_panel/log_view"; $file_id = "log_id"; }
else {$comment_file = ""; $file_id ="";}
echo "<td class='$cell_color' valign='top'><a href='".BASEDIR.$comment_file.".php?".$file_id."=".$data['comment_item_id']."' title='View Page'><img src='".IMAGES."view.png' alt='' /></a></td>\n";
echo "<td class='$cell_color' valign='top'>".nl2br(parseubb(parsesmileys($data['comment_message'])))."</td>\n";
echo "<td class='$cell_color' valign='top'>".spam_rating($data['comment_message'])."</td>\n</tr>\n";
echo "<td class='$cell_color' colspan='6' valign='top'><hr /></td>\n</tr>\n";
$i++;
}
} else {
echo "<center>".$locale['c101']."</center>\n";
}
echo "</table>\n";
if ($counter > 50) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($rowstart,50,$counter,3,FUSION_SELF."?page_id=".$_GET['page_id']."&"
![wink](../../images/smiley/wink.png)
."\n</div>\n";
?>[/syntaxhighlighter]