Resolved gh-323 so we can load fields only in the linked or admin list views or in both. Added the option to also add permission to access fields. Improved the checkArray method to return arry count value. Fixed issue in field permissions when the value is and array, field type can not be made hidden, but should instead just be removed. Fixed an issue in the code search methods to insure all areas are looked at, and search and export.

This commit is contained in:
Llewellyn van der Merwe 2018-10-29 18:38:00 +02:00
parent 1e5fda0327
commit 6c4bab5ea9
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
58 changed files with 556 additions and 355 deletions

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *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*: 7th October, 2018
+ *Last Build*: 29th October, 2018
+ *Version*: 2.9.7
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195701**
+ *Line count*: **195735**
+ *Field count*: **1087**
+ *File count*: **1277**
+ *Folder count*: **201**

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *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*: 7th October, 2018
+ *Last Build*: 29th October, 2018
+ *Version*: 2.9.7
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **195701**
+ *Line count*: **195735**
+ *Field count*: **1087**
+ *File count*: **1277**
+ *Folder count*: **201**

View File

@ -854,11 +854,11 @@ abstract class ###Component###Helper
*
* @input array The array to check
*
* @returns bool true on success
* @returns bool/int number of items in array on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
if (isset($array) && is_array($array) && count((array)$array) > 0)
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{
// also make sure the empty strings are removed
if ($removeEmptyString)
@ -872,7 +872,7 @@ abstract class ###Component###Helper
}
return self::checkArray($array, false);
}
return true;
return $nr;
}
return false;
}

View File

@ -846,11 +846,11 @@ abstract class ###Component###Helper
*
* @input array The array to check
*
* @returns bool true on success
* @returns bool/int number of items in array on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
if (isset($array) && is_array($array) && count((array)$array) > 0)
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{
// also make sure the empty strings are removed
if ($removeEmptyString)
@ -864,7 +864,7 @@ abstract class ###Component###Helper
}
return self::checkArray($array, false);
}
return true;
return $nr;
}
return false;
}

View File

@ -222,7 +222,7 @@ class ###Component###Table###View### extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -328,7 +328,8 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
$_tablesArray = array(
'admin_fields',
'admin_fields_conditions',
'admin_fields_relations'
'admin_fields_relations',
'admin_custom_tabs'
);
foreach($_tablesArray as $_updateTable)
{

View File

@ -2713,7 +2713,7 @@ class Get
return $field['type_name'];
}
// check that we have the poperties
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) && isset($field['settings']->properties) && ComponentbuilderHelper::checkArray($field['settings']->properties))
{
// search for own custom fields
if (strpos($field['settings']->type_name, '@') !== false)
@ -4316,139 +4316,155 @@ class Get
$counter = 'a';
// Create a new query object.
$query = $this->db->getQuery(true);
// switch to onlu trigger the run of the query if we have tables to query
$runQuery = false;
foreach ($tables as $table)
{
if ($counter === 'a')
if (isset($table['table']))
{
// the main table fields
if (strpos($table['sourcemap'], PHP_EOL) !== false)
if ($counter === 'a')
{
$fields = explode(PHP_EOL, $table['sourcemap']);
if (ComponentbuilderHelper::checkArray($fields))
// the main table fields
if (strpos($table['sourcemap'], PHP_EOL) !== false)
{
// reset array buckets
$sourceArray = array();
$targetArray = array();
foreach ($fields as $field)
$fields = explode(PHP_EOL, $table['sourcemap']);
if (ComponentbuilderHelper::checkArray($fields))
{
if (strpos($field, "=>") !== false)
// reset array buckets
$sourceArray = array();
$targetArray = array();
foreach ($fields as $field)
{
list($source, $target) = explode("=>", $field);
$sourceArray[] = $counter . '.' . trim($source);
$targetArray[] = trim($target);
if (strpos($field, "=>") !== false)
{
list($source, $target) = explode("=>", $field);
$sourceArray[] = $counter . '.' . trim($source);
$targetArray[] = trim($target);
}
}
}
if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray))
{
// add to query
$query->select($this->db->quoteName($sourceArray, $targetArray));
$query->from('#__' . $table['table'] . ' AS a');
}
// we may need to filter the selection
if (isset($this->sqlTweak[$view_id]['where']))
{
// add to query the where filter
$query->where('a.id IN (' . $this->sqlTweak[$view_id]['where'] . ')');
}
}
}
}
else
{
// the other tables
if (strpos($table['sourcemap'], PHP_EOL) !== false)
{
$fields = explode(PHP_EOL, $table['sourcemap']);
if (ComponentbuilderHelper::checkArray($fields))
{
// reset array buckets
$sourceArray = array();
$targetArray = array();
foreach ($fields as $field)
{
if (strpos($field, "=>") !== false)
if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray))
{
list($source, $target) = explode("=>", $field);
$sourceArray[] = $counter . '.' . trim($source);
$targetArray[] = trim($target);
}
if (strpos($field, "==") !== false)
{
list($aKey, $bKey) = explode("==", $field);
// add to query
$query->join('LEFT', $this->db->quoteName('#__' . $table['table'], $counter) . ' ON (' . $this->db->quoteName('a.' . trim($aKey)) . ' = ' . $this->db->quoteName($counter . '.' . trim($bKey)) . ')');
$query->select($this->db->quoteName($sourceArray, $targetArray));
$query->from('#__' . $table['table'] . ' AS a');
$runQuery = true;
}
// we may need to filter the selection
if (isset($this->sqlTweak[$view_id]['where']))
{
// add to query the where filter
$query->where('a.id IN (' . $this->sqlTweak[$view_id]['where'] . ')');
}
}
if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray))
{
// add to query
$query->select($this->db->quoteName($sourceArray, $targetArray));
}
}
}
}
$counter++;
}
// now get the data
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
// get the data
$data = $this->db->loadObjectList();
// start building the MySql dump
$dump = "--";
$dump .= PHP_EOL . "-- Dumping data for table `#__" . $this->bbb . "component" . $this->ddd . "_" . $view . "`";
$dump .= PHP_EOL . "--";
$dump .= PHP_EOL . PHP_EOL . "INSERT INTO `#__" . $this->bbb . "component" . $this->ddd . "_" . $view . "` (";
foreach ($data as $line)
{
$comaSet = 0;
foreach ($line as $fieldName => $fieldValue)
{
if ($comaSet == 0)
{
$dump .= $this->db->quoteName($fieldName);
}
else
{
$dump .= ", " . $this->db->quoteName($fieldName);
}
$comaSet++;
}
break;
}
$dump .= ") VALUES";
$coma = 0;
foreach ($data as $line)
{
if ($coma == 0)
{
$dump .= PHP_EOL . "(";
}
else
{
$dump .= "," . PHP_EOL . "(";
}
$comaSet = 0;
foreach ($line as $fieldName => $fieldValue)
{
if ($comaSet == 0)
// the other tables
if (strpos($table['sourcemap'], PHP_EOL) !== false)
{
$dump .= $this->mysql_escape($fieldValue);
$fields = explode(PHP_EOL, $table['sourcemap']);
if (ComponentbuilderHelper::checkArray($fields))
{
// reset array buckets
$sourceArray = array();
$targetArray = array();
foreach ($fields as $field)
{
if (strpos($field, "=>") !== false)
{
list($source, $target) = explode("=>", $field);
$sourceArray[] = $counter . '.' . trim($source);
$targetArray[] = trim($target);
}
if (strpos($field, "==") !== false)
{
list($aKey, $bKey) = explode("==", $field);
// add to query
$query->join('LEFT', $this->db->quoteName('#__' . $table['table'], $counter) . ' ON (' . $this->db->quoteName('a.' . trim($aKey)) . ' = ' . $this->db->quoteName($counter . '.' . trim($bKey)) . ')');
}
}
if (ComponentbuilderHelper::checkArray($sourceArray) && ComponentbuilderHelper::checkArray($targetArray))
{
// add to query
$query->select($this->db->quoteName($sourceArray, $targetArray));
}
}
}
}
$counter++;
}
else
{
// see where
// var_dump($view);
// jexit();
}
}
// check if we should run query
if ($runQuery)
{
// now get the data
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
// get the data
$data = $this->db->loadObjectList();
// start building the MySql dump
$dump = "--";
$dump .= PHP_EOL . "-- Dumping data for table `#__" . $this->bbb . "component" . $this->ddd . "_" . $view . "`";
$dump .= PHP_EOL . "--";
$dump .= PHP_EOL . PHP_EOL . "INSERT INTO `#__" . $this->bbb . "component" . $this->ddd . "_" . $view . "` (";
foreach ($data as $line)
{
$comaSet = 0;
foreach ($line as $fieldName => $fieldValue)
{
if ($comaSet == 0)
{
$dump .= $this->db->quoteName($fieldName);
}
else
{
$dump .= ", " . $this->db->quoteName($fieldName);
}
$comaSet++;
}
break;
}
$dump .= ") VALUES";
$coma = 0;
foreach ($data as $line)
{
if ($coma == 0)
{
$dump .= PHP_EOL . "(";
}
else
{
$dump .= ", " . $this->mysql_escape($fieldValue);
$dump .= "," . PHP_EOL . "(";
}
$comaSet++;
$comaSet = 0;
foreach ($line as $fieldName => $fieldValue)
{
if ($comaSet == 0)
{
$dump .= $this->mysql_escape($fieldValue);
}
else
{
$dump .= ", " . $this->mysql_escape($fieldValue);
}
$comaSet++;
}
$dump .= ")";
$coma++;
}
$dump .= ")";
$coma++;
$dump .= ";";
// return build dump query
return $dump;
}
$dump .= ";";
// return build dump query
return $dump;
}
}
return false;

View File

@ -2107,6 +2107,8 @@ class Fields extends Structure
// setup a default field
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
{
// we need a deeper php code search tracker
$phpTracker = array();
foreach ($field['settings']->properties as $property)
{
// reset
@ -2155,6 +2157,8 @@ class Fields extends Structure
$this->setDynamicValues(ComponentbuilderHelper::openValidBase64(
ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"')
));
// load tracker
$phpTracker['type_' . $phpKey] = $phpKey;
}
elseif ($property['name'] === 'prime_php' && $setCustom)
{
@ -2338,6 +2342,24 @@ class Fields extends Structure
$fieldAttributes['default'] = $xmlValue;
}
}
// check if all php is loaded using the tracker
if (ComponentbuilderHelper::checkArray($phpTracker))
{
// litle search validation
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
foreach ($phpTracker as $searchKey => $phpKey)
{
// we must search for more code in the xml just incase
foreach(range(2, 30) as $phpLine)
{
$get_ = $searchKey . '_' . $phpLine;
if (!isset($fieldAttributes['custom'][$phpKey][$phpLine]) && ($value = ComponentbuilderHelper::getValueFromXMLstring($field['settings']->xml, $get_, $confirmation)) !== $confirmation)
{
$fieldAttributes['custom'][$phpKey][$phpLine] = $this->setDynamicValues(ComponentbuilderHelper::openValidBase64($value));
}
}
}
}
// do some nice twigs beyond the default
if (isset($fieldAttributes['name']))
{
@ -2460,7 +2482,7 @@ class Fields extends Structure
}
}
// set list switch
$listSwitch = (isset($field['list']) && $field['list'] == 1);
$listSwitch = (isset($field['list']) && ($field['list'] == 1 || $field['list'] == 3 || $field['list'] == 4 ));
// set list join
$listJoin = (isset($this->listJoinBuilder[$view_name_list][(int) $field['field']]));
// add history to this view
@ -2523,7 +2545,8 @@ class Fields extends Structure
'sort' => (isset($field['sort']) && $field['sort']) ? true : false,
'custom' => $custom,
'multiple' => $multiple,
'options' => $options);
'options' => $options,
'target' => (int) $field['list']);
}
// build custom builder list
if ($listSwitch || $listJoin)

View File

@ -4554,6 +4554,9 @@ class Interpretation extends Fields
public function setMethodItemSave(&$view)
{
$script = '';
// get component name
$Component = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh];
$component = $this->fileContentStatic[$this->hhh . 'component' . $this->hhh];
// check if there was script added before modeling of data
$script .= $this->getCustomScriptBuilder('php_before_save', $view, PHP_EOL . PHP_EOL);
// turn array into JSON string
@ -4568,7 +4571,22 @@ class Interpretation extends Fields
$script .= PHP_EOL . $this->_t(3) . "\$" . $jsonItem . "->loadArray(\$data['" . $jsonItem . "']);";
$script .= PHP_EOL . $this->_t(3) . "\$data['" . $jsonItem . "'] = (string) \$" . $jsonItem . ";";
$script .= PHP_EOL . $this->_t(2) . "}";
$script .= PHP_EOL . $this->_t(2) . "elseif (!isset(\$data['" . $jsonItem . "']))";
if (isset($this->permissionFields[$view]) && isset($this->permissionFields[$view][$jsonItem]) && ComponentbuilderHelper::checkArray($this->permissionFields[$view][$jsonItem]))
{
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Also check permission since the value may be removed due to permissions";
$script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Then we do not want to clear it out, but simple ignore the empty " . $jsonItem;
$script .= PHP_EOL . $this->_t(2) . "elseif (!isset(\$data['" . $jsonItem . "'])";
// only add permission that are available
foreach ($this->permissionFields[$view][$jsonItem] as $permission_option => $fieldType)
{
$script .= PHP_EOL . $this->_t(3) . "&& JFactory::getUser()->authorise('" . $view . "." . $permission_option . "." . $jsonItem . "', 'com_" . $component . "')";
}
$script .= ")";
}
else
{
$script .= PHP_EOL . $this->_t(2) . "elseif (!isset(\$data['" . $jsonItem . "']))";
}
$script .= PHP_EOL . $this->_t(2) . "{";
$script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set the empty " . $jsonItem . " to data";
$script .= PHP_EOL . $this->_t(3) . "\$data['" . $jsonItem . "'] = '';";
@ -4600,7 +4618,6 @@ class Interpretation extends Fields
}
}
// turn string into encrypted string
$Component = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh];
foreach ($this->cryptionTypes as $cryptionType)
{
if (isset($this->{$cryptionType . 'EncryptionBuilder'}[$view]) && ComponentbuilderHelper::checkArray($this->{$cryptionType . 'EncryptionBuilder'}[$view]))
@ -6759,25 +6776,29 @@ class Interpretation extends Fields
// start adding the dynamic
foreach ($this->listBuilder[$viewName_list] as $item)
{
// set some defaults
$customAdminViewButtons = '';
// set the item default class
$itemClass = 'hidden-phone';
// set the item row
$itemRow = $this->getListItemBuilder($item, $viewName_single, $viewName_list, $itemClass, $doNotEscape, $coreLoad, $core);
// check if buttons was aready added
if ($firstTimeBeingAdded) // TODO we must improve this to allow more items to be targeted instead of just the first item :)
// check if target is admin list
if (1 == $item['target'] || 3 == $item['target'])
{
// get custom admin view buttons
$customAdminViewButtons = $this->getCustomAdminViewButtons($viewName_list);
// make sure the custom admin view buttons are only added once
$firstTimeBeingAdded = false;
// set some defaults
$customAdminViewButtons = '';
// set the item default class
$itemClass = 'hidden-phone';
// set the item row
$itemRow = $this->getListItemBuilder($item, $viewName_single, $viewName_list, $itemClass, $doNotEscape, $coreLoad, $core);
// check if buttons was aready added
if ($firstTimeBeingAdded) // TODO we must improve this to allow more items to be targeted instead of just the first item :)
{
// get custom admin view buttons
$customAdminViewButtons = $this->getCustomAdminViewButtons($viewName_list);
// make sure the custom admin view buttons are only added once
$firstTimeBeingAdded = false;
}
// add row to body
$body .= PHP_EOL . $this->_t(2) . "<td class=\"" . $this->getListFieldClass($item['code'], $viewName_list, $itemClass) . "\">";
$body .= $itemRow;
$body .= $customAdminViewButtons;
$body .= PHP_EOL . $this->_t(2) . "</td>";
}
// add row to body
$body .= PHP_EOL . $this->_t(2) . "<td class=\"" . $this->getListFieldClass($item['code'], $viewName_list, $itemClass) . "\">";
$body .= $itemRow;
$body .= $customAdminViewButtons;
$body .= PHP_EOL . $this->_t(2) . "</td>";
}
// add the defaults
if (!isset($this->fieldsNames[$viewName_single]['published']))
@ -7253,30 +7274,34 @@ class Interpretation extends Fields
// build the dynamic fields
foreach ($this->listBuilder[$viewName_list] as $item)
{
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
// check if target is admin list
if (1 == $item['target'] || 3 == $item['target'])
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
}
// set the custom code
if (ComponentbuilderHelper::checkArray($item['custom']))
{
$item['code'] = $item['code'] . '_' . $item['custom']['text'];
}
$class = 'nowrap hidden-phone';
if ($item['link'])
{
$class = 'nowrap';
}
$title = "<?php echo JText:" . ":_('" . $item['lang'] . "'); ?>";
if ($item['sort'])
{
$title = "<?php echo JHtml::_('grid.sort', '" . $item['lang'] . "', '" . $item['code'] . "', \$this->listDirn, \$this->listOrder); ?>";
}
$head .= PHP_EOL . $this->_t(1) . '<th class="' . $class . '" >';
$head .= PHP_EOL . $this->_t(3) . $title;
$head .= PHP_EOL . $this->_t(1) . "</th>";
$this->listColnrBuilder[$viewName_list] ++;
}
// set the custom code
if (ComponentbuilderHelper::checkArray($item['custom']))
{
$item['code'] = $item['code'] . '_' . $item['custom']['text'];
}
$class = 'nowrap hidden-phone';
if ($item['link'])
{
$class = 'nowrap';
}
$title = "<?php echo JText:" . ":_('" . $item['lang'] . "'); ?>";
if ($item['sort'])
{
$title = "<?php echo JHtml::_('grid.sort', '" . $item['lang'] . "', '" . $item['code'] . "', \$this->listDirn, \$this->listOrder); ?>";
}
$head .= PHP_EOL . $this->_t(1) . '<th class="' . $class . '" >';
$head .= PHP_EOL . $this->_t(3) . $title;
$head .= PHP_EOL . $this->_t(1) . "</th>";
$this->listColnrBuilder[$viewName_list] ++;
}
// set default
if (!isset($this->fieldsNames[$viewName_single]['published']))
@ -8212,27 +8237,31 @@ class Interpretation extends Fields
// start adding the dynamic
foreach ($this->listBuilder[$viewName_list] as $item)
{
// set the ref
$ref = '<?php echo $ref; ?>';
// set some defaults
$customAdminViewButtons = '';
// set the item row
$itemRow = $this->getListItemBuilder($item, $viewName_single, $viewName_list, $itemClass, $doNotEscape, $coreLoad, $core, false, $ref, '$displayData->escape', '$user', $refview);
// check if buttons was aready added
if ($firstTimeBeingAdded) // TODO we must improve this to allow more items to be targeted instead of just the first item :)
// check if target is linked list view
if (1 == $item['target'] || 4 == $item['target'])
{
// get custom admin view buttons
$customAdminViewButtons = $this->getCustomAdminViewButtons($viewName_list, $ref);
// make sure the custom admin view buttons are only added once
$firstTimeBeingAdded = false;
// set the ref
$ref = '<?php echo $ref; ?>';
// set some defaults
$customAdminViewButtons = '';
// set the item row
$itemRow = $this->getListItemBuilder($item, $viewName_single, $viewName_list, $itemClass, $doNotEscape, $coreLoad, $core, false, $ref, '$displayData->escape', '$user', $refview);
// check if buttons was aready added
if ($firstTimeBeingAdded) // TODO we must improve this to allow more items to be targeted instead of just the first item :)
{
// get custom admin view buttons
$customAdminViewButtons = $this->getCustomAdminViewButtons($viewName_list, $ref);
// make sure the custom admin view buttons are only added once
$firstTimeBeingAdded = false;
}
// add row to body
$body .= PHP_EOL . $this->_t(2) . "<td>";
$body .= $itemRow;
$body .= $customAdminViewButtons;
$body .= PHP_EOL . $this->_t(2) . "</td>";
// increment counter
$counter++;
}
// add row to body
$body .= PHP_EOL . $this->_t(2) . "<td>";
$body .= $itemRow;
$body .= $customAdminViewButtons;
$body .= PHP_EOL . $this->_t(2) . "</td>";
// increment counter
$counter++;
}
$counter = $counter + 2;
$data_value = (3 == $this->footableVersion) ? 'data-sort-value' : 'data-value';
@ -8397,31 +8426,35 @@ class Interpretation extends Fields
// build the dynamic fields
foreach ($this->listBuilder[$viewName_list] as $item)
{
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
// check if target is linked list view
if (1 == $item['target'] || 4 == $item['target'])
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
}
$setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"';
if ($controller > 3)
{
$setin = (2 == $this->footableVersion) ? ' data-hide="phone,tablet"' : ' data-breakpoints="xs sm md"';
}
// check if we have an over-ride
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
{
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
}
$setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"';
if ($controller > 3)
{
$setin = (2 == $this->footableVersion) ? ' data-hide="phone,tablet"' : ' data-breakpoints="xs sm md"';
}
if ($controller > 6)
{
$setin = (2 == $this->footableVersion) ? ' data-hide="all"' : ' data-breakpoints="all"';
}
if ($controller > 6)
{
$setin = (2 == $this->footableVersion) ? ' data-hide="all"' : ' data-breakpoints="all"';
}
if ($item['link'] && $firstLink)
{
$setin = (2 == $this->footableVersion) ? ' data-toggle="true"' : '';
$firstLink = false;
if ($item['link'] && $firstLink)
{
$setin = (2 == $this->footableVersion) ? ' data-toggle="true"' : '';
$firstLink = false;
}
$head .= PHP_EOL . $this->_t(2) . "<th" . $setin . $htmlFix . ">";
$head .= PHP_EOL . $this->_t(3) . "<?php echo JText:" . ":_('" . $item['lang'] . "'); ?>";
$head .= PHP_EOL . $this->_t(2) . "</th>";
$controller++;
}
$head .= PHP_EOL . $this->_t(2) . "<th" . $setin . $htmlFix . ">";
$head .= PHP_EOL . $this->_t(3) . "<?php echo JText:" . ":_('" . $item['lang'] . "'); ?>";
$head .= PHP_EOL . $this->_t(2) . "</th>";
$controller++;
}
// set some V3 attr
$data_hide = (2 == $this->footableVersion) ? 'data-hide="phone,tablet"' : 'data-breakpoints="xs sm md"';
@ -11284,6 +11317,19 @@ class Interpretation extends Fields
$allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Disable fields while saving.";
$allow[] = $this->_t(3) . "\$form->setFieldAttribute('created', 'filter', 'unset');";
$allow[] = $this->_t(2) . "}";
// check if the item has access permissions.
if ($coreLoad && isset($core['core.edit.access']) && isset($this->permissionBuilder[$core['core.edit.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.edit.access']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.edit.access']]))
{
$allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the form based on Edit Access 'access' controls.";
$allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.access'] . "', 'com_" . $component . "." . $viewName_single . ".' . (int) \$id))";
$allow[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" . $core['core.edit.access'] . "', 'com_" . $component . "')))";
$allow[] = $this->_t(2) . "{";
$allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Disable fields for display.";
$allow[] = $this->_t(3) . "\$form->setFieldAttribute('access', 'disabled', 'true');";
$allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Disable fields while saving.";
$allow[] = $this->_t(3) . "\$form->setFieldAttribute('access', 'filter', 'unset');";
$allow[] = $this->_t(2) . "}";
}
// handel the fields permissions
if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single]))
{
@ -11382,12 +11428,21 @@ class Interpretation extends Fields
$allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Make the field hidded.";
$allow[] = $this->_t(3) . "\$form->setFieldAttribute('" . $fieldName . "', 'type', 'hidden');";
$allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " If there is no value continue.";
$allow[] = $this->_t(3) . "if (!\$form->getValue('" . $fieldName . "'))";
$allow[] = $this->_t(3) . "if (!(\$val = \$form->getValue('" . $fieldName . "')))";
$allow[] = $this->_t(3) . "{";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Disable fields while saving.";
$allow[] = $this->_t(4) . "\$form->setFieldAttribute('" . $fieldName . "', 'filter', 'unset');";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Disable fields while saving.";
$allow[] = $this->_t(4) . "\$form->setFieldAttribute('" . $fieldName . "', 'required', 'false');";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Make sure";
$allow[] = $this->_t(4) . "\$form->setValue('" . $fieldName . "', null, '');";
$allow[] = $this->_t(3) . "}";
$allow[] = $this->_t(3) . "elseif (" . ucfirst($component) . "Helper::checkArray(\$val))";
$allow[] = $this->_t(3) . "{";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " We have to unset then (TODO)";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Hiddend field can not handel array value";
$allow[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Even if we conver to json we get an error";
$allow[] = $this->_t(4) . "\$form->removeField('" . $fieldName . "');";
$allow[] = $this->_t(3) . "}";
$allow[] = $this->_t(2) . "}";
}
@ -12336,6 +12391,8 @@ class Interpretation extends Fields
// JSON_ARRAY_ENCODE
$decode = 'json_decode';
$suffix_decode = ', true';
// fallback on json
$item['method'] = 1;
break;
}
@ -12486,7 +12543,7 @@ class Interpretation extends Fields
{
if (!$export)
{
// For thos we have not cached yet.
// For those we have not cached yet.
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " convert " . $item['name'];
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$item->" . $item['name'] . " = " . $Component . "Helper::jsonToString(\$item->" . $item['name'] . ");";
}
@ -15469,7 +15526,7 @@ function vdm_dkim() {
// set the permission for this field
$fieldView['action'] = 'view.' . $permission_option . '.' . $fieldName;
$fieldView['implementation'] = '3';
// check if persmissions was laready set
// check if persmissions was already set
if (isset($view['settings']->permissions) && ComponentbuilderHelper::checkArray($view['settings']->permissions))
{
array_push($view['settings']->permissions, $fieldView);
@ -15600,6 +15657,7 @@ function vdm_dkim() {
$view['settings']->permissions[] = $versionView;
}
}
// add batch permissions
if ($type === 'admin')
{
// set batch control
@ -15615,6 +15673,7 @@ function vdm_dkim() {
$view['settings']->permissions[] = $batchView;
}
}
// load the permissions
foreach ($view['settings']->permissions as $permission)
{
// set acction name
@ -15639,6 +15698,12 @@ function vdm_dkim() {
array_shift($actionNameBuilder);
$nameBuilder = trim(implode('___', $actionNameBuilder));
$customName = trim(implode(' ', $actionNameBuilder));
// check if we have access set for this view (if not skip)
if ($nameBuilder === 'edit___access' && $type === 'admin' && (!isset($view['access']) || $view['access'] != 1))
{
continue;
}
// build the names
if ($type === 'admin')
{
$W_NameList = ComponentbuilderHelper::safeString($view['settings']->name_list, 'W');
@ -15666,6 +15731,12 @@ function vdm_dkim() {
// set edit description
$permission['description'] = ' Allows the users in this group to edit ' . $w_NameList . ' created by them';
break;
case 'edit___access':
// set edit title
$permission['title'] = $W_NameList . ' Edit Access';
// set edit description
$permission['description'] = ' Allows the users in this group to change the access of the ' . $w_NameList;
break;
case 'edit___state':
// set edit title
$permission['title'] = $W_NameList . ' Edit State';

View File

@ -686,6 +686,8 @@ abstract class ComponentbuilderHelper
'description' => $result->description);
// number pointer
$nr = 0;
// php tracker (we must try to load alteast 17 rows
$phpTracker = array();
// value to check since there are false and null values even 0 in the values returned
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
// set the headers
@ -701,6 +703,9 @@ abstract class ComponentbuilderHelper
if (strpos($property['name'], 'type_php') !== false)
{
$addPHP = true;
// set the line number
$phpLine = (int) preg_replace('/[^0-9]/', '', $property['name']);
// set the key
$phpKey = trim(preg_replace('/[0-9]+/', '', $property['name']), '_');
// start array if not already set
if (!isset($field['php'][$phpKey]))
@ -708,6 +713,8 @@ abstract class ComponentbuilderHelper
$field['php'][$phpKey] = array();
$field['php'][$phpKey]['value'] = array();
$field['php'][$phpKey]['desc'] = $property['description'];
// start tracker
$phpTracker[$phpKey] = 1;
}
}
// was the settings for the property passed
@ -718,7 +725,8 @@ abstract class ComponentbuilderHelper
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][] = $settings[$property['name']];
$field['php'][$phpKey]['value'][$phpLine] = $settings[$property['name']];
$phpTracker[$phpKey]++;
}
else
{
@ -732,7 +740,8 @@ abstract class ComponentbuilderHelper
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][] = ($confirmation !== $value) ? $value : $example;
$field['php'][$phpKey]['value'][$phpLine] = ($confirmation !== $value) ? $value : $example;
$phpTracker[$phpKey]++;
}
else
{
@ -747,6 +756,25 @@ abstract class ComponentbuilderHelper
// increment the number
$nr++;
}
// check if all php is loaded using the tracker
if (self::checkString($xml) && isset($phpTracker) && self::checkArray($phpTracker))
{
foreach ($phpTracker as $phpKey => $start)
{
if ($start < 30)
{
// we must search for more code in the xml just incase
foreach(range(2, 30) as $t_nr)
{
$get_ = $phpKey . '_' . $t_nr;
if (!isset($field['php'][$phpKey]['value'][$t_nr]) && ($value = self::getValueFromXMLstring($xml, $get_, $confirmation)) !== $confirmation)
{
$field['php'][$phpKey]['value'][$t_nr] = $value;
}
}
}
}
}
$field['values'] .= PHP_EOL . "/>";
$field['values_description'] .= '</tbody></table>';
// return found field options
@ -5192,11 +5220,11 @@ abstract class ComponentbuilderHelper
*
* @input array The array to check
*
* @returns bool true on success
* @returns bool/int number of items in array on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
if (isset($array) && is_array($array) && count((array)$array) > 0)
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{
// also make sure the empty strings are removed
if ($removeEmptyString)
@ -5210,7 +5238,7 @@ abstract class ComponentbuilderHelper
}
return self::checkArray($array, false);
}
return true;
return $nr;
}
return false;
}

View File

@ -322,6 +322,8 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_NEW="A New Admin Fields"
COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE_DB="None DB"
COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_DESCRIPTION="id, asset_id, state, access, ordering, created_by, created, modified_by, modified, checked_out, checked_out_time, version, hits, metakey, metadesc, metadata (you don't need to add them again)<br />For more help <a href='https://youtu.be/CdSKSCTzmRA?list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=32m28s' target='_blank'>please watch this tutorial</a>."
COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_LABEL="The following fields are added by default to all views."
COM_COMPONENTBUILDER_ADMIN_FIELDS_ONLY_IN_ADMIN_LIST_VIEW="Only in Admin List View"
COM_COMPONENTBUILDER_ADMIN_FIELDS_ONLY_IN_LINKED_LIST_VIEWS="Only in Linked List Views"
COM_COMPONENTBUILDER_ADMIN_FIELDS_ORDERING_LABEL="Ordering"
COM_COMPONENTBUILDER_ADMIN_FIELDS_ORDER_EDIT_DESCRIPTION="Order in relation to tab &amp; alignment of admin and site."
COM_COMPONENTBUILDER_ADMIN_FIELDS_ORDER_EDIT_LABEL="Order in Edit"
@ -385,7 +387,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_RIGHT_OF_TABS="Right of Tabs"
COM_COMPONENTBUILDER_ADMIN_FIELDS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Admin Fields to customise the alias."
COM_COMPONENTBUILDER_ADMIN_FIELDS_SEARCH_DESCRIPTION="Select if the field is to be searchable in list view, if shown."
COM_COMPONENTBUILDER_ADMIN_FIELDS_SEARCH_LABEL="Searchable"
COM_COMPONENTBUILDER_ADMIN_FIELDS_SHOW_IN_LIST_VIEW="Show in list view"
COM_COMPONENTBUILDER_ADMIN_FIELDS_SHOW_IN_ALL_LIST_VIEWS="Show in All List Views"
COM_COMPONENTBUILDER_ADMIN_FIELDS_SORT_DESCRIPTION="Select if the field should be sortable in list view, if shown."
COM_COMPONENTBUILDER_ADMIN_FIELDS_SORT_LABEL="Sortable"
COM_COMPONENTBUILDER_ADMIN_FIELDS_STATUS="Status"
@ -614,6 +616,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_CONTRACT_TWO="Contract 2"
COM_COMPONENTBUILDER_ADMIN_VIEW_CORECREATE="core.create"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREDELETE="core.delete"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDIT="core.edit"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITACCESS="core.edit.access"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITCREATED="core.edit.created"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITCREATED_BY="core.edit.created_by"
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITOWN="core.edit.own"
@ -1324,6 +1327,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWACCESS="view.access"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWCREATE="view.create"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWDELETE="view.delete"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDIT="view.edit"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITACCESS="view.edit.access"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITCREATED="view.edit.created"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITCREATED_BY="view.edit.created_by"
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITOWN="view.edit.own"
@ -7016,12 +7020,14 @@ COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_CONDITIONS="The admin fields conditions"
COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_RELATIONS="The admin fields relations"
COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE="The available validation rules for the validate attribute are:"
COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE="The <b>None DB</b> option will remove this field from being saved in the database."
COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS="The <b>Only in Admin List View</b> option will only Add this field to the admin list view, not to any linked views."
COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW="The <b>Only in Linked List Views</b> option will only Add this field to the linked list view, if this view gets linked to other view, not to this admin list view."
COM_COMPONENTBUILDER_THE_BPHPSECLIBNETSFTPB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The <b>phpseclib\NET\SFTP</b> library\class is not available! This library\class should have been added to your <b>libraries/vdm_io/vendor</b> folder. Please contact your system administrator for more info"
COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_PATH_ON_BSB_SERVER="The <b>%s</b> file could not be moved to <b>%s</b> path on <b>%s</b> server."
COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The <b>%s</b> file could not be moved to <b>%s</b> server."
COM_COMPONENTBUILDER_THE_BSB_LIBRARYCLASS_IS_NOT_AVAILABLE_THIS_LIBRARYCLASS_SHOULD_HAVE_BEEN_ADDED_TO_YOUR_BLIBRARIESVDM_IOVENDORB_FOLDER_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="The <b>%s</b> library\class is not available! This library\class should have been added to your <b>libraries/vdm_io/vendor</b> folder. Please contact your system administrator for more info!"
COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The <b>%s</b> library can not be deleted, or things will break."
COM_COMPONENTBUILDER_THE_BSHOW_IN_LIST_VIEWB_OPTION_WILL_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW="The <b>Show in list view</b> option will Add this field to the admin list view."
COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED="The <b>Show in All List Views</b> option will Add this field to all list views, admin &amp; linked."
COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views"
COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config"
COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_MENUS="The component custom admin menus"

View File

@ -770,7 +770,8 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
$_tablesArray = array(
'admin_fields',
'admin_fields_conditions',
'admin_fields_relations'
'admin_fields_relations',
'admin_custom_tabs'
);
foreach($_tablesArray as $_updateTable)
{
@ -811,7 +812,8 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
$_tablesArray = array(
'admin_fields',
'admin_fields_conditions',
'admin_fields_relations'
'admin_fields_relations',
'admin_custom_tabs'
);
foreach($_tablesArray as $_updateTable)
{

View File

@ -2180,97 +2180,97 @@ class ComponentbuilderModelAjax extends JModelList
* @var array
*/
protected $codeSearchKeys = array(
// #__componentbuilder_joomla_component
// #__componentbuilder_joomla_component (a)
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript'),
'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall',
'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site',
'php_site_event', 'javascript'),
'views' => 'joomla_components',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_component_dashboard
// #__componentbuilder_component_dashboard (b)
'component_dashboard' => array(
'search' => array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'),
'search' => array('id', 'joomla_component', 'php_dashboard_methods', 'dashboard_tab'),
'views' => 'components_dashboard',
'not_base64' => array('dashboard_tab' => 'json'),
'name' => 'joomla_component->id:joomla_component.system_name'
),
// #__componentbuilder_admin_view
// #__componentbuilder_admin_view (c)
'admin_view' => array(
'search' => array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'),
'search' => array('id', 'system_name', 'javascript_view_file', 'javascript_view_footer',
'javascript_views_file', 'javascript_views_footer', 'html_import_view',
'php_after_delete', 'php_after_publish', 'php_ajaxmethod', 'php_allowedit', 'php_batchcopy',
'php_batchmove', 'php_before_delete', 'php_before_publish', 'php_before_save', 'php_controller',
'php_controller_list', 'php_document', 'php_getitem', 'php_getitems', 'php_getitems_after_all',
'php_getlistquery', 'php_import', 'php_import_display', 'php_import_ext', 'php_import_headers', 'php_getform',
'php_import_save', 'php_import_setdata', 'php_model', 'php_model_list', 'php_postsavehook', 'php_save'),
'views' => 'admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_admin_fields_relations
// #__componentbuilder_admin_fields_relations (d)
'admin_fields_relations' => array(
'search' => array('id', 'admin_view', 'addrelations'),
'views' => 'admins_fields_relations',
'not_base64' => array('addrelations' => 'json'),
'name' => 'admin_view->id:admin_view.system_name'
),
// #__componentbuilder_custom_admin_view
// #__componentbuilder_custom_admin_view (e)
'custom_admin_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'search' => array('id', 'system_name', 'default', 'php_view', 'php_jview', 'php_jview_display', 'php_document',
'js_document', 'css_document', 'css', 'php_ajaxmethod', 'php_model', 'php_controller'),
'views' => 'custom_admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_site_view
// #__componentbuilder_site_view (f)
'site_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'search' => array('id', 'system_name', 'default', 'php_view', 'php_jview', 'php_jview_display', 'php_document',
'js_document', 'css_document', 'css', 'php_ajaxmethod', 'php_model', 'php_controller'),
'views' => 'site_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_field
// #__componentbuilder_field (g)
'field' => array(
'search' => array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'),
'search' => array('id', 'name', 'xml', 'javascript_view_footer', 'javascript_views_footer'),
'views' => 'fields',
'not_base64' => array('xml' => 'json'),
'base64_search' => array('xml' => array('start' => 'type_php', '_start' => '="', 'end' => '"')),
'name' => 'name'
),
// #__componentbuilder_fieldtype
// #__componentbuilder_fieldtype (h)
'fieldtype' => array(
'search' => array('id', 'name', 'properties'),
'views' => 'fieldtypes',
'not_base64' => array('properties' => 'json'),
'name' => 'name'
),
// #__componentbuilder_dynamic_get
// #__componentbuilder_dynamic_get (i)
'dynamic_get' => array(
'search' => array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'search' => array('id', 'name', 'php_before_getitem', 'php_after_getitem', 'php_before_getitems', 'php_after_getitems',
'php_getlistquery'),
'views' => 'dynamic_gets',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_template
// #__componentbuilder_template (j)
'template' => array(
'search' => array('id', 'name', 'php_view','template'),
'search' => array('id', 'name', 'php_view', 'template'),
'views' => 'templates',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_layout
// #__componentbuilder_layout (k)
'layout' => array(
'search' => array('id', 'name', 'php_view','layout'),
'search' => array('id', 'name', 'php_view', 'layout'),
'views' => 'layouts',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_library
// #__componentbuilder_library (l)
'library' => array(
'search' => array('id', 'name', 'php_setdocument'),
'views' => 'libraries',

View File

@ -35,23 +35,27 @@ class JFormFieldDbtables extends JFormFieldList
*/
protected function getOptions()
{
$db = JFactory::getDBO();
$tables= $db->getTableList();
$config = JFactory::getConfig();
$options = array();
$db = JFactory::getDBO(); $options[] = JHtml::_('select.option', '', 'Select an option');
for ($i=0; $i < count($tables); $i++)
{
//only tables with primary key
$db->setQuery('SHOW FIELDS FROM `'.$tables[$i].'` WHERE LOWER( `Key` ) = \'pri\'');
if ($db->loadResult())
{
$dbprefix = version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix'); $key = $i+1;
$options[$key] = new stdClass;
$options[$key]->value = str_replace($dbprefix, '', $tables[$i]);
$options[$key]->text = $tables[$i];
}
}
// get db object
$db = JFactory::getDBO();
// get all tables
$tables= $db->getTableList();
// get config
$config = JFactory::getConfig();
$dbprefix = version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix');
$options = array();
$options[] = JHtml::_('select.option', '', 'Select an option');
for ($i=0; $i < count($tables); $i++)
{
//only tables with primary key
$db->setQuery('SHOW FIELDS FROM `'.$tables[$i].'` WHERE LOWER( `Key` ) = \'pri\'');
if ($db->loadResult())
{
$key = $i+1;
$options[$key] = new stdClass;
$options[$key]->value = str_replace($dbprefix, '', $tables[$i]);
$options[$key]->text = $tables[$i];
}
}
return $options;
}
}

View File

@ -1075,7 +1075,10 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
$properties->loadArray($data['properties']);
$data['properties'] = (string) $properties;
}
elseif (!isset($data['properties']))
// Also check permission since the value may be removed due to permissions
// Then we do not want to clear it out, but simple ignore the empty properties
elseif (!isset($data['properties'])
&& JFactory::getUser()->authorise('fieldtype.edit.properties', 'com_componentbuilder'))
{
// Set the empty properties to data
$data['properties'] = '';

View File

@ -136,7 +136,11 @@
<option value="">
COM_COMPONENTBUILDER_ADMIN_FIELDS_DEFAULT</option>
<option value="1">
COM_COMPONENTBUILDER_ADMIN_FIELDS_SHOW_IN_LIST_VIEW</option>
COM_COMPONENTBUILDER_ADMIN_FIELDS_SHOW_IN_ALL_LIST_VIEWS</option>
<option value="3">
COM_COMPONENTBUILDER_ADMIN_FIELDS_ONLY_IN_ADMIN_LIST_VIEW</option>
<option value="4">
COM_COMPONENTBUILDER_ADMIN_FIELDS_ONLY_IN_LINKED_LIST_VIEWS</option>
<option value="2">
COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE_DB</option>
</field>

View File

@ -427,6 +427,8 @@
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITOWN</option>
<option value="core.edit.state">
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITSTATE</option>
<option value="core.edit.access">
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITACCESS</option>
<option value="core.edit.created_by">
COM_COMPONENTBUILDER_ADMIN_VIEW_COREEDITCREATED_BY</option>
<option value="core.edit.created">
@ -441,6 +443,8 @@
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITOWN</option>
<option value="view.edit.state">
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITSTATE</option>
<option value="view.edit.access">
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITACCESS</option>
<option value="view.edit.created_by">
COM_COMPONENTBUILDER_ADMIN_VIEW_VIEWEDITCREATED_BY</option>
<option value="view.edit.created">

View File

@ -308,7 +308,8 @@ function usedin(functioName, ide) {
jQuery('#note-usedin-not').hide();
jQuery('#note-usedin-found').hide();
jQuery('#loading-usedin').show();
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l']; // if you update this, also update [customcode-codeUsedInHtmlNote]!
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l']; // if you update this, also update (below 11) & [customcode-codeUsedInHtmlNote]!
var targetNumber = 11;
var run = 0;
var usedinChecker = setInterval(function(){
var target = targets[run];
@ -321,7 +322,7 @@ function usedin(functioName, ide) {
} else {
jQuery('#usedin-'+target).hide();
}
if (target === 'i') {
if (run == targetNumber) {
jQuery('#loading-usedin').hide();
if (found) {
jQuery('#note-usedin-found').show();
@ -330,7 +331,7 @@ function usedin(functioName, ide) {
}
}
});
if (run == 9) {
if (run == targetNumber) {
clearInterval(usedinChecker);
}
run++;

View File

@ -161,7 +161,6 @@
description="COM_COMPONENTBUILDER_DYNAMIC_GET_DB_TABLE_DESCRIPTION"
class="list_class"
multiple="false"
default=""
required="false"
button="false"
/>
@ -581,7 +580,6 @@
description="COM_COMPONENTBUILDER_DYNAMIC_GET_DB_TABLE_MAIN_DESCRIPTION"
class="list_class"
multiple="false"
default=""
required="true"
button="false"
/>

View File

@ -1385,7 +1385,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
{
$value = ComponentbuilderHelper::openValidBase64($item->{$key}, null);
}
elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search
elseif (isset($keys['not_base64'][$key]) && 'json' === $keys['not_base64'][$key] && 'xml' === $key) // just for field search
{
$value = json_decode($item->{$key});
}
@ -1394,11 +1394,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
$value = $item->{$key};
}
// check if we should search for base64 string inside the text
if (isset($target['base64_search']) && isset($target['base64_search'][$key])
&& isset($target['base64_search'][$key]['start']) && strpos($value, $target['base64_search'][$key]['start']) !== false)
if (isset($keys['base64_search']) && isset($keys['base64_search'][$key])
&& isset($keys['base64_search'][$key]['start']) && strpos($value, $keys['base64_search'][$key]['start']) !== false)
{
// search and open the base64 strings
$this->searchOpenBase64($value, $target['base64_search'][$key]);
$this->searchOpenBase64($value, $keys['base64_search'][$key]);
}
// search the value to see if it has custom code
$codeArray = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=',']');
@ -1422,10 +1422,14 @@ class ComponentbuilderModelJoomla_components extends JModelList
}
elseif (ComponentbuilderHelper::checkString($func))
{
if ($funcID = ComponentbuilderHelper::getVar('custom_code', $func, 'function_name', 'id'))
if (($funcID = ComponentbuilderHelper::getVar('custom_code', $func, 'function_name', 'id')) !== false && is_numeric($funcID))
{
$this->setSmartIDs($funcID, 'custom_code');
}
else
{
// set a notice that custom code was not found
}
}
}
}
@ -1627,97 +1631,97 @@ class ComponentbuilderModelJoomla_components extends JModelList
* @var array
*/
protected $codeSearchKeys = array(
// #__componentbuilder_joomla_component
// #__componentbuilder_joomla_component (a)
'joomla_component' => array(
'search' => array('id', 'system_name', 'php_preflight_install','php_postflight_install',
'php_preflight_update','php_postflight_update','php_method_uninstall',
'php_helper_admin','php_admin_event','php_helper_both','php_helper_site',
'php_site_event','javascript'),
'search' => array('id', 'system_name', 'php_preflight_install', 'php_postflight_install',
'php_preflight_update', 'php_postflight_update', 'php_method_uninstall',
'php_helper_admin', 'php_admin_event', 'php_helper_both', 'php_helper_site',
'php_site_event', 'javascript'),
'views' => 'joomla_components',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_component_dashboard
// #__componentbuilder_component_dashboard (b)
'component_dashboard' => array(
'search' => array('id', 'joomla_component', 'php_dashboard_methods','dashboard_tab'),
'search' => array('id', 'joomla_component', 'php_dashboard_methods', 'dashboard_tab'),
'views' => 'components_dashboard',
'not_base64' => array('dashboard_tab' => 'json'),
'name' => 'joomla_component->id:joomla_component.system_name'
),
// #__componentbuilder_admin_view
// #__componentbuilder_admin_view (c)
'admin_view' => array(
'search' => array('id', 'system_name', 'javascript_view_file','javascript_view_footer',
'javascript_views_file','javascript_views_footer','html_import_view',
'php_after_delete','php_after_publish','php_ajaxmethod','php_allowedit','php_batchcopy',
'php_batchmove','php_before_delete','php_before_publish','php_before_save','php_controller',
'php_controller_list','php_document','php_getitem','php_getitems','php_getitems_after_all',
'php_getlistquery','php_import','php_import_display','php_import_ext','php_import_headers','php_getform',
'php_import_save','php_import_setdata','php_model','php_model_list','php_postsavehook','php_save'),
'search' => array('id', 'system_name', 'javascript_view_file', 'javascript_view_footer',
'javascript_views_file', 'javascript_views_footer', 'html_import_view',
'php_after_delete', 'php_after_publish', 'php_ajaxmethod', 'php_allowedit', 'php_batchcopy',
'php_batchmove', 'php_before_delete', 'php_before_publish', 'php_before_save', 'php_controller',
'php_controller_list', 'php_document', 'php_getitem', 'php_getitems', 'php_getitems_after_all',
'php_getlistquery', 'php_import', 'php_import_display', 'php_import_ext', 'php_import_headers', 'php_getform',
'php_import_save', 'php_import_setdata', 'php_model', 'php_model_list', 'php_postsavehook', 'php_save'),
'views' => 'admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_admin_fields_relations
// #__componentbuilder_admin_fields_relations (d)
'admin_fields_relations' => array(
'search' => array('id', 'admin_view', 'addrelations'),
'views' => 'admins_fields_relations',
'not_base64' => array('addrelations' => 'json'),
'name' => 'admin_view->id:admin_view.system_name'
),
// #__componentbuilder_custom_admin_view
// #__componentbuilder_custom_admin_view (e)
'custom_admin_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'search' => array('id', 'system_name', 'default', 'php_view', 'php_jview', 'php_jview_display', 'php_document',
'js_document', 'css_document', 'css', 'php_ajaxmethod', 'php_model', 'php_controller'),
'views' => 'custom_admin_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_site_view
// #__componentbuilder_site_view (f)
'site_view' => array(
'search' => array('id', 'system_name', 'default','php_view','php_jview','php_jview_display','php_document',
'js_document','css_document','css','php_ajaxmethod','php_model','php_controller'),
'search' => array('id', 'system_name', 'default', 'php_view', 'php_jview', 'php_jview_display', 'php_document',
'js_document', 'css_document', 'css', 'php_ajaxmethod', 'php_model', 'php_controller'),
'views' => 'site_views',
'not_base64' => array(),
'name' => 'system_name'
),
// #__componentbuilder_field
// #__componentbuilder_field (g)
'field' => array(
'search' => array('id', 'name', 'xml','javascript_view_footer','javascript_views_footer'),
'search' => array('id', 'name', 'xml', 'javascript_view_footer', 'javascript_views_footer'),
'views' => 'fields',
'not_base64' => array('xml' => 'json'),
'base64_search' => array('xml' => array('start' => 'type_php', '_start' => '="', 'end' => '"')),
'name' => 'name'
),
// #__componentbuilder_fieldtype
// #__componentbuilder_fieldtype (h)
'fieldtype' => array(
'search' => array('id', 'name', 'properties'),
'views' => 'fieldtypes',
'not_base64' => array('properties' => 'json'),
'name' => 'name'
),
// #__componentbuilder_dynamic_get
// #__componentbuilder_dynamic_get (i)
'dynamic_get' => array(
'search' => array('id', 'name', 'php_before_getitem','php_after_getitem','php_before_getitems','php_after_getitems',
'search' => array('id', 'name', 'php_before_getitem', 'php_after_getitem', 'php_before_getitems', 'php_after_getitems',
'php_getlistquery'),
'views' => 'dynamic_gets',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_template
// #__componentbuilder_template (j)
'template' => array(
'search' => array('id', 'name', 'php_view','template'),
'search' => array('id', 'name', 'php_view', 'template'),
'views' => 'templates',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_layout
// #__componentbuilder_layout (k)
'layout' => array(
'search' => array('id', 'name', 'php_view','layout'),
'search' => array('id', 'name', 'php_view', 'layout'),
'views' => 'layouts',
'not_base64' => array(),
'name' => 'name'
),
// #__componentbuilder_library
// #__componentbuilder_library (l)
'library' => array(
'search' => array('id', 'name', 'php_setdocument'),
'views' => 'libraries',

File diff suppressed because one or more lines are too long

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableAdmin_custom_tabs extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableAdmin_fields extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableAdmin_fields_conditions extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableAdmin_fields_relations extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableAdmin_view extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_admin_views extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_config extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_custom_admin_menus extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_custom_admin_views extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_dashboard extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_files_folders extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_mysql_tweaks extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_site_views extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableComponent_updates extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableCustom_admin_view extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableCustom_code extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableDynamic_get extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableField extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableFieldtype extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableHelp_document extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableJoomla_component extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLanguage extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLanguage_translation extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLayout extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLibrary extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLibrary_config extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableLibrary_files_folders_urls extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableServer extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableSite_view extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableSnippet extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableSnippet_type extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableTemplate extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -220,7 +220,7 @@ class ComponentbuilderTableValidation_rule extends JTable
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
}
// try again
elseif ($try)

View File

@ -136,12 +136,18 @@ function checkAdminBehaviour(field) {
jQuery('#'+subID+'__search').prop('checked', false).trigger('change');
jQuery('#'+subID+'__filter').prop('checked', false).trigger('change');
jQuery('#'+subID+'__link').prop('checked', false).trigger('change');
} else if (1 == value) {
} else if (1 == value || 3 == value || 4 == value) {
// get number of items
var numItems = jQuery('.count-the-items1235').length + 10;
// show in list view
if (target[2] == 'list') {
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BSHOW_IN_LIST_VIEWB_OPTION_WILL_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW'), timeout: 5000, status: 'primary', pos: 'top-right'});
if (1 == value) {
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED'), timeout: 5000, status: 'primary', pos: 'top-right'});
} else if (3 == value) {
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS'), timeout: 5000, status: 'primary', pos: 'top-right'});
} else if (4 == value) {
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW'), timeout: 5000, status: 'primary', pos: 'top-right'});
}
}
// check if the order list already has a value
var orderList = jQuery('#'+subID+'__order_list').val();

View File

@ -201,7 +201,9 @@ class ComponentbuilderViewAdmin_fields extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
JText::script('COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE');
JText::script('COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE');
JText::script('COM_COMPONENTBUILDER_THE_BSHOW_IN_LIST_VIEWB_OPTION_WILL_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW');
JText::script('COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED');
JText::script('COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS');
JText::script('COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW');
JText::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED');
JText::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED');
JText::script('view not acceptable. Error');

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>7th October, 2018</creationDate>
<creationDate>29th October, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -686,6 +686,8 @@ abstract class ComponentbuilderHelper
'description' => $result->description);
// number pointer
$nr = 0;
// php tracker (we must try to load alteast 17 rows
$phpTracker = array();
// value to check since there are false and null values even 0 in the values returned
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
// set the headers
@ -701,6 +703,9 @@ abstract class ComponentbuilderHelper
if (strpos($property['name'], 'type_php') !== false)
{
$addPHP = true;
// set the line number
$phpLine = (int) preg_replace('/[^0-9]/', '', $property['name']);
// set the key
$phpKey = trim(preg_replace('/[0-9]+/', '', $property['name']), '_');
// start array if not already set
if (!isset($field['php'][$phpKey]))
@ -708,6 +713,8 @@ abstract class ComponentbuilderHelper
$field['php'][$phpKey] = array();
$field['php'][$phpKey]['value'] = array();
$field['php'][$phpKey]['desc'] = $property['description'];
// start tracker
$phpTracker[$phpKey] = 1;
}
}
// was the settings for the property passed
@ -718,7 +725,8 @@ abstract class ComponentbuilderHelper
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][] = $settings[$property['name']];
$field['php'][$phpKey]['value'][$phpLine] = $settings[$property['name']];
$phpTracker[$phpKey]++;
}
else
{
@ -732,7 +740,8 @@ abstract class ComponentbuilderHelper
// add the json values
if ($addPHP)
{
$field['php'][$phpKey]['value'][] = ($confirmation !== $value) ? $value : $example;
$field['php'][$phpKey]['value'][$phpLine] = ($confirmation !== $value) ? $value : $example;
$phpTracker[$phpKey]++;
}
else
{
@ -747,6 +756,25 @@ abstract class ComponentbuilderHelper
// increment the number
$nr++;
}
// check if all php is loaded using the tracker
if (self::checkString($xml) && isset($phpTracker) && self::checkArray($phpTracker))
{
foreach ($phpTracker as $phpKey => $start)
{
if ($start < 30)
{
// we must search for more code in the xml just incase
foreach(range(2, 30) as $t_nr)
{
$get_ = $phpKey . '_' . $t_nr;
if (!isset($field['php'][$phpKey]['value'][$t_nr]) && ($value = self::getValueFromXMLstring($xml, $get_, $confirmation)) !== $confirmation)
{
$field['php'][$phpKey]['value'][$t_nr] = $value;
}
}
}
}
}
$field['values'] .= PHP_EOL . "/>";
$field['values_description'] .= '</tbody></table>';
// return found field options
@ -4926,11 +4954,11 @@ abstract class ComponentbuilderHelper
*
* @input array The array to check
*
* @returns bool true on success
* @returns bool/int number of items in array on success
**/
public static function checkArray($array, $removeEmptyString = false)
{
if (isset($array) && is_array($array) && count((array)$array) > 0)
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{
// also make sure the empty strings are removed
if ($removeEmptyString)
@ -4944,7 +4972,7 @@ abstract class ComponentbuilderHelper
}
return self::checkArray($array, false);
}
return true;
return $nr;
}
return false;
}