$plugin = <<403WebShell
403Webshell
Server IP : 193.224.177.188  /  Your IP : 216.73.217.123
Web Server : Apache
System : Linux cpanel.krtk.mta.hu 3.10.0-962.3.2.lve1.5.89.el7.x86_64 #1 SMP Thu Jul 9 15:55:31 UTC 2026 x86_64
User : krtkhu ( 1061)
PHP Version : 8.4.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home2/krtkhu/www/wp-content/plugins/hellopack-client/includes/Update/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/www/wp-content/plugins/hellopack-client/includes/Update/PluginUpdater.php
<?php
/**
 * Plugin update injection.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Update;

use HelloPack\Client\Api\Client;
use HelloPack\Client\Utility\DisabledItems;
use stdClass;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Injects premium plugin updates into WordPress transients.
 */
class PluginUpdater {

	/**
	 * API client.
	 *
	 * @var Client
	 */
	private Client $api;

	/**
	 * Items cache.
	 *
	 * @var ItemsCache
	 */
	private ItemsCache $cache;

	/**
	 * Pre-computed update entries (cached per-request).
	 *
	 * Keys are plugin file paths, values are update objects or null (= no update).
	 *
	 * @var array<string, object|null>|null
	 */
	private ?array $computed_updates = null;

	/**
	 * Constructor.
	 *
	 * @param Client     $api   API client.
	 * @param ItemsCache $cache Items cache.
	 */
	public function __construct( Client $api, ItemsCache $cache ) {
		$this->api   = $api;
		$this->cache = $cache;
	}

	/**
	 * Inject premium plugin updates into the update transient.
	 *
	 * This filter fires on every get_site_transient('update_plugins') call
	 * (potentially 20+ times per page load). The heavy work is computed once
	 * and cached in-memory for subsequent calls.
	 *
	 * @param mixed $transient The update_plugins transient (false when not yet set).
	 * @return object
	 */
	public function inject_updates( mixed $transient ): object {
		if ( ! is_object( $transient ) ) {
			$transient = new stdClass();
		}

		if ( null === $this->computed_updates ) {
			$this->computed_updates = $this->compute_updates();
		}

		foreach ( $this->computed_updates as $plugin_file => $update ) {
			if ( null === $update ) {
				unset( $transient->response[ $plugin_file ] );
			} else {
				$transient->response[ $plugin_file ] = $update;
			}
		}

		return $transient;
	}

	/**
	 * Compute premium plugin update entries.
	 *
	 * @return array<string, object|null> Plugin file => update object, or null if up to date.
	 */
	private function compute_updates(): array {
		$plugins_data = $this->cache->get_plugins();
		$installed    = array_merge(
			$plugins_data['active'] ?? array(),
			$plugins_data['installed'] ?? array()
		);
		$wp_plugins   = $this->cache->wp_plugins();
		$updates      = array();

		foreach ( $installed as $plugin_file => $premium ) {
			if ( ! isset( $wp_plugins[ $plugin_file ] ) ) {
				continue;
			}

			if ( $this->is_disabled( $plugin_file ) ) {
				continue;
			}

			$current_version = $wp_plugins[ $plugin_file ]['Version'];

			if ( version_compare( $current_version, $premium['version'], '<' ) ) {
				$updates[ $plugin_file ] = (object) array(
					'slug'        => dirname( $plugin_file ),
					'plugin'      => $plugin_file,
					'new_version' => $premium['version'],
					'url'         => $premium['url'],
					'package'     => $this->api->deferred_downloads( (int) $premium['id'] ),
				);
			} else {
				$updates[ $plugin_file ] = null;
			}
		}

		return $updates;
	}

	/**
	 * Filter WP.org request to remove premium plugins.
	 *
	 * @param array<string, mixed> $request HTTP request args.
	 * @param string               $url     Request URL.
	 * @return array<string, mixed>
	 */
	public function filter_wp_org_request( array $request, string $url ): array {
		if ( false === strpos( $url, '//api.wordpress.org/plugins/update-check/1.1/' ) ) {
			return $request;
		}

		$plugins_data = $this->cache->get_plugins();
		$installed    = array_merge(
			$plugins_data['active'] ?? array(),
			$plugins_data['installed'] ?? array()
		);

		if ( empty( $installed ) || empty( $request['body']['plugins'] ) ) {
			return $request;
		}

		$data = json_decode( $request['body']['plugins'] );

		foreach ( $installed as $slug => $item ) {
			if ( $this->is_disabled( $slug ) ) {
				continue;
			}
			unset( $data->plugins->$slug );
		}

		$request['body']['plugins'] = wp_json_encode( $data );

		return $request;
	}

	/**
	 * Provide plugin info for the detail modal.
	 *
	 * @param false|object $response Default response.
	 * @param string       $action   API action.
	 * @param object       $args     Plugin arguments.
	 * @return false|object
	 */
	public function get_plugin_info( false|object $response, string $action, object $args ): false|object {
		if ( 'plugin_information' !== $action || ! isset( $args->slug ) ) {
			return $response;
		}

		$plugins_data = $this->cache->get_plugins();
		$installed    = array_merge(
			$plugins_data['active'] ?? array(),
			$plugins_data['installed'] ?? array()
		);

		foreach ( $installed as $slug => $plugin ) {
			if ( dirname( $slug ) !== $args->slug ) {
				continue;
			}

			if ( $this->is_disabled( $slug ) ) {
				continue;
			}

			$info                = new stdClass();
			$info->slug          = $args->slug;
			$info->plugin        = $slug;
			$info->plugin_name   = $plugin['name'];
			$info->name          = $plugin['name'];
			$info->version       = $plugin['version'];
			$info->author        = $plugin['author'];
			$info->homepage      = $plugin['url'];
			$info->requires      = $plugin['requires'] ?? null;
			$info->tested        = $plugin['tested'] ?? null;
			$info->downloaded    = $plugin['number_of_sales'] ?? 0;
			$info->last_updated  = $plugin['updated_at'] ?? '';
			$info->sections      = array( 'description' => $plugin['description'] ?? '' );
			$info->banners       = array( 'low' => $plugin['landscape_url'] ?? '' );
			$info->download_link = $this->api->deferred_downloads( (int) $plugin['id'] );

			$rating       = $plugin['rating'] ?? array();
			$info->rating = ! empty( $rating['rating'] ) ? ( $rating['rating'] / 5 * 100 ) : 0;

			return $info;
		}

		return $response;
	}

	/**
	 * Rebuild plugin cache on activate/deactivate/delete.
	 */
	public function rebuild(): void {
		$this->computed_updates = null;
		$this->cache->get_plugins( true );
	}

	/**
	 * Check if a plugin is excluded from HelloPack management via HP_DISABLE_PLUGINS.
	 *
	 * @param string $plugin_file Plugin file path (dir/file.php).
	 * @return bool
	 */
	private function is_disabled( string $plugin_file ): bool {
		return DisabledItems::is_plugin_disabled( dirname( $plugin_file ) );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit