Flood Koruması ( Prevent Doubleposting )

Kon-Rei

New member
- Ne işe yarıyor bu eklenti DJ PİSAGOR?
- Ard arda mesaj atıldığında önceki mesaja birleştiriyor.
- Yani artık flood yaptı diye 5 uyarı puanı verilmeyecek.
-
- Peki ben 48 saat sonra mesaj atsam yine birleşecek mi ilk mesajımla?
- Hayır Bu aşağıdaki kodlara göre 24 saat içinde ard arda attığın mesajlar birleştiriliyor.
- Peki bu süre ayarlanabiliyor mu?
- Tabii LOL $dp_settings kısmından ayarlayabilirsiniz.
- Saol allah rası ossun



Hack Name: Prevent Doubleposting
Hack Version: 1.0 Beta 1
Hack Author: Stefan 'Xenon' Kaeser


includes/functions_newpost.php dosyasını açın ve şu kodu bulun
PHP Kodu:
Kod:
$id = $dataman->save();
Bu kod ile değiştirin
PHP Kodu:
Kod:
// ########### Xenon's prevent doublepost hack #########
$dp_settings = array(
'timespan' => 3600 * 24,// how many seconds after the last post the new post is defined as doublepost
'spacer' => "\n\n", // What should be between the old post and the new one (default: two empty lines)
'editedbymsg' => 'Automerged Doublepost', // If left blank no edited by will appear
);
 
$isdoublepost = false;
$oldmsg = $post['message'];
 
if ($type != 'thread' 
AND $threadinfo['lastpost'] > TIMENOW - $dp_settings['timespan'] 
AND $threadinfo['lastposter'] == $vbulletin->userinfo['username'])
{
// we are here, so we may have a doublepost -> do more exact checkings
$doublepost = $vbulletin->db->query_first("
SELECT post.*
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
WHERE threadid = $threadinfo[threadid]
AND dateline > " . (TIMENOW - $dp_settings['timespan']) . "
AND visible = 1 AND deletionlog.primaryid IS NULL
ORDER BY dateline DESC
LIMIT 1
");
 
if ($doublepost['userid'] == $vbulletin->userinfo['userid'])
{
// we truely have a doublepost, now check if the merged post still fits the rules!
$dataman2 =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman2->set_existing($doublepost);
$post['message'] = $doublepost['pagetext'] . $dp_settings['spacer'] . $post['message'];
 
// set info
$dataman2->set_info('preview', $post['preview']);
$dataman2->set_info('parseurl', $post['parseurl']);
$dataman2->set_info('posthash', $post['posthash']);
$dataman2->set_info('forum', $foruminfo);
$dataman2->set_info('thread', $threadinfo);
 
// set options
$dataman2->setr('showsignature', $post['signature']);
$dataman2->setr('allowsmilie', $post['enablesmilies']);
 
// set data
$dataman2->setr('pagetext', $post['message']);
$dataman2->setr('iconid', $post['iconid']);
 
$dataman2->pre_save();
if (!$dataman2->errors)
{
// merged post is ok, so do merging
$isdoublepost = true;
unset($dataman);
$dataman =& $dataman2;
$post['postid'] = $doublepost['postid'];
}
else
{
// merging will produce errors so keep it as a single post..
$isdoublepost = false;
}
}
}
 
if ($isdoublepost)
{
$id = $doublepost['postid'];
$dataman->save();
 
//now add edited by
if ($dp_settings['editedbymsg'] != '')
{
$vbulletin->db->query_write("
REPLACE INTO " . TABLE_PREFIX . "editlog (postid, userid, username, dateline, reason)
VALUES ($id, " . $vbulletin->userinfo['userid'] . ", '" . addslashes($vbulletin->userinfo['username']) . "', " . TIMENOW . ", '" . addslashes($dp_settings['editedbymsg']) . "')
");
}
}
else
{
// no doublepost so save as new post
$post['message'] = $oldmsg;
$id = $dataman->save();
}
Değişiklikleri kaydedin ve dosyayı upload edin.
 
Üst