mirror of
git://develop.git.wordpress.org/
synced 2025-03-22 04:49:49 +01:00
Coding Standards: Use strict comparison in check_comment()
.
Some checks are pending
Cleanup Pull Requests / Clean up pull requests (push) Waiting to run
Coding Standards / PHP coding standards (push) Waiting to run
Coding Standards / JavaScript coding standards (push) Waiting to run
Coding Standards / Slack Notifications (push) Blocked by required conditions
Coding Standards / Failed workflow tasks (push) Blocked by required conditions
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Waiting to run
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Waiting to run
End-to-end Tests / Slack Notifications (push) Blocked by required conditions
End-to-end Tests / Failed workflow tasks (push) Blocked by required conditions
JavaScript Tests / QUnit Tests (push) Waiting to run
JavaScript Tests / Slack Notifications (push) Blocked by required conditions
JavaScript Tests / Failed workflow tasks (push) Blocked by required conditions
Performance Tests / Determine Matrix (push) Waiting to run
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Blocked by required conditions
Performance Tests / Compare (push) Blocked by required conditions
Performance Tests / Slack Notifications (push) Blocked by required conditions
Performance Tests / Failed workflow tasks (push) Blocked by required conditions
PHP Compatibility / Check PHP compatibility (push) Waiting to run
PHP Compatibility / Slack Notifications (push) Blocked by required conditions
PHP Compatibility / Failed workflow tasks (push) Blocked by required conditions
PHPUnit Tests / PHP 7.2 (push) Waiting to run
PHPUnit Tests / PHP 7.3 (push) Waiting to run
PHPUnit Tests / PHP 7.4 (push) Waiting to run
PHPUnit Tests / PHP 8.0 (push) Waiting to run
PHPUnit Tests / PHP 8.1 (push) Waiting to run
PHPUnit Tests / PHP 8.2 (push) Waiting to run
PHPUnit Tests / PHP 8.3 (push) Waiting to run
PHPUnit Tests / PHP 8.4 (push) Waiting to run
PHPUnit Tests / html-api-html5lib-tests (push) Waiting to run
PHPUnit Tests / Slack Notifications (push) Blocked by required conditions
PHPUnit Tests / Failed workflow tasks (push) Blocked by required conditions
Test Build Processes / Core running from build (push) Waiting to run
Test Build Processes / Core running from src (push) Waiting to run
Test Build Processes / Gutenberg running from build (push) Waiting to run
Test Build Processes / Gutenberg running from src (push) Waiting to run
Test Build Processes / Slack Notifications (push) Blocked by required conditions
Test Build Processes / Failed workflow tasks (push) Blocked by required conditions
Upgrade Develop Version Tests / Build (push) Waiting to run
Upgrade Develop Version Tests / Upgrade from 4.9 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.5 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.6 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.7 (push) Blocked by required conditions
Upgrade Develop Version Tests / Slack Notifications (push) Blocked by required conditions
Upgrade Develop Version Tests / Failed workflow tasks (push) Blocked by required conditions
Some checks are pending
Cleanup Pull Requests / Clean up pull requests (push) Waiting to run
Coding Standards / PHP coding standards (push) Waiting to run
Coding Standards / JavaScript coding standards (push) Waiting to run
Coding Standards / Slack Notifications (push) Blocked by required conditions
Coding Standards / Failed workflow tasks (push) Blocked by required conditions
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Waiting to run
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Waiting to run
End-to-end Tests / Slack Notifications (push) Blocked by required conditions
End-to-end Tests / Failed workflow tasks (push) Blocked by required conditions
JavaScript Tests / QUnit Tests (push) Waiting to run
JavaScript Tests / Slack Notifications (push) Blocked by required conditions
JavaScript Tests / Failed workflow tasks (push) Blocked by required conditions
Performance Tests / Determine Matrix (push) Waiting to run
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Blocked by required conditions
Performance Tests / Compare (push) Blocked by required conditions
Performance Tests / Slack Notifications (push) Blocked by required conditions
Performance Tests / Failed workflow tasks (push) Blocked by required conditions
PHP Compatibility / Check PHP compatibility (push) Waiting to run
PHP Compatibility / Slack Notifications (push) Blocked by required conditions
PHP Compatibility / Failed workflow tasks (push) Blocked by required conditions
PHPUnit Tests / PHP 7.2 (push) Waiting to run
PHPUnit Tests / PHP 7.3 (push) Waiting to run
PHPUnit Tests / PHP 7.4 (push) Waiting to run
PHPUnit Tests / PHP 8.0 (push) Waiting to run
PHPUnit Tests / PHP 8.1 (push) Waiting to run
PHPUnit Tests / PHP 8.2 (push) Waiting to run
PHPUnit Tests / PHP 8.3 (push) Waiting to run
PHPUnit Tests / PHP 8.4 (push) Waiting to run
PHPUnit Tests / html-api-html5lib-tests (push) Waiting to run
PHPUnit Tests / Slack Notifications (push) Blocked by required conditions
PHPUnit Tests / Failed workflow tasks (push) Blocked by required conditions
Test Build Processes / Core running from build (push) Waiting to run
Test Build Processes / Core running from src (push) Waiting to run
Test Build Processes / Gutenberg running from build (push) Waiting to run
Test Build Processes / Gutenberg running from src (push) Waiting to run
Test Build Processes / Slack Notifications (push) Blocked by required conditions
Test Build Processes / Failed workflow tasks (push) Blocked by required conditions
Upgrade Develop Version Tests / Build (push) Waiting to run
Upgrade Develop Version Tests / Upgrade from 4.9 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.5 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.6 (push) Blocked by required conditions
Upgrade Develop Version Tests / Upgrade from 6.7 (push) Blocked by required conditions
Upgrade Develop Version Tests / Slack Notifications (push) Blocked by required conditions
Upgrade Develop Version Tests / Failed workflow tasks (push) Blocked by required conditions
Follow-up to [1012], [1737], [48121]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59957 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0b06068330
commit
f01ff83ac3
@ -40,7 +40,7 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent,
|
||||
global $wpdb;
|
||||
|
||||
// If manual moderation is enabled, skip all checks and return false.
|
||||
if ( 1 == get_option( 'comment_moderation' ) ) {
|
||||
if ( '1' === get_option( 'comment_moderation' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -126,18 +126,38 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent,
|
||||
* as well as whether there are any moderation keywords (if set) present in the author
|
||||
* email address. If both checks pass, return true. Otherwise, return false.
|
||||
*/
|
||||
if ( 1 == get_option( 'comment_previously_approved' ) ) {
|
||||
if ( '1' === get_option( 'comment_previously_approved' ) ) {
|
||||
if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) {
|
||||
$comment_user = get_user_by( 'email', wp_unslash( $email ) );
|
||||
if ( ! empty( $comment_user->ID ) ) {
|
||||
$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) );
|
||||
$ok_to_comment = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT comment_approved
|
||||
FROM $wpdb->comments
|
||||
WHERE user_id = %d
|
||||
AND comment_approved = '1'
|
||||
LIMIT 1",
|
||||
$comment_user->ID
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// expected_slashed ($author, $email)
|
||||
$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) );
|
||||
$ok_to_comment = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT comment_approved
|
||||
FROM $wpdb->comments
|
||||
WHERE comment_author = %s
|
||||
AND comment_author_email = %s
|
||||
AND comment_approved = '1'
|
||||
LIMIT 1",
|
||||
$author,
|
||||
$email
|
||||
)
|
||||
);
|
||||
}
|
||||
if ( ( 1 == $ok_to_comment ) &&
|
||||
( empty( $mod_keys ) || ! str_contains( $email, $mod_keys ) ) ) {
|
||||
return true;
|
||||
|
||||
if ( '1' === $ok_to_comment && ( empty( $mod_keys ) || ! str_contains( $email, $mod_keys ) ) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user