September 07 2010 14:23:31
Navigation
Last Seen Users
LaNceROnline
wanili00:11:18
Tabibito00:12:30
Xoft00:33:01
bohdas00:42:33
Djordje00:45:39
Alorsss00:48:14
kyborgasfm00:48:54
pamises1601:08:09
nightgockel01:10:08

Members: 16,220
Newest: kyborgasfm
Blogs
Diemux
» 18-09-2009 - Say ...
Diemux
» 10-07-2009 - Will...
Diemux
» 24-06-2009 - Blog...
elyn
» Elyn + Streamyx (...
Diemux
» 19-05-2009 - Thin...
Diemux
» 15-05-2009 - Week...
Diemux
» 13-05-2009 - Comp...
elyn
» Number 1925
Diemux
» Number One
Things to Do
Latest Articles
A tour through the n...
Protect your Fusion ...
Change your database...
Handling MySQL Datab...
Admin Control Panel ...
How to Secure Your I...
Show Content by Defa...
v7 | Add social book...
v7 | Custom MySQL er...
How To: A PM after r...
v7 | SEO friendly UR...
v7 | SEO friendly UR...
Comments Advanced Vi...
Auto-redirect to the...
A tour through PHP-F...

View all articles
Downloads v7
Currently popular Downloads

FusionBoard 4 4011
Video Gallery 2868
Professional Down... 2569
Photoalbum Mass U... 2519
Avatar Studio 2348
Extended Profile 1898
Button panel 1865
XHTML mod for mod... 1863
VArcade 2.1 1833
HighSlide Gallery... 1800

Latest Downloads


Bosnian Locale - PHP... 4
Multimedia Studio ve... 25
Post-Report 1
Post Report with pd_... 0
XHTML mod for modern... 1863
Pimped-Fusion v0.08.01 23
Update Package v0.08.01 3
Support Panel-Skype 23
Header Weather Widget 82
Forum Thread List Pa... 34

Latest 100
Downloads v6
Currently popular Downloads

Banner System v2.0.4 1702
Video Gallery 1212
Extreme Theme Editor 916
Fuzed Shoutbox 815
Seoname.php 756
Icon Package 2.0 701
Extended Profile ... 659
News.php 585
EXTboard 552
Tabbed welcome panel 532

Latest Downloads


Google Sitemap Fast 56
ExtBoard 1.2 385
EXTboard 552
v6.01.18 - v6.01.19 33
v6.01.19 FULL 91
Birthday 123
Moneybookers 47
User info 104
Link to us 262
jNews.php 346

Latest 100
Provider
PHPfusion-mods.net is hosted at:

110MB
Comments Advanced View and Anti-Spam Captcha Image
Here is a small modification that I've made to the php fusion so that we can enjoy a fully functional well displayed paged COMMENTS (15 per page) + captcha image anti-spam protection and not this a bit silly math calculation....

First of all you have to edit files so make a copy before editing each one. Now let's stick to the business:

**************************
Open your includes/comments_include.php and replace the code within with this one:

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright  2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Comments system developed by CrappoMan
| email: simonpatterson@dsl.pipex.com
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }

include LOCALE.LOCALESET."comments.php";

function showcomments($ctype,$cdb,$ccol,$cid,$clink,$rowstartt) {

    global $settings,$locale,$userdata,$aidlink;
    

    if (isset($_POST['post_comment'])) {
global $settings,$locale,$userdata,$aidlink;


if (isset($_POST['post_comment'])) {
if (dbrows(dbquery("SELECT $ccol FROM ".DB_PREFIX."$cdb WHERE $ccol='$cid'"))==0) {
fallback(BASEDIR."index.php");
}
if (iMEMBER) {
$comment_name = $userdata['user_id'];
} elseif ($settings['guestposts'] == "1") {
$comment_name = trim(stripinput($_POST['comment_name']));
$comment_name = preg_replace("(^[0-9]*)", "", $comment_name);
if (isNum($comment_name)) $comment_name="";
}
$comment_message = trim(stripinput(censorwords($_POST['comment_message'])));
$comment_smileys = isset($_POST['disable_smileys']) ? "0" : "1";
if ($comment_name != "" && $comment_message != "") {
if (!check_captcha($_POST['captcha_encode'], $_POST['captcha_code'])) {
if (checkrights("C")) {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
redirect($clink);
}
else { $error .= "· <span class='alt'><b>Please enter correct verification code!</b></span><br />\n"; }
}
else {
$result = dbquery("INSERT INTO ".DB_PREFIX."comments VALUES('', '$cid', '$ctype', '$comment_name', '$comment_message', '$comment_smileys', '".time()."', '".USER_IP."')");
redirect($clink);
}
}
}
} else {
$invalid = true;
$comment_message2 = trim(stripinput(censorwords($_POST['comment_message'])));
}

    tablebreak();
    $rows = dbrows(dbquery("SELECT tcm.*,user_name FROM ".DB_PREFIX."comments tcm
        LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
        WHERE comment_item_id='$cid' AND comment_type='$ctype'
        ORDER BY comment_datestamp DESC")); // Ausgabe der Anzahl an Threads no sticky
    if (!isset($rowstartt) || !isNum($rowstartt)) $rowstartt = 0;
    if ($rows==0) $rowstartt = 0;
    opentable($locale['c100']);
    if ($rows > 15) {
        echo "<table cellspacing='1' cellpadding='0' border='0' width='100%'><tr><td valign='bottom'>";
        $clink2 = str_replace('.htm','',$clink);
        echo forumpagenav($rowstartt,15,$rows,3,$clink2)."</td></tr></table>\n";
    }
    $result10 = dbquery(
        "SELECT tcm.*,user_name FROM ".DB_PREFIX."comments tcm
        LEFT JOIN ".DB_PREFIX."users tcu ON tcm.comment_name=tcu.user_id
        WHERE comment_item_id='$cid' AND comment_type='$ctype'
        ORDER BY comment_datestamp DESC LIMIT ".$rowstartt.", 15"
    );
    if (dbrows($result10) != 0) {
        $i = 0;
        echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n";
        while ($data = dbarray($result10)) {
            echo "<tr>\n<td class='".($i% 2==0?"tbl1":"tbl2")."'><span class='comment-name'>\n";
            if ($data['user_name']) {
                echo "<a href='".BASEDIR.seoname($data['user_name'])."-user".$data['comment_name'].".htm'>".$data['user_name']."</a>";
            } else {
                echo $data['comment_name'];
            }
            if ($data['comment_smileys'] == "1") {
                $comment_message = parsesmileys($data['comment_message']);
            } else {
                $comment_message = $data['comment_message'];
            }
            $comment_message = nl2br(parseubb($comment_message));
            echo "</span>\n<span class='small'>".$locale['041'].showdate("longdate", $data['comment_datestamp'])."</span><br>\n";
            echo $comment_message."</td>\n</tr>\n";
            $i++;
        }
        if (checkrights("C")) echo "<tr>\n<td align='right' class='".($i% 2==0?"tbl1":"tbl2")."'><a href='".ADMIN."comments.php".$aidlink."&ctype=$ctype&cid=$cid'>".$locale['c106']."</a></td>\n</tr>\n";        
        echo "</table>\n";
        if ($rows > 15) {
        echo "<table cellspacing='1' cellpadding='0' border='0' width='100%'><tr><td valign='bottom'>";
        $clink2 = str_replace('.htm','',$clink);
        echo forumpagenav($rowstartt,15,$rows,3,$clink2)."</td></tr></table>\n";
    }
    } else {
        echo $locale['c101']."\n";
    }
    closetable();
    tablebreak();


    opentable($locale['c102']);
    if (iMEMBER || $settings['guestposts'] == "1") {
        echo "<p align='center'><font color='red'>".$error."</font></p>";
        echo "<form name='inputform' method='post' action='$clink'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>\n";
        if (iGUEST) {
            echo "<tr>
<td>".$locale['c103']."</td>
</tr>
<tr>
<td><input type='text' name='comment_name' maxlength='50' class='textbox' style='width:100%;'></td>
</tr>\n";
        }
        echo "<tr>
<td align='center'><textarea name='comment_message' rows='6' class='textbox' style='width:400px'>"; if($invalid) echo $comment_message2; echo"</textarea><br>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('comment_message', '[b]', '[/b]');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('comment_message', '[i]', '[/i]');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('comment_message', '[u]', '[/u]');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('comment_message', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('comment_message', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('comment_message', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('comment_message', '[center]', '[/center]');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('comment_message', '[small]', '[/small]');\">
<input type='button' value='code' class='button' style='width:40px;' onClick=\"addText('comment_message', '[code]', '[/code]');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('comment_message', '[quote]', '[/quote]');\">
<br><br>
".displaysmileys("comment_message")."
</td>
</tr>
<tr><td class='tbl' align='left'><b>Anti-Spam Code:</b>    ".make_captcha()."</tr>
<tr><td class='tbl' align='left'><b>Enter Anti-Spam Code:</b><input type='text' name='captcha_code' class='textbox' width='100'></td></td></tr>
<tr>
<td align='center'><input type='checkbox' name='disable_smileys' value='1'>".$locale['c107']."<br><br>
<input type='submit' name='post_comment' value='".$locale['c102']."' class='button'></td>
</tr>
</table>
</form>\n";
    } else {
        echo $locale['c105']."\n";
    }
    closetable();
}
?>


Save, Close and Upload file.

*************************

Open maincore.php and find the following line:

function makepagenav($start,$count,$total,$range=0,$link=""){

ABOVE this line, place the following:

function commentpagenav($start,$count,$total,$range=0,$link=""){
global $locale;
if ($link == "") $link = FUSION_SELF."?";
$res="";
$pg_cnt=ceil($total / $count);
if ($pg_cnt > 1) {
$idx_back = $start - $count;
$idx_next = $start + $count;
$cur_page=ceil(($start + 1) / $count);
$res.="<table cellspacing='1' cellpadding='1' border='0' class='tbl-border'>\n<tr>\n";
$res.="<td class='tbl2'><span class='small'>".$locale['052']."$cur_page".$locale['053']."$pg_cnt</span></td>\n";
if ($idx_back >= 0) {
if ($cur_page > ($range + 1)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=0'><<</a></td>\n";
$res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=$idx_back'><</a></td>\n";
}
$idx_fst=max($cur_page - $range, 1);
$idx_lst=min($cur_page + $range, $pg_cnt);
if ($range==0) {
$idx_fst = 1;
$idx_lst=$pg_cnt;
}
for($i=$idx_fst;$i<=$idx_lst;$i++) {
$offset_page=($i - 1) * $count;
if ($i==$cur_page) {
$res.="<td class='tbl1'><span class='small'><b>$i</b></span></td>\n";
} else {
$res.="<td class='tbl1'><a class='small' href='$link"."rowstartt=$offset_page'>$i</a></td>\n";
}
}
if ($idx_next < $total) {
$res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=$idx_next'>></a></td>\n";
if ($cur_page < ($pg_cnt - $range)) $res.="<td class='tbl2'><a class='small' href='$link"."rowstartt=".($pg_cnt-1)*$count."'>>></a></td>\n";
}
$res.="</tr>\n</table>\n";

}
return $res;
}

*************************

Ok done, now in order to display your comments correctly, all you have to do is lets say to open readarticle.php

Find the line that includes comments include (looks like this):

if ($data['article_allow_comments']) showcomments("A","articles","article_id",$article_id,FUSION_SELF."?article_id=$article_id");

And add 6th parameter within the showcomments() function called $rowstartt like that:

if ($data['article_allow_comments']) showcomments("A","articles","article_id",$article_id,FUSION_SELF."?article_id=$article_id",$rowstartt);

You can do that on all pages on which you want to add comments, e.g. news.php, just add the $rowstartt 6th parameter and it will display correctly and etc...

*************************

Regards, Webadmin88

PS: For technical support regarding this mod, click here .

PS2: Please note that if you are a SuperAdministrator or Administrator, you don't have to fill out the anti-spam measure, I thought this is crucial when you are and admin LOL :)
Comments
#1Diemux on August 04 2008 14:46:53
Diemux
Tried to implant this but got the following error:

Parse error: syntax error, unexpected T_ELSE in /home/undergro/public_html/includes/comments_include.php on line 51
#2Diemux on August 07 2008 14:48:46
Diemux
Issue resolved with correct code. Article updated.
#3webadmin88 on August 24 2008 20:52:49
webadmin88
Thank you- I am really proud with this one =)
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 75% [3 Votes]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 25% [1 Vote]
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Our Coders
Smokeman
Rizald 'Elyn' Maxwell
Diemux
Netrix
Donate
Shoutbox
You must login to post a message.

06/09/2010 13:00
@smokeman: my shout was not adressed to a special person. Fusion-Mods and Fusion-Main sites have the same problems with stupid spammers. Wink

06/09/2010 10:02
@MarcusG: I agreed with you but I can't do anything about it. It's Diemux that stands for that part of the site.

06/09/2010 09:21
This SPAM really SUX, especially when there are solutions to fight it. I have NO (ZERO) Spam on my site.

06/09/2010 04:18
I think someone break Fusion captcha.

04/09/2010 09:32
Spam deleted.

04/09/2010 08:09
Try this to fight the SPAM: KLICK ME HARD Or THIS

04/09/2010 06:56
Spammm Alarm^^ Confused

31/08/2010 14:30
@Info: Cleaned up the shouts for support questions. Thumb Up!

30/08/2010 03:26
It's not my site - im just admin inhere. Smile

30/08/2010 02:29
Why not replace the Shoutbox with the Tagwall infusion Smokeman? Then put the Tagwall as a lower center panel. Just a suggestion..

Advertiser
One-click Translation
Translate This Site

Render time: 0.15 seconds 5,388,390 unique visits