diff --git a/Packages/Double_post_stopper_1.1.zip b/Packages/Double_post_stopper_1.1.zip new file mode 100644 index 0000000..05e5561 Binary files /dev/null and b/Packages/Double_post_stopper_1.1.zip differ diff --git a/Packages/backups/2014-02-04_before_Double_post_stopper_1.tar.gz b/Packages/backups/2014-02-04_before_Double_post_stopper_1.tar.gz new file mode 100644 index 0000000..ca6eae5 Binary files /dev/null and b/Packages/backups/2014-02-04_before_Double_post_stopper_1.tar.gz differ diff --git a/Packages/installed.list b/Packages/installed.list index 6dbebe5..0c048f7 100644 --- a/Packages/installed.list +++ b/Packages/installed.list @@ -1 +1 @@ -1391537333 \ No newline at end of file +1391538208 \ No newline at end of file diff --git a/Sources/ManagePermissions.php b/Sources/ManagePermissions.php index 2385775..99d258d 100644 --- a/Sources/ManagePermissions.php +++ b/Sources/ManagePermissions.php @@ -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'), diff --git a/Sources/ManagePosts.php b/Sources/ManagePosts.php index 3f26a4b..929aaf7 100644 --- a/Sources/ManagePosts.php +++ b/Sources/ManagePosts.php @@ -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']), + ); diff --git a/Sources/Post.php b/Sources/Post.php index b7db3ca..31a1acc 100644 --- a/Sources/Post.php +++ b/Sources/Post.php @@ -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; + } +} ?> \ No newline at end of file diff --git a/Themes/default/languages/Modifications.english.php b/Themes/default/languages/Modifications.english.php index 4faae72..c0f2f50 100644 --- a/Themes/default/languages/Modifications.english.php +++ b/Themes/default/languages/Modifications.english.php @@ -1,4 +1,14 @@ \ No newline at end of file