Moved the phpseclib files to their own folder in libraries. Improved the composer autoloader in JCB. Improved the phpseclib class implementation. Added a new Expert Mode to field modeling under the database tab in the field area.

This commit is contained in:
2019-10-16 22:34:36 +02:00
parent d78e3bb215
commit 010a134e1a
97 changed files with 5213 additions and 3202 deletions

View File

@ -638,7 +638,7 @@ class Get
*
* @var array
*/
public $cryptionTypes = array('basic', 'medium', 'whmcs');
public $cryptionTypes = array('basic', 'medium', 'whmcs', 'expert');
/**
* The WHMCS Encryption Switch
@ -2586,7 +2586,7 @@ class Get
{
if (!isset($this->libManager[$this->target][$view->code][$library]))
{
if ($this->getLibrary((int) $library))
if ($this->getMediaLibrary((int) $library))
{
$this->libManager[$this->target][$view->code][(int) $library] = true;
}
@ -2595,7 +2595,7 @@ class Get
}
elseif (is_numeric($view->libraries) && !isset($this->libManager[$this->target][$view->code][(int) $view->libraries]))
{
if ($this->getLibrary((int) $view->libraries))
if ($this->getMediaLibrary((int) $view->libraries))
{
$this->libManager[$this->target][$view->code][(int) $view->libraries] = true;
}
@ -2922,6 +2922,28 @@ class Get
{
$this->mediumEncryption = true;
}
// check if we have better encryption
elseif (6 == $field->store
&& ComponentbuilderHelper::checkString($field->on_get_model_field)
&& ComponentbuilderHelper::checkString($field->on_save_model_field))
{
// add only if string lenght found
if (ComponentbuilderHelper::checkString($field->initiator_on_save_model))
{
$field->initiator_save_key = md5($field->initiator_on_save_model);
$field->initiator_save = explode(PHP_EOL, $this->setPlaceholders($this->setDynamicValues(base64_decode($field->initiator_on_save_model)), $this->placeholders));
}
if (ComponentbuilderHelper::checkString($field->initiator_on_save_model))
{
$field->initiator_get_key = md5($field->initiator_on_get_model);
$field->initiator_get = explode(PHP_EOL, $this->setPlaceholders($this->setDynamicValues(base64_decode($field->initiator_on_get_model)), $this->placeholders));
}
// set the field modeling
$field->model_field['save'] = explode(PHP_EOL, $this->setPlaceholders($this->setDynamicValues(base64_decode($field->on_save_model_field)), $this->placeholders));
$field->model_field['get'] = explode(PHP_EOL, $this->setPlaceholders($this->setDynamicValues(base64_decode($field->on_get_model_field)), $this->placeholders));
// remove the original values
unset($field->on_save_model_field, $field->on_get_model_field, $field->initiator_on_save_model, $field->initiator_on_get_model);
}
// get the last used version
$field->history = $this->getHistoryWatch('field', $id);
@ -4400,7 +4422,7 @@ class Get
{
if (!isset($this->libManager[$this->target][$view][$library]))
{
if ($this->getLibrary((int) $library))
if ($this->getMediaLibrary((int) $library))
{
$this->libManager[$this->target][$view][(int) $library] = true;
}
@ -4409,7 +4431,7 @@ class Get
}
elseif (is_numeric($row->libraries) && !isset($this->libManager[$this->target][$view][(int) $row->libraries]))
{
if ($this->getLibrary((int) $row->libraries))
if ($this->getMediaLibrary((int) $row->libraries))
{
$this->libManager[$this->target][$view][(int) $row->libraries] = true;
}
@ -4488,14 +4510,14 @@ class Get
}
/**
* Get Library Data and store globaly
* Get Media Library Data and store globally
*
* @param string $id the library id
*
* @return bool true on success
*
*/
protected function getLibrary($id)
protected function getMediaLibrary($id)
{
// check if the lib has already been set
@ -4579,6 +4601,7 @@ class Get
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_library_config', 'b') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('b.library') . ')');
$query->join('LEFT', $this->db->quoteName('#__componentbuilder_library_files_folders_urls', 'c') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('c.library') . ')');
$query->where($this->db->quoteName('a.id') . ' = ' . (int) $id);
$query->where($this->db->quoteName('a.target') . ' = 1');
// Reset the query using our newly populated query object.
$this->db->setQuery($query);

View File

@ -20,252 +20,266 @@ class Fields extends Structure
/**
* Metadate Switch
*
*
* @var array
*/
public $metadataBuilder = array();
/**
* View access Switch
*
*
* @var array
*/
public $accessBuilder = array();
/**
* edit view tabs counter
*
*
* @var array
*/
public $tabCounter = array();
/**
* layout builder
*
*
* @var array
*/
public $layoutBuilder = array();
/**
* used to fix the zero order
*
*
* @var array
*/
private $zeroOrderFix = array();
/**
* Site field data
*
*
* @var array
*/
public $siteFieldData = array();
/**
* list of fields that are not being escaped
*
*
* @var array
*/
public $doNotEscape = array();
/**
* list of classes used in the list view for the fields
*
*
* @var array
*/
public $listFieldClass = array();
/**
* tags builder
*
*
* @var array
*/
public $tagsBuilder = array();
/**
* query builder
*
*
* @var array
*/
public $queryBuilder = array();
/**
* unique keys for database field
*
*
* @var array
*/
public $dbUniqueKeys = array();
/**
* keys for database field
*
*
* @var array
*/
public $dbKeys = array();
/**
* history builder
*
*
* @var array
*/
public $historyBuilder = array();
/**
* alias builder
*
*
* @var array
*/
public $aliasBuilder = array();
/**
* title builder
*
*
* @var array
*/
public $titleBuilder = array();
/**
* list builder
*
*
* @var array
*/
public $listBuilder = array();
/**
* custom Builder List
*
*
* @var array
*/
public $customBuilderList = array();
/**
* Hidden Fields Builder
*
*
* @var array
*/
public $hiddenFieldsBuilder = array();
/**
* INT Field Builder
*
*
* @var array
*/
public $intFieldsBuilder = array();
/**
* Dynamic Fields Builder
*
*
* @var array
*/
public $dynamicfieldsBuilder = array();
/**
* Main text Builder
*
*
* @var array
*/
public $maintextBuilder = array();
/**
* Custom Builder
*
*
* @var array
*/
public $customBuilder = array();
/**
* Custom Field Links Builder
*
*
* @var array
*/
public $customFieldLinksBuilder = array();
/**
* Set Script for User Switch
*
*
* @var array
*/
public $setScriptUserSwitch = array();
/**
* Set Script for Media Switch
*
*
* @var array
*/
public $setScriptMediaSwitch = array();
/**
* Category builder
*
*
* @var array
*/
public $categoryBuilder = array();
/**
* Category Code builder
*
*
* @var array
*/
public $catCodeBuilder = array();
/**
* Check Box builder
*
*
* @var array
*/
public $checkboxBuilder = array();
/**
* Json String Builder
*
*
* @var array
*/
public $jsonStringBuilder = array();
/**
* Json String Builder for return values to array
*
*
* @var array
*/
public $jsonItemBuilderArray = array();
/**
* Json Item Builder
*
*
* @var array
*/
public $jsonItemBuilder = array();
/**
* Base 64 Builder
*
*
* @var array
*/
public $base64Builder = array();
/**
* Basic Encryption Builder
*
* Basic Encryption Field Modeling
*
* @var array
*/
public $basicEncryptionBuilder = array();
public $basicFieldModeling = array();
/**
* WHMCS Encryption Builder
*
* WHMCS Encryption Field Modeling
*
* @var array
*/
public $whmcsEncryptionBuilder = array();
public $whmcsFieldModeling = array();
/**
* Medium Encryption Builder
*
* Medium Encryption Field Modeling
*
* @var array
*/
public $mediumEncryptionBuilder = array();
public $mediumFieldModeling = array();
/**
* Expert Field Modeling
*
* @var array
*/
public $expertFieldModeling = array();
/**
* Expert Mode Initiator
*
* @var array
*/
public $expertFieldModelInitiator = array();
/**
* Get Items Method List String Fix Builder
*
*
* @var array
*/
public $getItemsMethodListStringFixBuilder = array();
@ -2320,7 +2334,7 @@ class Fields extends Structure
*/
public function buildSiteFieldData($view, $field, $set, $type)
{
$decode = array('json', 'base64', 'basic_encryption', 'whmcs_encryption', 'medium_encryption');
$decode = array('json', 'base64', 'basic_encryption', 'whmcs_encryption', 'medium_encryption', 'expert_mode');
$textareas = array('textarea', 'editor');
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field]))
{
@ -2988,22 +3002,41 @@ class Fields extends Structure
break;
case 3:
// BASIC_ENCRYPTION_LOCALKEY
$this->basicEncryptionBuilder[$view_name_single][] = $name;
$this->basicFieldModeling[$view_name_single][] = $name;
// Site settings of each field if needed
$this->buildSiteFieldData($view_name_single, $name, 'basic_encryption', $typeName);
break;
case 4:
// WHMCS_ENCRYPTION_VDMKEY
$this->whmcsEncryptionBuilder[$view_name_single][] = $name;
$this->whmcsFieldModeling[$view_name_single][] = $name;
// Site settings of each field if needed
$this->buildSiteFieldData($view_name_single, $name, 'whmcs_encryption', $typeName);
break;
case 5:
// MEDIUM_ENCRYPTION_LOCALFILE
$this->mediumEncryptionBuilder[$view_name_single][] = $name;
$this->mediumFieldModeling[$view_name_single][] = $name;
// Site settings of each field if needed
$this->buildSiteFieldData($view_name_single, $name, 'medium_encryption', $typeName);
break;
case 6:
// EXPERT_MODE
if(isset($field['settings']->model_field))
{
if (isset($field['settings']->initiator_save_key))
{
$this->expertFieldModelInitiator[$view_name_single]['save'][$field['settings']->initiator_save_key]
= $field['settings']->initiator_save;
}
if (isset($field['settings']->initiator_get_key))
{
$this->expertFieldModelInitiator[$view_name_single]['get'][$field['settings']->initiator_get_key]
= $field['settings']->initiator_get;
}
$this->expertFieldModeling[$view_name_single][$name] = $field['settings']->model_field;
// Site settings of each field if needed
$this->buildSiteFieldData($view_name_single, $name, 'expert_mode', $typeName);
}
break;
default:
// JSON_ARRAY_ENCODE
$this->jsonItemBuilder[$view_name_single][] = $name;

View File

@ -635,12 +635,12 @@ class Interpretation extends Fields
// WHMCS_ENCRYPT_FILE
$this->fileContentStatic[$this->hhh . 'WHMCS_ENCRYPT_FILE' . $this->hhh] = '';
// check if encryption is ative
if ((isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder)) ||
(isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder)) ||
(isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder)) ||
if ((isset($this->basicFieldModeling) && ComponentbuilderHelper::checkArray($this->basicFieldModeling)) ||
(isset($this->mediumFieldModeling) && ComponentbuilderHelper::checkArray($this->mediumFieldModeling)) ||
(isset($this->whmcsFieldModeling) && ComponentbuilderHelper::checkArray($this->whmcsFieldModeling)) ||
$this->componentData->add_license)
{
if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license)
if (isset($this->whmcsFieldModeling) && ComponentbuilderHelper::checkArray($this->whmcsFieldModeling) || $this->componentData->add_license)
{
// set whmcs encrypt file into place
$target = array('admin' => 'whmcs');
@ -669,7 +669,7 @@ class Interpretation extends Fields
$function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the global params";
$function[] = $this->_t(2) . "\$params = JComponentHelper::getParams('com_" . $component . "', true);";
// add the basic option
if (isset($this->basicEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->basicEncryptionBuilder))
if (isset($this->basicFieldModeling) && ComponentbuilderHelper::checkArray($this->basicFieldModeling))
{
$function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Basic Encryption Type";
$function[] = $this->_t(2) . "if ('basic' === \$type)";
@ -682,7 +682,7 @@ class Interpretation extends Fields
$function[] = $this->_t(2) . "}";
}
// add the medium option
if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder))
if (isset($this->mediumFieldModeling) && ComponentbuilderHelper::checkArray($this->mediumFieldModeling))
{
$function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Medium Encryption Type";
$function[] = $this->_t(2) . "if ('medium' === \$type)";
@ -705,7 +705,7 @@ class Interpretation extends Fields
$function[] = $this->_t(2) . "}";
}
// add the whmcs option
if (isset($this->whmcsEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->whmcsEncryptionBuilder) || $this->componentData->add_license)
if (isset($this->whmcsFieldModeling) && ComponentbuilderHelper::checkArray($this->whmcsFieldModeling) || $this->componentData->add_license)
{
$function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " WHMCS Encryption Type";
$function[] = $this->_t(2) . "if ('whmcs' === \$type || 'advanced' === \$type)";
@ -724,7 +724,7 @@ class Interpretation extends Fields
$function[] = PHP_EOL . $this->_t(2) . "return \$default;";
$function[] = $this->_t(1) . "}";
// set the getMediumCryptKey class/method
if (isset($this->mediumEncryptionBuilder) && ComponentbuilderHelper::checkArray($this->mediumEncryptionBuilder))
if (isset($this->mediumFieldModeling) && ComponentbuilderHelper::checkArray($this->mediumFieldModeling))
{
$function[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**";
$function[] = $this->_t(1) . " * The Medium Encryption Key";
@ -1821,6 +1821,8 @@ class Interpretation extends Fields
// now loop the array
foreach ($array['decode'] as $decode)
{
$if = '';
$decoder = '';
if ('json' === $decode)
{
$if = PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkJson(" . $string . "->" . $field . "))" . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{";
@ -1839,17 +1841,33 @@ class Interpretation extends Fields
{
if ($cryptionType . '_encryption' === $decode)
{
$if = PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "if (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{";
// set decryption
$decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
if ('expert' !== $cryptionType)
{
$if = PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "if (!empty(" . $string . "->" . $field . ") && \$" . $cryptionType . "key && !is_numeric(" . $string . "->" . $field . ") && " . $string . "->" . $field . " === base64_encode(base64_decode(" . $string . "->" . $field . ", true)))" . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{";
// set decryption
$decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
}
elseif (isset($this->{$cryptionType . 'FieldModeling'}[$code][$field]))
{
$_placeholder_for_field = array('[[[field]]]' => $string . "->" . $field);
$fieldDecode .= $this->setPlaceholders(PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . implode(PHP_EOL . $this->_t(1) . $tab . $this->_t(1), $this->{$cryptionType . 'FieldModeling'}[$code][$field]['get']), $_placeholder_for_field);
}
// activate site decryption
$this->siteDecrypt[$cryptionType][$code] = true;
}
}
}
// build decoder string
$fieldDecode .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Check if we can decode " . $field .$if . PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Decode " . $field;
$fieldDecode .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . $decoder . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}";
// check if we have found the details
if (ComponentbuilderHelper::checkString($if))
{
// build decoder string
$fieldDecode .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Check if we can decode " . $field .$if . PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Decode " . $field;
}
if (ComponentbuilderHelper::checkString($decoder))
{
// build decoder string
$fieldDecode .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . $decoder . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}";
}
}
}
}
@ -2495,10 +2513,21 @@ class Interpretation extends Fields
{
if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code])
{
$script .= PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
}
elseif (isset($this->{$cryptionType . 'FieldModelInitiator'}[$code])
&& isset($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get'] as $block)
{
$script .= PHP_EOL . $this->_t(1) . implode(PHP_EOL . $this->_t(1), $block);
}
}
}
}
$getItem = $script . $getItem;
@ -2993,10 +3022,21 @@ class Interpretation extends Fields
{
if (isset($this->siteDecrypt[$cryptionType][$code]) && $this->siteDecrypt[$cryptionType][$code])
{
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);" . PHP_EOL;
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);" . PHP_EOL;
}
elseif (isset($this->{$cryptionType . 'FieldModelInitiator'}[$code])
&& isset($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get'] as $block)
{
$script .= PHP_EOL . $this->_t(2) . implode(PHP_EOL . $this->_t(2), $block);
}
}
}
}
$methods = str_replace($this->hhh . 'CRYPT' . $this->hhh, $script, $methods);
@ -3250,10 +3290,21 @@ class Interpretation extends Fields
{
if ($this->siteDecrypt[$cryptionType][$code])
{
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
}
elseif (isset($this->{$cryptionType . 'FieldModelInitiator'}[$code])
&& isset($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$code]['get'] as $block)
{
$script .= PHP_EOL . $this->_t(2) . implode(PHP_EOL . $this->_t(2), $block);
}
}
}
}
return $script . $getItem;
@ -4574,19 +4625,38 @@ class Interpretation extends Fields
// decryption
foreach ($this->cryptionTypes as $cryptionType)
{
if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view]))
if (isset($this->{$cryptionType . 'FieldModeling'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'FieldModeling'}[$view]))
{
$script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(3) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(3) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString)
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(3) . "if (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))";
$script .= PHP_EOL . $this->_t(3) . "{";
$script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . ".";
$script .= PHP_EOL . $this->_t(4) . "\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");";
$script .= PHP_EOL . $this->_t(3) . "}";
$script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption.";
$script .= PHP_EOL . $this->_t(3) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(3) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
foreach ($this->{$cryptionType . 'FieldModeling'}[$view] as $baseString)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(3) . "if (!empty(\$item->" . $baseString . ") && \$" . $cryptionType . "key && !is_numeric(\$item->" . $baseString . ") && \$item->" . $baseString . " === base64_encode(base64_decode(\$item->" . $baseString . ", true)))";
$script .= PHP_EOL . $this->_t(3) . "{";
$script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " " . $cryptionType . " decrypt data " . $baseString . ".";
$script .= PHP_EOL . $this->_t(4) . "\$item->" . $baseString . " = rtrim(\$" . $cryptionType . "->decryptString(\$item->" . $baseString . "), " . '"\0"' . ");";
$script .= PHP_EOL . $this->_t(3) . "}";
}
}
else
{
if (isset($this->{$cryptionType . 'FieldModelInitiator'}[$view]['get']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$view]['get'] as $block)
{
$script .= PHP_EOL . $this->_t(3) . implode(PHP_EOL . $this->_t(3), $block);
}
}
// set the expert script
foreach ($this->{$cryptionType . 'FieldModeling'}[$view] as $baseString => $opener_)
{
$_placeholder_for_field = array('[[[field]]]' => '$item->' . $baseString);
$script .= $this->setPlaceholders(PHP_EOL . $this->_t(3) . implode(PHP_EOL . $this->_t(3), $opener_['get']), $_placeholder_for_field);
}
}
}
}
@ -4718,19 +4788,39 @@ class Interpretation extends Fields
// turn string into encrypted string
foreach ($this->cryptionTypes as $cryptionType)
{
if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view]))
if (isset($this->{$cryptionType . 'FieldModeling'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'FieldModeling'}[$view]))
{
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
foreach ($this->{$cryptionType . 'EncryptionBuilder'}[$view] as $baseString)
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . ".";
$script .= PHP_EOL . $this->_t(2) . "if (isset(\$data['" . $baseString . "']) && \$" . $cryptionType . "key)";
$script .= PHP_EOL . $this->_t(2) . "{";
$script .= PHP_EOL . $this->_t(3) . "\$data['" . $baseString . "'] = \$" . $cryptionType . "->encryptString(\$data['" . $baseString . "']);";
$script .= PHP_EOL . $this->_t(2) . "}";
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key.";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the encryption object";
$script .= PHP_EOL . $this->_t(2) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
foreach ($this->{$cryptionType . 'FieldModeling'}[$view] as $baseString)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Encrypt data " . $baseString . ".";
$script .= PHP_EOL . $this->_t(2) . "if (isset(\$data['" . $baseString . "']) && \$" . $cryptionType . "key)";
$script .= PHP_EOL . $this->_t(2) . "{";
$script .= PHP_EOL . $this->_t(3) . "\$data['" . $baseString . "'] = \$" . $cryptionType . "->encryptString(\$data['" . $baseString . "']);";
$script .= PHP_EOL . $this->_t(2) . "}";
}
}
else
{
if (isset($this->{$cryptionType . 'FieldModelInitiator'}[$view]) &&
isset($this->{$cryptionType . 'FieldModelInitiator'}[$view]['save']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$view]['save'] as $block)
{
$script .= PHP_EOL . $this->_t(2) . implode(PHP_EOL . $this->_t(2), $block);
}
}
// set the expert script
foreach ($this->{$cryptionType . 'FieldModeling'}[$view] as $baseString => $locker_)
{
$_placeholder_for_field = array('[[[field]]]' => "\$data['" . $baseString . "']");
$script .= $this->setPlaceholders(PHP_EOL . $this->_t(2) . implode(PHP_EOL . $this->_t(2), $locker_['save']), $_placeholder_for_field);
}
}
}
}
@ -12863,6 +12953,12 @@ class Interpretation extends Fields
$mediumCrypt = true;
$suffix_decode = '';
break;
case 6:
// EXPERT_ENCRYPTION
$decode = '///////////////////////////////////////////';
$expertCrypt = true;
$suffix_decode = '';
break;
default:
// JSON_ARRAY_ENCODE
$decode = 'json_decode';
@ -13142,10 +13238,21 @@ class Interpretation extends Fields
{
if (${$cryptionType . 'Crypt'})
{
$script .= PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
if ('expert' !== $cryptionType)
{
$script .= PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the " . $cryptionType . " encryption key.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . "key = " . $Component . "Helper::getCryptKey('" . $cryptionType . "');";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get the encryption object.";
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "\$" . $cryptionType . " = new FOFEncryptAes(\$" . $cryptionType . "key);";
}
elseif (isset($this->{$cryptionType . 'FieldModelInitiator'}[$viewName_single])
&& isset($this->{$cryptionType . 'FieldModelInitiator'}[$viewName_single]['get']))
{
foreach ($this->{$cryptionType . 'FieldModelInitiator'}[$viewName_single]['get'] as $block)
{
$script .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . implode(PHP_EOL . $this->_t(1) . $tab . $this->_t(1), $block);
}
}
}
}
// add the encryption script

View File

@ -224,7 +224,6 @@ class Infusion extends Interpretation
$this->fileContentStatic[$globalPlaceholder] = $gloabalValue;
}
}
// reset view array
$viewarray = array();
$site_edit_view_array = array();
@ -313,7 +312,6 @@ class Infusion extends Interpretation
{
$this->fileContentDynamic[$viewName_single][$this->hhh . 'DOCUMENT_CUSTOM_PHP' . $this->hhh] = '';
}
// LINKEDVIEWTABLESCRIPTS <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_single][$this->hhh . 'LINKEDVIEWTABLESCRIPTS' . $this->hhh] = '';
@ -606,7 +604,6 @@ class Infusion extends Interpretation
}
// HELPER_EXEL
$this->fileContentStatic[$this->hhh . 'HELPER_EXEL' . $this->hhh] = $this->setExelHelperMethods();
// Trigger Event: jcb_ce_onAfterBuildAdminViewContent
$this->triggerEvent('jcb_ce_onAfterBuildAdminViewContent', array(&$this->componentContext, &$view, &$viewName_single, &$viewName_list, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh));
}