Edit File by line
/home/barbar84/www/wp-conte.../plugins/akismet
File: class.akismet.php
} else {
[1500] Fix | Delete
/*
[1501] Fix | Delete
* $wp_xmlrpc_server->message looks like this:
[1502] Fix | Delete
*
[1503] Fix | Delete
(
[1504] Fix | Delete
[message] =>
[1505] Fix | Delete
[messageType] => methodCall
[1506] Fix | Delete
[faultCode] =>
[1507] Fix | Delete
[faultString] =>
[1508] Fix | Delete
[methodName] => pingback.ping
[1509] Fix | Delete
[params] => Array
[1510] Fix | Delete
(
[1511] Fix | Delete
[0] => http://www.example.net/?p=1 // Site that created the pingback.
[1512] Fix | Delete
[1] => https://www.example.com/?p=2 // Post being pingback'd on this site.
[1513] Fix | Delete
)
[1514] Fix | Delete
)
[1515] Fix | Delete
*/
[1516] Fix | Delete
$pingback_args = $wp_xmlrpc_server->message->params;
[1517] Fix | Delete
}
[1518] Fix | Delete
[1519] Fix | Delete
if ( ! empty( $pingback_args[1] ) ) {
[1520] Fix | Delete
$post_id = url_to_postid( $pingback_args[1] );
[1521] Fix | Delete
[1522] Fix | Delete
// If pingbacks aren't open on this post, we'll still check whether this request is part of a potential DDOS,
[1523] Fix | Delete
// but indicate to the server that pingbacks are indeed closed so we don't include this request in the user's stats,
[1524] Fix | Delete
// since the user has already done their part by disabling pingbacks.
[1525] Fix | Delete
$pingbacks_closed = false;
[1526] Fix | Delete
[1527] Fix | Delete
$post = get_post( $post_id );
[1528] Fix | Delete
[1529] Fix | Delete
if ( ! $post || ! pings_open( $post ) ) {
[1530] Fix | Delete
$pingbacks_closed = true;
[1531] Fix | Delete
}
[1532] Fix | Delete
[1533] Fix | Delete
// Note: If is_multicall is true and multicall_count=0, then we know this is at least the 2nd pingback we've processed in this multicall.
[1534] Fix | Delete
[1535] Fix | Delete
$comment = array(
[1536] Fix | Delete
'comment_author_url' => $pingback_args[0],
[1537] Fix | Delete
'comment_post_ID' => $post_id,
[1538] Fix | Delete
'comment_author' => '',
[1539] Fix | Delete
'comment_author_email' => '',
[1540] Fix | Delete
'comment_content' => '',
[1541] Fix | Delete
'comment_type' => 'pingback',
[1542] Fix | Delete
'akismet_pre_check' => '1',
[1543] Fix | Delete
'comment_pingback_target' => $pingback_args[1],
[1544] Fix | Delete
'pingbacks_closed' => $pingbacks_closed ? '1' : '0',
[1545] Fix | Delete
'is_multicall' => $is_multicall,
[1546] Fix | Delete
'multicall_count' => $multicall_count,
[1547] Fix | Delete
);
[1548] Fix | Delete
[1549] Fix | Delete
$comment = Akismet::auto_check_comment( $comment );
[1550] Fix | Delete
[1551] Fix | Delete
if (
[1552] Fix | Delete
is_wp_error( $comment ) // This triggered a 'discard' directive.
[1553] Fix | Delete
|| ( isset( $comment['akismet_result'] ) && 'true' == $comment['akismet_result'] ) // It was just a normal spam response.
[1554] Fix | Delete
) {
[1555] Fix | Delete
// Sad: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything.
[1556] Fix | Delete
$wp_xmlrpc_server->error( new IXR_Error( 0, 'Invalid discovery target' ) );
[1557] Fix | Delete
[1558] Fix | Delete
// Also note that if this was part of a multicall, a spam result will prevent the subsequent calls from being executed.
[1559] Fix | Delete
// This is probably fine, but it raises the bar for what should be acceptable as a false positive.
[1560] Fix | Delete
}
[1561] Fix | Delete
}
[1562] Fix | Delete
}
[1563] Fix | Delete
[1564] Fix | Delete
/**
[1565] Fix | Delete
* Ensure that we are loading expected scalar values from akismet_as_submitted commentmeta.
[1566] Fix | Delete
*
[1567] Fix | Delete
* @param mixed $meta_value
[1568] Fix | Delete
* @return mixed
[1569] Fix | Delete
*/
[1570] Fix | Delete
private static function sanitize_comment_as_submitted( $meta_value ) {
[1571] Fix | Delete
if ( empty( $meta_value ) ) {
[1572] Fix | Delete
return $meta_value;
[1573] Fix | Delete
}
[1574] Fix | Delete
[1575] Fix | Delete
$meta_value = (array) $meta_value;
[1576] Fix | Delete
[1577] Fix | Delete
foreach ( $meta_value as $key => $value ) {
[1578] Fix | Delete
if ( ! is_scalar( $value ) ) {
[1579] Fix | Delete
unset( $meta_value[ $key ] );
[1580] Fix | Delete
} else {
[1581] Fix | Delete
// These can change, so they're not explicitly listed in comment_as_submitted_allowed_keys.
[1582] Fix | Delete
if ( strpos( $key, 'POST_ak_' ) === 0 ) {
[1583] Fix | Delete
continue;
[1584] Fix | Delete
}
[1585] Fix | Delete
[1586] Fix | Delete
if ( ! isset( self::$comment_as_submitted_allowed_keys[ $key ] ) ) {
[1587] Fix | Delete
unset( $meta_value[ $key ] );
[1588] Fix | Delete
}
[1589] Fix | Delete
}
[1590] Fix | Delete
}
[1591] Fix | Delete
[1592] Fix | Delete
return $meta_value;
[1593] Fix | Delete
}
[1594] Fix | Delete
[1595] Fix | Delete
public static function predefined_api_key() {
[1596] Fix | Delete
if ( defined( 'WPCOM_API_KEY' ) ) {
[1597] Fix | Delete
return true;
[1598] Fix | Delete
}
[1599] Fix | Delete
[1600] Fix | Delete
return apply_filters( 'akismet_predefined_api_key', false );
[1601] Fix | Delete
}
[1602] Fix | Delete
[1603] Fix | Delete
/**
[1604] Fix | Delete
* Controls the display of a privacy related notice underneath the comment form using the `akismet_comment_form_privacy_notice` option and filter respectively.
[1605] Fix | Delete
* Default is top not display the notice, leaving the choice to site admins, or integrators.
[1606] Fix | Delete
*/
[1607] Fix | Delete
public static function display_comment_form_privacy_notice() {
[1608] Fix | Delete
if ( 'display' !== apply_filters( 'akismet_comment_form_privacy_notice', get_option( 'akismet_comment_form_privacy_notice', 'hide' ) ) ) {
[1609] Fix | Delete
return;
[1610] Fix | Delete
}
[1611] Fix | Delete
echo apply_filters(
[1612] Fix | Delete
'akismet_comment_form_privacy_notice_markup',
[1613] Fix | Delete
'<p class="akismet_comment_form_privacy_notice">' . sprintf(
[1614] Fix | Delete
__( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank" rel="nofollow noopener">Learn how your comment data is processed</a>.', 'akismet' ),
[1615] Fix | Delete
'https://akismet.com/privacy/'
[1616] Fix | Delete
) . '</p>'
[1617] Fix | Delete
);
[1618] Fix | Delete
}
[1619] Fix | Delete
}
[1620] Fix | Delete
[1621] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function