Fixed gh-571 compiler path errors.

This commit is contained in:
2020-06-25 21:22:30 +02:00
parent 90f48bd5fa
commit e86ab88f5c
77 changed files with 369 additions and 125 deletions

View File

@ -1413,6 +1413,8 @@ class Get
? json_decode($component->addadmin_views, true) : null;
if (ComponentbuilderHelper::checkArray($component->addadmin_views))
{
$this->lang = 'admin';
$this->target = 'admin';
// sort the views according to order
usort(
$component->addadmin_views, function ($a, $b) {
@ -2923,6 +2925,10 @@ class Get
false,
$guiMapper
);
// check if we have template or layouts to load
$this->setTemplateAndLayoutData($view->{$scripter}, $name_single);
unset($view->{$scripter});
}
}
@ -2953,6 +2959,9 @@ class Get
),
$guiMapper
);
// check if we have template or layouts to load
$this->setTemplateAndLayoutData($view->{$button_code_field}, $name_single);
}
}
// set the button array
@ -3045,6 +3054,7 @@ class Get
$name_single,
$guiMapper
);
if ($addAjaxSite)
{
$this->setCustomScriptBuilder(
@ -4988,6 +4998,8 @@ class Get
{
$script = $this->setGuiCodePlaceholder($script, $config);
}
// add base64 locking option of a string
$script = $this->setBase64LOCK($script);
// load the script
if ($first && $second && $third)
{
@ -9851,7 +9863,7 @@ class Get
*/
protected function customCodeFactory(&$paths, &$today)
{
// we must first store the current woking directory
// we must first store the current working directory
$joomla = getcwd();
$counter = array(1 => 0, 2 => 0);
// file types to get
@ -10337,6 +10349,35 @@ class Get
}
}
/**
* Lock a string with bsae64 (basic)
*
* @param string $string The code string
*
* @return string
*
*/
protected function setBase64LOCK($script)
{
if (strpos($script, 'LOCKBASE64((((') !== false)
{
// get the strings
$values = ComponentbuilderHelper::getAllBetween($script, 'LOCKBASE64((((', '))))');
$locker = array();
// convert them
foreach($values as $value)
{
$locker['LOCKBASE64((((' . $value . '))))'] = "base64_decode( preg_replace('/\s+/', ''," .
PHP_EOL . $this->_t(2) . "'" .
wordwrap(base64_encode($value), 64, PHP_EOL . $this->_t(2), true) .
"'));";
}
// update the script
return $this->setPlaceholders($script, $locker);
}
return $script;
}
/**
* Set the JCB GUI code placeholder
*

View File

@ -2556,7 +2556,8 @@ class Structure extends Get
public function moveFieldsRules($field, $path)
{
// check if we have a subform or repeatable field
if ($field['type_name'] === 'subform' || $field['type_name'] === 'repeatable')
if ($field['type_name'] === 'subform'
|| $field['type_name'] === 'repeatable')
{
// since we could have a custom field or rule inside
$this->moveMultiFieldsRules($field, $path);
@ -2624,7 +2625,7 @@ class Structure extends Get
* move the fields and Rules of multi fields
*
* @param array $multi_field The field data
* @param string $path The path to move to
* @param string $path The path to move to
*
* @return void
*
@ -2632,13 +2633,19 @@ class Structure extends Get
protected function moveMultiFieldsRules($multi_field, $path)
{
// get the fields ids
$ids = array_map( 'trim', explode(',', ComponentbuilderHelper::getBetween($multi_field['settings']->xml, 'fields="', '"')));
$ids = array_map(
'trim', explode(
',', ComponentbuilderHelper::getBetween(
$multi_field['settings']->xml, 'fields="', '"'
)
)
);
if (ComponentbuilderHelper::checkArray($ids))
{
foreach ($ids as $id)
{
// setup the field
$field = array();
$field = array();
$field['field'] = $id;
$this->setFieldDetails($field);
// move field and rules if needed
@ -2835,10 +2842,24 @@ class Structure extends Get
{
$path = $details->path;
}
$zipPath = str_replace('c0mp0n3nt/', '', $path);
$path = str_replace(
'c0mp0n3nt/', $this->componentPath . '/', $path
);
// make sure we have component to replace
if (strpos($path, 'c0mp0n3nt') !== false)
{
$zipPath = str_replace('c0mp0n3nt/', '', $path);
$path = str_replace(
'c0mp0n3nt/', $this->componentPath . '/', $path
);
}
else
{
$this->app->enqueueMessage(
JText::sprintf(
'<hr /><h3>c0mp0n3nt issue found</h3><p>The path (%s) could not be used.</p>',
$path
), 'Error'
);
continue;
}
// setup the folder
if (!JFolder::exists($path))
@ -2878,7 +2899,7 @@ class Structure extends Get
// move the file to its place
JFile::copy(
$this->templatePath . '/' . $item,
$path . '/' . $new, '', true
$path . '/' . $new
);
// count the file created
$this->fileCount++;
@ -2934,9 +2955,10 @@ class Structure extends Get
'rename' => 1);
$this->componentData->folders[] = $importView;
// move the phpspreadsheet Folder (TODO we must move this to a library package)
$PHPExcel = array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor',
'path' => '/libraries/phpspreadsheet/',
'rename' => 0);
$PHPExcel
= array('folderpath' => 'JPATH_LIBRARIES/phpspreadsheet/vendor',
'path' => '/libraries/phpspreadsheet/',
'rename' => 0);
$this->componentData->folders[] = $PHPExcel;
}
if (2 == $this->uikit || 1 == $this->uikit)

View File

@ -5260,7 +5260,10 @@ class Interpretation extends Fields
. " this is where you want to load your module position";
$addModule[] = $this->_t(3)
. "\$modules = JModuleHelper::getModules(\$position);";
$addModule[] = $this->_t(3) . "if (\$modules)";
$addModule[] = $this->_t(3) . "if ("
. $this->fileContentStatic[$this->hhh . 'Component'
. $this->hhh]
. "Helper::checkArray(\$modules, true))";
$addModule[] = $this->_t(3) . "{";
$addModule[] = $this->_t(4) . "//" . $this->setLine(__LINE__)
. " set the place holder";
@ -12622,10 +12625,11 @@ class Interpretation extends Fields
if ($items_one || $items_two)
{
// check if the item has permissions.
$publishingPer = array();
$allToBeChekced = array('core.delete', 'core.edit.created_by',
'core.edit.state', 'core.edit.created');
foreach ($allToBeChekced as $core_permission)
$publishingPerOR = array();
$allToBeChekcedOR = array('core.edit.created_by',
'core.edit.created',
'core.edit.state');
foreach ($allToBeChekcedOR as $core_permission)
{
if ($coreLoad && isset($core[$core_permission])
&& isset($this->permissionBuilder['global'][$core[$core_permission]])
@ -12638,13 +12642,38 @@ class Interpretation extends Fields
))
{
// set permissions.
$publishingPer[] = "\$this->canDo->get('"
$publishingPerOR[] = "\$this->canDo->get('"
. $core[$core_permission] . "')";
}
else
{
// set permissions.
$publishingPer[] = "\$this->canDo->get('" . $core_permission
$publishingPerOR[] = "\$this->canDo->get('" . $core_permission
. "')";
}
}
$publishingPerAND = array();
$allToBeChekcedAND = array('core.delete', 'core.edit.state');
foreach ($allToBeChekcedAND as $core_permission)
{
if ($coreLoad && isset($core[$core_permission])
&& isset($this->permissionBuilder['global'][$core[$core_permission]])
&& ComponentbuilderHelper::checkArray(
$this->permissionBuilder['global'][$core[$core_permission]]
)
&& in_array(
$view_name_single,
$this->permissionBuilder['global'][$core[$core_permission]]
))
{
// set permissions.
$publishingPerAND[] = "\$this->canDo->get('"
. $core[$core_permission] . "')";
}
else
{
// set permissions.
$publishingPerAND[] = "\$this->canDo->get('" . $core_permission
. "')";
}
}
@ -12655,8 +12684,11 @@ class Interpretation extends Fields
{
$tabs .= $_customTabHTML;
}
// add the AND values to OR
$publishingPerOR[] = '(' . implode(' && ', $publishingPerAND) . ')';
// now build the complete showhide behaviour for the publishing area
$tabs .= PHP_EOL . PHP_EOL . $this->_t(1) . "<?php if (" . implode(
' || ', $publishingPer
' || ', $publishingPerOR
) . ") : ?>";
// set the default publishing tab
$tabs .= PHP_EOL . $this->_t(1)
@ -20821,7 +20853,7 @@ class Interpretation extends Fields
// move the image to its place
JFile::copy(
JPATH_SITE . '/' . $path,
$imagePath . '/vdm-component.' . $type, '', true
$imagePath . '/vdm-component.' . $type
);
// now set the type to global for re-use
$this->componentImageType = $type;
@ -21060,8 +21092,7 @@ class Interpretation extends Fields
}
// move the image to its place
JFile::copy(
JPATH_SITE . '/' . $path, $imagePath . '/' . $imageName,
'', true
JPATH_SITE . '/' . $path, $imagePath . '/' . $imageName
);
}
}

View File

@ -1077,6 +1077,9 @@ class Infusion extends Interpretation
);
}
// setup the layouts
$this->setCustomViewLayouts();
// ADMIN_HELPER_CLASS_HEADER
$this->fileContentStatic[$this->hhh . 'ADMIN_HELPER_CLASS_HEADER'
. $this->hhh]
@ -1760,6 +1763,7 @@ class Infusion extends Interpretation
&$this->placeholders, &$this->hhh)
);
}
// setup the layouts
$this->setCustomViewLayouts();
}