$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/Admin/Rest/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/www/wp-content/plugins/hellopack-client/includes/Admin/Rest/ModuleController.php
<?php
/**
 * Module REST controller.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\Admin\Rest;

use HelloPack\Client\Options;

use HelloPack\Client\Module\Loader as ModuleLoader;
use WP_REST_Request;
use WP_REST_Response;

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

/**
 * Handles module list and toggle via REST.
 */
class ModuleController {

	/**
	 * List all registered modules.
	 *
	 * @return WP_REST_Response
	 */
	public function list(): WP_REST_Response {
		$loader   = ModuleLoader::instance();
		$modules  = $loader->get_modules();
		$settings = Options::get_module_settings();

		if ( ! is_array( $settings ) ) {
			$settings = array();
		}

		$grouped   = array();
		$active_on = $this->active_sites( $modules );

		foreach ( $modules as $id => $module ) {
			$category = $module->get_category();

			$info = $module->get_info();

			$grouped[ $category ][] = array(
				'activeOn'      => $active_on[ $id ] ?? array(),
				'id'            => $id,
				'name'          => $info['name'],
				'description'   => $info['description'],
				'icon'          => $info['icon'],
				'category'      => $category,
				'version'       => $info['version'],
				'enabled'       => $module->is_enabled(),
				'active'        => $module->should_load(),
				'canBeDisabled' => $module->can_be_disabled(),
				'hardDisabled'  => $module->is_hard_disabled(),
			);
		}

		return new WP_REST_Response( array( 'modules' => $grouped ) );
	}

	/**
	 * On a network, find the sites where each module actually runs.
	 *
	 * The "active" flag only describes the current site; a network admin
	 * needs to see that a module is running on three subsites even when the
	 * main site does not use that plugin at all.
	 *
	 * @param array<string, \HelloPack\Client\Module\AbstractModule> $modules Registered modules.
	 * @return array<string, array<int, array{id: int, url: string}>>
	 */
	private function active_sites( array $modules ): array {
		if ( ! HELLOPACK_CLIENT_NETWORK_ACTIVATED ) {
			return array();
		}

		$result = array();

		foreach ( get_sites(
			array(
				'fields' => 'ids',
				'number' => 10000,
			)
		) as $blog_id ) {
			switch_to_blog( (int) $blog_id );

			try {
				foreach ( $modules as $id => $module ) {
					if ( 'system' !== $module->get_category() && $module->should_load() ) {
						$result[ $id ][] = array(
							'id'  => (int) $blog_id,
							'url' => home_url(),
						);
					}
				}
			} finally {
				restore_current_blog();
			}
		}

		return $result;
	}

	/**
	 * Toggle a module on or off.
	 *
	 * @param WP_REST_Request $request REST request.
	 * @return WP_REST_Response
	 */
	public function toggle( WP_REST_Request $request ): WP_REST_Response {
		$module_id = sanitize_text_field( $request->get_param( 'id' ) );
		$enabled   = (bool) $request->get_param( 'enabled' );

		$module = ModuleLoader::instance()->set_module_enabled( $module_id, $enabled );

		if ( null === $module ) {
			return new WP_REST_Response(
				array( 'message' => __( 'Module not found.', 'hellopack-client' ) ),
				404
			);
		}

		$is_active = false;
		if ( $enabled ) {
			$is_active = $module->should_load();
		}

		$message = $enabled
			? __( 'Module enabled.', 'hellopack-client' )
			: __( 'Module disabled.', 'hellopack-client' );

		return new WP_REST_Response(
			array(
				'message'   => $message,
				'is_active' => $is_active,
			)
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit