Uname:Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 13.126.101.145  /  Your IP : 216.73.217.50
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rentals_updated/wp-content/plugins/wpo365-login/Services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rentals_updated/wp-content/plugins/wpo365-login/Services/Request_Service.php
<?php

namespace Wpo\Services;

// Prevent public access to this script
defined('ABSPATH') or die();

use \Wpo\Core\Request;
use Wpo\Core\Wpmu_Helpers;
use \Wpo\Services\Access_Token_Service;
use \Wpo\Services\Options_Service;
use \Wpo\Services\User_Service;
use \Wpo\Services\Router_Service;

if (!class_exists('\Wpo\Services\Request_Service')) {

    class Request_Service
    {

        private $requests = array();

        private static $instance = null;

        private function __construct()
        {
        }

        public static function get_instance($create_new_request = false)
        {

            if (empty(self::$instance)) {
                self::$instance = new Request_Service();
            }

            if ($create_new_request) {
                $request = self::$instance->get_request($GLOBALS['WPO_CONFIG']['request_id']);

                if (!empty($_POST['idp_id'])) {
                    $idp_id = sanitize_text_field($_POST['idp_id']);
                    $request->set_item('idp_id', $idp_id);
                }

                if (!empty($is_oidc_response = !empty($_REQUEST['state']) && (!empty($_REQUEST['id_token']) || !empty($_REQUEST['code']) || !empty($_REQUEST['error'])))) {
                    $state = Router_Service::process_state_url($_REQUEST['state'], $request);

                    // The state parameter is not a URL and therefore this OIDC response is not requested by WPO365. 
                    if (false === $state) {
                        $is_oidc_response = false;
                    } else {

                        if (Options_Service::mu_use_subsite_options() && !Wpmu_Helpers::mu_is_network_admin()) {
                            $options = get_option('wpo365_options', array());
                        } else {
                            // For non-multisite installs, it uses get_option.
                            $options = get_site_option('wpo365_options', array());
                        }

                        // The OIDC response is not requested by WPO365 because SSO uses SAML.
                        if (!empty($options['use_saml']) && $request->get_item('mode') != 'mailAuthorize') {
                            $is_oidc_response = false;
                        } else {
                            unset($_REQUEST['state']);
                            $request->set_item('state', $state);
                        }
                    }
                }

                if (!empty($is_saml_response = !empty($_POST['RelayState']) && !empty($_REQUEST['SAMLResponse']))) {
                    $relay_state = Router_Service::process_state_url($_POST['RelayState'], $request);

                    if (false === $relay_state) {
                        $is_saml_response = false;
                    } else {
                        $request->set_item('relay_state', $relay_state); // -> Cannot be unset because there dependies relying on it
                    }
                }

                $request->set_item('is_oidc_response', $is_oidc_response);
                $request->set_item('is_saml_response', $is_saml_response);

                $request->set_item(
                    'request_log',
                    array(
                        'debug_log' => false, // At this point the Options_Service has not yet been initialized
                        'log' => array(),
                    )
                );
            }

            return self::$instance;
        }

        public function get_request($id)
        {

            if (!array_key_exists($id, $this->requests)) {
                $request = new Request($id);
                $this->requests[$id] = $request;
            }

            return $this->requests[$id];
        }

        public static function shutdown()
        {

            $request = self::$instance->get_request($GLOBALS['WPO_CONFIG']['request_id']);
            $mode = $request->get_item('mode');

            if (!empty($mode)) {
                Log_Service::flush_log();
                $request->clear();
                return;
            }

            $authorization_code = $request->get_item('code');

            if (!empty($authorization_code)) {
                Access_Token_Service::save_authorization_code($authorization_code);
            }

            $access_tokens = $request->get_item('access_tokens');

            if (!empty($access_tokens)) {
                Access_Token_Service::save_access_tokens($access_tokens);
            }

            $refresh_token = $request->get_item('refresh_token');

            if (!empty($refresh_token)) {
                Access_Token_Service::save_refresh_token($refresh_token);
            }

            $pkce_code_verifier = $request->get_item('pkce_code_verifier');

            if (Options_Service::get_global_boolean_var('use_pkce') && class_exists('\Wpo\Services\Pkce_Service') && !empty($pkce_code_verifier)) {
                \Wpo\Services\Pkce_Service::save_personal_pkce_code_verifier($pkce_code_verifier);
            }

            $idp_id = $request->get_item('idp_id');

            if (!empty($idp_id)) {
                User_Service::save_user_idp_id($idp_id);
            }

            /**
             * @since 28.x  Check if cURL logging has been enabled and output to WPO365 debug log
             */

            $curl_log = $request->get_item('curl_log');

            if (!empty($curl_log)) {

                if (false !== rewind($curl_log)) {
                    $log = '';

                    while (true) {
                        $line = fgets($curl_log);

                        if (!$line) {
                            break;
                        } else {
                            $log .= $line;
                        }
                    }

                    if (!empty($log)) {
                        Log_Service::write_log('CURL', $log);
                    }
                }

                fclose($curl_log);
            }

            Log_Service::flush_log();

            if (method_exists('\Wpo\Services\Event_Service', 'flush_events')) {
                \Wpo\Services\Event_Service::flush_events();
            }

            $request->clear();
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit