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 namespace Informunity\Rest; use Exception; use Informunity\Astman\CheckAstDB;..

Decoded Output download

<?php 
 
namespace Informunity\Rest; 
 
use Exception; 
use Informunity\Astman\CheckAstDB; 
use Informunity\Log; 
use Informunity\ModuleStaticConfig; 
 
class Rest 
{ 
    public $queryStart; 
    public $config; 
    protected $data; 
    protected $token; 
    private $Log; 
    private $checkConnection = 1; 
    private $currentTimeout; 
 
    public function __construct($config, $data = array()) 
    { 
        goto J8IIb; 
        J8IIb: 
        $this->setStartQuery(); 
        goto qxOC0; 
        vYgGP: 
        $this->currentTimeout = $this->config["timeout"]; 
        goto gDNlD; 
        gDNlD: 
        $callID = empty($config["asterisk_callid"]) ? "[Interface]" : $config["asterisk_callid"]; 
        goto P68ml; 
        P68ml: 
        $this->Log = new Log(array("header" => "To Bitrix24", "asterisk_callid" => $callID), $config["logging"]); 
        goto bfjJV; 
        GwN8l: 
        $this->data = $data; 
        goto vYgGP; 
        qxOC0: 
        $this->config = $config; 
        goto GwN8l; 
        bfjJV: 
    } 
 
    function __destruct() 
    { 
        return false; 
    } 
 
    private function checkConnectToken() 
    { 
        $this->checkConnection++; 
    } 
 
    private function getTokenAttempt() 
    { 
        goto viqUY; 
        MUk5T: 
        $ts = $date->getTimestamp() - $this->queryStart; 
        goto Fdbv1; 
        Fdbv1: 
        $this->currentTimeout = $this->currentTimeout - $ts; 
        goto SVst9; 
        viqUY: 
        $date = new \DateTime(); 
        goto MUk5T; 
        v3QN3: 
        return false; 
        goto gaxUy; 
        gaxUy: yQ0Ph: 
        goto JF8zK; 
        SVst9: 
        if (!($ts > $this->currentTimeout)) { 
            goto yQ0Ph; 
        } 
        goto v3QN3; 
        JF8zK: 
        return true; 
        goto nR81U; 
        nR81U: 
    } 
 
    private function endRest() 
    { 
        goto XsSvm; 
        rMQUr: te0XS: 
        goto ZMWVz; 
        N9MYD: 
        $ts = $date->getTimestamp() - $this->queryStart; 
        goto yaAbH; 
        XsSvm: 
        $date = new \DateTime(); 
        goto N9MYD; 
        c1kBz: 
        return false; 
        goto rMQUr; 
        yaAbH: 
        if (!($ts > $this->currentTimeout)) { 
            goto te0XS; 
        } 
        goto c1kBz; 
        ZMWVz: 
        return true; 
        goto g5zZL; 
        g5zZL: 
    } 
 
    protected function query($method, $fields = array(), $skipTimeout = false) 
    { 
        goto CBAYp; 
        qULig: 
        if ($this->getTokenAttempt()) { 
            goto B3E_8; 
        } 
        goto MYiCl; 
        VHxW8: kBbK4: 
        goto YoAuo; 
        g0SO5: 
        return $result; 
        goto fdXvA; 
        MYiCl: 
        return false; 
        goto Xouzm; 
        c8O43: 
        $this->config["expires"] = 0; 
        goto qULig; 
        AIgOT: 
        if (!file_exists($this->config["conf_dir"] . "debug")) { 
            goto wKvi5; 
        } 
        goto PIbS8; 
        tyWd4: wKvi5: 
        goto Uzhkg; 
        c4KQ9: 
        $this->token = encrypt_decrypt("decrypt", $this->getToken()); 
        goto Q8nny; 
        Q8nny: kwVjP: 
        goto SzzAt; 
        qJKOp: 
        $execMethod = Methods::load($this->config)->Get($method); 
        goto Sg_OW; 
        Xouzm: 
        goto kBbK4; 
        goto iZhn9; 
        PIbS8: 
        var_dump($result); 
        goto JFoeC; 
        QN6ml: 
        $this->currentTimeout = 180; 
        goto XdkNq; 
        ZVYzp: 
        switch ($method) { 
            case "task.item.addfile": 
            case "crm.activity.update": 
            case "telephony.externalCall.attachRecord": 
                goto AvKY5; 
            default: 
                goto HRi3N; 
                j5XBt: 
                $optarray[CURLOPT_TIMEOUT] = $this->currentTimeout; 
                goto R7RKo; 
                HRi3N: 
                $optarray[CURLOPT_CONNECTTIMEOUT] = $this->currentTimeout; 
                goto j5XBt; 
                R7RKo: 
                goto AvKY5; 
                goto qotZ3; 
                qotZ3: 
        } 
        goto Qi_K0; 
        I9dfF: AvKY5: 
        goto bq_ha; 
        XdkNq: S85ut: 
        goto xQ60v; 
        bq_ha: 
        goto S85ut; 
        goto XcQEC; 
        bRHyy: 
        unset($optarray_log["FILE_CONTENT"], $optarray_log["FILE"], $optarray_log["auth"], $optarray_log["token"]); 
        goto qJKOp; 
        dlOMY: 
        $this->Log->toFile(array("Request" => $execMethod, $optarray_log)); 
        goto lyw24; 
        JFoeC: 
        file_put_contents($this->config["conf_dir"] . "debug", $result . "\xa", 8); 
        goto tyWd4; 
        yUvQC: 
        return false; 
        goto jt0B7; 
        dmt67: 
        $this->Log->toFile(array("Response" => $execMethod, $result)); 
        goto HG25X; 
        qIJkL: 
        if ($skipTimeout) { 
            goto qQZLy; 
        } 
        goto ZVYzp; 
        lyw24: 
        $result = curl_exec($curl); 
        goto AIgOT; 
        Sg_OW: 
        $url = $this->config["client_server"] . "/rest/" . $execMethod; 
        goto cwoWU; 
        jt0B7: 
        goto kwVjP; 
        goto wgBcG; 
        CBAYp: 
        if ($this->endRest()) { 
            goto k2TOO; 
        } 
        goto yUvQC; 
        Yh5cn: 
        $curl = curl_init(); 
        goto HK90J; 
        iZhn9: B3E_8: 
        goto NcEQr; 
        HK90J: 
        $optarray = array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTREDIR => 3, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $postFields); 
        goto qIJkL; 
        cwoWU: 
        $postFields = http_build_query($fields); 
        goto Yh5cn; 
        mJHS7: 
        $result = json_decode($result, true); 
        goto dmt67; 
        Uzhkg: 
        curl_close($curl); 
        goto mJHS7; 
        NcEQr: 
        $result = $this->query($method, $fields); 
        goto VHxW8; 
        XcQEC: qQZLy: 
        goto QN6ml; 
        YoAuo: BVxHc: 
        goto g0SO5; 
        HG25X: 
        if (!(isset($result["error"]) && ($result["error"] == "NO_AUTH_FOUND" || $result["error"] == "invalid_token" || $result["error"] == "expired_token"))) { 
            goto BVxHc; 
        } 
        goto c8O43; 
        JuXAD: 
        $optarray_log = $fields; 
        goto bRHyy; 
        Qi_K0: YZ3dh: 
        goto I9dfF; 
        SzzAt: 
        $fields["auth"] = $this->token; 
        goto JuXAD; 
        xQ60v: 
        curl_setopt_array($curl, $optarray); 
        goto dlOMY; 
        wgBcG: k2TOO: 
        goto c4KQ9; 
        fdXvA: 
    } 
 
    private function getToken() 
    { 
        goto K1UD6; 
        EyomB: 
        $this->config["token"] = filter_var($result["access_token"], FILTER_SANITIZE_URL); 
        goto kzzRm; 
        IT4I3: 
        try { 
            goto d6fst; 
            WG1NM: 
            $fields = array("refresh_token" => "refresh_token", "member_id" => "member_id", "pbx_version" => "version"); 
            goto z4gJT; 
            oIBCC: 
            CheckAstDB::Run(); 
            goto fIfgh; 
            z4gJT: 
            $result = $this->config["License"]->Request($moduleConfig["license"]["server"] . $moduleConfig["license"]["route"]["update_token"], '', $fields); 
            goto oIBCC; 
            d6fst: 
            $moduleConfig = ModuleStaticConfig::load()->get(); 
            goto WG1NM; 
            fIfgh: 
        } catch (Exception $e) { 
            $this->checkConnectToken(); 
            return false; 
        } 
        goto bR1nz; 
        hyYUh: 
        $expires = $this->config["expires"]; 
        goto Bn9kz; 
        NbTLz: 
        $token = $this->config["token"]; 
        goto OzS06; 
        xH97d: 
        return false; 
        goto CtBgJ; 
        bR1nz: 
        if (!(!empty($result["access_token"]) && !empty($result["refresh_token"]) && !empty($result["expires"]))) { 
            goto ZBUE1; 
        } 
        goto EyomB; 
        K1UD6: 
        $token = null; 
        goto hyYUh; 
        tY7Gg: aGPdd: 
        goto NbTLz; 
        OzS06: 
        if (!empty($this->config["token"])) { 
            goto R238D; 
        } 
        goto xH97d; 
        EHZiv: ZBUE1: 
        goto tY7Gg; 
        vwX0o: 
        $db->query("UPDATE asterisk.iub24 SET " . implode(",", $q_array) . " WHERE id='0'"); 
        goto EHZiv; 
        CtBgJ: R238D: 
        goto OwT2l; 
        OwT2l: 
        return $token; 
        goto xBiok; 
        Bo9fQ: global $db; 
        goto vwX0o; 
        kzzRm: 
        $q_array = array("token" => "token='" . filter_var($result["access_token"], FILTER_SANITIZE_URL) . "'", "refresh_token" => "refresh_token='" . filter_var($result["refresh_token"], FILTER_SANITIZE_URL) . "'", "expires" => "expires='" . filter_var($result["expires"], FILTER_SANITIZE_URL) . "'", "member_id" => "member_id='" . filter_var($result["member_id"], FILTER_SANITIZE_URL) . "'"); 
        goto Bo9fQ; 
        Bn9kz: 
        if (!($expires - time() < 5 * 60 && !empty($this->config["refresh_token"]))) { 
            goto aGPdd; 
        } 
        goto IT4I3; 
        xBiok: 
    } 
 
    public function setStartQuery() 
    { 
        $date = new \DateTime(); 
        $this->queryStart = $date->getTimestamp(); 
    } 
} 
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Informunity\Rest;

use Exception;
use Informunity\Astman\CheckAstDB;
use Informunity\Log;
use Informunity\ModuleStaticConfig;

class Rest
{
    public $queryStart;
    public $config;
    protected $data;
    protected $token;
    private $Log;
    private $checkConnection = 1;
    private $currentTimeout;

    public function __construct($config, $data = array())
    {
        goto J8IIb;
        J8IIb:
        $this->setStartQuery();
        goto qxOC0;
        vYgGP:
        $this->currentTimeout = $this->config["\x74\x69\x6d\x65\x6f\x75\x74"];
        goto gDNlD;
        gDNlD:
        $callID = empty($config["\x61\x73\164\x65\162\x69\x73\x6b\x5f\143\x61\154\154\151\144"]) ? "\x5b\x49\156\164\x65\x72\x66\141\143\145\x5d" : $config["\x61\x73\164\x65\162\151\x73\x6b\x5f\143\141\x6c\x6c\151\144"];
        goto P68ml;
        P68ml:
        $this->Log = new Log(array("\150\x65\141\144\x65\x72" => "\x54\157\40\x42\x69\164\162\151\x78\62\x34", "\141\163\x74\145\x72\151\x73\153\x5f\143\x61\x6c\x6c\x69\x64" => $callID), $config["\154\157\147\147\151\x6e\x67"]);
        goto bfjJV;
        GwN8l:
        $this->data = $data;
        goto vYgGP;
        qxOC0:
        $this->config = $config;
        goto GwN8l;
        bfjJV:
    }

    function __destruct()
    {
        return false;
    }

    private function checkConnectToken()
    {
        $this->checkConnection++;
    }

    private function getTokenAttempt()
    {
        goto viqUY;
        MUk5T:
        $ts = $date->getTimestamp() - $this->queryStart;
        goto Fdbv1;
        Fdbv1:
        $this->currentTimeout = $this->currentTimeout - $ts;
        goto SVst9;
        viqUY:
        $date = new \DateTime();
        goto MUk5T;
        v3QN3:
        return false;
        goto gaxUy;
        gaxUy: yQ0Ph:
        goto JF8zK;
        SVst9:
        if (!($ts > $this->currentTimeout)) {
            goto yQ0Ph;
        }
        goto v3QN3;
        JF8zK:
        return true;
        goto nR81U;
        nR81U:
    }

    private function endRest()
    {
        goto XsSvm;
        rMQUr: te0XS:
        goto ZMWVz;
        N9MYD:
        $ts = $date->getTimestamp() - $this->queryStart;
        goto yaAbH;
        XsSvm:
        $date = new \DateTime();
        goto N9MYD;
        c1kBz:
        return false;
        goto rMQUr;
        yaAbH:
        if (!($ts > $this->currentTimeout)) {
            goto te0XS;
        }
        goto c1kBz;
        ZMWVz:
        return true;
        goto g5zZL;
        g5zZL:
    }

    protected function query($method, $fields = array(), $skipTimeout = false)
    {
        goto CBAYp;
        qULig:
        if ($this->getTokenAttempt()) {
            goto B3E_8;
        }
        goto MYiCl;
        VHxW8: kBbK4:
        goto YoAuo;
        g0SO5:
        return $result;
        goto fdXvA;
        MYiCl:
        return false;
        goto Xouzm;
        c8O43:
        $this->config["\x65\x78\x70\151\162\x65\x73"] = 0;
        goto qULig;
        AIgOT:
        if (!file_exists($this->config["\x63\x6f\x6e\146\x5f\144\151\162"] . "\x64\145\x62\165\x67")) {
            goto wKvi5;
        }
        goto PIbS8;
        tyWd4: wKvi5:
        goto Uzhkg;
        c4KQ9:
        $this->token = encrypt_decrypt("\144\x65\x63\162\x79\160\164", $this->getToken());
        goto Q8nny;
        Q8nny: kwVjP:
        goto SzzAt;
        qJKOp:
        $execMethod = Methods::load($this->config)->Get($method);
        goto Sg_OW;
        Xouzm:
        goto kBbK4;
        goto iZhn9;
        PIbS8:
        var_dump($result);
        goto JFoeC;
        QN6ml:
        $this->currentTimeout = 180;
        goto XdkNq;
        ZVYzp:
        switch ($method) {
            case "\x74\141\x73\x6b\56\x69\x74\x65\155\x2e\141\144\x64\x66\151\154\x65":
            case "\x63\x72\x6d\x2e\141\143\164\x69\166\151\164\x79\56\x75\x70\x64\x61\x74\145":
            case "\x74\145\x6c\x65\x70\x68\x6f\x6e\171\x2e\145\x78\164\145\162\x6e\141\154\x43\141\x6c\x6c\56\x61\164\164\x61\143\x68\122\x65\143\157\x72\x64":
                goto AvKY5;
            default:
                goto HRi3N;
                j5XBt:
                $optarray[CURLOPT_TIMEOUT] = $this->currentTimeout;
                goto R7RKo;
                HRi3N:
                $optarray[CURLOPT_CONNECTTIMEOUT] = $this->currentTimeout;
                goto j5XBt;
                R7RKo:
                goto AvKY5;
                goto qotZ3;
                qotZ3:
        }
        goto Qi_K0;
        I9dfF: AvKY5:
        goto bq_ha;
        XdkNq: S85ut:
        goto xQ60v;
        bq_ha:
        goto S85ut;
        goto XcQEC;
        bRHyy:
        unset($optarray_log["\x46\111\x4c\105\x5f\x43\x4f\116\124\105\x4e\124"], $optarray_log["\x46\x49\114\105"], $optarray_log["\141\x75\x74\x68"], $optarray_log["\164\x6f\x6b\x65\x6e"]);
        goto qJKOp;
        dlOMY:
        $this->Log->toFile(array("\122\x65\x71\165\x65\x73\x74" => $execMethod, $optarray_log));
        goto lyw24;
        JFoeC:
        file_put_contents($this->config["\143\157\156\146\x5f\x64\x69\x72"] . "\144\x65\142\165\147", $result . "\xa", 8);
        goto tyWd4;
        yUvQC:
        return false;
        goto jt0B7;
        dmt67:
        $this->Log->toFile(array("\122\x65\163\x70\x6f\156\x73\145" => $execMethod, $result));
        goto HG25X;
        qIJkL:
        if ($skipTimeout) {
            goto qQZLy;
        }
        goto ZVYzp;
        lyw24:
        $result = curl_exec($curl);
        goto AIgOT;
        Sg_OW:
        $url = $this->config["\143\154\x69\145\x6e\164\137\163\145\x72\166\145\162"] . "\57\162\x65\163\164\x2f" . $execMethod;
        goto cwoWU;
        jt0B7:
        goto kwVjP;
        goto wgBcG;
        CBAYp:
        if ($this->endRest()) {
            goto k2TOO;
        }
        goto yUvQC;
        Yh5cn:
        $curl = curl_init();
        goto HK90J;
        iZhn9: B3E_8:
        goto NcEQr;
        HK90J:
        $optarray = array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => "\120\x4f\123\x54", CURLOPT_POSTREDIR => 3, CURLOPT_VERBOSE => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_URL => $url, CURLOPT_POSTFIELDS => $postFields);
        goto qIJkL;
        cwoWU:
        $postFields = http_build_query($fields);
        goto Yh5cn;
        mJHS7:
        $result = json_decode($result, true);
        goto dmt67;
        Uzhkg:
        curl_close($curl);
        goto mJHS7;
        NcEQr:
        $result = $this->query($method, $fields);
        goto VHxW8;
        XcQEC: qQZLy:
        goto QN6ml;
        YoAuo: BVxHc:
        goto g0SO5;
        HG25X:
        if (!(isset($result["\145\162\x72\157\162"]) && ($result["\145\x72\162\157\x72"] == "\116\x4f\137\101\125\124\x48\137\x46\x4f\125\x4e\x44" || $result["\145\x72\x72\x6f\x72"] == "\151\156\x76\141\x6c\x69\x64\x5f\x74\157\153\x65\x6e" || $result["\x65\162\162\157\x72"] == "\145\x78\160\151\162\x65\x64\x5f\164\157\153\x65\156"))) {
            goto BVxHc;
        }
        goto c8O43;
        JuXAD:
        $optarray_log = $fields;
        goto bRHyy;
        Qi_K0: YZ3dh:
        goto I9dfF;
        SzzAt:
        $fields["\x61\165\x74\150"] = $this->token;
        goto JuXAD;
        xQ60v:
        curl_setopt_array($curl, $optarray);
        goto dlOMY;
        wgBcG: k2TOO:
        goto c4KQ9;
        fdXvA:
    }

    private function getToken()
    {
        goto K1UD6;
        EyomB:
        $this->config["\164\x6f\153\145\156"] = filter_var($result["\x61\143\x63\x65\163\163\137\164\157\x6b\145\x6e"], FILTER_SANITIZE_URL);
        goto kzzRm;
        IT4I3:
        try {
            goto d6fst;
            WG1NM:
            $fields = array("\162\145\146\x72\x65\x73\150\137\164\x6f\x6b\x65\156" => "\162\145\146\x72\x65\163\150\x5f\x74\x6f\153\145\156", "\x6d\145\155\142\145\162\137\x69\x64" => "\x6d\145\155\x62\145\162\137\x69\x64", "\160\x62\x78\137\166\x65\162\x73\151\x6f\x6e" => "\166\x65\x72\x73\151\157\156");
            goto z4gJT;
            oIBCC:
            CheckAstDB::Run();
            goto fIfgh;
            z4gJT:
            $result = $this->config["\114\151\x63\x65\x6e\x73\x65"]->Request($moduleConfig["\154\151\143\x65\156\163\x65"]["\163\x65\162\166\x65\162"] . $moduleConfig["\154\151\x63\145\156\163\x65"]["\162\157\x75\164\145"]["\x75\x70\144\x61\x74\x65\137\164\157\x6b\x65\x6e"], '', $fields);
            goto oIBCC;
            d6fst:
            $moduleConfig = ModuleStaticConfig::load()->get();
            goto WG1NM;
            fIfgh:
        } catch (Exception $e) {
            $this->checkConnectToken();
            return false;
        }
        goto bR1nz;
        hyYUh:
        $expires = $this->config["\145\x78\x70\x69\162\x65\x73"];
        goto Bn9kz;
        NbTLz:
        $token = $this->config["\164\x6f\x6b\x65\156"];
        goto OzS06;
        xH97d:
        return false;
        goto CtBgJ;
        bR1nz:
        if (!(!empty($result["\x61\143\143\145\163\163\137\x74\x6f\153\145\x6e"]) && !empty($result["\x72\x65\x66\162\145\163\150\x5f\x74\x6f\153\145\x6e"]) && !empty($result["\145\x78\x70\x69\x72\145\163"]))) {
            goto ZBUE1;
        }
        goto EyomB;
        K1UD6:
        $token = null;
        goto hyYUh;
        tY7Gg: aGPdd:
        goto NbTLz;
        OzS06:
        if (!empty($this->config["\164\x6f\x6b\145\156"])) {
            goto R238D;
        }
        goto xH97d;
        EHZiv: ZBUE1:
        goto tY7Gg;
        vwX0o:
        $db->query("\125\120\104\101\x54\x45\40\x61\x73\164\145\x72\151\x73\153\56\x69\165\x62\x32\x34\x20\123\105\x54\40" . implode("\54", $q_array) . "\x20\127\x48\x45\x52\x45\x20\x69\144\x3d\x27\x30\47");
        goto EHZiv;
        CtBgJ: R238D:
        goto OwT2l;
        OwT2l:
        return $token;
        goto xBiok;
        Bo9fQ: global $db;
        goto vwX0o;
        kzzRm:
        $q_array = array("\x74\157\153\145\156" => "\x74\157\x6b\145\156\75\47" . filter_var($result["\x61\x63\143\145\163\163\137\x74\157\153\x65\x6e"], FILTER_SANITIZE_URL) . "\47", "\x72\145\146\162\x65\163\x68\137\164\157\x6b\145\x6e" => "\x72\x65\x66\x72\145\163\150\x5f\x74\157\153\145\156\75\x27" . filter_var($result["\x72\x65\x66\x72\x65\163\x68\137\x74\157\x6b\x65\156"], FILTER_SANITIZE_URL) . "\47", "\x65\170\160\151\x72\145\x73" => "\x65\x78\160\x69\162\145\x73\x3d\x27" . filter_var($result["\145\x78\x70\x69\x72\x65\163"], FILTER_SANITIZE_URL) . "\x27", "\x6d\x65\x6d\142\x65\162\137\151\144" => "\x6d\x65\x6d\142\x65\x72\137\151\x64\x3d\47" . filter_var($result["\x6d\145\155\142\145\162\137\151\144"], FILTER_SANITIZE_URL) . "\x27");
        goto Bo9fQ;
        Bn9kz:
        if (!($expires - time() < 5 * 60 && !empty($this->config["\162\x65\x66\x72\145\163\150\137\x74\157\153\x65\x6e"]))) {
            goto aGPdd;
        }
        goto IT4I3;
        xBiok:
    }

    public function setStartQuery()
    {
        $date = new \DateTime();
        $this->queryStart = $date->getTimestamp();
    }
}

Function Calls

None

Variables

None

Stats

MD5 5d463a72fe7480d8642911f5611e913a
Eval Count 0
Decode Time 50 ms