403Webshell
Server IP : 104.21.28.229  /  Your IP : 216.73.216.142
Web Server : Apache/2
System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : mienphi ( 1014)
PHP Version : 8.2.14
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mienphi/public_html/wp-content/plugins/paid-memberships-pro/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mienphi/public_html/wp-content/plugins/paid-memberships-pro/includes/xmlrpc.php
<?php
/**
 * Define the XMLRPC Methods We Add
 * Since v2.0
 */
add_filter('xmlrpc_methods', 'pmpro_xmlrpc_methods');
function pmpro_xmlrpc_methods($methods)
{
	$methods['pmpro.getMembershipLevelForUser'] = 'pmpro_xmlrpc_getMembershipLevelForUser';
	$methods['pmpro.hasMembershipAccess'] = 'pmpro_xmlrpc_hasMembershipAccess';
	return $methods;
}

/**
 * API method to get the membership level info for a user.
 * Since v2.0
 */
function pmpro_xmlrpc_getMembershipLevelForUser($args)
{
	// Parse the arguments, assuming they're in the correct order
	$username	= $args[0];
	$password	= $args[1];
	$user_id = $args[2];	//optional user id passed in

	global $wp_xmlrpc_server;

	// Let's run a check to see if credentials are okay
	if ( !$user = $wp_xmlrpc_server->login($username, $password) ) {
		return $wp_xmlrpc_server->error;
	}

	// The user passed should be an admin or have the pmpro_xmlprc capability
	if(!user_can($user->ID, "manage_options") && !user_can($user->ID, "pmpro_xmlrpc"))
		return "ERROR: User does not have access to the PMPro XMLRPC methods.";
	
	// Default to logged in user if no user_id is given.
	if(empty($user_id))
	{		
		$user_id = $user->ID;
	}

	$membership_level = pmpro_getMembershipLevelForUser($user_id);
	
	return $membership_level;
}

/**
 * API method to check if a user has access to a certain post.
 * Since v2.0
 */
function pmpro_xmlrpc_hasMembershipAccess($args)
{
	// Parse the arguments, assuming they're in the correct order
	$username	= $args[0];
	$password	= $args[1];
	$post_id = $args[2];	//post id to check
	$user_id = $args[3];	//optional user id passed in
	$return_membership_levels = $args[4];	//option to also include an array of membership levels with access to the post

	global $wp_xmlrpc_server;

	// Let's run a check to see if credentials are okay
	if ( !$user = $wp_xmlrpc_server->login($username, $password) ) {
		return $wp_xmlrpc_server->error;
	}

	// The user passed should be an admin or have the pmpro_xmlprc capability
	if(!user_can($user->ID, "manage_options") && !user_can($user->ID, "pmpro_xmlrpc"))
		return "ERROR: User does not have access to the PMPro XMLRPC methods.";
	
	// Default to logged in user if no user_id is given.
	if(empty($user_id))
	{		
		$user_id = $user->ID;
	}

	$has_access = pmpro_has_membership_access($post_id, $user_id, $return_membership_levels);

	return $has_access;
}

Youez - 2016 - github.com/yon3zu
LinuXploit