mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 15:47:38 +02:00
Remove the duplicate code for sanitising IP Addresses we only need to do it once. Fixes #4579.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c027ed065
commit
2ac5c0204f
@ -552,7 +552,7 @@ function wp_insert_comment($commentdata) {
|
|||||||
extract($commentdata, EXTR_SKIP);
|
extract($commentdata, EXTR_SKIP);
|
||||||
|
|
||||||
if ( ! isset($comment_author_IP) )
|
if ( ! isset($comment_author_IP) )
|
||||||
$comment_author_IP = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
|
$comment_author_IP = '';
|
||||||
if ( ! isset($comment_date) )
|
if ( ! isset($comment_date) )
|
||||||
$comment_date = current_time('mysql');
|
$comment_date = current_time('mysql');
|
||||||
if ( ! isset($comment_date_gmt) )
|
if ( ! isset($comment_date_gmt) )
|
||||||
@ -650,7 +650,7 @@ function wp_new_comment( $commentdata ) {
|
|||||||
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
||||||
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
||||||
|
|
||||||
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
|
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
|
||||||
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
$commentdata['comment_date'] = current_time('mysql');
|
$commentdata['comment_date'] = current_time('mysql');
|
||||||
|
Loading…
Reference in New Issue
Block a user