public function setVDMCryption()
 {
     // make sure we have the correct file
     if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key)) {
         // Get the basic encription.
         $basickey = ComponentbuilderHelper::getCryptKey('basic');
         // Get the encription object.
         $basic = new FOFEncryptAes($basickey, 128);
         if (!empty($this->componentData->whmcs_key) && $basickey && !is_numeric($this->componentData->whmcs_key) && $this->componentData->whmcs_key === base64_encode(base64_decode($this->componentData->whmcs_key, true))) {
             // basic decript data whmcs_key.
             $this->componentData->whmcs_key = rtrim($basic->decryptString($this->componentData->whmcs_key), "");
             // set the needed string to connect to whmcs
             $key["kasier"] = $this->componentData->whmcs_url;
             $key["geheim"] = $this->componentData->whmcs_key;
             $key["onthou"] = 1;
             // prep the call info
             $theKey = base64_encode(serialize($key));
             // set the script
             $encrypt[] = "/**";
             $encrypt[] = "* " . $this->setLine(__LINE__) . "VDM Class ";
             $encrypt[] = "**/";
             $encrypt[] = "\nclass VDM";
             $encrypt[] = "{";
             $encrypt[] = "\tpublic \$_key = false;";
             $encrypt[] = "\tpublic \$_is = false;";
             $encrypt[] = "\t";
             $encrypt[] = "\tpublic function __construct(\$Vk5smi0wjnjb)";
             $encrypt[] = "\t{";
             $encrypt[] = "\t\t// get the session";
             $encrypt[] = "\t\t\$session = JFactory::getSession();";
             $encrypt[] = "\t\t\$V2uekt2wcgwk = \$session->get(\$Vk5smi0wjnjb, null);";
             $encrypt[] = "\t\t\$h4sgrGsqq = \$this->get(\$Vk5smi0wjnjb,\$V2uekt2wcgwk);";
             $encrypt[] = "\t\tif (isset(\$h4sgrGsqq['nuut']) && \$h4sgrGsqq['nuut'] && (isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['eiegrendel']) && strlen(\$h4sgrGsqq['eiegrendel']) > 300)";
             $encrypt[] = "\t\t{";
             $encrypt[] = "\t\t\t\$session->set(\$Vk5smi0wjnjb, \$h4sgrGsqq['eiegrendel']);";
             $encrypt[] = "\t\t}";
             $encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 && isset(\$h4sgrGsqq['customfields']) && strlen(\$h4sgrGsqq['customfields']) > 4)";
             $encrypt[] = "\t\t{";
             $encrypt[] = "\t\t\t\$this->_key = md5(\$h4sgrGsqq['customfields']);";
             $encrypt[] = "\t\t}";
             $encrypt[] = "\t\tif ((isset(\$h4sgrGsqq['status']) && 'Active' == \$h4sgrGsqq['status']) && isset(\$h4sgrGsqq['md5hash']) && strlen(\$h4sgrGsqq['md5hash']) == 32 )";
             $encrypt[] = "\t\t{";
             $encrypt[] = "\t\t\t\$this->_is = true;";
             $encrypt[] = "\t\t}";
             $encrypt[] = "\t}";
             $encrypt[] = "\t";
             $encrypt[] = "\tprivate function get(\$Vk5smi0wjnjb,\$V2uekt2wcgwk)";
             $encrypt[] = "\t{";
             $encrypt[] = "\t\t\$Viioj50xuqu2 = unserialize(base64_decode('" . $theKey . "'));";
             $encrypt[] = "\t\t\$Visqfrd1caus = time() . md5(mt_rand(1000000000, 9999999999) . \$Vk5smi0wjnjb);";
             $encrypt[] = "\t\t\$Vo4tezfgcf3e = date(\"Ymd\");";
             $encrypt[] = "\t\t\$Vozblwvfym2f = \$_SERVER['SERVER_NAME'];";
             $encrypt[] = "\t\t\$Vozblwvfym2fdie = isset(\$_SERVER['SERVER_ADDR']) ? \$_SERVER['SERVER_ADDR'] : \$_SERVER['LOCAL_ADDR'];";
             $encrypt[] = "\t\t\$V343jp03dxco = dirname(__FILE__);";
             $encrypt[] = "\t\t\$Vc2rayehw4f0 = unserialize(base64_decode('czozNjoibW9kdWxlcy9zZXJ2ZXJzL2xpY2Vuc2luZy92ZXJpZnkucGhwIjs='));";
             $encrypt[] = "\t\t\$Vlpolphukogz = false;";
             $encrypt[] = "\t\tif (\$V2uekt2wcgwk) {";
             $encrypt[] = "\t\t\t\$V2uekt2wcgwk = str_replace(\"" . '\\n' . "\", '', \$V2uekt2wcgwk);";
             $encrypt[] = "\t\t\t\$Vm5cxjdc43g4 = substr(\$V2uekt2wcgwk, 0, strlen(\$V2uekt2wcgwk) - 32);";
             $encrypt[] = "\t\t\t\$Vbgx0efeu2sy = substr(\$V2uekt2wcgwk, strlen(\$V2uekt2wcgwk) - 32);";
             $encrypt[] = "\t\t\tif (\$Vbgx0efeu2sy == md5(\$Vm5cxjdc43g4 . \$Viioj50xuqu2['geheim'])) {";
             $encrypt[] = "\t\t\t\t\$Vm5cxjdc43g4 = strrev(\$Vm5cxjdc43g4);";
             $encrypt[] = "\t\t\t\t\$Vbgx0efeu2sy = substr(\$Vm5cxjdc43g4, 0, 32);";
             $encrypt[] = "\t\t\t\t\$Vm5cxjdc43g4 = substr(\$Vm5cxjdc43g4, 32);";
             $encrypt[] = "\t\t\t\t\$Vm5cxjdc43g4 = base64_decode(\$Vm5cxjdc43g4);";
             $encrypt[] = "\t\t\t\t\$Vm5cxjdc43g4finding = unserialize(\$Vm5cxjdc43g4);";
             $encrypt[] = "\t\t\t\t\$V3qqz0p00fbq  = \$Vm5cxjdc43g4finding['dan'];";
             $encrypt[] = "\t\t\t\tif (\$Vbgx0efeu2sy == md5(\$V3qqz0p00fbq  . \$Viioj50xuqu2['geheim'])) {";
             $encrypt[] = "\t\t\t\t\t\$Vbfbwv2y4kre = date(\"Ymd\", mktime(0, 0, 0, date(\"m\"), date(\"d\") - \$Viioj50xuqu2['onthou'], date(\"Y\")));";
             $encrypt[] = "\t\t\t\t\tif (\$V3qqz0p00fbq  > \$Vbfbwv2y4kre) {";
             $encrypt[] = "\t\t\t\t\t\t\$Vlpolphukogz = true;";
             $encrypt[] = "\t\t\t\t\t\t\$Vwasqoybpyed = \$Vm5cxjdc43g4finding;";
             $encrypt[] = "\t\t\t\t\t\t\$Vcixw3trerrt = explode(',', \$Vwasqoybpyed['validdomain']);";
             $encrypt[] = "\t\t\t\t\t\tif (!in_array(\$_SERVER['SERVER_NAME'], \$Vcixw3trerrt)) {";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vlpolphukogz = false;";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vm5cxjdc43g4finding['status'] = \"sleg\";";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vwasqoybpyed = array();";
             $encrypt[] = "\t\t\t\t\t\t}";
             $encrypt[] = "\t\t\t\t\t\t\$Vkni3xyhkqzv = explode(',', \$Vwasqoybpyed['validip']);";
             $encrypt[] = "\t\t\t\t\t\tif (!in_array(\$Vozblwvfym2fdie, \$Vkni3xyhkqzv)) {";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vlpolphukogz = false;";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vm5cxjdc43g4finding['status'] = \"sleg\";";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vwasqoybpyed = array();";
             $encrypt[] = "\t\t\t\t\t\t}";
             $encrypt[] = "\t\t\t\t\t\t\$Vckfvnepoaxj = explode(',', \$Vwasqoybpyed['validdirectory']);";
             $encrypt[] = "\t\t\t\t\t\tif (!in_array(\$V343jp03dxco, \$Vckfvnepoaxj)) {";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vlpolphukogz = false;";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vm5cxjdc43g4finding['status'] = \"sleg\";";
             $encrypt[] = "\t\t\t\t\t\t\t\$Vwasqoybpyed = array();";
             $encrypt[] = "\t\t\t\t\t\t}";
             $encrypt[] = "\t\t\t\t\t}";
             $encrypt[] = "\t\t\t\t}";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t}";
             $encrypt[] = "\t\tif (!\$Vlpolphukogz) {";
             $encrypt[] = "\t\t\t\$V1u0c4dl3ehp = array(";
             $encrypt[] = "\t\t\t\t'licensekey' => \$Vk5smi0wjnjb,";
             $encrypt[] = "\t\t\t\t'domain' => \$Vozblwvfym2f,";
             $encrypt[] = "\t\t\t\t'ip' => \$Vozblwvfym2fdie,";
             $encrypt[] = "\t\t\t\t'dir' => \$V343jp03dxco,";
             $encrypt[] = "\t\t\t);";
             $encrypt[] = "\t\t\tif (\$Visqfrd1caus) \$V1u0c4dl3ehp['check_token'] = \$Visqfrd1caus;";
             $encrypt[] = "\t\t\t\$Vdsjeyjmpq2o = '';";
             $encrypt[] = "\t\t\tforeach (\$V1u0c4dl3ehp AS \$V2sgyscukmgi=>\$V1u00zkzmb1d) {";
             $encrypt[] = "\t\t\t\t\$Vdsjeyjmpq2o .= \$V2sgyscukmgi.'='.urlencode(\$V1u00zkzmb1d).'&';";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\tif (function_exists('curl_exec')) {";
             $encrypt[] = "\t\t\t\t\$Vdathuqgjyf0 = curl_init();";
             $encrypt[] = "\t\t\t\tcurl_setopt(\$Vdathuqgjyf0, CURLOPT_URL, \$Viioj50xuqu2['kasier'] . \$Vc2rayehw4f0);";
             $encrypt[] = "\t\t\t\tcurl_setopt(\$Vdathuqgjyf0, CURLOPT_POST, 1);";
             $encrypt[] = "\t\t\t\tcurl_setopt(\$Vdathuqgjyf0, CURLOPT_POSTFIELDS, \$Vdsjeyjmpq2o);";
             $encrypt[] = "\t\t\t\tcurl_setopt(\$Vdathuqgjyf0, CURLOPT_TIMEOUT, 30);";
             $encrypt[] = "\t\t\t\tcurl_setopt(\$Vdathuqgjyf0, CURLOPT_RETURNTRANSFER, 1);";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5 = curl_exec(\$Vdathuqgjyf0);";
             $encrypt[] = "\t\t\t\tcurl_close(\$Vdathuqgjyf0);";
             $encrypt[] = "\t\t\t} else {";
             $encrypt[] = "\t\t\t\t\$Vrpmu4bvnmkp = fsockopen(\$Viioj50xuqu2['kasier'], 80, \$Vc0t5kmpwkwk, \$Va3g41fnofhu, 5);";
             $encrypt[] = "\t\t\t\tif (\$Vrpmu4bvnmkp) {";
             $encrypt[] = "\t\t\t\t\t\$Vznkm0a0me1y = \"\r\n\";";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop = \"POST \".\$Viioj50xuqu2['kasier'] . \$Vc2rayehw4f0 . \" HTTP/1.0\" . \$Vznkm0a0me1y;";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Host: \".\$Viioj50xuqu2['kasier'] . \$Vznkm0a0me1y;";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Content-type: application/x-www-form-urlencoded\" . \$Vznkm0a0me1y;";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Content-length: \".@strlen(\$Vdsjeyjmpq2o) . \$Vznkm0a0me1y;";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \"Connection: close\" . \$Vznkm0a0me1y . \$Vznkm0a0me1y;";
             $encrypt[] = "\t\t\t\t\t\$V2sgyscukmgiop .= \$Vdsjeyjmpq2o;";
             $encrypt[] = "\t\t\t\t\t\$Vqojefyeohg5 = '';";
             $encrypt[] = "\t\t\t\t\t@stream_set_timeout(\$Vrpmu4bvnmkp, 20);";
             $encrypt[] = "\t\t\t\t\t@fputs(\$Vrpmu4bvnmkp, \$V2sgyscukmgiop);";
             $encrypt[] = "\t\t\t\t\t\$V2czq24pjexf = @socket_get_status(\$Vrpmu4bvnmkp);";
             $encrypt[] = "\t\t\t\t\twhile (!@feof(\$Vrpmu4bvnmkp)&&\$V2czq24pjexf) {";
             $encrypt[] = "\t\t\t\t\t\t\$Vqojefyeohg5 .= @fgets(\$Vrpmu4bvnmkp, 1024);";
             $encrypt[] = "\t\t\t\t\t\t\$V2czq24pjexf = @socket_get_status(\$Vrpmu4bvnmkp);";
             $encrypt[] = "\t\t\t\t\t}";
             $encrypt[] = "\t\t\t\t\t@fclose (\$Vqojefyeohg5);";
             $encrypt[] = "\t\t\t\t}";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\tif (!\$Vqojefyeohg5) {";
             $encrypt[] = "\t\t\t\t\$Vbfbwv2y4kre = date(\"Ymd\", mktime(0, 0, 0, date(\"m\"), date(\"d\") - \$Viioj50xuqu2['onthou'], date(\"Y\")));";
             $encrypt[] = "\t\t\t\tif (isset(\$V3qqz0p00fbq) && \$V3qqz0p00fbq  > \$Vbfbwv2y4kre) {";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed = \$Vm5cxjdc43g4finding;";
             $encrypt[] = "\t\t\t\t} else {";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed = array();";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed['status'] = \"sleg\";";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed['description'] = \"Remote Check Failed\";";
             $encrypt[] = "\t\t\t\t\treturn \$Vwasqoybpyed;";
             $encrypt[] = "\t\t\t\t}";
             $encrypt[] = "\t\t\t} else {";
             $encrypt[] = "\t\t\t\tpreg_match_all('" . '/<(.*?)>([^<]+)<\\/\\1>/i' . "', \$Vqojefyeohg5, \$V1ot20wob03f);";
             $encrypt[] = "\t\t\t\t\$Vwasqoybpyed = array();";
             $encrypt[] = "\t\t\t\tforeach (\$V1ot20wob03f[1] AS \$V2sgyscukmgi=>\$V1u00zkzmb1d) {";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed[\$V1u00zkzmb1d] = \$V1ot20wob03f[2][\$V2sgyscukmgi];";
             $encrypt[] = "\t\t\t\t}";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\tif (!is_array(\$Vwasqoybpyed)) {";
             $encrypt[] = "\t\t\t\tdie(\"Invalid License Server Response\");";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\tif (isset(\$Vwasqoybpyed['md5hash']) && \$Vwasqoybpyed['md5hash']) {";
             $encrypt[] = "\t\t\t\tif (\$Vwasqoybpyed['md5hash'] != md5(\$Viioj50xuqu2['geheim'] . \$Visqfrd1caus)) {";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed['status'] = \"sleg\";";
             $encrypt[] = "\t\t\t\t\t\$Vwasqoybpyed['description'] = \"MD5 Checksum Verification Failed\";";
             $encrypt[] = "\t\t\t\t\treturn \$Vwasqoybpyed;";
             $encrypt[] = "\t\t\t\t}";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\tif (isset(\$Vwasqoybpyed['status']) && \$Vwasqoybpyed['status'] == \"Active\") {";
             $encrypt[] = "\t\t\t\t\$Vwasqoybpyed['dan'] = \$Vo4tezfgcf3e;";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = serialize(\$Vwasqoybpyed);";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = base64_encode(\$Vqojefyeohg5ing);";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = md5(\$Vo4tezfgcf3e . \$Viioj50xuqu2['geheim']) . \$Vqojefyeohg5ing;";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = strrev(\$Vqojefyeohg5ing);";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = \$Vqojefyeohg5ing . md5(\$Vqojefyeohg5ing . \$Viioj50xuqu2['geheim']);";
             $encrypt[] = "\t\t\t\t\$Vqojefyeohg5ing = wordwrap(\$Vqojefyeohg5ing, 80, \"" . '\\n' . "\", true);";
             $encrypt[] = "\t\t\t\t\$Vwasqoybpyed['eiegrendel'] = \$Vqojefyeohg5ing;";
             $encrypt[] = "\t\t\t}";
             $encrypt[] = "\t\t\t\$Vwasqoybpyed['nuut'] = true;";
             $encrypt[] = "\t\t}";
             $encrypt[] = "\t\tunset(\$V1u0c4dl3ehp,\$Vqojefyeohg5,\$V1ot20wob03f,\$Viioj50xuqu2['kasier'],\$Viioj50xuqu2['geheim'],\$Vo4tezfgcf3e,\$Vozblwvfym2fdie,\$Viioj50xuqu2['onthou'],\$Vbgx0efeu2sy);";
             $encrypt[] = "\t\treturn \$Vwasqoybpyed;";
             $encrypt[] = "\t}";
             $encrypt[] = "}";
             // return the help methods
             return implode("\n", $encrypt);
         }
     }
     return '';
 }
Ejemplo n.º 2
0
 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function save($data)
 {
     $input = JFactory::getApplication()->input;
     $filter = JFilterInput::getInstance();
     // set the metadata to the Item Data
     if (isset($data['metadata']) && isset($data['metadata']['author'])) {
         $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
         $metadata = new JRegistry();
         $metadata->loadArray($data['metadata']);
         $data['metadata'] = (string) $metadata;
     }
     // Set the php_helper_site string to base64 string.
     if (isset($data['php_helper_site'])) {
         $data['php_helper_site'] = base64_encode($data['php_helper_site']);
     }
     // Set the php_helper_admin string to base64 string.
     if (isset($data['php_helper_admin'])) {
         $data['php_helper_admin'] = base64_encode($data['php_helper_admin']);
     }
     // Set the sql string to base64 string.
     if (isset($data['sql'])) {
         $data['sql'] = base64_encode($data['sql']);
     }
     // Set the php_admin_event string to base64 string.
     if (isset($data['php_admin_event'])) {
         $data['php_admin_event'] = base64_encode($data['php_admin_event']);
     }
     // Set the php_site_event string to base64 string.
     if (isset($data['php_site_event'])) {
         $data['php_site_event'] = base64_encode($data['php_site_event']);
     }
     // Set the php_dashboard_methods string to base64 string.
     if (isset($data['php_dashboard_methods'])) {
         $data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']);
     }
     // Set the css string to base64 string.
     if (isset($data['css'])) {
         $data['css'] = base64_encode($data['css']);
     }
     // Set the php_preflight_install string to base64 string.
     if (isset($data['php_preflight_install'])) {
         $data['php_preflight_install'] = base64_encode($data['php_preflight_install']);
     }
     // Set the php_preflight_update string to base64 string.
     if (isset($data['php_preflight_update'])) {
         $data['php_preflight_update'] = base64_encode($data['php_preflight_update']);
     }
     // Set the php_postflight_install string to base64 string.
     if (isset($data['php_postflight_install'])) {
         $data['php_postflight_install'] = base64_encode($data['php_postflight_install']);
     }
     // Set the php_postflight_update string to base64 string.
     if (isset($data['php_postflight_update'])) {
         $data['php_postflight_update'] = base64_encode($data['php_postflight_update']);
     }
     // Set the php_method_uninstall string to base64 string.
     if (isset($data['php_method_uninstall'])) {
         $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']);
     }
     // Set the readme string to base64 string.
     if (isset($data['readme'])) {
         $data['readme'] = base64_encode($data['readme']);
     }
     // Get the basic encription key.
     $basickey = ComponentbuilderHelper::getCryptKey('basic');
     // Get the encription object
     $basic = new FOFEncryptAes($basickey, 128);
     // Encript data update_server_ftp.
     if (isset($data['update_server_ftp']) && $basickey) {
         $data['update_server_ftp'] = $basic->encryptString($data['update_server_ftp']);
     }
     // Encript data whmcs_key.
     if (isset($data['whmcs_key']) && $basickey) {
         $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']);
     }
     // Encript data sales_server_ftp.
     if (isset($data['sales_server_ftp']) && $basickey) {
         $data['sales_server_ftp'] = $basic->encryptString($data['sales_server_ftp']);
     }
     // Set the Params Items to data
     if (isset($data['params']) && is_array($data['params'])) {
         $params = new JRegistry();
         $params->loadArray($data['params']);
         $data['params'] = (string) $params;
     }
     // Alter the uniqe field for save as copy
     if ($input->get('task') == 'save2copy') {
         // Automatic handling of other uniqe fields
         $uniqeFields = $this->getUniqeFields();
         if (ComponentbuilderHelper::checkArray($uniqeFields)) {
             foreach ($uniqeFields as $uniqeField) {
                 $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]);
             }
         }
     }
     if (parent::save($data)) {
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * Method to get list export data.
  *
  * @return mixed  An array of data items on success, false on failure.
  */
 public function getExportData($pks)
 {
     // setup the query
     if (ComponentbuilderHelper::checkArray($pks)) {
         // Set a value to know this is exporting method.
         $_export = true;
         // Get the user object.
         $user = JFactory::getUser();
         // Create a new query object.
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         // Select some fields
         $query->select('a.*');
         // From the componentbuilder_component table
         $query->from($db->quoteName('#__componentbuilder_component', 'a'));
         $query->where('a.id IN (' . implode(',', $pks) . ')');
         // Implement View Level Access
         if (!$user->authorise('core.options', 'com_componentbuilder')) {
             $groups = implode(',', $user->getAuthorisedViewLevels());
             $query->where('a.access IN (' . $groups . ')');
         }
         // Order the results by ordering
         $query->order('a.ordering  ASC');
         // Load the items
         $db->setQuery($query);
         $db->execute();
         if ($db->getNumRows()) {
             $items = $db->loadObjectList();
             // Get the basic encription key.
             $basickey = ComponentbuilderHelper::getCryptKey('basic');
             // Get the encription object.
             $basic = new FOFEncryptAes($basickey, 128);
             // set values to display correctly.
             if (ComponentbuilderHelper::checkArray($items)) {
                 foreach ($items as $nr => &$item) {
                     // decode php_helper_site
                     $item->php_helper_site = base64_decode($item->php_helper_site);
                     // decode php_helper_admin
                     $item->php_helper_admin = base64_decode($item->php_helper_admin);
                     if ($basickey && !is_numeric($item->update_server_ftp) && $item->update_server_ftp === base64_encode(base64_decode($item->update_server_ftp, true))) {
                         // decrypt update_server_ftp
                         $item->update_server_ftp = $basic->decryptString($item->update_server_ftp);
                     }
                     // decode sql
                     $item->sql = base64_decode($item->sql);
                     // decode php_admin_event
                     $item->php_admin_event = base64_decode($item->php_admin_event);
                     // decode php_site_event
                     $item->php_site_event = base64_decode($item->php_site_event);
                     // decode php_dashboard_methods
                     $item->php_dashboard_methods = base64_decode($item->php_dashboard_methods);
                     if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) {
                         // decrypt whmcs_key
                         $item->whmcs_key = $basic->decryptString($item->whmcs_key);
                     }
                     // decode css
                     $item->css = base64_decode($item->css);
                     // decode php_preflight_install
                     $item->php_preflight_install = base64_decode($item->php_preflight_install);
                     // decode php_preflight_update
                     $item->php_preflight_update = base64_decode($item->php_preflight_update);
                     // decode php_postflight_install
                     $item->php_postflight_install = base64_decode($item->php_postflight_install);
                     // decode php_postflight_update
                     $item->php_postflight_update = base64_decode($item->php_postflight_update);
                     // decode php_method_uninstall
                     $item->php_method_uninstall = base64_decode($item->php_method_uninstall);
                     // decode readme
                     $item->readme = base64_decode($item->readme);
                     if ($basickey && !is_numeric($item->sales_server_ftp) && $item->sales_server_ftp === base64_encode(base64_decode($item->sales_server_ftp, true))) {
                         // decrypt sales_server_ftp
                         $item->sales_server_ftp = $basic->decryptString($item->sales_server_ftp);
                     }
                     // unset the values we don't want exported.
                     unset($item->asset_id);
                     unset($item->checked_out);
                     unset($item->checked_out_time);
                 }
             }
             // Add headers to items array.
             $headers = $this->getExImPortHeaders();
             if (ComponentbuilderHelper::checkObject($headers)) {
                 array_unshift($items, $headers);
             }
             return $items;
         }
     }
     return false;
 }
Ejemplo n.º 4
0
 private function zipComponent()
 {
     // before we zip the component we first need to move it to the git folder if set
     if (ComponentbuilderHelper::checkString($this->gitPath)) {
         // set the git path
         $this->gitPath = $this->gitPath . '/com_' . $this->componentData->sales_name . '__joomla_' . $this->joomlaVersion;
         // remove old data
         $this->removeFolder($this->gitPath, true);
         // set the new data
         JFolder::copy($this->componentPath, $this->gitPath, '', true);
     }
     // the name of the zip file to create
     $this->filepath = $this->tempPath . '/' . $this->componentFolderName . '.zip';
     // store the current joomla working directory
     $joomla = getcwd();
     // we are changing the working directory to the componet temp folder
     chdir($this->componentPath);
     // the full file path of the zip file
     $this->filepath = JPath::clean($this->filepath);
     // delete an existing zip file (or use an exclusion parameter in JFolder::files()
     JFile::delete($this->filepath);
     // get a list of files in the current directory tree
     $files = JFolder::files('.', '', true, true);
     $zipArray = array();
     // setup the zip array
     foreach ($files as $file) {
         $tmp = array();
         $tmp['name'] = str_replace('./', '', $file);
         $tmp['data'] = JFile::read($file);
         $tmp['time'] = filemtime($file);
         $zipArray[] = $tmp;
     }
     // change back to joomla working directory
     chdir($joomla);
     // get the zip adapter
     $zip = JArchive::getAdapter('zip');
     //create the zip file
     if ($zip->create($this->filepath, $zipArray)) {
         // now move to backup if zip was made and backup is requered
         if ($this->backupPath) {
             JFile::copy($this->filepath, $this->backupPath);
         }
         // move to sales server host
         if ($this->componentData->add_sales_server) {
             // make sure we have the correct file
             if (isset($this->componentData->sales_server_ftp)) {
                 // Get the basic encription.
                 $basickey = ComponentbuilderHelper::getCryptKey('basic');
                 // Get the encription object.
                 $basic = new FOFEncryptAes($basickey, 128);
                 if (!empty($this->componentData->sales_server_ftp) && $basickey && !is_numeric($this->componentData->sales_server_ftp) && $this->componentData->sales_server_ftp === base64_encode(base64_decode($this->componentData->sales_server_ftp, true))) {
                     // basic decript data update_server_ftp.
                     $this->componentData->sales_server_ftp = rtrim($basic->decryptString($this->componentData->sales_server_ftp), "");
                 }
                 // now move the file
                 $this->moveFileToFtpServer($this->filepath, $this->componentData->sales_server_ftp, $this->componentSalesName . '.zip', false);
             }
         }
         // remove the component folder since we are done
         if ($this->removeFolder($this->componentPath)) {
             return true;
         }
     }
     return false;
 }