mirror of
https://github.com/moparisthebest/moparscape.org-smf
synced 2024-11-24 01:32:20 -05:00
Added Double Post Stopper mod
This commit is contained in:
parent
5cb937a2fd
commit
4dccad1423
BIN
Packages/Double_post_stopper_1.1.zip
Normal file
BIN
Packages/Double_post_stopper_1.1.zip
Normal file
Binary file not shown.
BIN
Packages/backups/2014-02-04_before_Double_post_stopper_1.tar.gz
Normal file
BIN
Packages/backups/2014-02-04_before_Double_post_stopper_1.tar.gz
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
1391537333
|
||||
1391538208
|
@ -1512,6 +1512,8 @@ function loadAllPermissions($loadType = 'classic')
|
||||
'delete' => array(true, 'post', 'modify', 'moderate'),
|
||||
'modify' => array(true, 'post', 'modify', 'moderate'),
|
||||
'report_any' => array(false, 'post', 'participate'),
|
||||
'doublePost' => array(false, 'post', 'participate'),
|
||||
|
||||
'poll_view' => array(false, 'poll', 'participate'),
|
||||
'poll_vote' => array(false, 'poll', 'participate'),
|
||||
'poll_post' => array(false, 'poll', 'post_polls'),
|
||||
|
@ -339,6 +339,9 @@ function ModifyTopicSettings($return_config = false)
|
||||
array('int', 'enableAllMessages', 'postinput' => $txt['manageposts_posts'], 'subtext' => $txt['enableAllMessages_zero']),
|
||||
array('check', 'disableCustomPerPage'),
|
||||
array('check', 'enablePreviousNext'),
|
||||
'',
|
||||
array('int', 'doublePostThold', 'postinput' => $txt['doublePostAdmin_main'], 'subtext' => $txt['doublePostAdmin_sub']),
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
@ -82,6 +82,11 @@ if (!defined('SMF'))
|
||||
|
||||
function Post()
|
||||
{
|
||||
// Double Post Stopper change - Start
|
||||
checkForBump();
|
||||
// End
|
||||
|
||||
|
||||
global $txt, $scripturl, $topic, $modSettings, $board;
|
||||
global $user_info, $sc, $board_info, $context, $settings;
|
||||
global $sourcedir, $options, $smcFunc, $language;
|
||||
@ -1208,6 +1213,11 @@ function Post()
|
||||
|
||||
function Post2()
|
||||
{
|
||||
// Double Post Stopper change - Start
|
||||
checkForBump();
|
||||
// End
|
||||
|
||||
|
||||
global $board, $topic, $txt, $modSettings, $sourcedir, $context;
|
||||
global $user_info, $board_info, $options, $smcFunc;
|
||||
|
||||
@ -2891,4 +2901,50 @@ function JavaScriptModify()
|
||||
obExit(false);
|
||||
}
|
||||
|
||||
|
||||
function checkForBump() {
|
||||
// This function here is for the Mod : Double Post Stopper, Made by Dragooon.
|
||||
// It Checks weather the Poster is trying to bump the topic or not.
|
||||
global $smcFunc, $topic, $modSettings, $user_info;
|
||||
if(isset($topic)) {
|
||||
// Do the Query to grab the stuff for checking.
|
||||
$result = $smcFunc['db_query']('',"SELECT
|
||||
m.poster_time, m.poster_name, m.poster_email
|
||||
FROM
|
||||
{db_prefix}topics AS t, {db_prefix}messages AS m
|
||||
WHERE
|
||||
t.id_last_msg = m.id_msg
|
||||
AND m.id_topic = {int:topic}
|
||||
AND m.id_member = {int:user}
|
||||
LIMIT 1"
|
||||
,array('user' => $user_info['id'], 'topic' => $topic));
|
||||
if($smcFunc['db_num_rows']($result) <= 0)
|
||||
return;
|
||||
|
||||
$row = $smcFunc['db_fetch_assoc']($result);
|
||||
$smcFunc['db_free_result']($result);
|
||||
// Check it if its a Bump Attempt
|
||||
// The Poster Time assigned to the variable
|
||||
$lpt = $row['poster_time'];
|
||||
$timeTHold = $modSettings['doublePostThold'] * 60 * 60 * 24;
|
||||
|
||||
// Declare it false in begginning. If some conditions gets true, It turns into true, else it goes as false.
|
||||
$bumpAttempt = false;
|
||||
|
||||
// Time Not set? Declare it as true then
|
||||
if(empty($modSettings['doublePostThold']))
|
||||
$bumpAttempt = true;
|
||||
// Is it set?
|
||||
elseif ($lpt + $timeTHold > time())
|
||||
$bumpAttempt = true;
|
||||
|
||||
if(!isset($_REQUEST['msg']) && $bumpAttempt && !allowedTo('doublePost') && ($user_info['id'] > 0 || (isset($_POST['guestname']) && $_POST['guestname'] == $row['poster_name']) || (isset($_POST['email']) && $_POST['email'] == $row['poster_email'])))
|
||||
fatal_lang_error('double_post_attempt');
|
||||
else
|
||||
return;
|
||||
} else {
|
||||
// Do nothing if it isn't set.
|
||||
return;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,4 +1,14 @@
|
||||
<?php
|
||||
// Version: 2.0; Modifications
|
||||
|
||||
|
||||
// Double Post stopper strings
|
||||
$txt['double_post_attempt'] = 'Sorry, but you are not allowed to double post. Please go back and edit your previous post.';
|
||||
$txt['permissionname_doublePost'] = 'Allow them to Double post';
|
||||
$txt['permissionhelp_doublePost'] = 'By Enabling this You will allow them to double post.';
|
||||
$txt['doublePostAdmin_main'] = 'Time before the user is not allowed to double post';
|
||||
$txt['doublePostHelp'] = 'Time(in Days) before double posting is considered as a bump attempt. A user is not allowed to post a continous second reply within the given time threshhold.';
|
||||
$txt['doublePostAdmin_sub'] = 'Is set as in Days. Click on the "?" if you want more information. Leave Blank to prevent double posting always';
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user