diff options
Diffstat (limited to 'phpBB/includes/functions_user.php')
| -rw-r--r-- | phpBB/includes/functions_user.php | 40 | 
1 files changed, 29 insertions, 11 deletions
| diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b26f28864..f2c80705ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -766,7 +766,8 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas  			if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) &&  				(strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2))  			{ -				$ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0])); +				$time_offset = (isset($user->timezone) && isset($user->dst)) ? (int) $user->timezone + (int) $user->dst : 0; +				$ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0]) - $time_offset);  			}  			else  			{ @@ -1229,22 +1230,39 @@ function user_unban($mode, $ban)  }  /** -* Whois facility +* Internet Protocol Address Whois +* RFC3912: WHOIS Protocol Specification  * -* @link http://tools.ietf.org/html/rfc3912 RFC3912: WHOIS Protocol Specification +* @param string $ip		Ip address, either IPv4 or IPv6. +* +* @return string		Empty string if not a valid ip address. +*						Otherwise make_clickable()'ed whois result.  */  function user_ipwhois($ip)  { -	$ipwhois = ''; +	if (empty($ip)) +	{ +		return ''; +	} -	// Check IP -	// Only supporting IPv4 at the moment... -	if (empty($ip) || !preg_match(get_preg_expression('ipv4'), $ip)) +	if (preg_match(get_preg_expression('ipv4'), $ip)) +	{ +		// IPv4 address +		$whois_host = 'whois.arin.net.'; +	} +	else if (preg_match(get_preg_expression('ipv6'), $ip)) +	{ +		// IPv6 address +		$whois_host = 'whois.sixxs.net.'; +	} +	else  	{  		return '';  	} -	if (($fsk = @fsockopen('whois.arin.net', 43))) +	$ipwhois = ''; + +	if (($fsk = @fsockopen($whois_host, 43)))  	{  		// CRLF as per RFC3912  		fputs($fsk, "$ip\r\n"); @@ -1257,7 +1275,7 @@ function user_ipwhois($ip)  	$match = array(); -	// Test for referrals from ARIN to other whois databases, roll on rwhois +	// Test for referrals from $whois_host to other whois databases, roll on rwhois  	if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match))  	{  		if (strpos($match[1], ':') !== false) @@ -1285,7 +1303,7 @@ function user_ipwhois($ip)  			@fclose($fsk);  		} -		// Use the result from ARIN if we don't get any result here +		// Use the result from $whois_host if we don't get any result here  		$ipwhois = (empty($buffer)) ? $ipwhois : $buffer;  	} @@ -2326,7 +2344,7 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu  	// Can we upload?  	if (is_null($can_upload))  	{ -		$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; +		$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;  	}  	if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) | 
