1 (edited by loodos 2006-03-29 12:49)

Topic: LooDos' Anti-Double-Post-Mod v0.1

my first mod for PunBB.
I hope it works.

##
##
##
##        Mod title:  LooDos' Anti-Double-Post-Mod 
##
##      Mod version:  0.1 
##   Works on PunBB:  1.2.11 
##     Release date:  2006-03-29 
##           Author:  LooDos 
##
##      Description:  Disallows double-posts in your board.
##                    Instead, a post if edited is marked as unread.
##                    Admins and Mods can still do double posts.
##                    Multilanguage support.
##
##       Affects DB:  No 
##
##   Affected files:  edit.php, 
##                    post.php, 
##                    lang/YOURLANGUAGE/common.php 
##
##            Notes:  This is a beta release. Please report bugs to netzwerge@gmail.com or post 

they here!
##                    Thanks!
##                    Sorry for my bad English ;D 
##
##     Generated By:  Auto Read-Me(by Caleb Champlin) - http://www.rscheatnet.com/Auto_Readme.zip
##
##       DISCLAIMER:  Please note that 'mods' are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##



#
#---------[ 1. OPEN ]---------------------------------------------------
#

post.php

#
#---------[ 2. FIND (line:63) ]---------------------------------------------------
#

message($lang_common['No permission']);

#
#---------[ 3. AFTER, ADD ]---------------------------------------------------
#

//LooDos' Anti-Double-Post-Mod starts here
if ($pun_user['username'] == $cur_posting['last_poster'] AND !$is_admmod)
        message($lang_common['No double post']);
//LooDos' Anti-Double-Post-Mod ends here

#
#---------[ 4. FIND (line:41) ]---------------------------------------------------
#

$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, 

fp.post_topics, t.subject, t.closed FROM '.$db->prefix.'topics AS t INNER JOIN 

'.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON 

(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR 

fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, 

$db->error());

#
#---------[ 5. REPLACE WITH ]---------------------------------------------------
#

$result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, 

fp.post_topics, t.subject, t.closed, t.last_poster FROM '.$db->prefix.'topics AS t INNER JOIN 

'.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON 

(fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR 

fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, 

$db->error()); //LooDos' Anti-Double-Post-Mod has added: t.last_poster,

#
#---------[ 8. SAVE/UPLOAD ]---------------------------------------------------
#

#
#---------[ 1. OPEN ]---------------------------------------------------
#

edit.php

#
#---------[ 6. FIND (line:118) ]---------------------------------------------------
#

$db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\' WHERE 

id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', 

__FILE__, __LINE__, $db->error());

#
#---------[ 7. REPLACE WITH ]---------------------------------------------------
#

$db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\', 

last_post='.time().' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable 

to update topic', __FILE__, __LINE__, $db->error()); //LooDos' Anti-Double-Post-Mod has added: , 

last_post='.time().'

#
#---------[ 8. SAVE/UPLOAD ]---------------------------------------------------
#

#
#---------[ 9. OPEN ]---------------------------------------------------
#

lang/YOURLANGUAGE/common.php

#
#---------[ 10. FIND (line:39) ]---------------------------------------------------
#

'Bad referrer'                        =>        'Bad HTTP_REFERER. You were referred to this page 

from an unauthorized source. If the problem persists please make sure that \'Base URL\' is 

correctly set in Admin/Options and that you are visiting the forum by navigating to that URL. More 

information regarding the referrer check can be found in the PunBB documentation.',

#
#---------[ 11. AFTER, ADD ]---------------------------------------------------
#

'No double post'                      =>        'Double-Posts are not allwed. Please edit your 

post.',

#
#---------[ 12. SAVE/UPLOAD ]---------------------------------------------------
#

Greets
LooDos

2 (edited by Smartys 2006-03-29 12:31)

Re: LooDos' Anti-Double-Post-Mod v0.1

Your readme looks incorrect: I can't see where you edit post.php

Also, if you change last post time whenever someone edits but not last poster, etc, aren't you just confusing people?

Re: LooDos' Anti-Double-Post-Mod v0.1

thanks Smartys

this mistake has been corrected
waiting for the next wink