• 28-10-2007, 19:13:56
    #1
    Arkadaşlar PhpBB Forumumda Bir kişilere günlük konu ekleme limiti koyabilirmiyiz? Bu Konuda bir yazı bulamadım yardım ederseniz sevinirim. Teşekkürler
  • 28-10-2007, 19:18:09
    #2
    ############################################################## 
    ## MOD Title: Post Cap 
    ## MOD Author: UT[EO]Clans < webmaster@uteoclans.com > (Anti) www.uteoclans.com www.statho.com www.statho.com/anti/
    ## MOD Description: This mod will allow you to put a daily post cap on specific users via ACP, User - Management
    ## MOD Version: 1.0.3 
    ## 
    ## Installation Level: (Moderate) 
    ## Installation Time: ~15 Minutes 
    ## Files To Edit: 
    ##            includes/functions_post.php
    ##            admin/admin_users.php
    ##            language/lang_english/lang_admin.php
    ##            language/lang_english/lang_main.php
    ##            templates/subSilver/admin/user_edit_body.tpl
    ## Included Files: N/A 
    ############################################################## 
    ## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
    ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
    ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
    ## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
    ############################################################## 
    ## Author Notes: This mod was inspired by |UCT|Pimp'n_Fly. Thanx to Salty & Treat for the idea & name
    ##         Thanx to VIVI, Indy, Sapp, & all the others that either helped test this mod during it's
    ##         short development period, or pointed out errors during development. For The most up to date
    ##         copy of "Post Cap" mod, please check the downloads database at www.uteoclans.com/. 
    ##        
    ##         This will most likely be the last release of this mod, in this version. I have received 
    ##         requests for versions of this mod that work based on groups, and another that is based on
    ##         time the user has been registered. These releases will be Post_Cap_Mod-1.2.* and Post_Cap_Mod-2.0.*
    ## 
    ############################################################## 
    ## MOD History:
    ##   2005-04-27 - version 1.0.3 final
    ##    - Fixed small error and some typos. sorry for these, I was tired when I tested it.
    ##
    ##   2005-04-15 - Version 1.0.2
    ##    - Reworked period processing/generation to work by hours, not days
    ##
    ##   2005-02-22 - Version 1.0.1 
    ##      - Fixed error with new period generation.
    ##    - Re-organized logic on post count processing and period generation
    ##    - Re-strucutured original mysql table modificiations -- more efficient. 
    ## 
    ############################################################## 
    ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
    ############################################################## 
    
    
    ### USE THIS SQL IF YOU HAVE NEVER INSTALLED THIS MOD ###
    #
    #-----[ SQL ]------------------------------------------
    #
    ALTER TABLE `phpbb_users` 
    ADD `daily_post_count` TINYINT( 3 ) DEFAULT '0' NOT NULL ,
    ADD `daily_post_limit` TINYINT( 3 ) NOT NULL ,
    ADD `daily_post_period` INT( 11 ) NOT NULL ;
    
    ### USE THIS SQL IF YOU ARE UPDATING FROM THE FIRST VERSION ONLY! ###
    #
    #-----[ SQL ]------------------------------------------
    #
    ALTER TABLE `phpbb_users` CHANGE `daily_post_period` `daily_post_period` INT( 11 ) DEFAULT '0' NOT NULL 
    
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    #
    includes/functions_post.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
                        message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
                    }
                }
            }
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
            ############### POST CAP MOD BY ANTI -- www.uteoclans.com ###############
            function generate_limit_period($period_id) {
            global $db;
                    $sql = "UPDATE " . USERS_TABLE . " 
                    SET daily_post_period = '".time()."', daily_post_count = '0' 
                    WHERE user_id = '".$period_id."' 
                    LIMIT 1";
                    if(!($result = $db->sql_query($sql)))
                    {
                        message_die(GENERAL_ERROR, 'Could not update daily flood post period', 'Daily Flood Update');
                    }
                return 0;
            }        
    
            if($userdata['daily_post_period'] != 0 && ((time() - $userdata['daily_post_period']) > 86400 )) { // stale period
                $userdata['daily_post_limit'] = generate_limit_period($userdata['user_id']);
            }
            if($userdata['daily_post_period'] == 0 && $userdata['daily_post_limit'] > 0) { // new limit
                $userdata['daily_post_limit'] = generate_limit_period($userdata['user_id']);
            }
            if(($userdata['daily_post_limit'] - $userdata['daily_post_count']) <= 0 && $userdata['daily_post_limit'] != 0) // if they have reached the limit
            {
                message_die(GENERAL_MESSAGE, $lang['daily_flood_limit'], 'Daily Flood Limit');
            } else { // if they havent reached the limit
            $sql = "UPDATE " . USERS_TABLE . " 
            SET daily_post_count = daily_post_count+1 
            WHERE user_id = '".$userdata[user_id]."' 
            LIMIT 1";
                if(!($result = $db->sql_query($sql)))
                {
                    message_die(GENERAL_ERROR, 'Could not update daily flood post count', '', __LINE__, __FILE__, $sql);
                }
            }
            ############### END POST CAP MOD ###############
    
    
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    #
    admin/admin_users.php
    
    
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
            $user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0;
            $user_allowpm = ( !empty($HTTP_POST_VARS['user_allowpm']) ) ? intval( $HTTP_POST_VARS['user_allowpm'] ) : 0;
            $user_rank = ( !empty($HTTP_POST_VARS['user_rank']) ) ? intval( $HTTP_POST_VARS['user_rank'] ) : 0;
            $user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
            $daily_post_limit = ( !empty($HTTP_POST_VARS['daily_post_limit']) ) ? trim(strip_tags( $HTTP_POST_VARS['daily_post_limit'] ) ) : 0;
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
            //
            // Update entry in DB
            //
            if( !$error )
            {
                $sql = "UPDATE " . USERS_TABLE . "
                    SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
    
    
    # 
    #-----[ IN-LINE FIND ]------------------------------------------ 
    #
    user_rank = $user_rank" . $avatar_sql . "
    
    # 
    #-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
    #
            , daily_post_limit = $daily_post_limit
    
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
            $user_status = $this_userdata['user_active'];
            $user_allowavatar = $this_userdata['user_allowavatar'];
            $user_allowpm = $this_userdata['user_allow_pm'];
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
            $daily_post_limit = $this_userdata['daily_post_limit'];
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
                $s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';
                $s_hidden_fields .= '<input type="hidden" name="user_allowpm" value="' . $user_allowpm . '" />';
                $s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';
                $s_hidden_fields .= '<input type="hidden" name="user_rank" value="' . $user_rank . '" />';
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
                $s_hidden_fields .= '<input type="hidden" name="daily_post_limit" value="' . $daily_post_limit . '" />';
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
                'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '', 
                'RANK_SELECT_BOX' => $rank_select_box,
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
        #### DAILY POST LIMIT MOD -- Anti ####
                'DAILY_POST_LIMIT' => $daily_post_limit,
                'L_DAILY_LIMIT' => $lang['daily_limit'],
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    langauge/lang_english/lang_admin.php
    
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
    
    //
    // That's all Folks!
    // -------------------------------------------------
    
    # 
    #-----[ BEFORE, ADD ]------------------------------------------ 
    #
    //
    // DAILY POST LIMIT MOD -- Anti
    $lang['daily_limit'] = "Daily Post Limit";
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    language/lang_enlish/lang_main.php
    
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
    //
    // That's all, Folks!
    // -------------------------------------------------
    
    # 
    #-----[ BEFORE, ADD ]------------------------------------------ 
    #
    $lang['daily_flood_limit'] = "You have already posted your daily alloted posts. Please try back at a later time<br />";
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    templates/subSilver/admin/user_edit_body.tpl
    
    # 
    #-----[ FIND ]------------------------------------------ 
    #
        <tr>
          <th class="thSides" colspan="2">{L_SPECIAL}</th>
        </tr>
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    #
    
        <tr>
          <td class="row1"><span class="gen">{L_DAILY_LIMIT}</span><br /><span class="gensmall"># of posts a user can make in a 24 hour period. 0 = no limit</span></td>
          <td class="row2"><input class="post" type="text" name="daily_post_limit" value="{DAILY_POST_LIMIT}" size="3" /></td>
        </tr>
    
    
    # 
    #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
    # 
    # EoM
  • 28-10-2007, 19:18:40
    #3
    mesaj ekleme limiti ama belki işine yarar
  • 28-10-2007, 19:21:54
    #4
    Üyeliği durduruldu
    aradıgın Mod Bu ;

    YENİ BAŞLIK LİMİTİ

    ############################################################## 
    ## MOD Title: mod_new_topic_limit 
    ## MOD Author: Barbarella < babs@slebog.net > (N/A) N/A 
    ## MOD Description: Allows administrators to limit the number of new topics that users can start in a defined period 
    ## MOD Version: 1.0.0 
    ## 
    ## Installation Level: Intermediate 
    ## Installation Time: 5 Minutes 
    ## Files To Edit: includes/functions_post.php, includes/functions_select.php, admin/admin_board.php, 
    ## templates/subSilver/admin/board_config_body.tpl, language/lang_english/lang_main.php, language/lang_english/lang_admin.php
    ## Included Files: n/a 
    ############################################################## 
    ## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
    ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
    ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
    ## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
    ############################################################## 
    ## Author Notes: 
    ## 
    ############################################################## 
    ## MOD History: 
    ## 
    ##Ê ÊYYYY-MM-DD - Version x.x.x 
    ##Ê ÊÊ Ê- version notes go here 
    ## 
    ############################################################## 
    ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
    ############################################################## 
    
    # 
    #-----[ SQL ]------------------------------------------ 
    # 
    
    INSERT INTO `phpbb_config` VALUES('topic_limit_default','0');
    INSERT INTO `phpbb_config` VALUES('topic_limit_period','0');
    ALTER TABLE `phpbb_users`
    	ADD `user_topic_count` SMALLINT UNSIGNED DEFAULT '0' NOT NULL,
    	ADD `user_topic_period` INT UNSIGNED DEFAULT '0' NOT NULL;
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    includes/functions_post.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	// Check username
    	if (!empty($username))
    	{
    		$username = trim(strip_tags($username));
    
    		if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username']))
    		{
    			include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
    
    			$result = validate_username($username);
    			if ($result['error'])
    			{
    				$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
    			}
    		}
    		else
    		{
    			$username = '';
    		}
    	}
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    	// Check topic limit
    	if ($mode == 'newtopic' && $board_config['topic_limit_default'] 
    		&& $board_config['topic_limit_period'] && !$userdata['user_level'])
    	{
    		$timenow = time();
    		if (($timenow - $userdata['user_topic_period']) < $board_config['topic_limit_period'])
    		{
    			// in same posting period
    			if ($userdata['user_topic_count'] >= $board_config['topic_limit_default'])
    			{
    				// over limit
    				$msg = sprintf($lang['Newtopic_limit_reached'],
    					$board_config['topic_limit_default'],
    					$lang['Newtopic_limit'][$board_config['topic_limit_period']],
    					create_date($board_config['default_dateformat'],
    						$userdata['user_topic_period']+$board_config['topic_limit_period'], $board_config['board_timezone']));
    				message_die(GENERAL_MESSAGE, $msg);
    			} else {
    				// increment topic count
    				$userdata['new_user_topic_count'] = $userdata['user_topic_count']+1;
    			}
    		}
    		else
    		{
    			// start new posting period
    			$userdata['new_user_topic_period'] = $timenow;
    			$userdata['new_user_topic_count'] = 1;
    		}
    	}
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    //
    // Update post stats and details
    //
    function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
    {
    	global $db;
    
    # 
    #-----[ REPLACE WITH ]------------------------------------------ 
    # 
    //
    // Update post stats and details
    //
    function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
    {
    	global $db,$userdata;
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	if ($mode != 'poll_delete')
    	{
    		$sql = "UPDATE " . USERS_TABLE . "
    			SET user_posts = user_posts $sign 
    			WHERE user_id = $user_id";
    		if (!$db->sql_query($sql, END_TRANSACTION))
    		{
    			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    		}
    	}
    
    # 
    #-----[ REPLACE WITH ]------------------------------------------ 
    # 
    	if ($mode != 'poll_delete')
    	{
    		$sql = "UPDATE " . USERS_TABLE . " SET user_posts = user_posts $sign";
    		if ($userdata['new_user_topic_count'] || $userdata['new_user_topic_period'])
    		{
    			$sql .= ', user_topic_count = '.$userdata['new_user_topic_count'];
    		}
    		if ($userdata['new_user_topic_period'])
    		{
    			$sql .= ', user_topic_period = '.$userdata['new_user_topic_period'];
    		}
    		$sql .= " WHERE user_id = $user_id";
    		if (!$db->sql_query($sql, END_TRANSACTION))
    		{
    			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
    		}
    	}
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    includes/functions_select.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	return $tz_select;
    }
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    //
    // Pick a period to limit new topics in
    //
    function newtopic_select($default, $select_name = 'topic_limit_period')
    {
    	global $lang;
    	$nt_select = '<select name="' . $select_name . '">';
    
    	if ( !isset($default) )
    	{
    		$default == 0;
    	}
    	while( list($offset, $zone) = @each($lang['Newtopic_limit']) )
    	{
    		$selected = ( $offset == $default ) ? ' selected="selected"' : '';
    		$nt_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
    	}
    	$nt_select .= '</select>';
    
    	return $nt_select;
    }
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    admin/admin_board.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    $timezone_select = tz_select($new['board_timezone'], 'board_timezone');
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    $newtopic_select = newtopic_select($new['topic_limit_period'], 'topic_limit_period');
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	"L_RESET" => $lang['Reset'], 
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    	"L_NEWTOPIC_LIMIT" => $lang['Newtopic_limit_label'],
    	"L_NEWTOPIC_IN" => $lang['Newtopic_in'],
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	"COPPA_FAX" => $new['coppa_fax'])
    
    # 
    #-----[ REPLACE WITH ]------------------------------------------ 
    # 
    	"COPPA_FAX" => $new['coppa_fax'],
    	"NEWTOPIC_LIMIT_DEFAULT" => $new['topic_limit_default'],
    	"NEWTOPIC_SELECT" => $newtopic_select)
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    templates/subSilver/admin/board_config_body.tpl
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    	<tr>
    		<td class="row1">{L_ALLOW_NAME_CHANGE}</td>
    		<td class="row2"><input type="radio" name="allow_namechange" value="1" {NAMECHANGE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_namechange" value="0" {NAMECHANGE_NO} /> {L_NO}</td>
    	</tr>
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    	<tr>
    		<td class="row1">{L_NEWTOPIC_LIMIT}</td>
    		<td class="row2"><input class="post" type="text" size="5" maxlength="4" name="topic_limit_default" value="{NEWTOPIC_LIMIT_DEFAULT}" />&nbsp;{L_NEWTOPIC_IN}&nbsp;{NEWTOPIC_SELECT}</td>
    	</tr>
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    language/lang_english/lang_main.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    $lang['A_critical_error'] = 'A Critical Error Occurred';
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    //
    // New topic limiting
    //
    $lang['Newtopic_limit_reached'] = 'You can\'t start more than %d new topics in any %s. You can\'t start a new topic until %s';
    $lang['Newtopic_limit']['0'] = 'No limit';
    $lang['Newtopic_limit']['300'] = '5 minutes';
    $lang['Newtopic_limit']['900'] = '15 minutes';
    $lang['Newtopic_limit']['1800'] = '30 minutes';
    $lang['Newtopic_limit']['3600'] = '1 hour';
    $lang['Newtopic_limit']['10800'] = '3 hours';
    $lang['Newtopic_limit']['21600'] = '6 hours';
    $lang['Newtopic_limit']['43200'] = '12 hours';
    $lang['Newtopic_limit']['86400'] = '24 hours';
    $lang['Newtopic_limit']['172800'] = '48 hours';
    $lang['Newtopic_limit']['604800'] = '1 week';
    $lang['Newtopic_limit']['1209600'] = '2 weeks';
    $lang['Newtopic_limit']['2419200'] = '4 weeks';
    
    # 
    #-----[ OPEN ]------------------------------------------ 
    # 
    language/lang_english/lang_admin.php
    
    # 
    #-----[ FIND ]------------------------------------------ 
    # 
    $lang['Install_No_PCRE'] = 'phpBB2 Requires the Perl-Compatible Regular Expressions Module for PHP which your PHP configuration doesn\'t appear to support!';
    
    # 
    #-----[ AFTER, ADD ]------------------------------------------ 
    # 
    //
    // New topic limiting
    //
    $lang['Newtopic_limit_label'] = 'Limit the number of new topics a user can start';
    $lang['Newtopic_in'] = 'in any';
    
    # 
    #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
    # 
    # EoM
  • 29-10-2007, 13:01:23
    #5
    hemen bir deneyeyim arkadaşlar. İlginize çok teşekkürler