| @@ -13,9 +13,8 @@ | ||
| 13 | 13 | use Activitypub\Collection\Inbox; |
| 14 | 14 | use Activitypub\Collection\Remote_Actors; |
| 15 | 15 | |
| 16 | 16 | use function Activitypub\add_to_outbox; |
| 17 | -use function Activitypub\is_same_host; | |
| 18 | 17 | use function Activitypub\object_to_uri; |
| 19 | 18 | use function Activitypub\user_can_activitypub; |
| 20 | 19 | |
| 21 | 20 | /** |
| @@ -99,9 +98,9 @@ | ||
| 99 | 98 | * @param int|int[]|null $user_ids The user ID(s). |
| 100 | 99 | * @param string $type The type of the activity. |
| 101 | 100 | */ |
| 102 | 101 | public static function handle_blocked_request( $activity, $user_ids, $type ) { |
| 103 | - if ( ! \in_array( \strtolower( $type ), array( 'quoterequest', 'quote_request' ), true ) ) { | |
| 102 | + if ( ! in_array( strtolower( $type ), array( 'quoterequest', 'quote_request' ), true ) ) { | |
| 104 | 103 | return; |
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | // Extract the user ID (quote requests are always for a single user). |
| @@ -218,9 +217,9 @@ | ||
| 218 | 217 | |
| 219 | 218 | $activity_object['instrument'] = object_to_uri( $activity_object['instrument'] ); |
| 220 | 219 | |
| 221 | 220 | $post_meta = \get_post_meta( $post_id, '_activitypub_quoted_by', false ); |
| 222 | - if ( \in_array( $activity_object['instrument'], $post_meta, true ) ) { | |
| 221 | + if ( in_array( $activity_object['instrument'], $post_meta, true ) ) { | |
| 223 | 222 | global $wpdb; |
| 224 | 223 | |
| 225 | 224 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 226 | 225 | $meta_id = $wpdb->get_var( |
| @@ -235,9 +234,9 @@ | ||
| 235 | 234 | $meta_id = \add_post_meta( $post_id, '_activitypub_quoted_by', $activity_object['instrument'] ); |
| 236 | 235 | } |
| 237 | 236 | |
| 238 | 237 | // Only send minimal data. |
| 239 | - $activity_object = \array_intersect_key( | |
| 238 | + $activity_object = array_intersect_key( | |
| 240 | 239 | $activity_object, |
| 241 | 240 | array( |
| 242 | 241 | 'id' => 1, |
| 243 | 242 | 'type' => 1, |
| @@ -287,9 +286,9 @@ | ||
| 287 | 286 | |
| 288 | 287 | $activity_object['instrument'] = object_to_uri( $activity_object['instrument'] ); |
| 289 | 288 | |
| 290 | 289 | // Only send minimal data. |
| 291 | - $activity_object = \array_intersect_key( | |
| 290 | + $activity_object = array_intersect_key( | |
| 292 | 291 | $activity_object, |
| 293 | 292 | array( |
| 294 | 293 | 'id' => 1, |
| 295 | 294 | 'type' => 1, |
| @@ -328,14 +327,8 @@ | ||
| 328 | 327 | return $valid; |
| 329 | 328 | } |
| 330 | 329 | |
| 331 | 330 | if ( ! isset( $activity['actor'], $activity['object'], $activity['instrument'] ) ) { |
| 332 | - return false; | |
| 333 | - } | |
| 334 | - | |
| 335 | - // The instrument is the quoting object, authored by the actor, so it must live on the | |
| 336 | - // actor's host. Otherwise a remote server could bind a third-party reference to a local post. | |
| 337 | - if ( ! is_same_host( $activity['actor'], $activity['instrument'] ) ) { | |
| 338 | 331 | return false; |
| 339 | 332 | } |
| 340 | 333 | |
| 341 | 334 | return $valid; |