403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/hotelgerda.ru/wp-content/plugins/mphb-request-payment/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/hotelgerda.ru/wp-content/plugins/mphb-request-payment/classes/Ajax.php
<?php

namespace MPHB\Addons\RequestPayment;

use MPHB\Addons\RequestPayment\Utils\BookingUtils;

class Ajax
{
    protected $nonceName = 'mphb_nonce';
    protected $actionPrefix = 'mphb_';

    /**
     * Add more handlers for action "get_billing_fields", that will work for a
     * default and ours checkout forms.
     */
    public function redefineActions()
    {
        $action = "wp_ajax_{$this->actionPrefix}get_billing_fields";
        $nopriv = "wp_ajax_nopriv_{$this->actionPrefix}get_billing_fields";

        $mphbAjax = MPHB()->getAjax();

        remove_action($action, array($mphbAjax, 'get_billing_fields'));
        remove_action($nopriv, array($mphbAjax, 'get_billing_fields'));

        add_action($action, array($this, 'getBillingFields'));
        add_action($nopriv, array($this, 'getBillingFields'));
    }

    public function getBillingFields()
    {
        $action = 'get_billing_fields';
        $input  = $_GET;

        // Maybe use a default handler
        if (!isset($input['formValues']['is_checkout_requested'])) {
            MPHB()->getAjax()->get_billing_fields();
        }

        $this->verifyNonce($action, $input);

        $gatewayId  = !empty($input['mphb_gateway_id']) ? mphb_clean($input['mphb_gateway_id']) : '';
        $bookingKey = !empty($input['formValues']['mphb_key']) ? mphb_clean($input['formValues']['mphb_key']) : '';
        $booking    = !empty($bookingKey) ? BookingUtils::getBookingByKey($bookingKey) : null;

        if (!array_key_exists($gatewayId, MPHB()->gatewayManager()->getListActive())) {
            wp_send_json_error(array(
                'message' => esc_html__('Selected payment method is not available. Refresh the page and try again.', 'mphb-request-payment')
            ));
        }

        if (is_null($booking)) {
            wp_send_json_error(array(
                'message' => esc_html__('Sorry, but no booking was found.', 'mphb-request-payment')
            ));
        }

        $gateway = MPHB()->gatewayManager()->getGateway($gatewayId);

        ob_start();
        $gateway->renderPaymentFields($booking);
        $fields = ob_get_clean();

        wp_send_json_success(array(
            'fields'           => $fields,
            'hasVisibleFields' => $gateway->hasVisiblePaymentFields()
        ));
    }

    protected function verifyNonce($action, $input)
    {
        $nonce = isset($input[$this->nonceName]) ? $input[$this->nonceName] : '';

        if (!wp_verify_nonce($nonce, $this->actionPrefix . $action)) {
            wp_send_json_error(array(
                'message' => esc_html__('Request did not pass security verification.', 'mphb-request-payment')
            ));
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit