[外掛]限制簽名檔內圖案的數量及大小長度(2.04/2.05

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
sorry
星球普通子民
星球普通子民
文章: 29
註冊時間: 2002-04-29 06:23

[外掛]限制簽名檔內圖案的數量及大小長度(2.04/2.05

文章 sorry »

MOD說明 : 限制簽名檔內圖案的數量及大小長度.
英文版本 : 0.10 (適用於phpbb2.04)
中文化說明 : 中文化錯誤提示訊息, 並小改動後同樣適用於2.05
中文化作者 : 逸風(風笑痴)
中文化原文 : [MOD] 限制簽名檔內圖案的數量及大小長度(PHPBB2.04-2.05)

原英文MOD討論串(phpbbhacks.com)

原英文HACK檔

MOD中文化版本\r
=============

代碼: 選擇全部

###############################################
##	外掛標題:	Restrict images in signatures
##	外掛版本:	0.1.0
##	外掛作者:	Freakin' Booty ;-P
##	外掛說明:	限制簽名檔內圖案的數量及大小長度(一切可於後台管理)
##					
##	兼容 :	PHPBB2.0.4 / 2.05
##
##	安裝難度 : 易
##	安裝時間 : 5 - 10 分鐘
##	需要更改檔案 : 6個
##		admin/admin_board.php
##		admin/admin_users.php
##		includes/usercp_register.php
##		language/lang_english/lang_admin.php
##		language/lang_english/lang_main.php
##		templates/subSilver/admin/board_config_body.tpl
##
##	附帶檔案 : 1 個
##		db_update.php
##
##	History:
##		0.1.0		Initial release
##
##	Author Notes:
##		None
##
##	Support:		http://www.phpbbhacks.com/forums
##	Copyright:		?003 Restrict images in signatures 0.1.0 - Freakin' Booty ;-P
##
###############################################
##   You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
##   Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
##	This hack is released under the GPL License.
##	This hack can be freely used, but not distributed, without permission.
##	Intellectual Property is retained by the hack author(s) listed above.
###############################################

#
#-----[ 複製 ]--------------------------------------------
#
# 以ftp上載以下檔案於phpbb 主目錄下, 然後在網頁瀏覽器內執行該檔案, 執行成功後請刪除該檔案.
#
db_update.php		

#
#-----[ 打開 ]--------------------------------------------
#
admin/admin_board.php

#
#-----[ 尋找 ]--------------------------------------------
#
	"L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
	"L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],

#
#-----[ 在之後加入 ]--------------------------------------
#
	"L_MAX_SIG_IMAGES_LIMIT" => $lang['Max_sig_images_limit'],
	"L_MAX_SIG_IMAGES_SIZE" => $lang['Max_sig_images_size'],
	"L_MAX_SIG_IMAGES_SIZE_EXPLAIN" => $lang['Max_sig_images_explain'],

#
#-----[ 尋找 ]--------------------------------------------
#
	"SIG_SIZE" => $new['max_sig_chars'], 

#
#-----[ 在之後加入 ]--------------------------------------
#
	"SIG_IMAGES_MAX_LIMIT" => $new['sig_images_max_limit'],
	"SIG_IMAGES_MAX_HEIGHT" => $new['sig_images_max_height'],
	"SIG_IMAGES_MAX_WIDTH" => $new['sig_images_max_width'],

#
#-----[ 打開 ]--------------------------------------------
#
admin/admin_users.php

#
#-----[ 尋找 ]--------------------------------------------
#
			if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
			{ 
				$error = TRUE;
				$error_msg .=  ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
			}

#
#-----[ 在之後加入 ]--------------------------------------
#
			else
			{
				if( preg_match_all("#\[img(:$signature_bbcode_uid)?\]((ht|f)tp://)([^
\t<\"]*?)\[/img(:$signature_bbcode_uid)?\]#sie", $signature, $matches) )
				{
					if( count($matches[0]) > $board_config['sig_images_max_limit'] )
					{
						$error = TRUE;
						$l_too_many_images = ( $board_config['sig_images_max_limit'] == 1 ) ? sprintf($lang['Too_many_sig_image'], $board_config['sig_images_max_limit']) : sprintf($lang['Too_many_sig_images'], $board_config['sig_images_max_limit']);
						$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_too_many_images;
					}
					else
					{
						for( $i = 0; $i < count($matches[0]); $i++ )
						{
							$image = preg_replace("#\[img(:$signature_bbcode_uid)?\]((ht|f)tp://)([^
\t<\"]*?)\[/img(:$signature_bbcode_uid)?\]#si", "\\\2\\\4", $matches[0][$i]);
							list($width, $height) = @getimagesize($image);
							if( $width > $board_config['sig_images_max_width'] || $height > $board_config['sig_images_max_height'] )
							{
								$error = TRUE;
								$l_image_too_large = sprintf($lang['Sig_image_too_large'], $board_config['sig_images_max_width'], $board_config['sig_images_max_height']);
								$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_image_too_large;
								break;
							}
						}
					}
				}
			}

#
#-----[ 打開 ]--------------------------------------------
#
includes/usercp_register.php

#
#-----[ 尋找 ]--------------------------------------------
#
		if ( strlen($signature) > $board_config['max_sig_chars'] )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
		}

#
#-----[ 在之後加入 ]--------------------------------------
#
		else
		{
			if( preg_match_all("#\[img\]((ht|f)tp://)([^
\t<\"]*?)\[/img\]#sie", $signature, $matches) )
			{
				if( count($matches[0]) > $board_config['sig_images_max_limit'] )
				{
					$error = TRUE;
					$l_too_many_images = ( $board_config['images_max_limit'] == 1 ) ? sprintf($lang['Too_many_sig_image'], $board_config['sig_images_max_limit']) : sprintf($lang['Too_many_sig_images'], $board_config['sig_images_max_limit']);
					$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_too_many_images;
				}
				else
				{
					for( $i = 0; $i < count($matches[0]); $i++ )
					{
						$image = preg_replace("#\[img\](.*)\[/img\]#si", "\\\1", $matches[0][$i]);
						list($width, $height) = @getimagesize($image);
						if( $width > $board_config['sig_images_max_width'] || $height > $board_config['sig_images_max_height'] )
						{
							$error = TRUE;
							$l_image_too_large = sprintf($lang['Sig_image_too_large'], $board_config['sig_images_max_width'], $board_config['sig_images_max_height']);
							$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_image_too_large;
							break;
						}
					}
				}
			}
		}

#
#-----[ 打開 ]--------------------------------------------
#
# 請確定修改於每個安裝的語系檔案中\r
#
language/lang_english/lang_admin.php(英文語系)

language/lang_chinese_traditional_taiwan/lang_admin.php(中文繁體語系)

#
#-----[ 尋找 ]--------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ 在之前加入 ]-------------------------------------
#
//
// Restrict images in signatures
//
$lang['Max_sig_images_limit'] = '每個簽名檔最大圖像數';
$lang['Max_sig_images_size'] = '簽名檔內圖檔大小長度(高x闊)';
$lang['Max_sig_images_size_explain'] = '(高x闊)像素';

#
#-----[ 打開 ]--------------------------------------------
#
# 請確定修改於每個安裝的語系檔案中\r
#
language/lang_english/lang_main.php(英文語系)

language/lang_chinese_traditional_taiwan/lang_main.php(中文繁體語系)

#
#-----[ 尋找 ]--------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ 在之前加入 ]-------------------------------------
#
//
// Restrict images in signatures
//
$lang['Too_many_sig_image'] = '你在簽名檔內加入過多圖檔. 你只能加入 %d 個圖檔於簽名檔內.';
$lang['Too_many_sig_images'] = '你在簽名檔內加入過多圖檔. 你只能加入 %d 個圖檔於簽名檔內.';
$lang['Sig_image_too_large'] = '你簽名檔內圖檔過大. 圖檔必須是 %d (闊)x %d (高)之內';
#
#-----[ 打開 ]--------------------------------------------
#
# 請確定修改於每個安裝的template風格中
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ 尋找 ]------[color=red] 適用於phpbb2.04[/color]------------------
#
	<tr>
		<td class="row1">{L_MAX_SIG_LENGTH}<br /><span class="gensmall">{L_MAX_SIG_LENGTH_EXPLAIN}</span></td>
		<td class="row2"><input class="post" type="text" size="5" maxlength="4" name="max_sig_chars" value="{SIG_SIZE}" /></td>
	</tr>

#
#-----[ 尋找 ]------[color=red] 適用於phpbb2.05[/color]------------------
#
	<tr> 
	<td class="row1">{L_MAX_SIG_LENGTH}<br />
	<span class="gensmall">{L_MAX_SIG_LENGTH_EXPLAIN}</span></td>
	<td class="row2"> 
	<input type="text" size="5" maxlength="4" name="max_sig_chars" value="{SIG_SIZE}" class="post" />
	</td>
	</tr>

#
#-----[ 在之後加入 ]--------------------------------------
#
	<tr> 
      <td class="row1">{L_MAX_SIG_IMAGES_LIMIT} <br /> 
         <span class="gensmall">{L_MAX_SIG_IMAGES_LIMIT_EXPLAIN}</span> 
      </td> 
      <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="sig_images_max_limit" value="{SIG_IMAGES_MAX_LIMIT}" /></td> 
   </tr> 
   <tr> 
      <td class="row1">{L_MAX_SIG_IMAGES_SIZE} <br /> 
         <span class="gensmall">{L_MAX_SIG_IMAGES_SIZE_EXPLAIN}</span> 
      </td> 
      <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="sig_images_max_height" value="{SIG_IMAGES_MAX_HEIGHT}" /> x <input class="post" type="text" size="3" maxlength="4" name="sig_images_max_width" value="{SIG_IMAGES_MAX_WIDTH}" /></td> 
   </tr>

#
#-----[ 把所有檔存檔並上載 ]--------------------------
#
圖檔 PHPBB2.05+PLUS1.2
不要想你在此可以得到甚麼, 想想你可以對此有甚麼貢獻
主題已鎖定

回到「非官方認證外掛」