Ограничение кол-ва сообщений за 24 часа на определённом фор.

Идеи для расширения функциональности phpBB 2.0.x
Аватара пользователя
BisneK
phpBB 1.2.0
Сообщения: 15
Стаж: 18 лет 7 месяцев

Ограничение кол-ва сообщений за 24 часа на определённом фор.

Сообщение BisneK »

Ограничение кол-ва сообщений за 24 часа на определённом форуме.
Есть ли такой мод ? или похожие на него?
PROhvost
phpBB 1.4.0
Сообщения: 35
Стаж: 19 лет 4 месяца

Сообщение PROhvost »

Код: Выделить всё

##############################################################
## MOD Title: Limit Posts At Topic By Time
## MOD Author: [R: R@m$e$ :U] < phpBB@Ramses.us > (Ramses) http://www.Ramses.us
## MOD Description: Limits number of posts by user at each topic, eg.
##      3 posts at 1 week for topic
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ~10 Minutes
## Files To Edit:
##      includes/constants.php
##      includes/functions_post.php
##      language/lang_english/lang_admin.php
##      language/lang_english/lang_main.php
## Included Files:
##      root/db_update.php
##
## License: http://opensource.org/licenses/gpl-license.php GNU Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##      Find bug or write new translation? Please write me...
##
##      Translations to other languages you can find at "./Translations"
##
##      Run SQL-commands in phpMyAdmin or execute root/db_update.php
##
##      !!!!!!!!!!!!!!!!!
##      !!! IMPORTANT !!!
##      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
##      !! If you not bought this MOD, please, write me...         !!
##      !! You can levae this MOD for your use,                    !!
##      !! But user (and his site) which break my copyrights,      !!
##      !! will be ignored by phpBB Community...                   !!
##      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
##      !! You can't publicate this MOD or using on site which I'm !!
##      !! not permitted!                                          !!
##      !! Please, be honest =)                                    !!
##      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
##
##############################################################
## MOD History:
##
##   2005-12-12 - Version 1.0.0
##      - Initial release...
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#

INSERT INTO phpbb_config VALUES ('limit_posts', '3');
INSERT INTO phpbb_config VALUES ('limit_time', '7');

CREATE TABLE phpbb_posts_time (
  user_id MEDIUMINT(8) NOT NULL DEFAULT '0',
  topic_id MEDIUMINT(8) NOT NULL DEFAULT '0',
  time INT(11) NOT NULL DEFAULT '0',
  posts SMALLINT(4) NOT NULL DEFAULT '0'
) TYPE=MyISAM;

#
#-----[ OPEN ]------------------------------------------
#

admin/admin_board.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

/*** -= Limit Posts At Topic By Time v1.0.0 by [R: R@m$e$ :U] =- ***/

#
#-----[ FIND ]------------------------------------------
#

	"L_ENABLE_GZIP" => $lang['Enable_gzip'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// [start] Limit Posts At Topic By Time
	"L_LIMIT_POSTS" => $lang['Limit_posts'],
	"L_LIMIT_TIME" => $lang['Limit_time'],
	// [end] Limit Posts At Topic By Time

#
#-----[ FIND ]------------------------------------------
#

	"GZIP_YES" => $gzip_yes,
	"GZIP_NO" => $gzip_no,

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// [start] Limit Posts At Topic By Time
	"LIMIT_POSTS" => $board_config['limit_posts'],
	"LIMIT_TIME" => $board_config['limit_time'],
	// [end] Limit Posts At Topic By Time

#
#-----[ OPEN ]------------------------------------------
#

includes/constants.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

/*** -= Limit Posts At Topic By Time v1.0.0 by [R: R@m$e$ :U] =- ***/

#
#-----[ FIND ]------------------------------------------
#

define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');

#
#-----[ AFTER, ADD ]------------------------------------------
#

// [start] Limit Posts At Topic By Time
define('POSTS_TIME_TABLE', $table_prefix.'posts_time');
// [end] Limit Posts At Topic By Time

#
#-----[ OPEN ]------------------------------------------
#

includes/functions_post.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

/*** -= Limit Posts At Topic By Time v1.0.0 by [R: R@m$e$ :U] =- ***/

#
#-----[ FIND ]------------------------------------------
#

					message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
				}
			}
		}
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#

	// [start] Limit Posts At Topic By Time
	if ( $mode == 'reply' && $userdata['session_logged_in'] == 1 )
	{
		if ( ($board_config['limit_posts'] > 0) && ($board_config['limit_time'] > 0 ) )
		{
			$sql = 'SELECT *
				FROM ' . POSTS_TIME_TABLE . '
				WHERE user_id = ' . $userdata['user_id'] . '
					AND topic_id = ' . $topic_id . '
				LIMIT 1';
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain time limits information', '', __LINE__, __FILE__, $sql);
			}
			if ( $db->sql_numrows($result) > 0 )
			{
				$row = $db->sql_fetchrow($result);
				if ( ($row['time'] + ($board_config['limit_time'] * 86400)) < time() )
				{
					$sql = 'UPDATE ' . POSTS_TIME_TABLE . '
						SET time = ' . time() . ', posts = 1
						WHERE user_id = ' . $userdata['user_id'] . '
							AND topic_id = ' . $topic_id;
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not update time limits information', '', __LINE__, __FILE__, $sql);
					}
				}
				else
				{
					if ( $row['posts'] >= $board_config['limit_posts'] )
					{
						$message = sprintf($lang['Limit_posts_exceed'], $board_config['limit_posts'], $board_config['limit_time']);
						message_die(GENERAL_ERROR, $message);
					}
					else
					{
						$sql = 'UPDATE ' . POSTS_TIME_TABLE . '
							SET posts = ' . ($row['posts'] + 1) . '
							WHERE user_id = ' . $userdata['user_id'] . '
								AND topic_id = ' . $topic_id;
						if ( !($result = $db->sql_query($sql)) )
						{
							message_die(GENERAL_ERROR, 'Could not update time limits information', '', __LINE__, __FILE__, $sql);
						}
					}
				}
			}
			else
			{
				$sql = 'INSERT INTO ' . POSTS_TIME_TABLE . ' (user_id, topic_id, time, posts)
					VALUES(' . $userdata['user_id'] . ', ' . $topic_id . ', ' . time() . ', 1)';
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not insert time limits information', '', __LINE__, __FILE__, $sql);
				}
			}
		}
	}
	// [end] Limit Posts At Topic By Time

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

/*** -= Limit Posts At Topic By Time v1.0.0 by [R: R@m$e$ :U] =- ***/

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

// [start] Limit Posts At Topic By Time
$lang['Limit_posts'] = 'Limit post count per topic';
$lang['Limit_time'] = 'Limit time between post\'s limit per topic';
// [end] Limit Posts At Topic By Time

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

/*** -= Limit Posts At Topic By Time v1.0.0 by [R: R@m$e$ :U] =- ***/

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

// [start] Limit Posts At Topic By Time
$lang['Limit_posts_exceed'] = 'You have exceeded the number of posts (%s) for this time limit (%s Days)';
// [end] Limit Posts At Topic By Time

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]------------------------------------------
#

{GZIP_NO}
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

	<!-- [start] Limit Posts At Topic By Time //-->
	<tr>
		<td class="row1">{L_LIMIT_POSTS}</td>
		<td class="row2"><input class="post" type="text" name="post_limit" size="3" maxlength="4" value="{LIMIT_POSTS}" /></td>
	</tr>
	<tr>
		<td class="row1">{L_LIMIT_TIME}</td>
		<td class="row2"><input class="post" type="text" name="time_limit" size="3" maxlength="4" value="{LIMIT_TIME}" /></td>
	</tr>
	<!-- [end] Limit Posts At Topic By Time //-->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Ограничивает кол-во сообщений для пользователей на определенный срок. Написан для версии phpBB 2.0.17 .

Вернуться в «Запросы модов для phpBB 2.0.x»