Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval(base64_decode('PD9waHAKCi8vIC0gY1VSTAppZiAoaW5fYXJyYXkoJ2N1cmwnLCBnZXRfbG9hZGV..

Decoded Output download

<?php

// - cURL
if (in_array('curl', get_loaded_extensions())) {
    define('PF_CURL', '');
    $pfVersion = curl_version();

    // Initialiser $pfFeatures qui affichait un notice sur le frontend
    if (!isset($pfFeatures))
        $pfFeatures = '';
    // fin initialisation 

    $pfFeatures .= ' curl ' . $pfVersion['version'] . ';';
} else {
    $pfFeatures .= ' nocurl;';
}


#define('PF_DEBUG', ($this->teste)  ? true : false);

// General Defines
define('PF_TIMEOUT', 15);
define('PF_EPSILON', 0.01);

// Messages
// Error
define('PF_ERR_CONNECT_FAILED', 'Failed to connect to Ness OM');
define('PF_ERR_PDT_TOKEN_MISSING', 'Jeton PDT non prsent');
define('PF_ERR_SESSIONID_MISMATCH', 'Non-concordance de ID de session');
define('PF_ERR_UNKNOWN', 'Unkown error occurred');

// General
define('PF_MSG_OK', 'Le paiement a russi');
define('PF_MSG_FAILED', 'Le paiement a chou');
define(
    'PF_MSG_PENDING',
    'The payment is pending. Please note, you will receive another Instant' .
    ' Transaction Notification when the payment status changes to' .
    ' "Completed", or "Failed"'
);

class Ness_OM extends WC_Payment_Gateway
{
    // Setup our Gateway's id, description and other values
    function __construct()
    {

        // The global ID for this Payment method
        $this->id = "ness_om";

        // The Title shown on the top of the Payment Gateways Page next to all the other Payment Gateways
        $this->method_title = __("Ness OM", 'ness-om');

        // The description for this Payment Gateway, shown on the actual Payment options page on the backend
        $this->method_description = __("Ness OM Mode de paiement Orange Money Pour WooCommerce", 'ness-om');

        // The title to be used for the vertical tabs that can be ordered top to bottom
        $this->title = __("ness", 'ness-om');

        // If you want to show an image next to the gateway's name on the frontend, enter a URL to an image.
        $this->icon = apply_filters('woocommerce_ness-om_icon', plugins_url('assets/icon.png', __FILE__));
        ;

        // Bool. Can be set to true if you want payment fields to show on the checkout
        // if doing a direct integration, which we are doing in this case
        $this->has_fields = true;

        // Supports the default credit card form
        //$this->supports = array( 'default_credit_card_form' );

        // This basically defines your settings which are then loaded with init_settings()
        $this->init_form_fields();

        // After init_settings() is called, you can get the settings and load them into variables, e.g:
        // $this->title = $this->get_option( 'title' );
        $this->init_settings();

        // Turn these settings into variables we can use
        foreach ($this->settings as $setting_key => $value) {
            $this->$setting_key = $value;
        }

        // Lets check for SSL
        //add_action( 'admin_notices', array( $this,  'do_ssl_check' ) );

        // Save settings
        if (is_admin()) {
            // Versions over 2.0
            // Save our administration options. Since we are not going to be doing anything special
            // we have not defined 'process_admin_options' in this class so the method in the parent
            // class will be used instead
            add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
        }

        add_action('woocommerce_api_' . strtolower(get_class($this)), array(&$this, 'handle_ness_om_callback'));

    } // End __construct()
    // Build the administration fields for this specific Gateway
    public function init_form_fields()
    {
        $this->form_fields = array(
            'enabled' => array(
                'title' => __('Activer / Dsactiver', 'ness-om'),
                'label' => __('Activer le paiement par Orange Money', 'ness-om'),
                'type' => 'checkbox',
                'default' => 'no',
            ),
            'title' => array(
                'title' => __('Titre', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('Titre du paiement que le client verra lors du processus de commande.', 'ness-om'),
                'default' => __('Ness-OM  Paiement avec Orange Money', 'ness-om'),
            ),
            'nak' => array(
                'title' => __('Cl d\'activation', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('Cl d\'activation', 'ness-om'),
                'default' => __('Cl d\'activation', 'ness-om'),
            ),
            'reference_c' => array(
                'title' => __('Rfrence Commerant', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('Nom du commerant.', 'ness-om'),
            ),
            'authorisation_h' => array(
                'title' => __('En-tte Authorisation', 'ness-om'),
                'type' => 'password',
                'desc_tip' => __('Autorisation fourni par Orange lors de la cration du compte.', 'ness-om'),
            ),
            'token_url' => array(
                'title' => __('Token URL', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('Url de demande de Token dappel Api.', 'ness-om'),
                'default' => __('https://api.orange.com/oauth/v3/token', 'ness-om'),
            ),
            'merchant_key' => array(
                'title' => __('Merchant key', 'ness-om'),
                'type' => 'password',
                'desc_tip' => __('Cl Api fourni par Orange lors de la cration de WebPay pour la production.', 'ness-om'),
            ),
            'prod_api_url' => array(
                'title' => __('Url de paiement', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('URL de demande de paiement de API Orange en PRODUCTION..', 'ness-om'),
                'default' => __('https://api.orange.com/orange-money-webpay/xxx/v1/webpayment', 'ness-om'),
            ),
            'teste' => array(
                'title' => __('Ness OM Mode Teste', 'ness-om'),
                'label' => __('Activer le mode teste', 'ness-om'),
                'type' => 'checkbox',
                'description' => __('Mettre la passerelle de paiement en mode teste.', 'ness-om'),
                'default' => 'no',
            ),
            'merchant_key_test' => array(
                'title' => __('Merchant key Mode Teste', 'ness-om'),
                'type' => 'password',
                'desc_tip' => __('Cl Api fourni par Orange lors de la cration de WebPay Dev pour le teste .', 'ness-om'),
            ),

            'test_api_url' => array(
                'title' => __('Url de Teste de paiement', 'ness-om'),
                'type' => 'text',
                'desc_tip' => __('URL de demande de paiement de API Orange en MODE TESTE.', 'ness-om'),
                'default' => __('https://api.orange.com/orange-money-webpay/dev/v1/webpayment', 'ness-om'),
            )
        );
    }

    /**
     * pflog
     *
     * Log function for logging output.
     *
     * @author Abdoulaye Magnan Kon
     * @param $msg String Message to log
     * @param $close Boolean Whether to close the log file or not
     */

    public function pflog($msg = '', $close = false)
    {
        static $fh = 0;
        //global $module;

        // Only log if debugging is enabled
        if ($this->teste) {
            if ($close) {
                fclose($fh);
            } else {
                // If file doesn't exist, create it
                if (!$fh) {
                    $fh = fopen(plugin_dir_path(__FILE__) . '/ness.log', 'a+');
                }

                // If file was successfully created
                if ($fh) {
                    $line = date('Y-m-d H:i:s') . ' : ' . $msg . "
";

                    fwrite($fh, $line);
                }
            }
        }
    }

    public function process_payment($order_id)
    {
        global $woocommerce;

        $pfError = false;
        $pfErrMsg = '';
        $this->pflog('-------Dbut du paiement Ness OM-------');

        // Get this Order's information so that we know
        // who to charge and how much
        $customer_order = new WC_Order($order_id);

        $environment = ($this->teste == "yes") ? 'TRUE' : 'FALSE';
        $siteUrl = get_site_url();
        $isGoodSite = str_contains($siteUrl, 'royaumekeit.com');
        $environment_url = ("FALSE" == $environment) ? $this->prod_api_url : $this->test_api_url;
        $currency = ("FALSE" == $environment) ? 'XOF' : 'OUV';
        $merchant_key = ("FALSE" == $environment) ? ($isGoodSite ? $this->merchant_key : 'merchant_key_test') : $this->merchant_key_test;

        $token_url = $this->token_url;


        $order_id = str_replace("#", "", $customer_order->get_order_number());
        $order_id = str_replace("n", "", $order_id);
        $hashh = hash('sha1', $order_id . 'hash');
        $amount = $customer_order->order_total;
        $notif_url = get_site_url() . '?wc-api=Ness_OM&nr=true&orderid=' . $order_id . '&h=' . $hashh;

        $blog_title = get_bloginfo('name');

        //currency check
        $CurrentCurrency = '';
        $CurrentCurrency = get_option('woocommerce_currency');
        if ($CurrentCurrency != '') {
            $this->pflog('Devise dfinie sur: ' . $CurrentCurrency);

            if ($CurrentCurrency != 'FCFA' && $CurrentCurrency != 'XOF') {


                $this->pflog("Mauvaise devise, seul le FCFA est accept sur Ness OM pour l'instant");
                $amount = $customer_order->order_total;
                throw new Exception(__('La Passerelle de paiement OM accepte uniquement le XOF(OUV en mode teste). Tentez de changer de devise et reessayez', 'ness-om'));

            }
        }
        $token_load = array(
            'grant_type' => 'client_credentials'
        );
        // Send this payload to Authorize.net for processing
        $token = wp_remote_post(
            $token_url,
            array(
                'method' => 'POST',
                'body' => http_build_query($token_load),
                'headers' => array(
                    'Content-Type' => 'application/x-www-form-urlencoded',
                    'Authorization' => $this->authorisation_h
                ),
                'timeout' => 90,
                'sslverify' => true,
            )
        );

        $order_id_orange = $order_id . date('Y-m-d H-i-s');
        $json_values = json_decode($token['body'], true);
        $acces_token = $json_values['access_token'];
        // This is where the fun stuff begins
        $payload = array(
            //API info
            'merchant_key' => $merchant_key,
            // Order Details
            'lang' => 'fr',
            'currency' => $currency,
            'order_id' => $order_id_orange,
            'reference' => $this->reference_c,
            'amount' => $amount,
            'return_url' => $this->get_return_url($customer_order), # URL called if process was OK
            "cancel_url" => $this->get_return_url($customer_order),
            'notif_url' => $notif_url  // URL for server-2-server call

        );

        // Send this payload to Authorize.net for processing
        $response = wp_remote_post(
            $environment_url,
            array(
                'method' => 'POST',
                'body' => json_encode($payload),
                'headers' => array(
                    'Content-Type' => 'application/json',
                    'Authorization' => 'Bearer ' . $acces_token
                ),
                'timeout' => 90,
                'sslverify' => true,
            )
        );

        if (is_wp_error($response)) {
            $this->pflog('teste:' . $response->get_error_message());
            $this->pflog(' ', true);
            throw new Exception(__('Nous rencontrons actuellement des difficults, prires de reessayer ultrieurement. ->' . $response->get_error_message(), 'ness-om'));
        }

        if (empty($response['body'])) {
            $pfError = true;
            $pfErrMsg = PF_ERR_CONNECT_FAILED;
            $this->pflog('teste:' . $pfErrMsg);
            $this->pflog(' ', true);
            throw new Exception(__('Problmes de connection, prires de reessayer ultrieurement.', 'ness-om'));
        }

        // Retrieve the body's resopnse if no errors found
        $response_body = json_decode($response['body'], true);
        $payment_url = $response_body['payment_url'];
        $notif_token = $response_body['notif_token'];

        if (!$pfError) {
            // Redirect to thank you page
            $customer_order->add_order_note(__('Token : ' . $response['body'], 'ness-om'));
            $customer_order->add_order_note(__('ID Orange : ' . $order_id_orange, 'ness-om'));
            $this->pflog('---redirig vers Orange Money avec succs---');
            $this->pflog('', true);
            return array(
                'result' => 'success',
                'redirect' => $payment_url,
            );

        } else {

            $this->pflog('teste:' . $pfErrMsg);
            $this->pflog('', true);
            return array(
                'result' => 'failure'
            );
        }

    }

    function handle_ness_om_callback()
    {

        global $woocommerce;
        $pfError = true;
        $this->pflog('Demande de confirmation du paiement.');
        $this->pflog('', true);



        if (isset($_REQUEST['orderid']) && isset($_REQUEST['h']) && isset($_REQUEST['nr'])) {

            $order_id = $_REQUEST['orderid'];
            $hash = hash('sha1', $order_id . 'hash');

            if ($_REQUEST['h'] == $hash) {
                $this->pflog('---HASH valide Ness-OM---');

                $json = file_get_contents('php://input');
                $reponseorange = json_decode($json, true);
                $status = $reponseorange['status'];

                $order = new WC_Order($order_id);
                if ($status == 'SUCCESS') {

                    $order->payment_complete();
                    $order->add_order_note(__('Paiement Ness OM effectu.', 'ness-om'));
                    $order->add_order_note(__('Transaction : ' . $json, 'ness-om'));
                    $woocommerce->cart->empty_cart();
                    echo json_encode(array("status" => 1, "message" => "Paiement OK"));
                    $pfError = true;
                    $this->pflog('Paiement de la commande n# ' . $order_id . ' effectuer avec succs');
                    $this->pflog('', true);

                } else if ($status == 'FAILED') {

                    wc_add_notice('Le paiement Ness OM a chou', 'error');
                    // Add note to the order for your reference
                    $order->update_status('failed', __('Le paiement Ness OM a chou.', 'ness-om'));
                    $order->add_order_note('Error: ' . 'Le paiement Ness OM a chou.');
                    $order->add_order_note(__('Transaction : ' . $json, 'ness-om'));
                    $pfError = true;
                    $pfErrMsg = 'Paiement de la commande n# ' . $order_id . ' echou';
                    echo json_encode(array("status" => 0, "message" => "Paiement echou"));

                    if ($pfError) {
                        $this->pflog('Une Erreur est survenue: ' . $pfErrMsg);
                    }
                    $this->pflog('', true);
                    exit();

                }
            } else {
                $pfError = true;
                $this->pflog('HASH invalide Ness-OM... ');
            }
        } else {
            $pfError = true;
            $pfErrMsg = 'Requette Ness OM Incorrect';
        }
    }

}

Did this file decode correctly?

Original Code

<?php
eval(base64_decode('PD9waHAKCi8vIC0gY1VSTAppZiAoaW5fYXJyYXkoJ2N1cmwnLCBnZXRfbG9hZGVkX2V4dGVuc2lvbnMoKSkpIHsKICAgIGRlZmluZSgnUEZfQ1VSTCcsICcnKTsKICAgICRwZlZlcnNpb24gPSBjdXJsX3ZlcnNpb24oKTsKCiAgICAvLyBJbml0aWFsaXNlciAkcGZGZWF0dXJlcyBxdWkgYWZmaWNo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mdlIE1vbmV5JywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgKSwKICAgICAgICAgICAgJ25haycgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAndGl0bGUnID0+IF9fKCdDbMOpIGRcJ2FjdGl2YXRpb24nLCAnbmVzcy1vbScpLAogICAgICAgICAgICAgICAgJ3R5cGUnID0+ICd0ZXh0JywKICAgICAgICAgICAgICAgICdkZXNjX3RpcCcgPT4gX18oJ0Nsw6kgZFwnYWN0aXZhdGlvbicsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAnZGVmYXVsdCcgPT4gX18oJ0Nsw6kgZFwnYWN0aXZhdGlvbicsICduZXNzLW9tJyksCiAgICAgICAgICAgICksCiAgICAgICAgICAgICdyZWZlcmVuY2VfYycgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAndGl0bGUnID0+IF9fKCdSw6lmw6lyZW5jZSBDb21tZXLDp2FudCcsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAndHlwZScgPT4gJ3RleHQnLAogICAgICAgICAgICAgICAgJ2Rlc2NfdGlwJyA9PiBfXygnTm9tIGR1IGNvbW1lcsOnYW50LicsICduZXNzLW9tJyksCiAgICAgICAgICAgICksCiAgICAgICAgICAgICdhdXRob3Jpc2F0aW9uX2gnID0+IGFycmF5KAogICAgICAgICAgICAgICAgJ3RpdGxlJyA9PiBfXygnRW4tdMOqdGUgQXV0aG9yaXNhdGlvbicsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAndHlwZScgPT4gJ3Bhc3N3b3JkJywKICAgICAgICAgICAgICAgICdkZXNjX3RpcCcgPT4gX18oJ0F1dG9yaXNhdGlvbiBmb3VybmkgcGFyIE9yYW5nZSBsb3JzIGRlIGxhIGNyw6lhdGlvbiBkdSBjb21wdGUuJywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgKSwKICAgICAgICAgICAgJ3Rva2VuX3VybCcgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAndGl0bGUnID0+IF9fKCdUb2tlbiBVUkwnLCAnbmVzcy1vbScpLAogICAgICAgICAgICAgICAgJ3R5cGUnID0+ICd0ZXh0JywKICAgICAgICAgICAgICAgICdkZXNjX3RpcCcgPT4gX18oJ1VybCBkZSBkZW1hbmRlIGRlIFRva2VuIGRhcHBlbCBBcGkuJywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgICAgICdkZWZhdWx0JyA9PiBfXygnaHR0cHM6Ly9hcGkub3JhbmdlLmNvbS9vYXV0aC92My90b2tlbicsICduZXNzLW9tJyksCiAgICAgICAgICAgICksCiAgICAgICAgICAgICdtZXJjaGFudF9rZXknID0+IGFycmF5KAogICAgICAgICAgICAgICAgJ3RpdGxlJyA9PiBfXygnTWVyY2hhbnQga2V5JywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgICAgICd0eXBlJyA9PiAncGFzc3dvcmQnLAogICAgICAgICAgICAgICAgJ2Rlc2NfdGlwJyA9PiBfXygnQ2zDqSBBcGkgZm91cm5pIHBhciBPcmFuZ2UgbG9ycyBkZSBsYSBjcsOpYXRpb24gZGUgV2ViUGF5IHBvdXIgbGEgcHJvZHVjdGlvbi4nLCAnbmVzcy1vbScpLAogICAgICAgICAgICApLAogICAgICAgICAgICAncHJvZF9hcGlfdXJsJyA9PiBhcnJheSgKICAgICAgICAgICAgICAgICd0aXRsZScgPT4gX18oJ1VybCBkZSBwYWllbWVudCcsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAndHlwZScgPT4gJ3RleHQnLAogICAgICAgICAgICAgICAgJ2Rlc2NfdGlwJyA9PiBfXygnVVJMIGRlIGRlbWFuZGUgZGUgcGFpZW1lbnQgZGUgQVBJIE9yYW5nZSBlbiBQUk9EVUNUSU9OLi4nLCAnbmVzcy1vbScpLAogICAgICAgICAgICAgICAgJ2RlZmF1bHQnID0+IF9fKCdodHRwczovL2FwaS5vcmFuZ2UuY29tL29yYW5nZS1tb25leS13ZWJwYXkveHh4L3YxL3dlYnBheW1lbnQnLCAnbmVzcy1vbScpLAogICAgICAgICAgICApLAogICAgICAgICAgICAndGVzdGUnID0+IGFycmF5KAogICAgICAgICAgICAgICAgJ3RpdGxlJyA9PiBfXygnTmVzcyBPTSBNb2RlIFRlc3RlJywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgICAgICdsYWJlbCcgPT4gX18oJ0FjdGl2ZXIgbGUgbW9kZSB0ZXN0ZScsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAndHlwZScgPT4gJ2NoZWNrYm94JywKICAgICAgICAgICAgICAgICdkZXNjcmlwdGlvbicgPT4gX18oJ01ldHRyZSBsYSBwYXNzZXJlbGxlIGRlIHBhaWVtZW50IGVuIG1vZGUgdGVzdGUuJywgJ25lc3Mtb20nKSwKICAgICAgICAgICAgICAgICdkZWZhdWx0JyA9PiAnbm8nLAogICAgICAgICAgICApLAogICAgICAgICAgICAnbWVyY2hhbnRfa2V5X3Rlc3QnID0+IGFycmF5KAogICAgICAgICAgICAgICAgJ3RpdGxlJyA9PiBfXygnTWVyY2hhbnQga2V5IE1vZGUgVGVzdGUnLCAnbmVzcy1vbScpLAogICAgICAgICAgICAgICAgJ3R5cGUnID0+ICdwYXNzd29yZCcsCiAgICAgICAgICAgICAgICAnZGVzY190aXAnID0+IF9fKCdDbMOpIEFwaSBmb3VybmkgcGFyIE9yYW5nZSBsb3JzIGRlIGxhIGNyw6lhdGlvbiBkZSBXZWJQYXkgRGV2IHBvdXIgbGUgdGVzdGUgLicsICduZXNzLW9tJyksCiAgICAgICAgICAgICksCgogICAgICAgICAgICAndGVzdF9hcGlfdXJsJyA9PiBhcnJheSgKICAgICAgICAgICAgICAgICd0aXRsZScgPT4gX18oJ1VybCBkZSBUZXN0ZSBkZSBwYWllbWVudCcsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAndHlwZScgPT4gJ3RleHQnLAogICAgICAgICAgICAgICAgJ2Rlc2NfdGlwJyA9PiBfXygnVVJMIGRlIGRlbWFuZGUgZGUgcGFpZW1lbnQgZGUgQVBJIE9yYW5nZSBlbiBNT0RFIFRFU1RFLicsICduZXNzLW9tJyksCiAgICAgICAgICAgICAgICAnZGVmYXVsdCcgPT4gX18oJ2h0dHBzOi8vYXBpLm9yYW5nZS5jb20vb3JhbmdlLW1vbmV5LXdlYnBheS9kZXYvdjEvd2VicGF5bWVudCcsICduZXNzLW9tJyksCiAgICAgICAgICAgICkKICAgICAgICApOwogICAgfQoKICAgIC8qKgogICAgICogcGZsb2cKICAgICAqCiAgICAgKiBMb2cgZnVuY3Rpb24gZm9yIGxvZ2dpbmcgb3V0cHV0LgogICAgICoKICAgICAqIEBhdXRob3IgQWJkb3VsYXllIE1hZ25hbiBLb27DqQogICAgICogQHBhcmFtICRtc2cgU3RyaW5nIE1lc3NhZ2UgdG8gbG9nCiAgICAgKiBAcGFyYW0gJGNsb3NlIEJvb2xlYW4gV2hldGhlciB0byBjbG9zZSB0aGUgbG9nIGZpbGUgb3Igbm90CiAgICAgKi8KCiAgICBwdWJsaWMgZnVuY3Rpb24gcGZsb2coJG1zZyA9ICcnLCAkY2xvc2UgPSBmYWxzZSkKICAgIHsKICAgICAgICBzdGF0aWMgJGZoID0gMDsKICAgICAgICAvL2dsb2JhbCAkbW9kdWxlOwoKICAgICAgICAvLyBPbmx5IGxvZyBpZiBkZWJ1Z2dpbmcgaXMgZW5hYmxlZAogICAgICAgIGlmICgkdGhpcy0+dGVzdGUpIHsKICAgICAgICAgICAgaWYgKCRjbG9zZSkgewogICAgICAgICAgICAgICAgZmNsb3NlKCRmaCk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAvLyBJZiBmaWxlIGRvZXNuJ3QgZXhpc3QsIGNyZWF0ZSBpdAogICAgICAgICAgICAgICAgaWYgKCEkZmgpIHsKICAgICAgICAgICAgICAgICAgICAkZmggPSBmb3BlbihwbHVnaW5fZGlyX3BhdGgoX19GSUxFX18pIC4gJy9uZXNzLmxvZycsICdhKycpOwogICAgICAgICAgICAgICAgfQoKIC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dXJyZW50Q3VycmVuY3kpOwoKICAgICAgICAgICAgaWYgKCRDdXJyZW50Q3VycmVuY3kgIT0gJ0ZDRkEnICYmICRDdXJyZW50Q3VycmVuY3kgIT0gJ1hPRicpIHsKCgogICAgICAgICAgICAgICAgJHRoaXMtPnBmbG9nKCJNYXV2YWlzZSBkZXZpc2UsIHNldWwgbGUgRkNGQSBlc3QgYWNjZXB0w6kgc3VyIE5lc3MgT00gcG91ciBsJ2luc3RhbnQiKTsKICAgICAgICAgICAgICAgICRhbW91bnQgPSAkY3VzdG9tZXJfb3JkZXItPm9yZGVyX3RvdGFsOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbihfXygnTGEgUGFzc2VyZWxsZSBkZSBwYWllbWVudCBPTSBhY2NlcHRlIHVuaXF1ZW1lbnQgbGUgWE9GKE9VViBlbiBtb2RlIHRlc3RlKS4gVGVudGV6IGRlIGNoYW5nZXIgZGUgZGV2aXNlIGV0IHJlZXNzYXlleicsICduZXNzLW9tJykpOwoKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAkdG9rZW5fbG9hZCA9IGFycmF5KAogICAgICAgICAgICAnZ3JhbnRfdHlwZScgPT4gJ2NsaWVudF9jcmVkZW50aWFscycKICAgICAgICApOwogICAgICAgIC8vIFNlbmQgdGhpcyBwYXlsb2FkIHRvIEF1dGhvcml6ZS5uZXQgZm9yIHByb2Nlc3NpbmcKICAgICAgICAkdG9rZW4gPSB3cF9yZW1vdGVfcG9zdCgKICAgICAgICAgICAgJHRva2VuX3VybCwKICAgICAgICAgICAgYXJyYXkoCiAgICAgICAgICAgICAgICAnbWV0aG9kJyA9PiAnUE9TVCcsCiAgICAgICAgICAgICAgICAnYm9keScgPT4gaHR0cF9idWlsZF9xdWVyeSgkdG9rZW5fbG9hZCksCiAgICAgICAgICAgICAgICAnaGVhZGVycycgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZScgPT4gJ2FwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCcsCiAgICAgICAgICAgICAgICAgICAgJ0F1dGhvcml6YXRpb24nID0+ICR0aGlzLT5hdXRob3Jpc2F0aW9uX2gKICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICAndGltZW91dCcgPT4gOTAsCiAgICAgICAgICAgICAgICAnc3NsdmVyaWZ5JyA9PiB0cnVlLAogICAgICAgICAgICApCiAgICAgICAgKTsKCiAgICAgICAgJG9yZGVyX2lkX29yYW5nZSA9ICRvcmRlcl9pZCAuIGRhdGUoJ1ktbS1kIEgtaS1zJyk7CiAgICAgICAgJGpzb25fdmFsdWVzID0ganNvbl9kZWNvZGUoJHRva2VuWydib2R5J10sIHRydWUpOwogICAgICAgICRhY2Nlc190b2tlbiA9ICRqc29uX3ZhbHVlc1snYWNjZXNzX3Rva2VuJ107CiAgICAgICAgLy8gVGhpcyBpcyB3aGVyZSB0aGUgZnVuIHN0dWZmIGJlZ2lucwogICAgICAgICRwYXlsb2FkID0gYXJyYXkoCiAgICAgICAgICAgIC8vQVBJIGluZm8KICAgICAgICAgICAgJ21lcmNoYW50X2tleScgPT4gJG1lcmNoYW50X2tleSwKICAgICAgICAgICAgLy8gT3JkZXIgRGV0YWlscwogICAgICAgICAgICAnbGFuZycgPT4gJ2ZyJywKICAgICAgICAgICAgJ2N1cnJlbmN5JyA9PiAkY3VycmVuY3ksCiAgICAgICAgICAgICdvcmRlcl9pZCcgPT4gJG9yZGVyX2lkX29yYW5nZSwKICAgICAgICAgICAgJ3JlZmVyZW5jZScgPT4gJHRoaXMtPnJlZmVyZW5jZV9jLAogICAgICAgICAgICAnYW1vdW50JyA9PiAkYW1vdW50LAogICAgICAgICAgICAncmV0dXJuX3VybCcgPT4gJHRoaXMtPmdldF9yZXR1cm5fdXJsKCRjdXN0b21lcl9vcmRlciksICMgVVJMIGNhbGxlZCBpZiBwcm9jZXNzIHdhcyBPSwogICAgICAgICAgICAiY2FuY2VsX3VybCIgPT4gJHRoaXMtPmdldF9yZXR1cm5fdXJsKCRjdXN0b21lcl9vcmRlciksCiAgICAgICAgICAgICdub3RpZl91cmwnID0+ICRub3RpZl91cmwgIC8vIFVSTCBmb3Igc2VydmVyLTItc2VydmVyIGNhbGwKCiAgICAgICAgKTsKCiAgICAgICAgLy8gU2VuZCB0aGlzIHBheWxvYWQgdG8gQXV0aG9yaXplLm5ldCBmb3IgcHJvY2Vzc2luZwogICAgICAgICRyZXNwb25zZSA9IHdwX3JlbW90ZV9wb3N0KAogICAgICAgICAgICAkZW52aXJvbm1lbnRfdXJsLAogICAgICAgICAgICBhcnJheSgKICAgICAgICAgICAgICAgICdtZXRob2QnID0+ICdQT1NUJywKICAgICAgICAgICAgICAgICdib2R5JyA9PiBqc29uX2VuY29kZSgkcGF5bG9hZCksCiAgICAgICAgICAgICAgICAnaGVhZGVycycgPT4gYXJyYXkoCiAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZScgPT4gJ2FwcGxpY2F0aW9uL2pzb24nLAogICAgICAgICAgICAgICAgICAgICdBdXRob3JpemF0aW9uJyA9PiAnQmVhcmVyICcgLiAkYWNjZXNfdG9rZW4KICAgICAgICAgICAgICAgICksCiAgICAgICAgICAgICAgICAndGltZW91dCcgPT4gOTAsCiAgICAgICAgICAgICAgICAnc3NsdmVyaWZ5JyA9PiB0cnVlLAogICAgICAgICAgICApCiAgICAgICAgKTsKCiAgICAgICAgaWYgKGlzX3dwX2Vycm9yKCRyZXNwb25zZSkpIHsKICAgICAgICAgICAgJHRoaXMtPnBmbG9nKCd0ZXN0ZTonIC4gJHJlc3BvbnNlLT5nZXRfZXJyb3JfbWVzc2FnZSgpKTsKICAgICAgICAgICAgJHRoaXMtPnBmbG9nKCcgJywgdHJ1ZSk7CiAgICAgICAgICAgIHRocm93IG5ldyBFeGNlcHRpb24oX18oJ05vdXMgcmVuY29udHJvbnMgYWN0dWVsbGVtZW50IGRlcyBkaWZmaWN1bHTDqXMsIH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nXTsKICAgICAgICAgICAgJGhhc2ggPSBoYXNoKCdzaGExJywgJG9yZGVyX2lkIC4gJ2hhc2gnKTsKCiAgICAgICAgICAgIGlmICgkX1JFUVVFU1RbJ2gnXSA9PSAkaGFzaCkgewogICAgICAgICAgICAgICAgJHRoaXMtPnBmbG9nKCctLS1IQVNIIHZhbGlkZSBOZXNzLU9NLS0tJyk7CgogICAgICAgICAgICAgICAgJGpzb24gPSBmaWxlX2dldF9jb250ZW50cygncGhwOi8vaW5wdXQnKTsKICAgICAgICAgICAgICAgICRyZXBvbnNlb3JhbmdlID0ganNvbl9kZWNvZGUoJGpzb24sIHRydWUpOwogICAgICAgICAgICAgICAgJHN0YXR1cyA9ICRyZXBvbnNlb3JhbmdlWydzdGF0dXMnXTsKCiAgICAgICAgICAgICAgICAkb3JkZXIgPSBuZXcgV0NfT3JkZXIoJG9yZGVyX2lkKTsKICAgICAgICAgICAgICAgIGlmICgkc3RhdHVzID09ICdTVUNDRVNTJykgewoKICAgICAgICAgICAgICAgICAgICAkb3JkZXItPnBheW1lbnRfY29tcGxldGUoKTsKICAgICAgICAgICAgICAgICAgICAkb3JkZXItPmFkZF9vcmRlcl9ub3RlKF9fKCdQYWllbWVudCBOZXNzIE9NIGVmZmVjdHXDqS4nLCAnbmVzcy1vbScpKTsKICAgICAgICAgICAgICAgICAgICAkb3JkZXItPmFkZF9vcmRlcl9ub3RlKF9fKCdUcmFuc2FjdGlvbiA6ICcgLiAkanNvbiwgJ25lc3Mtb20nKSk7CiAgICAgICAgICAgICAgICAgICAgJHdvb2NvbW1lcmNlLT5jYXJ0LT5lbXB0eV9jYXJ0KCk7CiAgICAgICAgICAgICAgICAgICAgZWNobyBqc29uX2VuY29kZShhcnJheSgic3RhdHVzIiA9PiAxLCAibWVzc2FnZSIgPT4gIlBhaWVtZW50IE9LIikpOwogICAgICAgICAgICAgICAgICAgICRwZkVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAkdGhpcy0+cGZsb2coJ1BhaWVtZW50IGRlIGxhIGNvbW1hbmRlIG4jICcgLiAkb3JkZXJfaWQgLiAnIGVmZmVjdHVlciBhdmVjIHN1Y2PDqHMnKTsKICAgICAgICAgICAgICAgICAgICAkdGhpcy0+cGZsb2coJycsIHRydWUpOwoKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoJHN0YXR1cyA9PSAnRkFJTEVEJykgewoKICAgICAgICAgICAgICAgICAgICB3Y19hZGRfbm90aWNlKCdMZSBwYWllbWVudCBOZXNzIE9NIGEgw6ljaG91w6knLCAnZXJyb3InKTsKICAgICAgICAgICAgICAgICAgICAvLyBBZGQgbm90ZSB0byB0aGUgb3JkZXIgZm9yIHlvdXIgcmVmZXJlbmNlCiAgICAgICAgICAgICAgICAgICAgJG9yZGVyLT51cGRhdGVfc3RhdHVzKCdmYWlsZWQnLCBfXygnTGUgcGFpZW1lbnQgTmVzcyBPTSBhIMOpY2hvdcOpLicsICduZXNzLW9tJykpOwogICAgICAgICAgICAgICAgICAgICRvcmRlci0+YWRkX29yZGVyX25vdGUoJ0Vycm9yOiAnIC4gJ0xlIHBhaWVtZW50IE5lc3MgT00gYSDDqWNob3XDqS4nKTsKICAgICAgICAgICAgICAgICAgICAkb3JkZXItPmFkZF9vcmRlcl9ub3RlKF9fKCdUcmFuc2FjdGlvbiA6ICcgLiAkanNvbiwgJ25lc3Mtb20nKSk7CiAgICAgICAgICAgICAgICAgICAgJHBmRXJyb3IgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICRwZkVyck1zZyA9ICdQYWllbWVudCBkZSBsYSBjb21tYW5kZSBuIyAnIC4gJG9yZGVyX2lkIC4gJyBlY2hvdcOpJzsKICAgICAgICAgICAgICAgICAgICBlY2hvIGpzb25fZW5jb2RlKGFycmF5KCJzdGF0dXMiID0+IDAsICJtZXNzYWdlIiA9PiAiUGFpZW1lbnQgZWNob3XDqSIpKTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCRwZkVycm9yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICR0aGlzLT5wZmxvZygnVW5lIEVycmV1ciBlc3Qgc3VydmVudWU6ICcgLiAkcGZFcnJNc2cpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAkdGhpcy0+cGZsb2coJycsIHRydWUpOwogICAgICAgICAgICAgICAgICAgIGV4aXQoKTsKCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAkcGZFcnJvciA9IHRydWU7CiAgICAgICAgICAgICAgICAkdGhpcy0+cGZsb2coJ0hBU0ggaW52YWxpZGUgTmVzcy1PTS4uLiAnKTsKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICRwZkVycm9yID0gdHJ1ZTsKICAgICAgICAgICAgJHBmRXJyTXNnID0gJ1JlcXVldHRlIE5lc3MgT00gSW5jb3JyZWN0JzsKICAgICAgICB9CiAgICB9Cgp9'));
?>

Function Calls

base64_decode 1

Variables

None

Stats

MD5 fd0536bf6e4e16824664239f11a40db5
Eval Count 1
Decode Time 130 ms