Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Comments View

Asked Modified Viewed 4,259 times
H
HobbyMan
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
asked
Veteran Member

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; }

require_once INCLUDES."bbcode_include.php";
include LOCALE.LOCALESET."comments.php";
$counter = (dbcount("(comment_id)", DB_COMMENTS));

if (!function_exists("spam_rating"wink) {
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;
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;

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) {
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;
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);

if (iADMIN && checkrights("M"wink)
{ echo "<td class='$cell_color' align='center' valign='top'><a href='".ADMIN."members.php".$aidlink."&amp;step=view&amp;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 { $comment_file = "articles"; $file_id = "article_id";}
elseif ($data['comment_type'] == 'N'wink {$comment_file = "news"; $file_id = "readmore"; }
elseif ($data['comment_type'] == 'P'wink {$comment_file = "photogallery"; $file_id = "photo_id"; }
elseif ($data['comment_type'] == 'C'wink {$comment_file = "viewpage"; $file_id = "page_id"; }
elseif ($data['comment_type'] == 'M'wink {$comment_file = "infusions/addondb/view"; $file_id = "addon_id"; }
elseif ($data['comment_type'] == 'AL'wink {$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']."&amp;"wink."\n</div>\n";

?>[/syntaxhighlighter]
Edited by HobbyMan on 28-02-2011 17:38,
0 replies

5 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Never realise this was here, Nice work Philip and other Staff involved in this its quite a useful thing to keep an eye on them spam comments.

Thank you Fellow Staff guys. ;)
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Quote

Fangree_Craig wrote:
its quite a useful thing to keep an eye on them spam comments.


Yeah ! I agree with you ! Because, I have a lot of photos in my Clan website and sometimes, the Spammers post comments to the photos and Normally no one use to see the comment and even I cannot control the activity of members then :(

So it is quite Useful for me ! ;) Thanks For this :)
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Just do something with registration, and viola - no spamers - no spam.
Quite easy.
0 replies
R
Rolf Mayer
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
answered
Senior Member

Agree with Polar Fox.
0 replies
H
HobbyMan
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
answered
Veteran Member

This is a "Humanity Check" mod that I wrote for v7.00
It would be easy enough to adapt for v7.01

http://www.phpnuclear.com/downloads/h..._check.zip
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 5 posts
  • Votes 0 votes
  • Topic users 5 members

5 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
H
H
Just some Guy
  • Veteran Member, joined since
  • Contributed 1,486 posts on the community forums.
  • Started 91 threads in the forums
  • Started this discussions
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
R
R
Ex
  • Senior Member, joined since
  • Contributed 391 posts on the community forums.
  • Started 7 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet