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.

This commit is contained in:
Llewellyn van der Merwe 2018-03-06 04:28:44 +02:00
parent a39289ac9c
commit 417076243d
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
26 changed files with 583 additions and 326 deletions

View File

@ -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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2018 + *Last Build*: 6th March, 2018
+ *Version*: 2.6.17 + *Version*: 2.6.17
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *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** + *Field count*: **1645**
+ *File count*: **1169** + *File count*: **1169**
+ *Folder count*: **189** + *Folder count*: **189**

View File

@ -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) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th March, 2018 + *Last Build*: 6th March, 2018
+ *Version*: 2.6.17 + *Version*: 2.6.17
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *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** + *Field count*: **1645**
+ *File count*: **1169** + *File count*: **1169**
+ *Folder count*: **189** + *Folder count*: **189**

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -71,7 +71,7 @@
<files folder="admin"> <files folder="admin">
<filename>access.xml</filename> <filename>access.xml</filename>
<filename>config.xml</filename> <filename>config.xml</filename>
<filename>controller.php</filename>###ENCRYPT_FILE### <filename>controller.php</filename>###WHMCS_ENCRYPT_FILE###
<filename>index.html</filename> <filename>index.html</filename>
<filename>###component###.php</filename>###EXSTRA_ADMIN_FILES### <filename>###component###.php</filename>###EXSTRA_ADMIN_FILES###
<folder>assets</folder> <folder>assets</folder>

View File

@ -216,10 +216,10 @@
}, },
"dynamic": { "dynamic": {
"admin": { "admin": {
"vdm.php": { "whmcs.php": {
"path": "c0mp0n3nt/admin", "path": "c0mp0n3nt/admin",
"rename": false, "rename": false,
"type": "encrypt" "type": "whmcs"
}, },
"Helper_email.php": { "Helper_email.php": {
"path": "c0mp0n3nt/admin/helpers", "path": "c0mp0n3nt/admin/helpers",

View File

@ -29,4 +29,4 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
###VDM_ENCRYPTION_BODY### ###WHMCS_ENCRYPTION_BODY###

View File

@ -471,11 +471,18 @@ class Get
public $layoutData = array(); public $layoutData = array();
/** /**
* The Advanced Encryption Switch * The Encryption Types
*
* @var array
*/
public $cryptionTypes = array('basic','medium','whmcs');
/**
* The WHMCS Encryption Switch
* *
* @var boolean * @var boolean
*/ */
public $advancedEncryption = false; public $whmcsEncryption = false;
/** /**
* The Basic Encryption Switch * The Basic Encryption Switch
@ -484,6 +491,13 @@ class Get
*/ */
public $basicEncryption = false; public $basicEncryption = false;
/**
* The Medium Encryption Switch
*
* @var boolean
*/
public $mediumEncryption = false;
/** /**
* The Custom field Switch per view * The Custom field Switch per view
* *
@ -1956,16 +1970,21 @@ class Get
{ {
$field->properties = array_values($field->properties); $field->properties = array_values($field->properties);
} }
// check if we have advanced encryption // check if we have WHMCS encryption
if (4 == $field->store && (!isset($this->advancedEncryption) || !$this->advancedEncryption)) if (4 == $field->store && (!isset($this->whmcsEncryption) || !$this->whmcsEncryption))
{ {
$this->advancedEncryption = true; $this->whmcsEncryption = true;
} }
// check if we have basic encryption // check if we have basic encryption
elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption)) elseif (3 == $field->store && (!isset($this->basicEncryption) || !$this->basicEncryption))
{ {
$this->basicEncryption = true; $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 // get the last used version
$field->history = $this->getHistoryWatch('field', $id); $field->history = $this->getHistoryWatch('field', $id);
@ -3701,21 +3720,34 @@ class Get
// build local bucket // build local bucket
foreach ($found as $target) foreach ($found as $target)
{ {
// check if the target is valid URL or path // check if user has permission to use EXTERNAL code (we may add a custom access switch - use ADMIN for now)
if ((!filter_var($target, FILTER_VALIDATE_URL) === false && ComponentbuilderHelper::urlExists($target)) if ($this->user->authorise('core.admin', 'com_componentbuilder'))
|| (JPath::clean($target) === $target && JFile::exists($target)))
{ {
$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::_('<hr /><h3>External Code Warning</h3>'), 'Warning');
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> is not a valid url/path!', $key), 'Warning');
$this->app->enqueueMessage('<hr />', 'Warning');
// remove the placeholder
$bucket[$key] = '';
}
} }
// give notice that target is not a valid url/path
else else
{ {
// set key // set key
$key = '[EXTERNA'.'LCODE='.$target.']'; $key = '[EXTERNA'.'LCODE='.$target.']';
// set the notice // set the notice
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Warning</h3>'), 'Warning'); $this->app->enqueueMessage(JText::sprintf('%s, you do not have permission to use <b>EXTERNALCODE</b> feature (so it was removed from the compilation), please contact you system administrator for more info!<br /><small>(admin access required)</small>', $this->user->get('name')), 'Error');
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> is not a valid url/path!', $key), 'Warning');
$this->app->enqueueMessage('<hr />', 'Warning');
// remove the placeholder // remove the placeholder
$bucket[$key] = ''; $bucket[$key] = '';
} }

View File

@ -272,11 +272,18 @@ class Fields extends Structure
public $basicEncryptionBuilder = array(); public $basicEncryptionBuilder = array();
/** /**
* Advnaced Encryption Builder * WHMCS Encryption Builder
* *
* @var array * @var array
*/ */
public $advancedEncryptionBuilder = array(); public $whmcsEncryptionBuilder = array();
/**
* Medium Encryption Builder
*
* @var array
*/
public $mediumEncryptionBuilder = array();
/** /**
* Get Items Method List String Fix Builder * Get Items Method List String Fix Builder
@ -1330,7 +1337,7 @@ class Fields extends Structure
*/ */
public function buildSiteFieldData($view, $field, $set, $type) 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'); $textareas = array('textarea', 'editor');
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field])) 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); $this->buildSiteFieldData($viewName, $name, 'basic_encryption', $typeName);
break; break;
case 4: case 4:
// ADVANCE_ENCRYPTION_VDMKEY // WHMCS_ENCRYPTION_VDMKEY
$this->advancedEncryptionBuilder[$viewName][] = $name; $this->whmcsEncryptionBuilder[$viewName][] = $name;
// Site settings of each field if needed // 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; break;
default: default:
// JSON_ARRAY_ENCODE // JSON_ARRAY_ENCODE

View File

@ -377,7 +377,7 @@ class Interpretation extends Fields
return implode(PHP_EOL, $init); return implode(PHP_EOL, $init);
} }
public function setVDMCryption() public function setWHMCSCryption()
{ {
// make sure we have the correct file // make sure we have the correct file
if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key)) if (isset($this->componentData->whmcs_key) && ComponentbuilderHelper::checkString($this->componentData->whmcs_key))
@ -385,7 +385,7 @@ class Interpretation extends Fields
// Get the basic encryption. // Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object. // 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))) 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. // basic decrypt data whmcs_key.
@ -398,9 +398,9 @@ class Interpretation extends Fields
$theKey = base64_encode(serialize($key)); $theKey = base64_encode(serialize($key));
// set the script // set the script
$encrypt[] = "/**"; $encrypt[] = "/**";
$encrypt[] = "* " . $this->setLine(__LINE__) . "VDM Class "; $encrypt[] = "* " . $this->setLine(__LINE__) . "WHMCS Class ";
$encrypt[] = "**/"; $encrypt[] = "**/";
$encrypt[] = PHP_EOL . "class VDM"; $encrypt[] = PHP_EOL . "class WHMCS";
$encrypt[] = "{"; $encrypt[] = "{";
$encrypt[] = "\tpublic \$_key = false;"; $encrypt[] = "\tpublic \$_key = false;";
$encrypt[] = "\tpublic \$_is = false;"; $encrypt[] = "\tpublic \$_is = false;";
@ -570,85 +570,159 @@ class Interpretation extends Fields
{ {
// ###ENCRYPT_FILE### // ###ENCRYPT_FILE###
$this->fileContentStatic['###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 // set whmcs encrypt file into place
$target = array('admin' => 'encrypt'); $target = array('admin' => 'whmcs');
$done = $this->buildDynamique($target, 'encrypt'); $done = $this->buildDynamique($target, 'whmcs');
// the text for the file ###VDM_ENCRYPTION_BODY### // the text for the file ###WHMCS_ENCRYPTION_BODY###
$this->fileContentDynamic['encrypt']['###VDM_ENCRYPTION_BODY###'] = $this->setVDMCryption(); $this->fileContentDynamic['whmcs']['###WHMCS_ENCRYPTION_BODY###'] = $this->setWHMCSCryption();
// ###ENCRYPT_FILE### // ###ENCRYPT_FILE###
$this->fileContentStatic['###ENCRYPT_FILE###'] = PHP_EOL . "\t\t\t<filename>vdm.php</filename>"; $this->fileContentStatic['###WHMCS_ENCRYPT_FILE###'] = PHP_EOL . "\t\t\t<filename>whmcs.php</filename>";
} }
// get component name // get component name
$component = $this->fileContentStatic['###component###']; $component = $this->fileContentStatic['###component###'];
// set the getCryptKey function to the helper class // set the getCryptKey function to the helper class
$function = array(); $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\t//" . $this->setLine(__LINE__) . " Basic Encryption Type";
$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\tif ('basic' === \$type)"; $function[] = "\t\tif ('basic' === \$type)";
$function[] = "\t\t{"; $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\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{";
$function[] = "\t\t\t\treturn \$basic_key;"; $function[] = "\t\t\t\treturn \$basic_key;";
$function[] = "\t\t\t}"; $function[] = "\t\t\t}";
$function[] = "\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}"; $function[] = "\t}";
} }
// return the help methods // return the help methods
@ -1614,33 +1688,30 @@ class Interpretation extends Fields
{ {
if (strpos($get['selection']['select'], $field) !== false) 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{"; $if = PHP_EOL . "\t" . $tab . "\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . "\t" . $tab . "\t{";
// json_decode // json_decode
$decoder = $string . "->" . $field . " = json_decode(" . $string . "->" . $field . ", true);"; $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{"; $if = PHP_EOL . "\t" . $tab . "\tif (!empty(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ")))" . PHP_EOL . "\t" . $tab . "\t{";
// base64_decode // base64_decode
$decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");"; $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{"; foreach ($this->cryptionTypes as $cryptionType)
// basic decryption {
$decoder = $string . "->" . $field . " = rtrim(\$basic->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; if ($cryptionType.'_encryption' === $array['decode'])
$this->siteDecrypt['basic'][$code] = true; {
} $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{";
elseif ($array['decode'] === 'advance_encryption') // set decryption
{ $decoder = $string . "->" . $field . " = rtrim(\$".$cryptionType."->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
$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{"; $this->siteDecrypt[$cryptionType][$code] = true;
// advanced decryption }
$decoder = $string . "->" . $field . " = rtrim(\$advanced->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");"; }
$this->siteDecrypt['advanced'][$code] = true;
} }
// build decoder string // build decoder string
@ -2093,9 +2164,12 @@ class Interpretation extends Fields
{ {
if (ComponentbuilderHelper::checkObject($get)) if (ComponentbuilderHelper::checkObject($get))
{ {
$this->siteDecrypt['basic'][$code] = false; // set the site decription switches
$this->siteDecrypt['advanced'][$code] = false; 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//" . $this->setLine(__LINE__) . " Get a db connection.";
$getItem .= PHP_EOL . "\t" . $tab . "\t\$db = JFactory::getDbo();"; $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."; $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']; $asBucket[] = $main_get['as'];
} }
} }
// set the scripts
if ((isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code]) || (isset($this->siteDecrypt['advanced'][$code]) && $this->siteDecrypt['advanced'][$code])) $Component = $this->fileContentStatic['###Component###'];
$script = '';
foreach ($this->cryptionTypes as $cryptionType)
{ {
$Component = $this->fileContentStatic['###Component###']; if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code])
$script = '';
if (isset($this->siteDecrypt['basic'][$code]) && $this->siteDecrypt['basic'][$code])
{ {
$script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; $script .= PHP_EOL . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption.";
$script .= PHP_EOL . "\t" . $tab . "\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; $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//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; $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 // setup Globals
$getItem .= $this->setCustomViewGlobals($get->global, '$data', $asBucket, $tab); $getItem .= $this->setCustomViewGlobals($get->global, '$data', $asBucket, $tab);
// setup the custom gets that returns multipal values // setup the custom gets that returns multipal values
@ -2497,8 +2564,11 @@ class Interpretation extends Fields
{ {
foreach ($main_get->custom_get as $get) foreach ($main_get->custom_get as $get)
{ {
$this->siteDecrypt['basic'][$code] = false; // set the site decription switch
$this->siteDecrypt['advanced'][$code] = false; foreach ($this->cryptionTypes as $cryptionType)
{
$this->siteDecrypt[$cryptionType][$code] = false;
}
// set the method defaults // set the method defaults
$default = $this->setCustomViewMethodDefaults($get, $code); $default = $this->setCustomViewMethodDefaults($get, $code);
// build custom method // build custom method
@ -2676,26 +2746,20 @@ class Interpretation extends Fields
$methods .= PHP_EOL . "\t\treturn false;"; $methods .= PHP_EOL . "\t\treturn false;";
$methods .= PHP_EOL . "\t}"; $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###']; if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code])
$script = '';
if ($this->siteDecrypt['basic'][$code])
{ {
$script .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; $script .= PHP_EOL . "\t\t//".$this->setLine(__LINE__)." Get the ".$cryptionType." encryption.";
$script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; $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//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL . "\t\t\$basic = new FOFEncryptAes(\$basickey, 128);" . PHP_EOL; $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 // insure the crypt placeholder is removed
$methods = str_replace('###CRYPT###', '', $methods); $methods = str_replace('###CRYPT###', '', $methods);
@ -2802,9 +2866,14 @@ class Interpretation extends Fields
public function setCustomViewGetItems(&$get, $code) public function setCustomViewGetItems(&$get, $code)
{ {
$getItem = ''; $getItem = '';
$this->siteDecrypt['basic'][$code] = false; // set the site decrypt switch
$this->siteDecrypt['advanced'][$code] = false; foreach ($this->cryptionTypes as $cryptionType)
{
$this->siteDecrypt[$cryptionType][$code] = false;
}
// set the component name
$Component = $this->fileContentStatic['###Component###']; $Component = $this->fileContentStatic['###Component###'];
// start load the get item
if (ComponentbuilderHelper::checkObject($get)) if (ComponentbuilderHelper::checkObject($get))
{ {
$getItem .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Insure all item fields are adapted where needed."; $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[$cryptionType][$code])
if ($this->siteDecrypt['basic'][$code])
{ {
$script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption.";
$script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; $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//" . $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) public function setCustomViewDisplayMethod(&$view)
@ -4177,37 +4239,23 @@ class Interpretation extends Fields
$script .= PHP_EOL . "\t\t\t}"; $script .= PHP_EOL . "\t\t\t}";
} }
} }
// get the component name
$Component = $this->fileContentStatic['###Component###'];
// decryption // 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->{$cryptionType.'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType.'EncryptionBuilder'}[$view]))
if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view]))
{ {
$script .= PHP_EOL . PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption."; $script .= PHP_EOL . PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Get the ".$cryptionType." encryption.";
$script .= PHP_EOL . "\t\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; $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//".$this->setLine(__LINE__)." Get the encryption object.";
$script .= PHP_EOL . "\t\t\t\$basic = new FOFEncryptAes(\$basickey, 128);"; $script .= PHP_EOL . "\t\t\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);";
foreach ($this->basicEncryptionBuilder[$view] as $baseString) 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{";
$script .= PHP_EOL . "\t\t\t\t//" . $this->setLine(__LINE__) . " basic decrypt data " . $baseString . "."; $script .= PHP_EOL . "\t\t\t\t//".$this->setLine(__LINE__)." ".$cryptionType." decrypt data ".$baseString.".";
$script .= PHP_EOL . "\t\t\t\t\$item->" . $baseString . " = rtrim(\$basic->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");"; $script .= PHP_EOL . "\t\t\t\t\$item->".$baseString." = rtrim(\$".$cryptionType."->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}"; $script .= PHP_EOL . "\t\t\t}";
} }
} }
@ -4285,36 +4333,21 @@ class Interpretation extends Fields
} }
} }
// turn string into encrypted string // 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->{$cryptionType.'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType.'EncryptionBuilder'}[$view]))
if (isset($this->basicEncryptionBuilder[$view]) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder[$view]))
{ {
$script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the basic encryption key."; $script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption key.";
$script .= PHP_EOL . "\t\t\$basickey = " . $Component . "Helper::getCryptKey('basic');"; $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//" . $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);";
foreach ($this->basicEncryptionBuilder[$view] as $baseString) foreach ($this->{$cryptionType.'EncryptionBuilder'}[$view] as $baseString)
{ {
$script .= PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Encrypt data " . $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{";
$script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$basic->encryptString(\$data['" . $baseString . "']);"; $script .= PHP_EOL . "\t\t\t\$data['" . $baseString . "'] = \$".$cryptionType."->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}"; $script .= PHP_EOL . "\t\t}";
} }
} }
@ -11593,8 +11626,10 @@ class Interpretation extends Fields
// add the fix if this view has the need for it // add the fix if this view has the need for it
$fix = ''; $fix = '';
// encryption switches // encryption switches
$basicCrypt = false; foreach ($this->cryptionTypes as $cryptionType)
$advancedCrypt = false; {
${$cryptionType.'Crypt'} = false;
}
// setup correct core target // setup correct core target
$coreLoad = false; $coreLoad = false;
if (isset($this->permissionCore[$view])) if (isset($this->permissionCore[$view]))
@ -11662,9 +11697,15 @@ class Interpretation extends Fields
$suffix_decode = ''; $suffix_decode = '';
break; break;
case 4: case 4:
// ADVANCE_ENCRYPTION_VDMKEY // WHMCS_ENCRYPTION_WHMCS
$decode = '$advanced->decryptString'; $decode = '$whmcs->decryptString';
$advancedCrypt = true; $whmcsCrypt = true;
$suffix_decode = '';
break;
case 5:
// MEDIUM_ENCRYPTION_LOCALFILE
$decode = '$medium->decryptString';
$mediumCrypt = true;
$suffix_decode = ''; $suffix_decode = '';
break; break;
default: 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\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{"; $fix .= PHP_EOL . "\t" . $tab . "\t\t\t{";
} }
if ($item['method'] == 4) elseif ($item['method'] == 5)
{ {
$taber = "\t"; $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{"; $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']; $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 // add custom php to getitems method
$fix .= $this->getCustomScriptBuilder('php_getitems', $view, PHP_EOL . PHP_EOL . $tab); $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."; if (${$cryptionType.'Crypt'})
$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 . PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the ".$cryptionType." encryption key.";
$script .= PHP_EOL . "\t" . $tab . "\t\$basic = new FOFEncryptAes(\$basickey, 128);"; $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType."key = " . $Component . "Helper::getCryptKey('".$cryptionType."');";
// add the encryption script $script .= PHP_EOL . "\t" . $tab . "\t//" . $this->setLine(__LINE__) . " Get the encryption object.";
$fix = $script . $fix; $script .= PHP_EOL . "\t" . $tab . "\t\$".$cryptionType." = new FOFEncryptAes(\$".$cryptionType."key);";
}
} }
// add the encryption script
if ($advancedCrypt) return $script . $fix;
{
$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;
} }
public function setSelectionTranslationFix($views, $Component, $tab = '') public function setSelectionTranslationFix($views, $Component, $tab = '')
@ -12726,6 +12766,18 @@ class Interpretation extends Fields
$nameList = ComponentbuilderHelper::safeString($menu['name']); $nameList = ComponentbuilderHelper::safeString($menu['name']);
$nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U');
$this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; $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 // urlencode
$menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8');
// add custom menu // add custom menu
@ -12747,6 +12799,18 @@ class Interpretation extends Fields
$nameList = ComponentbuilderHelper::safeString($menu['name']); $nameList = ComponentbuilderHelper::safeString($menu['name']);
$nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U'); $nameUpper = ComponentbuilderHelper::safeString($menu['name'], 'U');
$this->langContent['adminsys'][$lang . '_' . $nameUpper] = $menu['name']; $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 // urlencode
$menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8'); $menu['link'] = htmlspecialchars($menu['link'], ENT_XML1, 'UTF-8');
// add custom menu // add custom menu
@ -14280,25 +14344,70 @@ function vdm_dkim() {
*/ */
public function setEncryptionConfigFieldsets($lang) public function setEncryptionConfigFieldsets($lang)
{ {
// enable the loading of dynamic field sets
$dynamicAddFields = array();
// Add encryption if needed // 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 // start building field set for encryption functions
$this->configFieldSets[] = "\t<fieldset"; $this->configFieldSets[] = "\t<fieldset";
$this->configFieldSets[] = "\t\t" . 'name="encryption_config"'; $this->configFieldSets[] = "\t\t" . 'name="encryption_config"';
$this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_ENCRYPTION_LABEL"'; $this->configFieldSets[] = "\t\t" . 'label="' . $lang . '_ENCRYPTION_LABEL"';
$this->configFieldSets[] = "\t\t" . 'description="' . $lang . '_ENCRYPTION_DESC">'; $this->configFieldSets[] = "\t\t" . 'description="' . $lang . '_ENCRYPTION_DESC">';
// set tab lang // set tab lang
$this->langContent[$this->lang][$lang . '_ENCRYPTION_LABEL'] = "Encryption Settings"; if (((isset($this->basicEncryption) && $this->basicEncryption) ||
$this->langContent[$this->lang][$lang . '_ENCRYPTION_DESC'] = "The encryption key for the field encryption is set here."; (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) if (isset($this->basicEncryption) && $this->basicEncryption)
{ {
// set field lang // set field lang
$this->langContent[$this->lang][$lang . '_BASIC_KEY_LABEL'] = "Basic Key <small>(basic encryption)</small>"; $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_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_LABEL'] = "Basic Encryption";
$this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use a 32 character passphrase.<br />Never change this passphrase once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>"; $this->langContent[$this->lang][$lang . '_BASIC_KEY_NOTE_DESC'] = "When using the basic encryption please use set a 32 character passphrase.<br />Never change this passphrase once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>";
// set the field // set the field
$this->configFieldSets[] = "\t\t" . '<field type="note" name="basic_key_note" class="alert alert-info" label="' . $lang . '_BASIC_KEY_NOTE_LABEL" description="' . $lang . '_BASIC_KEY_NOTE_DESC" />'; $this->configFieldSets[] = "\t\t" . '<field type="note" name="basic_key_note" class="alert alert-info" label="' . $lang . '_BASIC_KEY_NOTE_LABEL" description="' . $lang . '_BASIC_KEY_NOTE_DESC" />';
$this->configFieldSets[] = "\t\t" . '<field name="basic_key"'; $this->configFieldSets[] = "\t\t" . '<field name="basic_key"';
@ -14309,29 +14418,86 @@ function vdm_dkim() {
$this->configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t\t" . 'default=""';
$this->configFieldSets[] = "\t\t/>"; $this->configFieldSets[] = "\t\t/>";
} }
if (isset($this->mediumEncryption) && $this->mediumEncryption)
if (isset($this->advancedEncryption) && $this->advancedEncryption)
{ {
// set field lang // set field lang
$this->langContent[$this->lang][$lang . '_VDM_KEY_LABEL'] = "Advanced Key <small>(advanced encryption)</small>"; $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_LABEL'] = "Medium Key (Path)";
$this->langContent[$this->lang][$lang . '_VDM_KEY_DESC'] = "Add the advanced key here."; $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 . '_VDM_KEY_NOTE_LABEL'] = "Advanced Encryption"; $this->langContent[$this->lang][$lang . '_MEDIUM_KEY_NOTE_LABEL'] = "Medium 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 . ".<br />Never change this advanced key once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>"; $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.<br />Never change this key once it is set, or remove the key file! <b>DATA WILL GET CORRUPTED IF YOU DO!</b> 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 <b>secure connection</b> is recommended!";
// set the field // set the field
$this->configFieldSets[] = "\t\t" . '<field type="note" name="vdm_key_note" class="alert alert-info" label="' . $lang . '_VDM_KEY_NOTE_LABEL" description="' . $lang . '_VDM_KEY_NOTE_DESC" />'; $this->configFieldSets[] = "\t\t" . '<field type="note" name="medium_key_note" class="alert alert-info" label="' . $lang . '_MEDIUM_KEY_NOTE_LABEL" description="' . $lang . '_MEDIUM_KEY_NOTE_DESC" />';
$this->configFieldSets[] = "\t\t" . '<field name="advanced_key"'; $this->configFieldSets[] = "\t\t" . '<field name="medium_key_path"';
$this->configFieldSets[] = "\t\t\t" . 'type="text"'; $this->configFieldSets[] = "\t\t\t" . 'type="text"';
$this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_VDM_KEY_LABEL"'; $this->configFieldSets[] = "\t\t\t" . 'label="' . $lang . '_MEDIUM_KEY_LABEL"';
$this->configFieldSets[] = "\t\t\t" . 'description="' . $lang . '_VDM_KEY_DESC"'; $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 . ".<br />Never change this key once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>";
}
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" . '<field type="note" name="whmcs_key_note" class="alert alert-info" label="' . $lang . '_WHMCS_KEY_NOTE_LABEL" description="' . $lang . '_WHMCS_KEY_NOTE_DESC" />';
$this->configFieldSets[] = "\t\t" . '<field name="advanced_key"'; // We are going to change this field to whmcs_key (TODO)
$this->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" . 'size="60"';
$this->configFieldSets[] = "\t\t\t" . 'default=""'; $this->configFieldSets[] = "\t\t\t" . 'default=""';
$this->configFieldSets[] = "\t\t/>"; $this->configFieldSets[] = "\t\t/>";
} }
// add custom Encryption Settings fields // load the dynamic field sets
if (isset($this->configFieldSetsCustomField['Encryption Settings']) && ComponentbuilderHelper::checkArray($this->configFieldSetsCustomField['Encryption Settings'])) foreach ($dynamicAddFields as $dynamicAddField)
{ {
$this->configFieldSets[] = implode("\t\t", $this->configFieldSetsCustomField['Encryption Settings']); // add custom Encryption Settings fields
unset($this->configFieldSetsCustomField['Encryption Settings']); 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 // close that fieldset
$this->configFieldSets[] = "\t</fieldset>"; $this->configFieldSets[] = "\t</fieldset>";

View File

@ -3898,18 +3898,29 @@ abstract class ComponentbuilderHelper
return implode($key); 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) if ('basic' === $type)
{ {
// Get the global params
$params = JComponentHelper::getParams('com_componentbuilder', true);
$basic_key = $params->get('basic_key', $default); $basic_key = $params->get('basic_key', $default);
if ($basic_key) if (self::checkString($basic_key))
{ {
return $basic_key; return $basic_key;
} }
} }
return false;
return $default;
} }
} }

View File

@ -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_LABEL="Package Name"
COM_COMPONENTBUILDER_CONFIG_BACKUP_PACKAGE_NAME_MESSAGE="Error! Please add name here." 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_DESC="Set the basic local key here."
COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key <small>(basic encryption)</small>" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_LABEL="Basic Key"
COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use a 32 character passphrase.<br />Never change this passphrase once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>" COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_DESC="When using the basic encryption please use set a 32 character passphrase.<br />Never change this passphrase once it is set! <b>DATA WILL GET CORRUPTED IF YOU DO!</b>"
COM_COMPONENTBUILDER_CONFIG_BASIC_KEY_NOTE_LABEL="Basic Encryption" 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_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" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_LABEL="Check in timer"
@ -3181,6 +3181,7 @@ COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES="Fieldtypes<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category &nbsp;For<br />Fieldtypes" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPES_CATID="Category &nbsp;For<br />Fieldtypes"
COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPE_ADD="Add&nbsp;Fieldtype<br /><br />" COM_COMPONENTBUILDER_DASHBOARD_FIELDTYPE_ADD="Add&nbsp;Fieldtype<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add&nbsp;Field<br /><br />" COM_COMPONENTBUILDER_DASHBOARD_FIELD_ADD="Add&nbsp;Field<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_GETSNIPPETS="Get Snippets<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents<br /><br />" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENTS="Help Documents<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add&nbsp;Help Document<br /><br />" COM_COMPONENTBUILDER_DASHBOARD_HELP_DOCUMENT_ADD="Add&nbsp;Help Document<br /><br />"
COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components<br /><br />" COM_COMPONENTBUILDER_DASHBOARD_JOOMLA_COMPONENTS="Joomla Components<br /><br />"
@ -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_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="Add Javascript View Footer"
COM_COMPONENTBUILDER_FIELD_ADD_JAVASCRIPT_VIEW_FOOTER_LABEL="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_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_BIGINT="BIGINT"
COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories" COM_COMPONENTBUILDER_FIELD_CATID_DESCRIPTION="select one of the following categories"
COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category" COM_COMPONENTBUILDER_FIELD_CATID_LABEL="Category"
@ -3789,6 +3789,7 @@ COM_COMPONENTBUILDER_FIELD_JSON="JSON"
COM_COMPONENTBUILDER_FIELD_KEY="KEY" COM_COMPONENTBUILDER_FIELD_KEY="KEY"
COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT" COM_COMPONENTBUILDER_FIELD_LONGTEXT="LONGTEXT"
COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT="MEDIUMTEXT" 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_DESC="The last user that modified this Field."
COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_FIELD_MODIFIED_BY_LABEL="Modified By"
COM_COMPONENTBUILDER_FIELD_MODIFIED_DATE_DESC="The date this Field was modified." 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_VARCHAR="VARCHAR"
COM_COMPONENTBUILDER_FIELD_VERSION_DESC="A count of the number of times this Field has been revised." 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_VERSION_LABEL="Revision"
COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION="WHMCS-key Encryption"
COM_COMPONENTBUILDER_FIELD_XML="Xml" COM_COMPONENTBUILDER_FIELD_XML="Xml"
COM_COMPONENTBUILDER_FIELD_XML_DESCRIPTION="Text Area" COM_COMPONENTBUILDER_FIELD_XML_DESCRIPTION="Text Area"
COM_COMPONENTBUILDER_FIELD_XML_HINT="Field XML Go Here" 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_DESCRIPTION="Set the path to the private key."
COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT="/home/username/.ssh/id_rsa" COM_COMPONENTBUILDER_SERVER_PRIVATE_HINT="/home/username/.ssh/id_rsa"
COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY="Private Key" 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_FILE_PATH="Private Key - File Path"
COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY----- COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT="-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sY MIICXQIBAAKBgQDPF9uyDuHtD+sCYBaEIV34uAc+eRa62souVUcmsVwKUUBbk7sY

View File

@ -28,7 +28,7 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// set the defaults // set the defaults
$items = $displayData->wamlinked_components; $items = $displayData->wanlinked_components;
$user = JFactory::getUser(); $user = JFactory::getUser();
$id = $displayData->item->id; $id = $displayData->item->id;
$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit";

View File

@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
$icons = array(); $icons = array();
// view groups array // view groups array
$viewGroups = 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 // view access array
$viewAccess = array( $viewAccess = array(

View File

@ -239,8 +239,9 @@ class ComponentbuilderModelFields extends JModelList
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON',
2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR',
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION'
); );
// Now check if value is found in this array // Now check if value is found in this array
if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value]))

View File

@ -304,8 +304,9 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT', 0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
1 => 'COM_COMPONENTBUILDER_FIELD_JSON', 1 => 'COM_COMPONENTBUILDER_FIELD_JSON',
2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR', 2 => 'COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR',
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY', 3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
4 => 'COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY' 5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION'
); );
// Now check if value is found in this array // Now check if value is found in this array
if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value])) if (isset($storeArray[$value]) && ComponentbuilderHelper::checkString($storeArray[$value]))

View File

@ -327,8 +327,9 @@
<option value="0">COM_COMPONENTBUILDER_FIELD_DEFAULT</option> <option value="0">COM_COMPONENTBUILDER_FIELD_DEFAULT</option>
<option value="1">COM_COMPONENTBUILDER_FIELD_JSON</option> <option value="1">COM_COMPONENTBUILDER_FIELD_JSON</option>
<option value="2">COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR</option> <option value="2">COM_COMPONENTBUILDER_FIELD_BASESIXTY_FOUR</option>
<option value="3">COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALKEY</option> <option value="3">COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY</option>
<option value="4">COM_COMPONENTBUILDER_FIELD_ADVANCE_ENCRYPTION_WHMCSKEY</option> <option value="5">COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY</option>
<option value="4">COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION</option>
</field> </field>
<!-- Javascript_view_footer Field. Type: Textarea. (joomla)--> <!-- Javascript_view_footer Field. Type: Textarea. (joomla)-->
<field type="textarea" <field type="textarea"

View File

@ -23,12 +23,12 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// Some Global Values // Some Global Values
jform_vvvvwbdwan_required = false; jform_vvvvwbdwao_required = false;
jform_vvvvwbewao_required = false; jform_vvvvwbewap_required = false;
jform_vvvvwbfwap_required = false; jform_vvvvwbfwaq_required = false;
jform_vvvvwbgwaq_required = false; jform_vvvvwbgwar_required = false;
jform_vvvvwbhwar_required = false; jform_vvvvwbhwas_required = false;
jform_vvvvwbiwas_required = false; jform_vvvvwbiwat_required = false;
// Initial Script // Initial Script
jQuery(document).ready(function() jQuery(document).ready(function()
@ -59,26 +59,26 @@ function vvvvwbd(location_vvvvwbd)
if (location_vvvvwbd == 1) if (location_vvvvwbd == 1)
{ {
jQuery('#jform_admin_view').closest('.control-group').show(); jQuery('#jform_admin_view').closest('.control-group').show();
if (jform_vvvvwbdwan_required) if (jform_vvvvwbdwao_required)
{ {
updateFieldRequired('admin_view',0); updateFieldRequired('admin_view',0);
jQuery('#jform_admin_view').prop('required','required'); jQuery('#jform_admin_view').prop('required','required');
jQuery('#jform_admin_view').attr('aria-required',true); jQuery('#jform_admin_view').attr('aria-required',true);
jQuery('#jform_admin_view').addClass('required'); jQuery('#jform_admin_view').addClass('required');
jform_vvvvwbdwan_required = false; jform_vvvvwbdwao_required = false;
} }
} }
else else
{ {
jQuery('#jform_admin_view').closest('.control-group').hide(); jQuery('#jform_admin_view').closest('.control-group').hide();
if (!jform_vvvvwbdwan_required) if (!jform_vvvvwbdwao_required)
{ {
updateFieldRequired('admin_view',1); updateFieldRequired('admin_view',1);
jQuery('#jform_admin_view').removeAttr('required'); jQuery('#jform_admin_view').removeAttr('required');
jQuery('#jform_admin_view').removeAttr('aria-required'); jQuery('#jform_admin_view').removeAttr('aria-required');
jQuery('#jform_admin_view').removeClass('required'); jQuery('#jform_admin_view').removeClass('required');
jform_vvvvwbdwan_required = true; jform_vvvvwbdwao_required = true;
} }
} }
} }
@ -90,26 +90,26 @@ function vvvvwbe(location_vvvvwbe)
if (location_vvvvwbe == 2) if (location_vvvvwbe == 2)
{ {
jQuery('#jform_site_view').closest('.control-group').show(); jQuery('#jform_site_view').closest('.control-group').show();
if (jform_vvvvwbewao_required) if (jform_vvvvwbewap_required)
{ {
updateFieldRequired('site_view',0); updateFieldRequired('site_view',0);
jQuery('#jform_site_view').prop('required','required'); jQuery('#jform_site_view').prop('required','required');
jQuery('#jform_site_view').attr('aria-required',true); jQuery('#jform_site_view').attr('aria-required',true);
jQuery('#jform_site_view').addClass('required'); jQuery('#jform_site_view').addClass('required');
jform_vvvvwbewao_required = false; jform_vvvvwbewap_required = false;
} }
} }
else else
{ {
jQuery('#jform_site_view').closest('.control-group').hide(); jQuery('#jform_site_view').closest('.control-group').hide();
if (!jform_vvvvwbewao_required) if (!jform_vvvvwbewap_required)
{ {
updateFieldRequired('site_view',1); updateFieldRequired('site_view',1);
jQuery('#jform_site_view').removeAttr('required'); jQuery('#jform_site_view').removeAttr('required');
jQuery('#jform_site_view').removeAttr('aria-required'); jQuery('#jform_site_view').removeAttr('aria-required');
jQuery('#jform_site_view').removeClass('required'); jQuery('#jform_site_view').removeClass('required');
jform_vvvvwbewao_required = true; jform_vvvvwbewap_required = true;
} }
} }
} }
@ -134,26 +134,26 @@ function vvvvwbf(type_vvvvwbf)
if (type) if (type)
{ {
jQuery('#jform_url').closest('.control-group').show(); jQuery('#jform_url').closest('.control-group').show();
if (jform_vvvvwbfwap_required) if (jform_vvvvwbfwaq_required)
{ {
updateFieldRequired('url',0); updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required'); jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true); jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required'); jQuery('#jform_url').addClass('required');
jform_vvvvwbfwap_required = false; jform_vvvvwbfwaq_required = false;
} }
} }
else else
{ {
jQuery('#jform_url').closest('.control-group').hide(); jQuery('#jform_url').closest('.control-group').hide();
if (!jform_vvvvwbfwap_required) if (!jform_vvvvwbfwaq_required)
{ {
updateFieldRequired('url',1); updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required'); jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required'); jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required'); jQuery('#jform_url').removeClass('required');
jform_vvvvwbfwap_required = true; jform_vvvvwbfwaq_required = true;
} }
} }
} }
@ -189,26 +189,26 @@ function vvvvwbg(type_vvvvwbg)
if (type) if (type)
{ {
jQuery('#jform_article').closest('.control-group').show(); jQuery('#jform_article').closest('.control-group').show();
if (jform_vvvvwbgwaq_required) if (jform_vvvvwbgwar_required)
{ {
updateFieldRequired('article',0); updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required'); jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true); jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required'); jQuery('#jform_article').addClass('required');
jform_vvvvwbgwaq_required = false; jform_vvvvwbgwar_required = false;
} }
} }
else else
{ {
jQuery('#jform_article').closest('.control-group').hide(); jQuery('#jform_article').closest('.control-group').hide();
if (!jform_vvvvwbgwaq_required) if (!jform_vvvvwbgwar_required)
{ {
updateFieldRequired('article',1); updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required'); jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required'); jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required'); jQuery('#jform_article').removeClass('required');
jform_vvvvwbgwaq_required = true; jform_vvvvwbgwar_required = true;
} }
} }
} }
@ -244,26 +244,26 @@ function vvvvwbh(type_vvvvwbh)
if (type) if (type)
{ {
jQuery('#jform_content-lbl').closest('.control-group').show(); jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_vvvvwbhwar_required) if (jform_vvvvwbhwas_required)
{ {
updateFieldRequired('content',0); updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required'); jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true); jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required'); jQuery('#jform_content').addClass('required');
jform_vvvvwbhwar_required = false; jform_vvvvwbhwas_required = false;
} }
} }
else else
{ {
jQuery('#jform_content-lbl').closest('.control-group').hide(); jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_vvvvwbhwar_required) if (!jform_vvvvwbhwas_required)
{ {
updateFieldRequired('content',1); updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required'); jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required'); jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required'); jQuery('#jform_content').removeClass('required');
jform_vvvvwbhwar_required = true; jform_vvvvwbhwas_required = true;
} }
} }
} }
@ -286,26 +286,26 @@ function vvvvwbi(target_vvvvwbi)
if (target_vvvvwbi == 1) if (target_vvvvwbi == 1)
{ {
jQuery('#jform_groups').closest('.control-group').show(); jQuery('#jform_groups').closest('.control-group').show();
if (jform_vvvvwbiwas_required) if (jform_vvvvwbiwat_required)
{ {
updateFieldRequired('groups',0); updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required'); jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true); jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required'); jQuery('#jform_groups').addClass('required');
jform_vvvvwbiwas_required = false; jform_vvvvwbiwat_required = false;
} }
} }
else else
{ {
jQuery('#jform_groups').closest('.control-group').hide(); jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_vvvvwbiwas_required) if (!jform_vvvvwbiwat_required)
{ {
updateFieldRequired('groups',1); updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required'); jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required'); jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required'); jQuery('#jform_groups').removeClass('required');
jform_vvvvwbiwas_required = true; jform_vvvvwbiwat_required = true;
} }
} }
} }

View File

@ -31,6 +31,7 @@ jform_vvvvwatwai_required = false;
jform_vvvvwauwaj_required = false; jform_vvvvwauwaj_required = false;
jform_vvvvwavwak_required = false; jform_vvvvwavwak_required = false;
jform_vvvvwaxwal_required = false; jform_vvvvwaxwal_required = false;
jform_vvvvwazwam_required = false;
// Initial Script // Initial Script
jQuery(document).ready(function() jQuery(document).ready(function()
@ -436,10 +437,27 @@ function vvvvwaz(protocol_vvvvwaz,authentication_vvvvwaz)
if (protocol && authentication) if (protocol && authentication)
{ {
jQuery('#jform_private_key').closest('.control-group').show(); jQuery('#jform_private_key').closest('.control-group').show();
if (jform_vvvvwazwam_required)
{
updateFieldRequired('private_key',0);
jQuery('#jform_private_key').prop('required','required');
jQuery('#jform_private_key').attr('aria-required',true);
jQuery('#jform_private_key').addClass('required');
jform_vvvvwazwam_required = false;
}
} }
else else
{ {
jQuery('#jform_private_key').closest('.control-group').hide(); jQuery('#jform_private_key').closest('.control-group').hide();
if (!jform_vvvvwazwam_required)
{
updateFieldRequired('private_key',1);
jQuery('#jform_private_key').removeAttr('required');
jQuery('#jform_private_key').removeAttr('aria-required');
jQuery('#jform_private_key').removeClass('required');
jform_vvvvwazwam_required = true;
}
} }
} }

View File

@ -248,7 +248,8 @@
cols="5" cols="5"
description="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION" description="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION"
class="input-xxlarge span12" class="input-xxlarge span12"
hint="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT" /> hint="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT"
required="true" />
</fieldset> </fieldset>
<!-- Access Control Fields. --> <!-- Access Control Fields. -->

View File

@ -207,7 +207,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
// Get the basic encryption. // Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object. // 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))) 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. // Get the basic encryption key.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object // Get the encryption object
$basic = new FOFEncryptAes($basickey, 128); $basic = new FOFEncryptAes($basickey);
// Encrypt data whmcs_key. // Encrypt data whmcs_key.
if (isset($data['whmcs_key']) && $basickey) if (isset($data['whmcs_key']) && $basickey)

View File

@ -1707,7 +1707,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// Get the basic encryption key. // Get the basic encryption key.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object. // Get the encryption object.
$basic = new FOFEncryptAes($basickey, 128); $basic = new FOFEncryptAes($basickey);
// set values to display correctly. // set values to display correctly.
if (ComponentbuilderHelper::checkArray($items)) if (ComponentbuilderHelper::checkArray($items))

View File

@ -98,7 +98,7 @@ class ComponentbuilderModelServer extends JModelAdmin
// Get the basic encryption. // Get the basic encryption.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object. // 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))) 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. * @return mixed An array of data items on success, false on failure.
*/ */
public function getWamlinked_components() public function getWanlinked_components()
{ {
// Get the user object. // Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
@ -954,7 +954,7 @@ class ComponentbuilderModelServer extends JModelAdmin
// Get the basic encryption key. // Get the basic encryption key.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object // Get the encryption object
$basic = new FOFEncryptAes($basickey, 128); $basic = new FOFEncryptAes($basickey);
// Encrypt data path. // Encrypt data path.
if (isset($data['path']) && $basickey) if (isset($data['path']) && $basickey)

View File

@ -288,7 +288,7 @@ class ComponentbuilderModelServers extends JModelList
// Get the basic encryption key. // Get the basic encryption key.
$basickey = ComponentbuilderHelper::getCryptKey('basic'); $basickey = ComponentbuilderHelper::getCryptKey('basic');
// Get the encryption object. // Get the encryption object.
$basic = new FOFEncryptAes($basickey, 128); $basic = new FOFEncryptAes($basickey);
// set values to display correctly. // set values to display correctly.
if (ComponentbuilderHelper::checkArray($items)) if (ComponentbuilderHelper::checkArray($items))

View File

@ -64,7 +64,7 @@ class ComponentbuilderViewServer extends JViewLegacy
} }
// Get Linked view data // Get Linked view data
$this->wamlinked_components = $this->get('Wamlinked_components'); $this->wanlinked_components = $this->get('Wanlinked_components');
// Set the toolbar // Set the toolbar
$this->addToolBar(); $this->addToolBar();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>5th March, 2018</creationDate> <creationDate>6th March, 2018</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://joomlacomponentbuilder.com</authorUrl> <authorUrl>http://joomlacomponentbuilder.com</authorUrl>
@ -91,7 +91,7 @@ Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/compo
<files folder="admin"> <files folder="admin">
<filename>access.xml</filename> <filename>access.xml</filename>
<filename>config.xml</filename> <filename>config.xml</filename>
<filename>controller.php</filename> <filename>controller.php</filename>###WHMCS_ENCRYPT_FILE###
<filename>index.html</filename> <filename>index.html</filename>
<filename>componentbuilder.php</filename> <filename>componentbuilder.php</filename>
<filename>README.txt</filename> <filename>README.txt</filename>

View File

@ -2702,18 +2702,29 @@ abstract class ComponentbuilderHelper
return implode($key); 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) if ('basic' === $type)
{ {
// Get the global params
$params = JComponentHelper::getParams('com_componentbuilder', true);
$basic_key = $params->get('basic_key', $default); $basic_key = $params->get('basic_key', $default);
if ($basic_key) if (self::checkString($basic_key))
{ {
return $basic_key; return $basic_key;
} }
} }
return false;
return $default;
} }
} }