Clean up how we address IP addresses throughout the code

git-svn-id: http://svn.automattic.com/wordpress/trunk@3990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2006-07-06 00:04:24 +00:00
parent 619da18f1c
commit 7c65645c62
3 changed files with 3 additions and 7 deletions

View File

@ -321,7 +321,7 @@ function wp_insert_comment($commentdata) {
extract($commentdata);
if ( ! isset($comment_author_IP) )
$comment_author_IP = $_SERVER['REMOTE_ADDR'];
$comment_author_IP = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
if ( ! isset($comment_date) )
$comment_date = current_time('mysql');
if ( ! isset($comment_date_gmt) )
@ -365,7 +365,7 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
$commentdata['comment_date'] = current_time('mysql');

View File

@ -1012,6 +1012,7 @@ function wp_check_filetype($filename, $mimes = null) {
function wp_proxy_check($ipnum) {
if ( get_option('open_proxy_check') && isset($ipnum) ) {
$ipnum = preg_replace( '/([0-9]{1,3})\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*/', '$1', $ipnum );
$rev_ip = implode( '.', array_reverse( explode( '.', $ipnum ) ) );
$lookup = $rev_ip . '.sbl-xbl.spamhaus.org.';
if ( $lookup != gethostbyname( $lookup ) )

View File

@ -34,11 +34,6 @@ $is_IE = (($is_macIE) || ($is_winIE));
$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;
$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
// On OS X Server, $_SERVER['REMOTE_ADDR'] is the server's address. Workaround this
// by using $_SERVER['HTTP_PC_REMOTE_ADDR'], which *is* the remote address.
if ( isset($_SERVER['HTTP_PC_REMOTE_ADDR']) )
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_PC_REMOTE_ADDR'];
// if the config file does not provide the smilies array, let's define it here
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(