ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //home/u435929562/domains/tec-edu.in/public_html/wp-content/plugins/webarx/includes/rules.php
<?php

// Do not allow the file to be called directly.
if (!defined('ABSPATH')) {
	exit;
}

/**
 * This class is used to pull the firewall/whitelist rules from our API.
 */
class W_Rules extends W_Core
{
	/**
	 * Add the actions required to pull the rules.
	 * 
	 * @param Webarx $core
	 * @return void
	 */
	public function __construct($core)
	{
		parent::__construct($core);
		add_action('webarx_post_firewall_rules', array($this, 'post_firewall_rules'));
		add_action('webarx_post_dynamic_firewall_rules', array($this, 'dynamic_firewall_rules'));
	}

	/**
	 * Pull the .htaccess rules from the API.
	 * Then apply it to the .htaccess file after we create a backup.
	 *
	 * @return void
	 */
	public function post_firewall_rules()
	{
		$rules = $this->plugin->htaccess->get_firewall_rule_settings();
		$settings = wp_json_encode($rules);
		$results = $this->plugin->api->post_firewall_rule(array('settings' => $settings));
		
		// If no rules returned, we assume all settings are turned off.
		if (empty($results)) {
			$results['rules'] = '';
		}	

		// We have rules so apply it to the .htaccess file.
		if (isset($results['rules'])) {
			$this->plugin->htaccess->write_to_htaccess($results['rules']);
			return;
		}
	}

	/**
	 * Pull the firewall/whitelist rules from the API.
	 *
	 * @return void
	 */
	public function dynamic_firewall_rules()
	{
		// Get the firewall and whitelist rules.
		$results = $this->plugin->api->post_firewall_rule_json();
		if (!isset($results['firewall'])) {
			return;
		}

		// Update firewall rules.
		update_option('webarx_firewall_rules', json_encode($results['firewall']));

		// Update whitelist rules.
		update_option('webarx_whitelist_rules', json_encode($results['whitelists']));

		// Update secondary whitelist rules.
		if (isset($results['whitelist_keys'])) {
			update_option('webarx_whitelist_keys_rules', json_encode($results['whitelist_keys']));
		}
	}
}