Make sure new users posting limit expires at the correct time.
This commit is contained in:
parent
9dad93b90e
commit
0dde8d462e
|
@ -308,6 +308,7 @@ if ($type == "post") {
|
|||
|
||||
// Does user have their own rate limit?
|
||||
$new_user_notice = '';
|
||||
$new_user_logging = ' ';
|
||||
$is_new = false;
|
||||
$rate_limit = get_user_config($name, 'rate_limit');
|
||||
if (($rate_limit !== FALSE) && ($rate_limit > 0)) {
|
||||
|
@ -318,6 +319,7 @@ if ($type == "post") {
|
|||
$is_new = ($create_date - (time() - ($OVERRIDES['new_account_life'] * 3600))) / 60; // Time left before is NOT new
|
||||
$CONFIG['rate_limit'] = $rate_limit;
|
||||
$new_user_notice = '<br><br><div class="post_new_user_notice">(posting is limited for ' . $OVERRIDES['new_account_life'] . ' hour(s) after account creation)</div>';
|
||||
$new_user_logging = ' (new user) ';
|
||||
} else {
|
||||
$is_new = false;
|
||||
set_user_config($name, 'new_account', false);
|
||||
|
@ -330,7 +332,7 @@ if ($type == "post") {
|
|||
$postsremaining = check_rate_limit($name);
|
||||
if ($postsremaining < 1) {
|
||||
$postsremaining = 0;
|
||||
$wait = check_rate_limit($name, 0, 1);
|
||||
$wait = check_rate_limit($name, 0, 1);
|
||||
if ($is_new != false && ($is_new < $wait)) {
|
||||
$wait = $is_new;
|
||||
}
|
||||
|
@ -339,7 +341,7 @@ if ($type == "post") {
|
|||
echo $new_user_notice;
|
||||
echo '<br><p><a href="' . $file_thread . '?group=' . urlencode($returngroup) . '">' . $text_post["button_back"] . '</a> ' . $text_post["button_back2"] . ' ' . group_display_name($returngroup) . '</p>';
|
||||
echo '</div>';
|
||||
file_put_contents($logfile, "\n" . logging_prefix() . " POST Limit REACHED for: " . $name . ': ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'], FILE_APPEND);
|
||||
file_put_contents($logfile, "\n" . logging_prefix() . " POST Limit REACHED for" . $new_user_logging . $name . ': ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'], FILE_APPEND);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -376,11 +378,11 @@ if ($type == "post") {
|
|||
if ($CONFIG['rate_limit'] == true) {
|
||||
$postsremaining = check_rate_limit($name, 1);
|
||||
echo '<div class = "post_rate_limit_notice">';
|
||||
echo 'You have ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'] . ' posts per hour.<br />';
|
||||
file_put_contents($logfile, "\n" . logging_prefix() . " POST Limit Checked for: " . $name . ': ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'], FILE_APPEND);
|
||||
echo 'You have ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'] . ' posts per hour.<br>';
|
||||
file_put_contents($logfile, "\n" . logging_prefix() . " POST Limit Checked for" . $new_user_logging . $name . ': ' . $postsremaining . ' posts remaining of ' . $CONFIG['rate_limit'], FILE_APPEND);
|
||||
if ($postsremaining < 1) {
|
||||
$wait = check_rate_limit($name, 0, 1);
|
||||
echo 'Please wait ' . round($wait, 1) . ' minutes before posting again.<br>';
|
||||
echo 'Please wait ' . round($wait, 1) . ' minutes before posting again.';
|
||||
echo $new_user_notice;
|
||||
}
|
||||
echo '</div>';
|
||||
|
|
Loading…
Reference in New Issue