Double merge mod probleem
Geplaatst: 09 dec 2004, 11:57
ik gebruik de Double Merge mod, die laat dubbelposts in elkaar smelten
maar nou als hij een post in elkaar smelt, dan krijgt de persoon nog steeds points (ik gebruik de points system, niet de cashmod)
weet iemand hoe ik dit kan fixen?
owjah, ik heb van Austin (maker van de A-mod) gehoord dat ik dit ergens moest posten:
subtract_points()
maar waar moet ik dat dan neerzetten?
en hoe kan ik instellen hoeveel er af moet?
bij voorbaad dank
owjah (2), hier is de mod install file:
maar nou als hij een post in elkaar smelt, dan krijgt de persoon nog steeds points (ik gebruik de points system, niet de cashmod)
weet iemand hoe ik dit kan fixen?
owjah, ik heb van Austin (maker van de A-mod) gehoord dat ik dit ergens moest posten:
subtract_points()
maar waar moet ik dat dan neerzetten?
en hoe kan ik instellen hoeveel er af moet?
bij voorbaad dank
owjah (2), hier is de mod install file:
Code: Selecteer alles
##############################################################
## MOD Title: Double post merge
## MOD Author: Mercuree < mercuree@moldova.cc > ( Igor )
## MOD Description: This mod merges post text on posting
## to the last message in topic
## instead of adding a new one, only if
## the poster of the last message
## and the poster of current text is the
## same person (double post becomes one post)
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 1 Minute
##
## Files To Edit: posting.php
## includes\function_post.php
## admin\admin_board.php
## language\lang_english\lang_admin.php
## templates\subSilver\admin\board_config_body.tpl
##
## Included Files: double_post_merge_mod_install.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## your comments appreciated
## mailto: mercuree@moldova.cc
##
## Thanks to:
## x, Xpert, ra
##
##############################################################
## MOD History:
##
## 2004-09-08 - Version 1.0.2
##
## - fixed bug: sometimes "added after" was calculated
## incorrectly
##
## 2004-03-25 - Version 1.0.1
##
## - messages will join only if the time since last message
## is no more than XX hours (new field in board settings)
##
## - comment (separator between joined messages) changed to:
## "Added after XX hours XX minutes XX seconds"
## was:
## "Posted {date_in_php_date()_format}",
##
## - the date/time of last message updates to date/time of
## added message. the next "added after" will count from
## this time.
##
## - fixed bug: some smilies of the joined messages not showed
##
## - fixed bug: with htmlspecialchars
##
## 2004-01-13 - Version 1.0.0
##
## - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
# during 18 (you can change this) hours messages will join to the last
#
# if you don't know nothing about SQL just run double_post_merge_mod_install.php
#
INSERT INTO bbcc_config (config_name, config_value) VALUES ('join_interval', '18');
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
//
// Submit post/vote (newtopic, edit, reply, etc.)
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
// double_post eliminate start
if ( $mode == 'reply' && $userdata['user_id'] != ANONYMOUS )
{
$poster_id = $userdata['user_id'];
$sql = "SELECT post_id, poster_id, post_time, MAX(post_time) FROM " . POSTS_TABLE . " WHERE topic_id = $topic_id GROUP BY post_time ORDER BY post_time DESC LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$post_id_last_row = $db->sql_fetchrow($result);
$post_id = $post_id_last_row['post_id'];
$current_time = time();
$difference_time = $current_time - $post_id_last_row['post_time'];
$hours = floor($difference_time/60/60);
$minutes = floor($difference_time/60%60);
$seconds = $difference_time%60;
$separator = ' \n\n[size=9][color=#999999]Added after';
if ( $hours != 0 ) $separator .= ' ' . $hours . ' hours';
if ( $minutes != 0 ) $separator .= ' ' . $minutes . ' minutes';
if ( $hours == 0 && $minutes == 0 ) $separator .= ' ' . $seconds . ' seconds';
$separator .= ':[/color][/size]\n\n ';
if ( $post_id_last_row['poster_id'] == $poster_id && ( $difference_time < ( $board_config['join_interval'] * 3600 ) ) )
{
$mode = 'editpost';
$sql = "SELECT post_text, bbcode_uid FROM " . POSTS_TEXT_TABLE . " WHERE post_id = $post_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$last_message_row = $db->sql_fetchrow($result);
$bb_uid = ':' . $last_message_row['bbcode_uid'];
// i don't know much about parsing the message, so it may well be that,
// there are some wrongs, anyway all seems to work fine
$last_message = str_replace($bb_uid, '', $last_message_row['post_text']);
$last_message = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $last_message);
$last_message = undo_htmlspecialchars(addslashes($last_message));
}
}
// double_post eliminate end
#
#-----[ FIND ]------------------------------------------
#
$bbcode_uid = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !empty($last_message) )
{
$message = ( $last_message != $message ) ? $last_message . $separator . $message : $message;
$added = 1;
}
#
#-----[ FIND ]------------------------------------------
#
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, $poll_length
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, $added
#
#-----[ OPEN ]------------------------------------------
#
includes\function_post.php
#
#-----[ FIND ]------------------------------------------
#
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, &$poll_length
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, &$added
#
#-----[ FIND ]------------------------------------------
#
if ($mode == 'editpost')
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( $added && $mode == 'editpost' )
{
$sql = "UPDATE " . POSTS_TABLE . " SET post_time = " . $current_time . " WHERE post_id = " . $post_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update last post time', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ OPEN ]------------------------------------------
#
admin\admin_board.php
#
#-----[ FIND ]------------------------------------------
#
"L_FLOOD_INTERVAL" => $lang['Flood_Interval'],
"L_FLOOD_INTERVAL_EXPLAIN" => $lang['Flood_Interval_explain'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_JOIN_INTERVAL" => $lang['Join_Interval'],
"L_JOIN_INTERVAL_EXPLAIN" => $lang['Join_Interval_explain'],
#
#-----[ FIND ]------------------------------------------
#
"FLOOD_INTERVAL" => $new['flood_interval'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"JOIN_INTERVAL" => $new['join_interval'],
#
#-----[ OPEN ]------------------------------------------
#
language\lang_english\lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Flood_Interval'] = 'Flood Interval';
$lang['Flood_Interval_explain'] = 'Number of seconds a user must wait between posts';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Join_Interval'] = 'Join messages in: (hours)';
$lang['Join_Interval_explain'] = 'Join messages of the same poster if interval between them is less than this quantity in hours';
#
#-----[ OPEN ]------------------------------------------
#
templates\subSilver\admin\board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_FLOOD_INTERVAL} <br /><span class="gensmall">{L_FLOOD_INTERVAL_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="flood_interval" value="{FLOOD_INTERVAL}" /></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_JOIN_INTERVAL} <br /><span class="gensmall">{L_JOIN_INTERVAL_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="join_interval" value="{JOIN_INTERVAL}" /></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM