Japanese English

PHP deobfuscation, decryption, reconstruction tool

De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.

*Please note that not all obfuscation codes can be decoded.

Decoded the code below.

<?php /* __________________________________________________ | Built by Clearly IP Inc. | | on 2023-01-02 21:42:57 | |__________________________________________________| */ namespace FreePBX\modules\Clearlysp\CIP\Controllers\v1; use FreePBX\modules\Clearlysp\CIP\Controllers\Base; use DOMDocument; ...



Obfuscated php code

<?php
/*   __________________________________________________
    |  Built by Clearly IP Inc.                        |
    |              on 2023-01-02 21:42:57              |
    |__________________________________________________|
*/
 namespace FreePBX\modules\Clearlysp\CIP\Controllers\v1; use FreePBX\modules\Clearlysp\CIP\Controllers\Base; use DOMDocument; class GlobalProvisioning extends Base { public function globalProvisioning($request, $response, $args) { goto OA24W; VE0sG: $user = $request->getQueryParam("\143\154\157\x75\144\137\165\x73\x65\162\x6e\141\x6d\x65"); goto Jp9Ed; KPhhX: if ($usermanUser) { goto f6Hla; } goto kYuVc; Un9or: return self::returnError($response, _("\123\x6f\x66\164\160\150\157\x6e\145\x20\163\x75\142\x73\143\162\x69\160\164\151\157\156\x20\151\163\x20\156\157\x74\40\141\143\164\x69\166\145"), 404); goto DM6Mn; sHY4k: $this->token = $tokendata["\164\157\x6b\x65\156"]; goto mGo7t; xh6sm: $this->apiurl = $tokendata["\143\x6c\x69\x65\x6e\164\x73"]["\141\x70\151\125\x72\x6c"]; goto sHY4k; VzTp0: $quickdialData = array(); goto dzNhs; nC3Bg: return self::returnAsXML($response, $payload); goto ketzl; SMSja: $allUsers = $this->FreePBX->Clearlysp->getAllQuickDialEntries(); goto vcNQA; vcNQA: $blfData = $this->FreePBX->Clearlysp->getBLFInformation($usermanUser["\151\x64"]); goto A03mI; Jp9Ed: $pass = $request->getQueryParam("\143\x6c\x6f\165\144\137\x70\x61\x73\x73\x77\x6f\x72\144"); goto V4EGo; Ik9lT: $cloudid = $body["\x63\x6c\x6f\x75\x64\x5f\151\x64"]; goto nz6RJ; Jyn8n: $apiconf = json_decode($this->FreePBX->Clearlysp->getApiConfig(), true); goto D27hX; biJmD: return self::returnError($response, _("\x55\156\141\142\x6c\145\x20\x74\157\40\x63\157\x6d\x70\154\x65\164\x65\40\171\157\165\162\40\162\x65\x71\165\x65\x73\x74\x2c\x20\160\154\145\x61\x73\x65\40\143\157\156\x74\141\143\164\40\143\165\x73\x74\157\155\x65\x72\x20\x63\141\162\x65\56"), 400); goto j3tQ_; F50YD: $sort = $apiconf["\161\x75\x69\x63\153\144\x69\141\x6c\x73\157\x72\164\x69\x6e\147"]; goto fQtyI; Q7h9t: f6Hla: goto YHhMp; YHhMp: if (!empty($usermanUser["\x64\x65\x66\141\165\154\164\x5f\145\x78\x74\x65\156\163\x69\x6f\x6e"])) { goto ogh9Q; } goto W3fLD; IQVkV: $cloudid = $request->getQueryParam("\x63\154\157\x75\144\137\151\144"); goto VE0sG; mGo7t: $payload = $this->buildPayload($quickdialData, $usermanUser); goto nC3Bg; j3tQ_: kcKFZ: goto Q2Y7o; V4EGo: f4Nj8: goto N37W5; DM6Mn: mQMLM: goto Q3pRP; RvQs_: if ($tokendata["\x73\165\x62\x73\x63\x72\x69\x70\164\151\x6f\x6e"]) { goto mQMLM; } goto Un9or; g36uk: $permissions = $this->FreePBX->Clearlysp->isAllowed($usermanUser["\151\144"]); goto NFUGI; OA24W: $tokendata = $this->FreePBX->Clearlysp->getTokenData(); goto RvQs_; Q2Y7o: $usermanUser = $this->validateUser($user, $pass); goto KPhhX; skbFi: $body = $request->getParsedBody(); goto Ik9lT; D27hX: if (empty($apiconf["\161\165\151\x63\x6b\144\151\141\154\x73\157\x72\164\x69\156\x67"])) { goto McQPQ; } goto F50YD; W3fLD: return self::returnError($response, _("\x49\x6e\x76\x61\x6c\151\x64\40\125\x73\145\x72\x20\103\x6f\156\146\151\147\165\162\x61\x74\x69\157\156"), 404); goto hoz1m; dzNhs: foreach ($allUsers as $fpbxUser) { goto Nt0tt; Ovhzk: $ext = $fpbxUser["\x64\x65\x66\141\x75\154\164\x5f\145\170\x74\x65\156\x73\151\x6f\x6e"]; goto NbJHs; NbJHs: switch ($sort) { case "\165\163\145\x72\155\141\x6e\x46\151\x72\163\164\116\x61\x6d\x65": $key = $fpbxUser["\x66\x6e\141\155\x65"]; goto re5eM; case "\165\163\x65\x72\x6d\141\x6e\x4c\141\x73\x74\x4e\141\155\x65": $key = $fpbxUser["\154\x6e\141\x6d\145"]; goto re5eM; case "\165\x73\145\x72\155\141\x6e\104\151\x73\160\x6c\x61\x79\116\141\155\x65": $key = $fpbxUser["\144\x69\x73\160\154\141\x79\x6e\x61\x6d\145"]; goto re5eM; default: $key = $fpbxUser["\x64\x65\146\x61\165\x6c\164\137\145\170\164\x65\156\163\x69\157\x6e"]; goto re5eM; } goto b7iQ2; Ah0Ck: VD0b0: goto jE4Zp; B4w4N: if (isset($fpbxUser["\x64\x69\x73\x70\x6c\x61\171\156\x61\x6d\145"])) { goto l6LhZ; } goto l4vyh; hFC4n: goto VD0b0; goto hND62; RGaAq: $quickdialData[$key] = array("\x6e\141\155\145" => $name, "\145\170\x74\145\156\163\x69\x6f\156" => $ext); goto Ah0Ck; Nt0tt: if (isset($fpbxUser["\x64\145\146\141\x75\154\164\x5f\x65\x78\164\x65\x6e\163\x69\x6f\x6e"])) { goto ILadg; } goto XmVdN; vmjfn: if (isset($blfData[$fpbxUser["\x64\x65\x66\x61\x75\154\x74\x5f\x65\x78\x74\145\156\x73\151\157\156"]])) { goto UCPf_; } goto hFC4n; KYjZW: ILadg: goto B4w4N; h7ReP: $name = htmlentities($fpbxUser["\144\151\163\160\154\141\171\x6e\141\155\x65"], ENT_XML1); goto Ovhzk; l4vyh: $fpbxUser["\x64\151\x73\x70\x6c\141\171\156\x61\x6d\145"] = $fpbxUser["\x6e\141\x6d\x65"]; goto lCNpN; btSef: re5eM: goto RGaAq; b7iQ2: G8jPu: goto btSef; XmVdN: $fpbxUser["\x64\145\x66\141\165\x6c\164\x5f\145\170\164\x65\156\x73\151\x6f\x6e"] = $fpbxUser["\x65\170\x74\x65\x6e\x73\151\157\156"]; goto KYjZW; lCNpN: l6LhZ: goto vmjfn; hND62: UCPf_: goto h7ReP; jE4Zp: } goto cA14a; mHXLP: hloOQ: goto SMSja; FVgaM: $pass = $body["\143\154\x6f\165\144\x5f\x70\141\x73\x73\167\157\x72\144"]; goto gwgwo; bdcpG: $device = $this->FreePBX->Core->getDevice($usermanUser["\x64\x65\146\141\165\x6c\164\x5f\145\x78\x74\x65\x6e\x73\151\x6f\x6e"]); goto MHJPe; b3MBa: AhfGA: goto IQVkV; Oy5uG: ksort($quickdialData); goto xh6sm; oX28b: return self::returnError($response, _("\x53\x6f\x66\164\160\x68\157\x6e\145\40\x6e\x6f\164\40\x65\x6e\x61\142\154\x65\144\x20\x66\x6f\x72\40\164\150\x69\163\x20\165\163\145\x72"), 404); goto mHXLP; MHJPe: $mapping = $this->FreePBX->Clearlysp->getClientMapping($usermanUser["\x69\144"]); goto g36uk; kYuVc: return self::returnError($response, _("\x49\x6e\166\x61\154\151\144\40\143\x72\x65\x64\145\x6e\x74\x69\x61\x6c\x73"), 403); goto Q7h9t; N37W5: if (!(strpos($cloudid, "\103\x4c\105\x41\122\114\x59\x49\120") !== 0)) { goto kcKFZ; } goto biJmD; fQtyI: McQPQ: goto VzTp0; NFUGI: if (!($permissions["\x65\x6e\x61\x62\154\x65\144"] !== "\145\x6e\x61\x62\x6c\145\x64")) { goto hloOQ; } goto oX28b; A03mI: $sort = "\x65\170\x74\145\156\163\x69\x6f\x6e"; goto Jyn8n; Q3pRP: if ($request->isGet()) { goto AhfGA; } goto skbFi; gwgwo: goto f4Nj8; goto b3MBa; cA14a: OD_4A: goto Oy5uG; hoz1m: ogh9Q: goto bdcpG; nz6RJ: $user = $body["\143\154\157\165\x64\x5f\x75\x73\x65\x72\156\x61\155\x65"]; goto FVgaM; ketzl: } private function buildPayload($data = array(), $user = array()) { goto uZAw8; VKCm4: tQx2G: goto F34Jy; Z1j2C: $root->appendChild($fragment); goto Y9gtk; asBp1: $fragment->appendXml($frag); goto Z1j2C; HLYMv: Sg2BV: goto NKCjI; MFUSw: $prefKeys->appendChild($xml->createElement("\147\145\x6e\x65\x72\151\x63\123\155\x73\x46\x65\x74\143\x68\111\156\102\x61\143\x6b\x67\x72\x6f\x75\156\x64\111\156\164\x65\162\x76\x61\x6c", $smsBackgroundFetchInterval)); goto aMF3e; FW5y0: $root = $xml->createElement("\162\x6f\x6f\x74"); goto bSWCf; yFXVv: sRRla: goto THq9K; RBDcC: $quickDial = $this->buildQuickDial($xml, $data); goto plISZ; s0nRJ: $serverContactsAllowed = isset($userPermissions["\163\145\x72\166\x65\162\x5f\143\x6f\x6e\164\x61\143\164\163"]) && $userPermissions["\163\145\162\166\x65\x72\x5f\x63\157\156\164\141\x63\x74\163"] === "\145\156\141\x62\x6c\145\144" ? "\x61\x62\x2c\x77\x73" : "\x61\142"; goto bX1dl; sGd9f: if (empty($blindXfer)) { goto VKmu_; } goto Bu1u5; DpCtt: $prefKeys = $xml->createElement("\x70\x72\145\x66\x4b\145\171\x73"); goto YVmFD; NKCjI: $recordingAllowed = isset($userPermissions["\162\145\x63\x6f\162\x64\151\156\147"]) && $userPermissions["\x72\x65\x63\x6f\162\144\151\x6e\147"] !== "\x65\156\141\142\154\x65\x64" ? "\61" : "\x30"; goto YFhxQ; hC5ug: $parkinglot = $this->FreePBX->Parking->getAllParkingLots(); goto kkrXw; nq62g: $frag = "\x3c\x61\x63\164\151\x6f\x6e\x42\165\x74\x74\157\156\163\76\12\11\11\11\x9\11\11\74\x69\x74\145\x6d\x20\x69\x64\x3d\x22\x63\165\x73\164\157\155\101\143\164\x69\x6f\x6e\102\165\x74\164\x6f\x6e\61\x22\76\12\11\11\11\11\x9\11\11\74\x64\151\x73\x70\154\x61\x79\x4e\x61\x6d\x65\76\x50\141\x72\153\74\x2f\144\151\163\x70\x6c\x61\x79\x4e\x61\155\145\76\12\x9\11\11\x9\x9\x9\11\x3c\141\x63\x74\151\157\x6e\40\164\x79\x70\x65\75\42\144\164\155\146\x22\40\166\x61\154\x75\145\x3d\42" . $dtmfAction . "\x22\57\76\12\11\11\11\x9\x9\x9\11\74\160\157\x72\164\x72\x61\x69\164\x55\162\x6c\76" . sprintf(self::$defaultProvisionServer . "\57\x63\x6f\156\x74\x61\143\x74\x69\x6d\141\x67\145\163\57\45\163\57\x3f\x74\157\153\x65\156\x3d\45\163", "\160\x61\x72\x6b\151\156\x67", $this->token) . "\74\x2f\160\x6f\162\164\x72\141\151\164\x55\x72\154\76\12\x9\11\x9\11\x9\11\x9\x3c\x63\157\x6e\x64\151\164\151\157\x6e\163\76\xa\x9\11\11\x9\x9\x9\11\x9\74\x63\x6f\x6e\x64\x69\x74\151\x6f\x6e\x20\164\x79\160\145\x3d\x22\143\x61\x6c\x6c\x53\164\141\164\145\42\40\166\141\154\x75\145\75\x22\x49\156\x63\x6f\155\x69\156\x67\x52\151\156\x67\151\156\x67\54\x45\163\164\x61\x62\x6c\151\163\150\145\x64\x22\x2f\76\xa\x9\x9\11\x9\x9\11\11\x3c\57\x63\x6f\x6e\x64\151\164\151\157\156\x73\76\xa\11\x9\x9\x9\x9\x9\x3c\57\151\164\145\x6d\x3e\12\11\x9\x9\x9\11\74\57\141\x63\x74\x69\157\x6e\x42\165\x74\x74\157\156\x73\x3e"; goto LKT69; LKT69: $fragment = $xml->createDocumentFragment(); goto asBp1; bX1dl: $prefKeys->appendChild($xml->createElement("\143\x6f\156\164\x61\x63\x74\x53\157\165\x72\x63\x65\124\x79\x70\x65", $serverContactsAllowed)); goto RBDcC; Bu1u5: $dtmfAction = "{$blindXfer}{$lot}\43"; goto nq62g; NIF6v: $smsBackgroundFetchInterval = $this->FreePBX->Clearlysp->getDesktopSMSBackgroundFetchInterval(); goto MFUSw; iRhD1: $prefKeys->appendChild($xml->createElement("\147\x65\x6e\145\x72\151\x63\x53\155\163\106\x65\x74\143\x68\111\156\164\x65\162\x76\x61\154", $smsFetchInterval)); goto NIF6v; uZAw8: $xml = new DOMDocument(); goto FW5y0; bSWCf: $modifications = $xml->createElement("\155\157\144\x69\x66\x69\143\x61\164\151\x6f\156\x73"); goto DpCtt; DbXAq: Contactmanager::addContactUrlToConfigXml($xml, $root, $user["\151\x64"]); goto HLYMv; oz9m0: $usersettings = $this->FreePBX->Clearlysp->getCombinedSettings($user["\151\144"]); goto hgSH2; Y9gtk: VKmu_: goto VKCm4; YFhxQ: $prefKeys->appendChild($xml->createElement("\x6e\157\162\145\x63", $recordingAllowed)); goto s0nRJ; Hrbxp: $blindXfer = $blindXferFeatureCode->getCodeActive(); goto sGd9f; l6VRz: $blindXferFeatureCode = new \featurecode("\143\x6f\x72\x65", "\x62\x6c\151\x6e\144\170\146\x65\x72"); goto Hrbxp; THq9K: if (!$lot) { goto tQx2G; } goto l6VRz; kkrXw: $lot = false; goto t5Nar; twizK: return $xml->saveXML($root); goto UV_rA; iwV8F: if (!(isset($userPermissions["\163\145\x72\x76\145\x72\137\143\157\x6e\x74\141\x63\x74\163"]) && $userPermissions["\x73\x65\x72\x76\145\162\x5f\x63\x6f\x6e\164\x61\143\164\163"] === "\145\156\x61\x62\154\x65\144")) { goto Sg2BV; } goto DbXAq; t5Nar: foreach ($parkinglot as $pl) { goto L9qpG; Pf6R7: jxNtF: goto Gn06b; SRTZk: goto x2yxW; goto Pf6R7; N3Lbs: $lot = $pl["\160\x61\162\153\x65\170\164"]; goto SRTZk; Gn06b: x2yxW: goto lN_YX; L9qpG: if (!($pl["\x69\x64"] === $usersettings["\160\141\162\x6b\151\156\147\x6c\x6f\164"])) { goto jxNtF; } goto N3Lbs; lN_YX: } goto yFXVv; DLvdk: $root->appendChild($modifications); goto xqg70; hgSH2: if (!($this->FreePBX->Modules->checkStatus("\x70\x61\x72\x6b\151\x6e\147") && isset($usersettings["\x65\x6e\141\142\x6c\x65\160\141\x72\x6b"]) && $usersettings["\145\156\141\x62\154\x65\x70\141\162\153"] === "\x65\156\141\x62\x6c\145\144")) { goto QyaRA; } goto hC5ug; YVmFD: $modifications->appendChild($prefKeys); goto DLvdk; plISZ: $root->appendChild($quickDial); goto oz9m0; xqg70: $smsFetchInterval = $this->FreePBX->Clearlysp->getDesktopSMSFetchInterval(); goto iRhD1; aMF3e: $userPermissions = $this->FreePBX->Clearlysp->isAllowed($user["\151\x64"]); goto iwV8F; F34Jy: QyaRA: goto twizK; UV_rA: } private function buildQuickDial($xml, $data = array()) { goto Onx7P; BLSjC: WGTik: goto uzbbx; Onx7P: $quickDial = $xml->createElement("\161\x75\x69\143\x6b\104\151\141\154"); goto qzsQp; qzsQp: foreach ($data as $user) { goto OZUHv; OZUHv: $item = $xml->createElement("\151\164\145\155"); goto dqgm9; uBZL8: if (!Contactmanager::hasContactImage()) { goto vZUuO; } goto d7evF; jMfIp: $item->appendChild($xml->createElement("\x75\x72\x69", $user["\145\x78\x74\145\x6e\163\151\x6f\x6e"])); goto ll9R_; FJ6eJ: vZUuO: goto oI34q; d7evF: $imageurl = sprintf(self::$defaultProvisionServer . "\x2f\143\x6f\156\164\x61\143\x74\151\x6d\141\x67\145\163\x2f\45\163\57\77\x74\157\x6b\145\x6e\x3d\x25\163", $user["\145\x78\164\145\156\163\151\157\156"], $this->token); goto Jjqtn; dqgm9: $item->setAttributeNode(new \DOMAttr("\x69\x64", $user["\145\x78\x74\145\x6e\163\151\x6f\x6e"])); goto LOC1I; DYfFa: $_REQUEST["\x64\151\x64"] = $user["\x65\170\x74\x65\156\163\151\x6f\156"]; goto uBZL8; oI34q: $quickDial->appendChild($item); goto hDz2r; hDz2r: sTWPg: goto HFZrx; LOC1I: $item->appendChild($xml->createElement("\x64\x69\x73\160\x6c\141\x79\x4e\x61\155\145", $user["\x6e\141\x6d\145"])); goto jMfIp; ll9R_: $_REQUEST["\x65\170\164"] = $user["\145\x78\x74\x65\156\x73\x69\x6f\156"]; goto DYfFa; Jjqtn: $item->appendChild($xml->createElement("\160\157\162\164\162\141\x69\x74\x55\162\154", $imageurl)); goto FJ6eJ; HFZrx: } goto BLSjC; uzbbx: return $quickDial; goto r9jfR; r9jfR: } }

Decoded(de-Obfuscated) php code

<?php

/*   __________________________________________________
    |  Built by Clearly IP Inc.                        |
    |              on 2023-01-02 21:42:57              |
    |__________________________________________________|
*/
namespace FreePBX\modules\Clearlysp\CIP\Controllers\v1;

use FreePBX\modules\Clearlysp\CIP\Controllers\Base;
use DOMDocument;
class GlobalProvisioning extends Base
{
    public function globalProvisioning($request, $response, $args)
    {
        $tokendata = $this->FreePBX->Clearlysp->getTokenData();
        if ($tokendata["subscription"]) {
            if ($request->isGet()) {
                $cloudid = $request->getQueryParam("cloud_id");
                $user = $request->getQueryParam("cloud_username");
                $pass = $request->getQueryParam("cloud_password");
                goto V4EGo;
            }
            $body = $request->getParsedBody();
            $cloudid = $body["cloud_id"];
            $user = $body["cloud_username"];
            $pass = $body["cloud_password"];
            V4EGo:
            if (!(strpos($cloudid, "CLEARLYIP") !== 0)) {
                $usermanUser = $this->validateUser($user, $pass);
                if ($usermanUser) {
                    if (!empty($usermanUser["default_extension"])) {
                        $device = $this->FreePBX->Core->getDevice($usermanUser["default_extension"]);
                        $mapping = $this->FreePBX->Clearlysp->getClientMapping($usermanUser["id"]);
                        $permissions = $this->FreePBX->Clearlysp->isAllowed($usermanUser["id"]);
                        if (!($permissions["enabled"] !== "enabled")) {
                            $allUsers = $this->FreePBX->Clearlysp->getAllQuickDialEntries();
                            $blfData = $this->FreePBX->Clearlysp->getBLFInformation($usermanUser["id"]);
                            $sort = "extension";
                            $apiconf = json_decode($this->FreePBX->Clearlysp->getApiConfig(), true);
                            if (empty($apiconf["quickdialsorting"])) {
                                goto McQPQ;
                            }
                            $sort = $apiconf["quickdialsorting"];
                            McQPQ:
                            $quickdialData = array();
                            foreach ($allUsers as $fpbxUser) {
                                if (isset($fpbxUser["default_extension"])) {
                                    goto ILadg;
                                }
                                $fpbxUser["default_extension"] = $fpbxUser["extension"];
                                ILadg:
                                if (isset($fpbxUser["displayname"])) {
                                    goto l6LhZ;
                                }
                                $fpbxUser["displayname"] = $fpbxUser["name"];
                                l6LhZ:
                                if (isset($blfData[$fpbxUser["default_extension"]])) {
                                    $name = htmlentities($fpbxUser["displayname"], ENT_XML1);
                                    $ext = $fpbxUser["default_extension"];
                                    switch ($sort) {
                                        case "usermanFirstName":
                                            $key = $fpbxUser["fname"];
                                            goto re5eM;
                                        case "usermanLastName":
                                            $key = $fpbxUser["lname"];
                                            goto re5eM;
                                        case "usermanDisplayName":
                                            $key = $fpbxUser["displayname"];
                                            goto re5eM;
                                        default:
                                            $key = $fpbxUser["default_extension"];
                                            goto re5eM;
                                    }
                                    re5eM:
                                    $quickdialData[$key] = array("name" => $name, "extension" => $ext);
                                    goto Ah0Ck;
                                }
                                Ah0Ck:
                            }
                            ksort($quickdialData);
                            $this->apiurl = $tokendata["clients"]["apiUrl"];
                            $this->token = $tokendata["token"];
                            $payload = $this->buildPayload($quickdialData, $usermanUser);
                            return self::returnAsXML($response, $payload);
                        }
                        return self::returnError($response, _("Softphone not enabled for this user"), 404);
                    }
                    return self::returnError($response, _("Invalid User Configuration"), 404);
                }
                return self::returnError($response, _("Invalid credentials"), 403);
            }
            return self::returnError($response, _("Unable to complete your request, please contact customer care."), 400);
        }
        return self::returnError($response, _("Softphone subscription is not active"), 404);
    }
    private function buildPayload($data = array(), $user = array())
    {
        $xml = new DOMDocument();
        $root = $xml->createElement("root");
        $modifications = $xml->createElement("modifications");
        $prefKeys = $xml->createElement("prefKeys");
        $modifications->appendChild($prefKeys);
        $root->appendChild($modifications);
        $smsFetchInterval = $this->FreePBX->Clearlysp->getDesktopSMSFetchInterval();
        $prefKeys->appendChild($xml->createElement("genericSmsFetchInterval", $smsFetchInterval));
        $smsBackgroundFetchInterval = $this->FreePBX->Clearlysp->getDesktopSMSBackgroundFetchInterval();
        $prefKeys->appendChild($xml->createElement("genericSmsFetchInBackgroundInterval", $smsBackgroundFetchInterval));
        $userPermissions = $this->FreePBX->Clearlysp->isAllowed($user["id"]);
        if (!(isset($userPermissions["server_contacts"]) && $userPermissions["server_contacts"] === "enabled")) {
            goto Sg2BV;
        }
        Contactmanager::addContactUrlToConfigXml($xml, $root, $user["id"]);
        Sg2BV:
        $recordingAllowed = isset($userPermissions["recording"]) && $userPermissions["recording"] !== "enabled" ? "1" : "0";
        $prefKeys->appendChild($xml->createElement("norec", $recordingAllowed));
        $serverContactsAllowed = isset($userPermissions["server_contacts"]) && $userPermissions["server_contacts"] === "enabled" ? "ab,ws" : "ab";
        $prefKeys->appendChild($xml->createElement("contactSourceType", $serverContactsAllowed));
        $quickDial = $this->buildQuickDial($xml, $data);
        $root->appendChild($quickDial);
        $usersettings = $this->FreePBX->Clearlysp->getCombinedSettings($user["id"]);
        if (!($this->FreePBX->Modules->checkStatus("parking") && isset($usersettings["enablepark"]) && $usersettings["enablepark"] === "enabled")) {
            goto QyaRA;
        }
        $parkinglot = $this->FreePBX->Parking->getAllParkingLots();
        $lot = false;
        foreach ($parkinglot as $pl) {
            if (!($pl["id"] === $usersettings["parkinglot"])) {
                goto Gn06b;
            }
            $lot = $pl["parkext"];
            Gn06b:
        }
        if (!$lot) {
            goto tQx2G;
        }
        $blindXferFeatureCode = new \featurecode("core", "blindxfer");
        $blindXfer = $blindXferFeatureCode->getCodeActive();
        if (empty($blindXfer)) {
            goto VKmu_;
        }
        $dtmfAction = "{$blindXfer}{$lot}#";
        $frag = "<actionButtons>\n\t\t\t\t\t\t<item id=\"customActionButton1\">\n\t\t\t\t\t\t\t<displayName>Park</displayName>\n\t\t\t\t\t\t\t<action type=\"dtmf\" value=\"" . $dtmfAction . "\"/>\n\t\t\t\t\t\t\t<portraitUrl>" . sprintf(self::$defaultProvisionServer . "/contactimages/%s/?token=%s", "parking", $this->token) . "</portraitUrl>\n\t\t\t\t\t\t\t<conditions>\n\t\t\t\t\t\t\t\t<condition type=\"callState\" value=\"IncomingRinging,Established\"/>\n\t\t\t\t\t\t\t</conditions>\n\t\t\t\t\t\t</item>\n\t\t\t\t\t</actionButtons>";
        $fragment = $xml->createDocumentFragment();
        $fragment->appendXml($frag);
        $root->appendChild($fragment);
        VKmu_:
        tQx2G:
        QyaRA:
        return $xml->saveXML($root);
    }
    private function buildQuickDial($xml, $data = array())
    {
        $quickDial = $xml->createElement("quickDial");
        foreach ($data as $user) {
            $item = $xml->createElement("item");
            $item->setAttributeNode(new \DOMAttr("id", $user["extension"]));
            $item->appendChild($xml->createElement("displayName", $user["name"]));
            $item->appendChild($xml->createElement("uri", $user["extension"]));
            $_REQUEST["ext"] = $user["extension"];
            $_REQUEST["did"] = $user["extension"];
            if (!Contactmanager::hasContactImage()) {
                goto vZUuO;
            }
            $imageurl = sprintf(self::$defaultProvisionServer . "/contactimages/%s/?token=%s", $user["extension"], $this->token);
            $item->appendChild($xml->createElement("portraitUrl", $imageurl));
            vZUuO:
            $quickDial->appendChild($item);
        }
        return $quickDial;
    }
}


Malware detection & removal plugin for WordPress

(C)2020 Wordpress Doctor All rights reserved.