From 417076243d2c5ac85c03240d186759e9a904ed6a Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 6 Mar 2018 04:28:44 +0200 Subject: [PATCH] Added medium enencryption and added an over all improvment to the encryption implementation. Added extra security to EXTERNALCODE feature that only allows admin to make use of this feature. --- README.md | 4 +- admin/README.txt | 4 +- admin/assets/images/icons/getsnippets.png | Bin 0 -> 23431 bytes admin/compiler/joomla_3/component.xml | 2 +- admin/compiler/joomla_3/settings.json | 4 +- .../compiler/joomla_3/{vdm.php => whmcs.php} | 2 +- admin/helpers/compiler/a_Get.php | 58 +- admin/helpers/compiler/c_Fields.php | 25 +- admin/helpers/compiler/e_Interpretation.php | 636 +++++++++++------- admin/helpers/componentbuilder.php | 21 +- .../en-GB/en-GB.com_componentbuilder.ini | 12 +- .../server/linked_components_fullwidth.php | 2 +- admin/models/componentbuilder.php | 2 +- admin/models/fields.php | 5 +- admin/models/fieldtype.php | 5 +- admin/models/forms/field.xml | 5 +- admin/models/forms/help_document.js | 60 +- admin/models/forms/server.js | 18 + admin/models/forms/server.xml | 3 +- admin/models/joomla_component.php | 4 +- admin/models/joomla_components.php | 2 +- admin/models/server.php | 6 +- admin/models/servers.php | 2 +- admin/views/server/view.html.php | 2 +- componentbuilder.xml | 4 +- site/helpers/componentbuilder.php | 21 +- 26 files changed, 583 insertions(+), 326 deletions(-) create mode 100644 admin/assets/images/icons/getsnippets.png rename admin/compiler/joomla_3/{vdm.php => whmcs.php} (97%) diff --git a/README.md b/README.md index d9b77b479..15711b7ae 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 5th March, 2018 ++ *Last Build*: 6th March, 2018 + *Version*: 2.6.17 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **183587** ++ *Line count*: **183633** + *Field count*: **1645** + *File count*: **1169** + *Folder count*: **189** diff --git a/admin/README.txt b/admin/README.txt index d9b77b479..15711b7ae 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 5th March, 2018 ++ *Last Build*: 6th March, 2018 + *Version*: 2.6.17 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **183587** ++ *Line count*: **183633** + *Field count*: **1645** + *File count*: **1169** + *Folder count*: **189** diff --git a/admin/assets/images/icons/getsnippets.png b/admin/assets/images/icons/getsnippets.png new file mode 100644 index 0000000000000000000000000000000000000000..cbe68e80e554db2742be9186c1a583a3a765a5f5 GIT binary patch literal 23431 zcmV*4Ky|-~P)lxSo|cRT1HSdGd*n-fEnoI=82}eK9)I%J zl1Z;qeD8bT3tZ}J`Ld780Jz9;=e-Y%QwLn5UfEgtuCr{9?NVRQmw8+U03E73-jV#v zZ{%>VT(#!y2b!9@?@ft|NV2M#~lU9XxzgG5lw@DAav9qq!9rX>@i#PAgeDRpd5@iV#FU|fx z1BCxt04VNQrIKYyl2NSernDyH9{A9CK*5O8^MusCO!RvIvt25ix2GzT5 zKb~<1k6Fxvn^bd7|0Q6IiIA7Q`qux~VEC^CfZ~qT3SNQPMvZ(CRgi)e5LJihxS14{G#Ek4me)s{FRmJD=HkT=j$LWBix;`+VNx zzYhR+u2vu*ML-dJOosG*va?@ONU}nqP%AZLY?X=(u7*mZrCYkMQ$e9sgB}V7Wy$O5 z@#q5WP4CR=`f!ax@*P?E%Ijw@^>_L_$A1+7q}$&~B-dU{=Kigugo(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ILE### index.html ###component###.php###EXSTRA_ADMIN_FILES### assets diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index f9fcc2cf3..a56267742 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -216,10 +216,10 @@ }, "dynamic": { "admin": { - "vdm.php": { + "whmcs.php": { "path": "c0mp0n3nt/admin", "rename": false, - "type": "encrypt" + "type": "whmcs" }, "Helper_email.php": { "path": "c0mp0n3nt/admin/helpers", diff --git a/admin/compiler/joomla_3/vdm.php b/admin/compiler/joomla_3/whmcs.php similarity index 97% rename from admin/compiler/joomla_3/vdm.php rename to admin/compiler/joomla_3/whmcs.php index 3c541e902..ca0e36ddd 100644 --- a/admin/compiler/joomla_3/vdm.php +++ b/admin/compiler/joomla_3/whmcs.php @@ -29,4 +29,4 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); -###VDM_ENCRYPTION_BODY### +###WHMCS_ENCRYPTION_BODY### diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 18e8363a1..99f355f86 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -471,11 +471,18 @@ class Get public $layoutData = array(); /** - * The Advanced Encryption Switch + * The Encryption Types + * + * @var array + */ + public $cryptionTypes = array('basic','medium','whmcs'); + + /** + * The WHMCS Encryption Switch * * @var boolean */ - public $advancedEncryption = false; + public $whmcsEncryption = false; /** * The Basic Encryption Switch @@ -484,6 +491,13 @@ class Get */ public $basicEncryption = false; + /** + * The Medium Encryption Switch + * + * @var boolean + */ + public $mediumEncryption = false; + /** * The Custom field Switch per view * @@ -1956,16 +1970,21 @@ class Get { $field->properties = array_values($field->properties); } - // check if we have advanced encryption - if (4 == $field->store && (!isset($this->advancedEncryption) || !$this->advancedEncryption)) + // check if we have WHMCS encryption + if (4 == $field->store && (!isset($this->whmcsEncryption) || !$this->whmcsEncryption)) { - $this->advancedEncryption = true; + $this->whmcsEncryption = true; } // check if we have basic encryption elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption)) { $this->basicEncryption = true; } + // check if we have better encryption + elseif (5 == $field->store && (!isset($this->mediumEncryption) || !$this->mediumEncryption)) + { + $this->mediumEncryption = true; + } // get the last used version $field->history = $this->getHistoryWatch('field', $id); @@ -3701,21 +3720,34 @@ class Get // build local bucket foreach ($found as $target) { - // check if the target is valid URL or path - if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) - || (JPath::clean($target) === $target && JFile::exists($target))) + // check if user has permission to use EXTERNAL code (we may add a custom access switch - use ADMIN for now) + if ($this->user->authorise('core.admin', 'com_componentbuilder')) { - $this->getExternalCodeString($target, $bucket); + // check if the target is valid URL or path + if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) + || (JPath::clean($target) === $target && JFile::exists($target))) + { + $this->getExternalCodeString($target, $bucket); + } + // give notice that target is not a valid url/path + else + { + // set key + $key = '[EXTERNA'.'LCODE='.$target.']'; + // set the notice + $this->app->enqueueMessage(JText::_('

External Code Warning

'), 'Warning'); + $this->app->enqueueMessage(JText::sprintf('The %s is not a valid url/path!', $key), 'Warning'); + $this->app->enqueueMessage('
', 'Warning'); + // remove the placeholder + $bucket[$key] = ''; + } } - // give notice that target is not a valid url/path else { // set key $key = '[EXTERNA'.'LCODE='.$target.']'; // set the notice - $this->app->enqueueMessage(JText::_('

External Code Warning

'), 'Warning'); - $this->app->enqueueMessage(JText::sprintf('The %s is not a valid url/path!', $key), 'Warning'); - $this->app->enqueueMessage('
', 'Warning'); + $this->app->enqueueMessage(JText::sprintf('%s, you do not have permission to use EXTERNALCODE feature (so it was removed from the compilation), please contact you system administrator for more info!
(admin access required)', $this->user->get('name')), 'Error'); // remove the placeholder $bucket[$key] = ''; } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 72e7e09b2..ab6e28519 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -272,11 +272,18 @@ class Fields extends Structure public $basicEncryptionBuilder = array(); /** - * Advnaced Encryption Builder + * WHMCS Encryption Builder * * @var array */ - public $advancedEncryptionBuilder = array(); + public $whmcsEncryptionBuilder = array(); + + /** + * Medium Encryption Builder + * + * @var array + */ + public $mediumEncryptionBuilder = array(); /** * Get Items Method List String Fix Builder @@ -1330,7 +1337,7 @@ class Fields extends Structure */ public function buildSiteFieldData($view, $field, $set, $type) { - $decode = array('json', 'base64', 'basic_encryption', 'advance_encryption'); + $decode = array('json', 'base64', 'basic_encryption', 'whmcs_encryption', 'medium_encryption'); $textareas = array('textarea', 'editor'); if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field])) { @@ -2075,10 +2082,16 @@ class Fields extends Structure $this->buildSiteFieldData($viewName, $name, 'basic_encryption', $typeName); break; case 4: - // ADVANCE_ENCRYPTION_VDMKEY - $this->advancedEncryptionBuilder[$viewName][] = $name; + // WHMCS_ENCRYPTION_VDMKEY + $this->whmcsEncryptionBuilder[$viewName][] = $name; // Site settings of each field if needed - $this->buildSiteFieldData($viewName, $name, 'advance_encryption', $typeName); + $this->buildSiteFieldData($viewName, $name, 'whmcs_encryption', $typeName); + break; + case 5: + // MEDIUM_ENCRYPTION_LOCALFILE + $this->mediumEncryptionBuilder[$viewName][] = $name; + // Site settings of each field if needed + $this->buildSiteFieldData($viewName, $name, 'medium_encryption', $typeName); break; default: // JSON_ARRAY_ENCODE diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 3898f0b1f..1ef1ff464 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -377,7 +377,7 @@ class Interpretation extends Fields return implode(PHP_EOL, $init); } - public function setVDMCryption() + public function setWHMCSCryption() { // make sure we have the correct file if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key)) @@ -385,7 +385,7 @@ class Interpretation extends Fields // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); 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 decrypt data whmcs_key. @@ -398,9 +398,9 @@ class Interpretation extends Fields $theKey = base64_encode(serialize($key)); // set the script $encrypt[] = "/**"; - $encrypt[] = "* " . $this->setLine(__LINE__) . "VDM Class "; + $encrypt[] = "* " . $this->setLine(__LINE__) . "WHMCS Class "; $encrypt[] = "**/"; - $encrypt[] = PHP_EOL . "class VDM"; + $encrypt[] = PHP_EOL . "class WHMCS"; $encrypt[] = "{"; $encrypt[] = "\tpublic \$_key = false;"; $encrypt[] = "\tpublic \$_is = false;"; @@ -570,85 +570,159 @@ class Interpretation extends Fields { // ###ENCRYPT_FILE### $this->fileContentStatic['###ENCRYPT_FILE###'] = ''; - if ((isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) || (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) || $this->componentData->add_license) + if ((isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) || + (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) || + (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder)) || + $this->componentData->add_license) { - if (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder) || $this->componentData->add_license) + if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license) { - // set advanced encrypt file into place - $target = array('admin' => 'encrypt'); - $done = $this->buildDynamique($target, 'encrypt'); - // the text for the file ###VDM_ENCRYPTION_BODY### - $this->fileContentDynamic['encrypt']['###VDM_ENCRYPTION_BODY###'] = $this->setVDMCryption(); + // set whmcs encrypt file into place + $target = array('admin' => 'whmcs'); + $done = $this->buildDynamique($target, 'whmcs'); + // the text for the file ###WHMCS_ENCRYPTION_BODY### + $this->fileContentDynamic['whmcs']['###WHMCS_ENCRYPTION_BODY###'] = $this->setWHMCSCryption(); // ###ENCRYPT_FILE### - $this->fileContentStatic['###ENCRYPT_FILE###'] = PHP_EOL . "\t\t\tvdm.php"; + $this->fileContentStatic['###WHMCS_ENCRYPT_FILE###'] = PHP_EOL . "\t\t\twhmcs.php"; } // get component name $component = $this->fileContentStatic['###component###']; // set the getCryptKey function to the helper class $function = array(); - if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) + // start building the getCryptKey function/class method + $function[] = PHP_EOL . PHP_EOL . "\t/**"; + $function[] = "\t * Get The Encryption Keys"; + $function[] = "\t *"; + $function[] = "\t * @param string \$type The type of key"; + $function[] = "\t * @param string/bool \$default The return value if no key was found"; + $function[] = "\t *"; + $function[] = "\t * @return string On success"; + $function[] = "\t *"; + $function[] = "\t **/"; + $function[] = "\tpublic static function getCryptKey(\$type, \$default = false)"; + $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; + $function[] = "\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; + // add the basic option + if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; - $function[] = "\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; - $function[] = "\t\tif ('advanced' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; - $function[] = "\t\t\tif (\$advanced_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; - $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\telseif ('basic' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t\$basic_key = \$params->get('basic_key', \$default);"; - $function[] = "\t\t\tif (\$basic_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\treturn \$basic_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; - $function[] = "\t}"; - } - elseif (isset($this->advancedEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder)) - { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; - $function[] = "\t\tif ('advanced' === \$type)"; - $function[] = "\t\t{"; - $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; - $function[] = "\t\t\t\$advanced_key = \$params->get('advanced_key', \$default);"; - $function[] = "\t\t\tif (\$advanced_key)"; - $function[] = "\t\t\t{"; - $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; - $function[] = "\t\t\t\tJLoader::import( 'vdm', JPATH_COMPONENT_ADMINISTRATOR);"; - $function[] = PHP_EOL . "\t\t\t\t\$the = new VDM(\$advanced_key);"; - $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; - $function[] = "\t\t\t}"; - $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; - $function[] = "\t}"; - } - elseif (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) - { - $function[] = PHP_EOL . PHP_EOL . "\tpublic static function getCryptKey(\$type, \$default = null)"; - $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Basic Encryption Type"; $function[] = "\t\tif ('basic' === \$type)"; $function[] = "\t\t{"; - $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " Get the global params"; - $function[] = "\t\t\t\$params = JComponentHelper::getParams('com_" . $component . "', true);"; $function[] = "\t\t\t\$basic_key = \$params->get('basic_key', \$default);"; - $function[] = "\t\t\tif (\$basic_key)"; + $function[] = "\t\t\tif (self::checkString(\$basic_key))"; $function[] = "\t\t\t{"; $function[] = "\t\t\t\treturn \$basic_key;"; $function[] = "\t\t\t}"; $function[] = "\t\t}"; - $function[] = "\t\treturn false;"; + } + // add the medium option + if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) + { + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Medium Encryption Type"; + $function[] = "\t\tif ('medium' === \$type)"; + $function[] = "\t\t{"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " check if medium key is already loaded."; + $function[] = "\t\t\tif (self::checkString(self::\$mediumCryptKey))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\treturn (self::\$mediumCryptKey !== 'none') ? trim(self::\$mediumCryptKey) : \$default;"; + $function[] = "\t\t\t}"; + $function[] = "\t\t\t//" . $this->setLine(__LINE__) . " get the path to the medium encryption key."; + $function[] = "\t\t\t\$medium_key_path = \$params->get('medium_key_path', null);"; + $function[] = "\t\t\tif (self::checkString(\$medium_key_path))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the key from the file."; + $function[] = "\t\t\t\tif (self::getMediumCryptKey(\$medium_key_path))"; + $function[] = "\t\t\t\t{"; + $function[] = "\t\t\t\t\treturn trim(self::\$mediumCryptKey);"; + $function[] = "\t\t\t\t}"; + $function[] = "\t\t\t}"; + $function[] = "\t\t}"; + } + // add the whmcs option + if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license) + { + $function[] = "\t\t//" . $this->setLine(__LINE__) . " WHMCS Encryption Type"; + $function[] = "\t\tif ('whmcs' === \$type || 'advanced' === \$type)"; + $function[] = "\t\t{"; + $function[] = "\t\t\t\$key = \$params->get('advanced_key', \$default);"; + $function[] = "\t\t\tif (self::checkString(\$key))"; + $function[] = "\t\t\t{"; + $function[] = "\t\t\t\t//" . $this->setLine(__LINE__) . " load the file"; + $function[] = "\t\t\t\tJLoader::import( 'whmcs', JPATH_COMPONENT_ADMINISTRATOR);"; + $function[] = PHP_EOL . "\t\t\t\t\$the = new WHMCS(\$key);"; + $function[] = PHP_EOL . "\t\t\t\treturn \$the->_key;"; + $function[] = "\t\t\t}"; + $function[] = "\t\t}"; + } + // end the function + $function[] = PHP_EOL . "\t\treturn \$default;"; + $function[] = "\t}"; + // set the getMediumCryptKey class/method + if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) + { + $function[] = PHP_EOL . PHP_EOL . "\t/**"; + $function[] = "\t * The Medium Encryption Key"; + $function[] = "\t *"; + $function[] = "\t * @var string/bool"; + $function[] = "\t **/"; + $function[] = "\tprotected static \$mediumCryptKey = false;"; + $function[] = PHP_EOL . "\t/**"; + $function[] = "\t * Get The Medium Encryption Key"; + $function[] = "\t *"; + $function[] = "\t * @param string \$path The path to the medium crypt key folder"; + $function[] = "\t *"; + $function[] = "\t * @return string On success"; + $function[] = "\t *"; + $function[] = "\t **/"; + $function[] = "\tpublic static function getMediumCryptKey(\$path)"; + $function[] = "\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Prep the path a little"; + $function[] = "\t\t\$path = '/'. trim('/', str_replace('//', '/', \$path));"; + $function[] = "\t\t/jimport('joomla.filesystem.folder');"; + $function[] = "\t\t///" . $this->setLine(__LINE__) . " Check if folder exist"; + $function[] = "\t\t/if (!JFolder::exists(\$path))"; + $function[] = "\t\t/{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t/}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Create FileName and set file path"; + $function[] = "\t\t\$filePath = \$path.'/.'.md5('medium_crypt_key_file');"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Check if we already have the file set"; + $function[] = "\t\tif ((self::\$mediumCryptKey = @file_get_contents(\$filePath)) !== FALSE)"; + $function[] = "\t\t{"; + $function[] = "\t\t\treturn true;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Set the key for the first time"; + $function[] = "\t\tself::\$mediumCryptKey = self::randomkey(128);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Open the key file"; + $function[] = "\t\t\$fh = fopen(\$filePath, 'w');"; + $function[] = "\t\tif (!is_resource(\$fh))"; + $function[] = "\t\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Write to the key file"; + $function[] = "\t\tif (!fwrite(\$fh, self::\$mediumCryptKey))"; + $function[] = "\t\t{"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Close key file."; + $function[] = "\t\t\tfclose(\$fh);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Lock key."; + $function[] = "\t\t\tself::\$mediumCryptKey = 'none';"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Set the error message."; + $function[] = "\t\t\tJFactory::getApplication()->enqueueMessage(JText::_('" . $this->langPrefix . "_CONFIG_MEDIUM_KEY_PATH_ERROR'), 'Error');"; + $function[] = "\t\t\treturn false;"; + $function[] = "\t\t}"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Close key file."; + $function[] = "\t\tfclose(\$fh);"; + $function[] = "\t\t//" . $this->setLine(__LINE__) . " Key is set."; + $function[] = PHP_EOL . "\t\treturn true;"; $function[] = "\t}"; } // return the help methods @@ -1614,33 +1688,30 @@ class Interpretation extends Fields { if (strpos($get['selection']['select'], $field) !== false) { - if ($array['decode'] === 'json') + if ('json' === $array['decode']) { $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{"; // json_decode $decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; - // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] === 'base64') + elseif ('base64' === $array['decode']) { $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{"; // base64_decode $decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; - // TODO Use the type of field to prepare it even more for use in the view } - elseif ($array['decode'] === 'basic_encryption') + elseif (strpos($array['decode'], '_encryption') !== false) { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$basickey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; - // basic decryption - $decoder = $string . "->" . $field . " = rtrim(\$basic->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; - $this->siteDecrypt['basic'][$code] = true; - } - elseif ($array['decode'] === 'advance_encryption') - { - $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$advancedkey && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; - // advanced decryption - $decoder = $string . "->" . $field . " = rtrim(\$advanced->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; - $this->siteDecrypt['advanced'][$code] = true; + foreach ($this->cryptionTypes as $cryptionType) + { + if ($cryptionType.'_encryption' === $array['decode']) + { + $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && \$".$cryptionType."key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . "\t" . $tab . "\t{"; + // set decryption + $decoder = $string . "->" . $field . " = rtrim(\$".$cryptionType."->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; + $this->siteDecrypt[$cryptionType][$code] = true; + } + } } // build decoder string @@ -2093,9 +2164,12 @@ class Interpretation extends Fields { if (ComponentbuilderHelper::checkObject($get)) { - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; - + // set the site decription switches + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } + // start loadin the get Item $getItem = PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get a db connection."; $getItem .= PHP_EOL . "\t" . $tab . "\t\$db = JFactory::getDbo();"; $getItem .= PHP_EOL . PHP_EOL . $tab . "\t\t//" . $this->setLine(__LINE__) . " Create a new query object."; @@ -2198,27 +2272,20 @@ class Interpretation extends Fields $asBucket[] = $main_get['as']; } } - - if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) + // set the scripts + $Component = $this->fileContentStatic['###Component###']; + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - $script = ''; - if (isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) + if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption."; + $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType."key = ".$Component."Helper::getCryptKey('".$cryptionType."');"; + $script .= PHP_EOL . "\t" . $tab . "\t//".$this->setLine(__LINE__)." Get the encryption object."; + $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);"; } - if (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - } - $getItem = $script . $getItem; } + $getItem = $script . $getItem; // setup Globals $getItem .= $this->setCustomViewGlobals($get->global, '$data', $asBucket, $tab); // setup the custom gets that returns multipal values @@ -2497,8 +2564,11 @@ class Interpretation extends Fields { foreach ($main_get->custom_get as $get) { - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; + // set the site decription switch + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } // set the method defaults $default = $this->setCustomViewMethodDefaults($get, $code); // build custom method @@ -2676,26 +2746,20 @@ class Interpretation extends Fields $methods .= PHP_EOL . "\t\treturn false;"; $methods .= PHP_EOL . "\t}"; - if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) + // set the script if it was found + $Component = $this->fileContentStatic['###Component###']; + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - $script = ''; - if ($this->siteDecrypt['basic'][$code]) + if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);" . PHP_EOL; + $script .= PHP_EOL . "\t\t//".$this->setLine(__LINE__)." Get the ".$cryptionType." encryption."; + $script .= PHP_EOL . "\t\t\$".$cryptionType."key = ".$Component."Helper::getCryptKey('".$cryptionType."');"; + $script .= PHP_EOL . "\t\t//".$this->setLine(__LINE__)." Get the encryption object."; + $script .= PHP_EOL . "\t\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);".PHP_EOL; } - if ($this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);" . PHP_EOL; - } - $methods = str_replace('###CRYPT###', $script, $methods); } + $methods = str_replace('###CRYPT###', $script, $methods); } // insure the crypt placeholder is removed $methods = str_replace('###CRYPT###', '', $methods); @@ -2802,9 +2866,14 @@ class Interpretation extends Fields public function setCustomViewGetItems(&$get, $code) { $getItem = ''; - $this->siteDecrypt['basic'][$code] = false; - $this->siteDecrypt['advanced'][$code] = false; + // set the site decrypt switch + foreach ($this->cryptionTypes as $cryptionType) + { + $this->siteDecrypt[$cryptionType][$code] = false; + } + // set the component name $Component = $this->fileContentStatic['###Component###']; + // start load the get item if (ComponentbuilderHelper::checkObject($get)) { $getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Insure all item fields are adapted where needed."; @@ -2892,26 +2961,19 @@ class Interpretation extends Fields } } - if ($this->siteDecrypt['basic'][$code] || $this->siteDecrypt['advanced'][$code]) + // set the script if found + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $script = ''; - if ($this->siteDecrypt['basic'][$code]) + if ($this->siteDecrypt[$cryptionType][$code]) { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption."; + $script .= PHP_EOL . "\t\t\$".$cryptionType."key = " . $Component . "Helper::getCryptKey('".$cryptionType."');"; $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; + $script .= PHP_EOL . "\t\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);"; } - if ($this->siteDecrypt['advanced'][$code]) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - } - $getItem = $script . $getItem; } - return $getItem; + return $script.$getItem; } public function setCustomViewDisplayMethod(&$view) @@ -4177,37 +4239,23 @@ class Interpretation extends Fields $script .= PHP_EOL . "\t\t\t}"; } } + // get the component name + $Component = $this->fileContentStatic['###Component###']; // decryption - if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) + if (isset($this->{$cryptionType.'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType.'EncryptionBuilder'}[$view])) { - $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; - $script .= PHP_EOL . "\t\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; - $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - foreach ($this->basicEncryptionBuilder[$view] as $baseString) + $script .= PHP_EOL . PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the ".$cryptionType." encryption."; + $script .= PHP_EOL . "\t\t\t\$".$cryptionType."key = ".$Component."Helper::getCryptKey('".$cryptionType."');"; + $script .= PHP_EOL . "\t\t\t//".$this->setLine(__LINE__)." Get the encryption object."; + $script .= PHP_EOL . "\t\t\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);"; + foreach ($this->{$cryptionType.'EncryptionBuilder'}[$view] as $baseString) { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$basickey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; + $script .= PHP_EOL . PHP_EOL."\t\t\tif (!empty(\$item->".$baseString.") && \$".$cryptionType."key && !is_numeric(\$item->".$baseString.") && \$item->".$baseString." === base64_encode(base64_decode(\$item->".$baseString.", true)))"; $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " basic decrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$basic->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; - $script .= PHP_EOL . "\t\t\t}"; - } - } - if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - foreach ($this->advancedEncryptionBuilder[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t\tif (!empty(\$item->" . $baseString . ") && \$advancedkey && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))"; - $script .= PHP_EOL . "\t\t\t{"; - $script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " advanced decrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$advanced->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; + $script .= PHP_EOL . "\t\t\t\t//".$this->setLine(__LINE__)." ".$cryptionType." decrypt data ".$baseString."."; + $script .= PHP_EOL . "\t\t\t\t\$item->".$baseString." = rtrim(\$".$cryptionType."->decryptString(\$item->".$baseString."), " . '"\0"' . ");"; $script .= PHP_EOL . "\t\t\t}"; } } @@ -4285,36 +4333,21 @@ class Interpretation extends Fields } } // turn string into encrypted string - if ((isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) || (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view]))) + $Component = $this->fileContentStatic['###Component###']; + foreach ($this->cryptionTypes as $cryptionType) { - $Component = $this->fileContentStatic['###Component###']; - if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view])) + if (isset($this->{$cryptionType.'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType.'EncryptionBuilder'}[$view])) { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; - $script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; + $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption key."; + $script .= PHP_EOL . "\t\t\$".$cryptionType."key = " . $Component . "Helper::getCryptKey('".$cryptionType."');"; $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; - $script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - foreach ($this->basicEncryptionBuilder[$view] as $baseString) + $script .= PHP_EOL . "\t\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);"; + foreach ($this->{$cryptionType.'EncryptionBuilder'}[$view] as $baseString) { $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$basickey)"; + $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$".$cryptionType."key)"; $script .= PHP_EOL . "\t\t{"; - $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$basic->encryptString(\$data['" . $baseString . "']);"; - $script .= PHP_EOL . "\t\t}"; - } - } - if (isset($this->advancedEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->advancedEncryptionBuilder[$view])) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the encryption object"; - $script .= PHP_EOL . "\t\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - foreach ($this->advancedEncryptionBuilder[$view] as $baseString) - { - $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . "."; - $script .= PHP_EOL . "\t\tif (isset(\$data['" . $baseString . "']) && \$advancedkey)"; - $script .= PHP_EOL . "\t\t{"; - $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$advanced->encryptString(\$data['" . $baseString . "']);"; + $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$".$cryptionType."->encryptString(\$data['" . $baseString . "']);"; $script .= PHP_EOL . "\t\t}"; } } @@ -11593,8 +11626,10 @@ class Interpretation extends Fields // add the fix if this view has the need for it $fix = ''; // encryption switches - $basicCrypt = false; - $advancedCrypt = false; + foreach ($this->cryptionTypes as $cryptionType) + { + ${$cryptionType.'Crypt'} = false; + } // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$view])) @@ -11662,9 +11697,15 @@ class Interpretation extends Fields $suffix_decode = ''; break; case 4: - // ADVANCE_ENCRYPTION_VDMKEY - $decode = '$advanced->decryptString'; - $advancedCrypt = true; + // WHMCS_ENCRYPTION_WHMCS + $decode = '$whmcs->decryptString'; + $whmcsCrypt = true; + $suffix_decode = ''; + break; + case 5: + // MEDIUM_ENCRYPTION_LOCALFILE + $decode = '$medium->decryptString'; + $mediumCrypt = true; $suffix_decode = ''; break; default: @@ -11740,13 +11781,19 @@ class Interpretation extends Fields $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$basickey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; } - if ($item['method'] == 4) + elseif ($item['method'] == 5) { $taber = "\t"; - $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$advancedkey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$mediumkey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; } - if ($item['method'] == 3 || $item['method'] == 4) + elseif ($item['method'] == 4) + { + $taber = "\t"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\tif (\$whmcskey && !is_numeric(\$item->" . $item['name'] . ") && \$item->" . $item['name'] . " === base64_encode(base64_decode(\$item->" . $item['name'] . ", true)))"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{"; + } + if ($item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5) { $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\t//" . $this->setLine(__LINE__) . " decrypt " . $item['name']; } @@ -11853,27 +11900,20 @@ class Interpretation extends Fields // add custom php to getitems method $fix .= $this->getCustomScriptBuilder('php_getitems', $view, PHP_EOL . PHP_EOL . $tab); - if ($basicCrypt) + // load the encryption object if needed + $script = ''; + foreach ($this->cryptionTypes as $cryptionType) { - $script = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; - // add the encryption script - $fix = $script . $fix; + if (${$cryptionType.'Crypt'}) + { + $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption key."; + $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType."key = " . $Component . "Helper::getCryptKey('".$cryptionType."');"; + $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; + $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);"; + } } - - if ($advancedCrypt) - { - $script = PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the advanced encryption key."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advancedkey = " . $Component . "Helper::getCryptKey('advanced');"; - $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object."; - $script .= PHP_EOL . "\t" . $tab . "\t\$advanced = new FOFEncryptAes(\$advancedkey, 256);"; - // add the encryption script - $fix = $script . $fix; - } - - return $fix; + // add the encryption script + return $script . $fix; } public function setSelectionTranslationFix($views, $Component, $tab = '') @@ -12726,6 +12766,18 @@ class Interpretation extends Fields $nameList = ComponentbuilderHelper::safeString($menu['name']); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; + // sanitize url + if (strpos($menu['link'], 'http') === false) + { + $menu['link'] = str_replace('/administrator/index.php?', '', $menu['link']); + $menu['link'] = str_replace('administrator/index.php?', '', $menu['link']); + // check if the index is still there + if (strpos($menu['link'], 'index.php?') !== false) + { + $menu['link'] = str_replace('/index.php?', '', $menu['link']); + $menu['link'] = str_replace('index.php?', '', $menu['link']); + } + } // urlencode $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); // add custom menu @@ -12747,6 +12799,18 @@ class Interpretation extends Fields $nameList = ComponentbuilderHelper::safeString($menu['name']); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; + // sanitize url + if (strpos($menu['link'], 'http') === false) + { + $menu['link'] = str_replace('/administrator/index.php?', '', $menu['link']); + $menu['link'] = str_replace('administrator/index.php?', '', $menu['link']); + // check if the index is still there + if (strpos($menu['link'], 'index.php?') !== false) + { + $menu['link'] = str_replace('/index.php?', '', $menu['link']); + $menu['link'] = str_replace('index.php?', '', $menu['link']); + } + } // urlencode $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); // add custom menu @@ -14280,25 +14344,70 @@ function vdm_dkim() { */ public function setEncryptionConfigFieldsets($lang) { + // enable the loading of dynamic field sets + $dynamicAddFields = array(); // Add encryption if needed - if ((isset($this->basicEncryption) && $this->basicEncryption) || (isset($this->advancedEncryption) && $this->advancedEncryption)) + if ((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + $this->componentData->add_license || + (isset($this->configFieldSetsCustomField['Encryption Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Encryption Settings']))) { + $dynamicAddFields[] = "Encryption Settings"; // start building field set for encryption functions $this->configFieldSets[] = "\tconfigFieldSets[] = "\t\t" . 'name="encryption_config"'; $this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_ENCRYPTION_LABEL"'; $this->configFieldSets[] = "\t\t" . 'description="' . $lang . '_ENCRYPTION_DESC">'; + // set tab lang - $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Encryption Settings"; - $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here."; + if (((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption)) && + $this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "License & Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The license & encryption keys are set here."; + // add the next dynamic option + $dynamicAddFields[] = "License & Encryption Settings"; + } + elseif (((isset($this->basicEncryption) && $this->basicEncryption) || + (isset($this->mediumEncryption) && $this->mediumEncryption) || + (isset($this->whmcsEncryption) && $this->whmcsEncryption)) && + $this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Update & Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The update & encryption keys are set here."; + // add the next dynamic option + $dynamicAddFields[] = "Update & Encryption Settings"; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "License Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The license key is set here."; + // add the next dynamic option + $dynamicAddFields[] = "License Settings"; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Update Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The update key is set here."; + // add the next dynamic option + $dynamicAddFields[] = "Update Settings"; + } + else + { + $this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Encryption Settings"; + $this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here."; + } if (isset($this->basicEncryption) && $this->basicEncryption) { // set field lang - $this->langContent[$this->lang][$lang . '_BASIC_KEY_LABEL'] = "Basic Key (basic encryption)"; + $this->langContent[$this->lang][$lang . '_BASIC_KEY_LABEL'] = "Basic Key"; $this->langContent[$this->lang][$lang . '_BASIC_KEY_DESC'] = "Set the basic local key here."; $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_LABEL'] = "Basic Encryption"; - $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use set a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; // set the field $this->configFieldSets[] = "\t\t" . ''; $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'size="60"'; $this->configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t/>"; - } - - if (isset($this->advancedEncryption) && $this->advancedEncryption) + } + if (isset($this->mediumEncryption) && $this->mediumEncryption) { // set field lang - $this->langContent[$this->lang][$lang . '_VDM_KEY_LABEL'] = "Advanced Key (advanced encryption)"; - $this->langContent[$this->lang][$lang . '_VDM_KEY_DESC'] = "Add the advanced key here."; - $this->langContent[$this->lang][$lang . '_VDM_KEY_NOTE_LABEL'] = "Advanced Encryption"; - $this->langContent[$this->lang][$lang . '_VDM_KEY_NOTE_DESC'] = "When using the advanced encryption you need to get an advanced key from " . $this->componentData->companyname . ".
Never change this advanced key once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_LABEL'] = "Medium Key (Path)"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_DESC'] = "Set the full path to where the key file must be stored. Make sure it is behind the root folder of your website, so that it is not public accessible."; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_NOTE_LABEL'] = "Medium Encryption"; + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_NOTE_DESC'] = "When using the medium encryption option, the system generates its own key and stores it in a file at the folder/path you set here.
Never change this key once it is set, or remove the key file! DATA WILL GET CORRUPTED IF YOU DO! Also make sure the full path to where the the key file should be stored, is behind the root folder of your website/system, so that it is not public accessible. Making a backup of this key file over a secure connection is recommended!"; // set the field - $this->configFieldSets[] = "\t\t" . ''; - $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t" . ''; + $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'type="text"'; - $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_VDM_KEY_LABEL"'; - $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_VDM_KEY_DESC"'; + $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_MEDIUM_KEY_LABEL"'; + $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_MEDIUM_KEY_DESC"'; + $this->configFieldSets[] = "\t\t\t" . 'size="160"'; + $this->configFieldSets[] = "\t\t\t" . 'filter="PATH"'; + $this->configFieldSets[] = "\t\t\t" . 'hint="/home/user/hiddenfolder123/"'; + $this->configFieldSets[] = "\t\t\t" . 'default=""'; + $this->configFieldSets[] = "\t\t/>"; + // set some error message if the path does not exist + $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_PATH_ERROR'] = "Medium key path (for encryption of various fields) does not exist, or is not writable. Please check the path and update it in the global option of this component."; + } + if (isset($this->whmcsEncryption) && $this->whmcsEncryption || $this->componentData->add_license) + { + // set field lang label and description + if ($this->componentData->add_license && $this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "License Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the license key you recieved from " . $this->componentData->companyname . " here."; + } + elseif ($this->componentData->add_license && $this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "Update Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the update key you recieved from " . $this->componentData->companyname . " here."; + } + else + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_LABEL'] = "WHMCS Key"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_DESC'] = "Add the key you recieved from " . $this->componentData->companyname . " here."; + } + // ajust the notice based on license + if (isset($this->whmcsEncryption) && $this->whmcsEncryption) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Field Encryption (whmcs)"; + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_DESC'] = "When using this (whmcs) encryption you need to get a key from " . $this->componentData->companyname . ".
Never change this key once it is set! DATA WILL GET CORRUPTED IF YOU DO!"; + } + else + { + if ($this->componentData->license_type == 3) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your License Key"; + } + elseif ($this->componentData->license_type == 2) + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your Update Key"; + } + else + { + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_LABEL'] = "Your Key (whmcs)"; + } + $this->langContent[$this->lang][$lang . '_WHMCS_KEY_NOTE_DESC'] = "You need to get this key from " . $this->componentData->companyname . "."; + } + // set the fields + $this->configFieldSets[] = "\t\t" . ''; + $this->configFieldSets[] = "\t\t" . 'configFieldSets[] = "\t\t\t" . 'type="text"'; + $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_WHMCS_KEY_LABEL"'; + $this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_WHMCS_KEY_DESC"'; $this->configFieldSets[] = "\t\t\t" . 'size="60"'; $this->configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t/>"; } - // add custom Encryption Settings fields - if (isset($this->configFieldSetsCustomField['Encryption Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Encryption Settings'])) + // load the dynamic field sets + foreach ($dynamicAddFields as $dynamicAddField) { - $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Encryption Settings']); - unset($this->configFieldSetsCustomField['Encryption Settings']); + // add custom Encryption Settings fields + if (isset($this->configFieldSetsCustomField[$dynamicAddField]) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField[$dynamicAddField])) + { + $this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField[$dynamicAddField]); + unset($this->configFieldSetsCustomField[$dynamicAddField]); + } } // close that fieldset $this->configFieldSets[] = "\t"; diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 21315c31c..519361895 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -3898,18 +3898,29 @@ abstract class ComponentbuilderHelper return implode($key); } - public static function getCryptKey($type, $default = null) + /** + * Get The Encryption Keys + * + * @param string $type The type of key + * @param string/bool $default The return value if no key was found + * + * @return string On success + * + **/ + public static function getCryptKey($type, $default = false) { + // Get the global params + $params = JComponentHelper::getParams('com_componentbuilder', true); + // Basic Encryption Type if ('basic' === $type) { - // Get the global params - $params = JComponentHelper::getParams('com_componentbuilder', true); $basic_key = $params->get('basic_key', $default); - if ($basic_key) + if (self::checkString($basic_key)) { return $basic_key; } } - return false; + + return $default; } } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 03d0f1a0e..0e3ae827b 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -2258,8 +2258,8 @@ COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_HINT="JCB_Backup_[YEAR]_[MONTH]_ COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_LABEL="Package Name" COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_DESC="Set the basic local key here." -COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key (basic encryption)" -COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" +COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key" +COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use set a 32 character passphrase.
Never change this passphrase once it is set! DATA WILL GET CORRUPTED IF YOU DO!" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_LABEL="Basic Encryption" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user." COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_LABEL="Check in timer" @@ -3181,6 +3181,7 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes

" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category  For
Fieldtypes" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPE_ADD="Add Fieldtype

" COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add Field

" +COM_COMPONENTBUILDER_DASHBOARD_GETSNIPPETS="Get Snippets

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents

" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add Help Document

" COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components

" @@ -3718,9 +3719,8 @@ COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER="Add Javascript Views Foo COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEWS_FOOTER_LABEL="Add JavaScript (views-footer)" COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER="Add Javascript View Footer" COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="Add JavaScript (view-footer)" -COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY="Advance Encryption (WHMCS-key)" COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR="base64" -COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY="Basic Encryption (local-key)" +COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY="Basic Encryption (local-DB-key)" COM_COMPONENTBUILDER_FIELD_BIGINT="BIGINT" COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories" COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category" @@ -3789,6 +3789,7 @@ COM_COMPONENTBUILDER_FIELD_JSON="JSON" COM_COMPONENTBUILDER_FIELD_KEY="KEY" COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT" COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT" +COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY="Medium Encryption (local-file-key)" COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_DESC="The last user that modified this Field." COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_FIELD_MODIFIED_DATE_DESC="The date this Field was modified." @@ -3861,6 +3862,7 @@ COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY="UNIQUE KEY" COM_COMPONENTBUILDER_FIELD_VARCHAR="VARCHAR" COM_COMPONENTBUILDER_FIELD_VERSION_DESC="A count of the number of times this Field has been revised." COM_COMPONENTBUILDER_FIELD_VERSION_LABEL="Revision" +COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION="WHMCS-key Encryption" COM_COMPONENTBUILDER_FIELD_XML="Xml" COM_COMPONENTBUILDER_FIELD_XML_DESCRIPTION="Text Area" COM_COMPONENTBUILDER_FIELD_XML_HINT="Field XML Go Here" @@ -5373,7 +5375,7 @@ COM_COMPONENTBUILDER_SERVER_PRIVATE="Private" COM_COMPONENTBUILDER_SERVER_PRIVATE_DESCRIPTION="Set the path to the private key." COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT="/home/username/.ssh/id_rsa" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY="Private Key" -COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION="Add your private key here! Yes this field in encrypted in the DB, but if your DB gets compromised this key must also be considered compromised. The system path option is considered more secure and seen as best practice." +COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION="Add your private key here! Yes this field is encrypted in the DB, but if your DB gets compromised this key must also be considered compromised! The system path option is considered more secure and seen as best practice." COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_FILE_PATH="Private Key - File Path" COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sY diff --git a/admin/layouts/server/linked_components_fullwidth.php b/admin/layouts/server/linked_components_fullwidth.php index 2e873c70e..65ab05ca8 100644 --- a/admin/layouts/server/linked_components_fullwidth.php +++ b/admin/layouts/server/linked_components_fullwidth.php @@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->wamlinked_components; +$items = $displayData->wanlinked_components; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 910bb317a..7e768ddc7 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents') + 'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png||getsnippets||index.php?option=com_componentbuilder&view=get_snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_document.add', 'png.help_documents') ); // view access array $viewAccess = array( diff --git a/admin/models/fields.php b/admin/models/fields.php index 6666d984b..187acf80e 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -239,8 +239,9 @@ class ComponentbuilderModelFields extends JModelList 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', - 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', - 4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' + 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY', + 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY', + 4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION' ); // Now check if value is found in this array if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 9835abd82..83d087812 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -304,8 +304,9 @@ class ComponentbuilderModelFieldtype extends JModelAdmin 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', - 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', - 4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' + 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY', + 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY', + 4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION' ); // Now check if value is found in this array if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) diff --git a/admin/models/forms/field.xml b/admin/models/forms/field.xml index 0011745e7..8a17c1fd1 100644 --- a/admin/models/forms/field.xml +++ b/admin/models/forms/field.xml @@ -327,8 +327,9 @@ - - + + +
+ hint="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT" + required="true" /> diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 87567bb34..1cd2effc2 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -207,7 +207,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) { @@ -1346,7 +1346,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); // Encrypt data whmcs_key. if (isset($data['whmcs_key']) && $basickey) diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index c37258dd4..7185358c6 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -1707,7 +1707,7 @@ class ComponentbuilderModelJoomla_components extends JModelList // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); // set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) diff --git a/admin/models/server.php b/admin/models/server.php index 4625aae10..ded405619 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -98,7 +98,7 @@ class ComponentbuilderModelServer extends JModelAdmin // Get the basic encryption. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); if (!empty($item->path) && $basickey && !is_numeric($item->path) && $item->path === base64_encode(base64_decode($item->path, true))) { @@ -170,7 +170,7 @@ class ComponentbuilderModelServer extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWamlinked_components() + public function getWanlinked_components() { // Get the user object. $user = JFactory::getUser(); @@ -954,7 +954,7 @@ class ComponentbuilderModelServer extends JModelAdmin // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); // Encrypt data path. if (isset($data['path']) && $basickey) diff --git a/admin/models/servers.php b/admin/models/servers.php index 7397bf528..8f58b1beb 100644 --- a/admin/models/servers.php +++ b/admin/models/servers.php @@ -288,7 +288,7 @@ class ComponentbuilderModelServers extends JModelList // Get the basic encryption key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encryption object. - $basic = new FOFEncryptAes($basickey, 128); + $basic = new FOFEncryptAes($basickey); // set values to display correctly. if (ComponentbuilderHelper::checkArray($items)) diff --git a/admin/views/server/view.html.php b/admin/views/server/view.html.php index ea5621a46..993a06a09 100644 --- a/admin/views/server/view.html.php +++ b/admin/views/server/view.html.php @@ -64,7 +64,7 @@ class ComponentbuilderViewServer extends JViewLegacy } // Get Linked view data - $this->wamlinked_components = $this->get('Wamlinked_components'); + $this->wanlinked_components = $this->get('Wanlinked_components'); // Set the toolbar $this->addToolBar(); diff --git a/componentbuilder.xml b/componentbuilder.xml index 437faf01c..811f380ab 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 5th March, 2018 + 6th March, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://joomlacomponentbuilder.com @@ -91,7 +91,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo access.xml config.xml - controller.php + controller.php###WHMCS_ENCRYPT_FILE### index.html componentbuilder.php README.txt diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index feac8153b..013134935 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -2702,18 +2702,29 @@ abstract class ComponentbuilderHelper return implode($key); } - public static function getCryptKey($type, $default = null) + /** + * Get The Encryption Keys + * + * @param string $type The type of key + * @param string/bool $default The return value if no key was found + * + * @return string On success + * + **/ + public static function getCryptKey($type, $default = false) { + // Get the global params + $params = JComponentHelper::getParams('com_componentbuilder', true); + // Basic Encryption Type if ('basic' === $type) { - // Get the global params - $params = JComponentHelper::getParams('com_componentbuilder', true); $basic_key = $params->get('basic_key', $default); - if ($basic_key) + if (self::checkString($basic_key)) { return $basic_key; } } - return false; + + return $default; } }