Fixed linking issue, improved the new helpers to not hard code the component name to them.

This commit is contained in:
2022-05-16 06:27:50 +02:00
parent 1e0533ffa5
commit c99cb17c5b
28 changed files with 382 additions and 113 deletions

View File

@ -143,14 +143,14 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 9th May, 2022
+ *Last Build*: 16th May, 2022
+ *Version*: 2.12.17
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **286508**
+ *Line count*: **286766**
+ *Field count*: **1581**
+ *File count*: **1851**
+ *Folder count*: **260**
+ *File count*: **1853**
+ *Folder count*: **261**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)

View File

@ -25,12 +25,17 @@ defined('_JEXEC') or die('Restricted access');###ADMIN_POWER_HELPER###
abstract class ###Component###Helper
{
/**
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
use Utilities;
/**
* get the Component Code Name
*/
public static $ComponentCodeName = '###component###';
/**
* Composer Switch
*

View File

@ -25,12 +25,17 @@ defined('_JEXEC') or die('Restricted access');###SITE_POWER_HELPER###
abstract class ###Component###Helper
{
/**
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
use Utilities;
/**
* get the Component Code Name
*/
public static $ComponentCodeName = '###component###';
/**
* Composer Switch
*

View File

@ -12090,7 +12090,7 @@ class Interpretation extends Fields
&& isset($item['id_code']))
{
// build GUID link
if ($item['custom']['id'] !== 'id')
if (isset($item['custom']['id']) && $item['custom']['id'] !== 'id')
{
// link to that linked item
return 'index.php?option=' . $item['custom']['component'] . '&view='
@ -12101,7 +12101,7 @@ class Interpretation extends Fields
// link to that linked item
return 'index.php?option=' . $item['custom']['component'] . '&view='
. $item['custom']['views'] . '&task=' . $item['custom']['view']
. '.edit&id=<?php echo $item->' . $item['id_code'] . '_id; ?>'
. '.edit&id=<?php echo $item->' . $item['id_code'] . '; ?>'
. $ref;
}
elseif (isset($item['custom'])

View File

@ -76,12 +76,17 @@ use VDM\Joomla\Utilities;
abstract class ComponentbuilderHelper
{
/**
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
* Adding the utilities trait to this class
*
* @deprecated 4.0 - Check the trait methods for details, a legacy implementation
*/
use Utilities;
/**
* get the Component Code Name
*/
public static $ComponentCodeName = 'componentbuilder';
/**
* Composer Switch
*

View File

@ -1532,11 +1532,11 @@ class ComponentbuilderModelAjax extends JModelList
// set the key get value
$key_get_value = $values['a_id'];
// check if we have a GUID
if (isset($values['a_guid']))
{
$ref .= '&guid=' . (string) $values['a_guid'];
$key_get_value = $values['a_guid'];
}
//if (isset($values['a_guid']))
//{
// $ref .= '&guid=' . (string) $values['a_guid'];
// $key_get_value = $values['a_guid'];
//}
// get item id
if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0)
{

View File

@ -77,7 +77,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
public $postfix = false;
public $forceUpdate = 0;
public $hasKey = 0;
public $sleutle = null;
public $sleutle = '';
public $data = false;
public $app;
@ -241,7 +241,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// has a key
$this->hasKey = $this->app->input->getInt('haskey', 0);
// die sleutle
$this->sleutle = $this->app->input->getString('sleutle', NULL);
$this->sleutle = $this->app->input->getString('sleutle', '');
// try to store/set data
if (!$this->setData($package))
{
@ -349,7 +349,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
$db = 'COM_COMPONENTBUILDER_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM';
$password = base64_decode(JText::sprintf($db, 'VjR', 'WV0aE9k'));
// unlock the info data
if (($info = $this->unlock($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info))
if (($info = $this->decrypt($info, $password, true)) !== false && ComponentbuilderHelper::checkJson($info))
{
// we only continue if info could be opened
$session->set('smart_package_info', $info);
@ -666,7 +666,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected function extractData($data)
{
// remove all line breaks
if (($data = $this->unlock($data, $this->sleutle)) !== false)
if (($data = $this->decrypt($data, $this->sleutle)) !== false)
{
// final check if we have success
$data = @unserialize($data);
@ -1045,7 +1045,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
foreach ($files as $file)
{
// open the file content
if (($data = $this->unlock(file_get_contents($file), $this->sleutle)) !== false)
if (($data = $this->decrypt(file_get_contents($file), $this->sleutle)) !== false)
{
// write the decrypted data back to file
if (!ComponentbuilderHelper::writeFile($file, $data))
@ -1068,7 +1068,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
/**
* unlock data
* decrypt data
*
* @param string $data The data string
* @param string $password The key to unlock
@ -1078,7 +1078,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
*
* @since 3.0.11
**/
protected function unlock(string $data, string $password, bool $force = false)
protected function decrypt(string $data, string $password, bool $force = false)
{
// remove all line breaks
$data = str_replace("\n", '', $data);

View File

@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=custom_admin_views&task=cust
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->main_get_name); ?>
<?php endif; ?>

View File

@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('fieldtype.edit', 'com_componentbuilder.fieldtype.' . (int) $item->fieldtype)): ?>
<a href="index.php?option=com_componentbuilder&view=fieldtypes&task=fieldtype.edit&id=<?php echo $item->fieldtype_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->fieldtype_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=fieldtypes&task=fieldtype.edit&id=<?php echo $item->fieldtype; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->fieldtype_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->fieldtype_name); ?>
<?php endif; ?>

View File

@ -73,7 +73,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=jo
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->class_extends_name); ?>
<?php endif; ?>

View File

@ -102,7 +102,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('class_extends.edit', 'com_componentbuilder.class_extends.' . (int) $item->class_extends)): ?>
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=class_extendings&task=class_extends.edit&id=<?php echo $item->class_extends; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->class_extends_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->class_extends_name); ?>
<?php endif; ?>
@ -111,7 +111,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('core.edit', 'com_componentbuilder.joomla_plugin_group.' . (int) $item->joomla_plugin_group)): ?>
<a href="index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit&id=<?php echo $item->joomla_plugin_group_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->joomla_plugin_group_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=joomla_plugin_group.edit&id=<?php echo $item->joomla_plugin_group; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->joomla_plugin_group_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->joomla_plugin_group_name); ?>
<?php endif; ?>

View File

@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit";
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->dynamic_get_name); ?>
<?php endif; ?>

View File

@ -95,7 +95,7 @@ $edit = "index.php?option=com_componentbuilder&view=site_views&task=site_view.ed
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->main_get)): ?>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->main_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->main_get_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->main_get_name); ?>
<?php endif; ?>

View File

@ -82,7 +82,7 @@ $edit = "index.php?option=com_componentbuilder&view=snippets&task=snippet.edit";
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('library.edit', 'com_componentbuilder.library.' . (int) $item->library)): ?>
<a href="index.php?option=com_componentbuilder&view=libraries&task=library.edit&id=<?php echo $item->library_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->library_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=libraries&task=library.edit&id=<?php echo $item->library; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->library_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->library_name); ?>
<?php endif; ?>

View File

@ -83,7 +83,7 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit
<td class="nowrap">
<div class="name">
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int) $item->dynamic_get)): ?>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get_id; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get; ?>&return=<?php echo $this->return_here; ?>"><?php echo $this->escape($item->dynamic_get_name); ?></a>
<?php else: ?>
<?php echo $this->escape($item->dynamic_get_name); ?>
<?php endif; ?>