[推薦]限制連結頭像的大小長度(完美版)

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

版主: 版主管理群

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

[推薦]限制連結頭像的大小長度(完美版)

文章 sorry »

這個終於出來了! 之前看到依夢兒等人的討論串一直想要這功能,
但以往的方案都未能完滿解決大家的需要, 現在這個應該能解決大家的問題.
我已經成功試裝在2.05 和plus 1.2上, 並通過測試有效 ^_^

MOD說明 : 限制連結頭像的大小長度
版本 : 0.1.1 (適用於phpbb2.03-2.05 , plus 1.2)

代碼: 選擇全部

###############################################
##	Hack Title:		Restrict remote avatar images
##	Hack Version:	0.1.1
##	Author:			Freakin' Booty ;-P
##	Description:	Restrict the width and the height of remote avatars.
##	Compatibility:	2.0.3 - 2.0.5
##
##	Installation Level: Easy
##	Installation Time: 2 - 5 minutes
##	Files To Edit: 2
##		admin/admin_users.php
##		includes/usercp_avatar.php
##
##	Included Files: 0
##
##	History:
##		0.1.0	Initial release
##		0.1.1	Fixed a few bugs; added a filesize check as well.
##
##	Author Notes:
##		None
##
##	Support:		http://www.phpbbhacks.com/forums
##	Copyright:		?003 Restrict remote avatar images 0.1.1 - 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.
###############################################

#
#-----[ OPEN ]--------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]--------------------------------------------
#
				$error = true;
				$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
			}

#
#-----[ AFTER, ADD ]--------------------------------------
#
			list($width, $height) = @getimagesize($user_avatar_remoteurl);
			if( $width > $board_config['avatar_max_width'] || $height > $board_config['avatar_max_height'] )
			{
				$l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);

				$error = true;
				$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
			}

			$filehandle = @fopen($user_avatar_remoteurl, 'rb');
			$filedata = @fread($filehandle, ($board_config['avatar_filesize'] + 1));
			@fclose($filehandle);
			$avatar_filesize = strlen($filedata);
			if( !$error && ($avatar_filesize < 0 || $avatar_filesize > $board_config['avatar_filesize']) )
			{
				$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

				$error = true;
				$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
			}

#
#-----[ OPEN ]--------------------------------------------
#
includes/usercp_avatar.php

#
#-----[ FIND ]--------------------------------------------
#
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{

#
#-----[ AFTER, ADD ]--------------------------------------
#
	global $board_config, $lang;

#
#-----[ FIND ]--------------------------------------------
#
		$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
		return;
	}

#
#-----[ AFTER, ADD ]--------------------------------------
#
	list($width, $height) = @getimagesize($avatar_filename);
	if( $width > $board_config['avatar_max_width'] || $height > $board_config['avatar_max_height'] )
	{
		$l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);

		$error = true;
		$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
	}

	$filehandle = @fopen($avatar_filename, 'rb');
	$filedata = @fread($filehandle, ($board_config['avatar_filesize'] + 1));
	@fclose($filehandle);
	$avatar_filesize = strlen($filedata);
	if( !$error && ($avatar_filesize < 0 || $avatar_filesize > $board_config['avatar_filesize']) )
	{
		$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

		$error = true;
		$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
	}

#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
圖檔 PHPBB2.05+PLUS1.2
不要想你在此可以得到甚麼, 想想你可以對此有甚麼貢獻

majimmy
工友兼校長
工友兼校長
文章: 170
註冊時間: 2001-11-15 14:16
來自: 屏東
聯繫:

文章 majimmy »

成功 2.0.6
1.有問題,請先搜尋過一次,再來問
2.不要PM給我=.=(除非有好康的)


圖檔

主題已鎖定

回到「非官方認證外掛」