March 11 2010 22:35:14
Navigation
Last Seen Users
Kevin2009< 5 mins
mafiotabg< 5 mins
Nemo_O< 5 mins
MasteR_SVK00:13:02
afoster00:19:20
Silentneeb00:20:43
klopdd00:21:32
DJ-SKY00:22:35
Lukass44500:23:23
ST6600:31:46

Members: 13,490
Newest: weaser
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
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...
Upgrading to PHP-Fus...

View all articles
Downloads v7
Currently popular Downloads

FusionBoard 4 3160
Video Gallery 2271
Professional Down... 2231
Photoalbum Mass U... 2053
Avatar Studio 1995
Extended Profile 1687
VArcade 2.1 1582
HighSlide Gallery... 1559
XHTML mod for mod... 1443
Button panel 1439

Latest Downloads


User Info [Remade] 272
BBcode: AVI 6
Pimped PHP-Fusion 4
XHTML mod for modern... 1443
Banner Rotater 865
Who's Where Panel 733
VU Tab Panel 382
Viewlog Script 186
Usergroup Management 658
Unauthenicated User 185

Latest 100
Downloads v6
Currently popular Downloads

Banner System v2.0.4 1412
Video Gallery 1064
Extreme Theme Editor 815
Fuzed Shoutbox 705
Seoname.php 664
Icon Package 2.0 651
Extended Profile ... 610
EXTboard 542
News.php 541
Tabbed welcome panel 489

Latest Downloads


Google Sitemap Fast 4
ExtBoard 1.2 366
EXTboard 542
v6.01.18 - v6.01.19 20
v6.01.19 FULL 54
Birthday 88
Moneybookers 32
User info 74
Link to us 245
jNews.php 312

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
Rizald 'Elyn' Maxwell
Diemux
Netrix
Donate
Shoutbox
You must login to post a message.

11/03/2010 16:55
New spammer: deal202 That really suxx!

11/03/2010 13:57
Support question? Post in the forums!

11/03/2010 02:24
@Diemux: Important PM for you.

10/03/2010 20:10
Cool, added the download again Smile. Also cleaned inbox Smile

10/03/2010 13:41
Ohh - your inbox is full btw!

10/03/2010 13:40
@Diemux: I've re-coded the naptzer_user_info - from the "z-dump". You can DL it from here: www.dvdside.dk/do.
..r_info.zip

10/03/2010 00:07
So if you have some spare time Smile

10/03/2010 00:07
Introduced the "z dumb" category in v7 downloads. There reside the infusions who need some TLC to work again.

09/03/2010 19:35
Removed spam.

09/03/2010 17:38
New spammer: dottech Thumb Down!

Advertiser
One-click Translation
Translate This Site

Render time: 0.19 seconds 3,989,467 unique visits