Fixed count (php 7.2) issue across JCB. Improved the setModelExportMethod method in the compiler to now work as a setGetItemsModelMethod instead. Added more strict permissional implementation per/field across the export methods of JCB.

This commit is contained in:
Llewellyn van der Merwe 2019-09-05 23:12:56 +02:00
parent 3cbe21f57d
commit e3f22d631c
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
60 changed files with 623 additions and 247 deletions

View File

@ -146,11 +146,11 @@ 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*: 4th September, 2019
+ *Last Build*: 5th September, 2019
+ *Version*: 2.10.1
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **251119**
+ *Line count*: **251450**
+ *Field count*: **1343**
+ *File count*: **1608**
+ *Folder count*: **253**

View File

@ -146,11 +146,11 @@ 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*: 4th September, 2019
+ *Last Build*: 5th September, 2019
+ *Version*: 2.10.1
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **251119**
+ *Line count*: **251450**
+ *Field count*: **1343**
+ *File count*: **1608**
+ *Folder count*: **253**

View File

@ -654,7 +654,7 @@ abstract class ###Component###Helper
}
}
// check if there are any view values remaining
if (count($_result))
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);

View File

@ -292,7 +292,7 @@ abstract class ###Component###Helper
}
}
// check if there are any view values remaining
if (count($_result))
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);

View File

@ -174,7 +174,7 @@ class Compiler extends Infusion
if (isset($mismatch) && ComponentbuilderHelper::checkArray($mismatch))
{
$this->app->enqueueMessage(JText::_('<hr /><h3>Language Warning</h3>'), 'Warning');
if (count($mismatch) > 1)
if (count((array) $mismatch) > 1)
{
$this->app->enqueueMessage(JText::_('<h3>Please check the following mismatching Joomla.JText language constants.</h3>'), 'Warning');
}
@ -742,7 +742,7 @@ class Compiler extends Infusion
// we musk keep last three lines to dynamic find target entry
$fingerPrint[$lineNumber] = trim($lineContent);
// check lines each time if it fits our target
if (count($fingerPrint) === $sizeEnd && !$foundEnd)
if (count((array) $fingerPrint) === $sizeEnd && !$foundEnd)
{
$fingerTest = md5(implode('', $fingerPrint));
if ($fingerTest === $hashEnd)
@ -766,7 +766,7 @@ class Compiler extends Infusion
// we musk keep last three lines to dynamic find target entry
$fingerPrint[$lineNumber] = trim($lineContent);
// check lines each time if it fits our target
if (count($fingerPrint) === $size && !$found)
if (count((array) $fingerPrint) === $size && !$found)
{
$fingerTest = md5(implode('', $fingerPrint));
if ($fingerTest === $hash)

View File

@ -922,7 +922,7 @@ class Get
$results = $dispatcher->trigger($event, $data);
// Check for errors encountered while trigger the event
if (count($results) && in_array(false, $results, true))
if (count((array) $results) && in_array(false, $results, true))
{
// Get the last error.
$error = $dispatcher->getError();
@ -3862,7 +3862,7 @@ class Get
$id_range = (array) array_map('trim', explode('=>', $id));
unset($id_array[$key]);
// build range
if (count($id_range) == 2)
if (count((array) $id_range) == 2)
{
$range = range($id_range[0], $id_range[1]);
$id_array_new = array_merge($id_array_new, $range);
@ -5890,7 +5890,7 @@ class Get
*/
protected function setNewLangStrings($when = 1)
{
if (count($this->newLangStrings) >= $when)
if (count((array) $this->newLangStrings) >= $when)
{
// Create a new query object.
$query = $this->db->getQuery(true);
@ -5902,7 +5902,7 @@ class Get
$query->columns($this->db->quoteName($columns));
foreach ($this->newLangStrings as $values)
{
if (count($values) == 7)
if (count((array) $values) == 7)
{
$query->values(implode(',', $values));
$continue = true;
@ -5934,7 +5934,7 @@ class Get
*/
protected function setExistingLangStrings($when = 1)
{
if (count($this->existingLangStrings) >= $when)
if (count((array) $this->existingLangStrings) >= $when)
{
foreach ($this->existingLangStrings as $values)
{
@ -6663,7 +6663,7 @@ class Get
*/
protected function setNewCustomCode($when = 1)
{
if (count($this->newCustomCode) >= $when)
if (count((array) $this->newCustomCode) >= $when)
{
// Create a new query object.
$query = $this->db->getQuery(true);
@ -6675,7 +6675,7 @@ class Get
$query->columns($this->db->quoteName($columns));
foreach ($this->newCustomCode as $values)
{
if (count($values) == 15)
if (count((array) $values) == 15)
{
$query->values(implode(',', $values));
$continue = true;
@ -6707,7 +6707,7 @@ class Get
*/
protected function setExistingCustomCode($when = 1)
{
if (count($this->existingCustomCode) >= $when)
if (count((array) $this->existingCustomCode) >= $when)
{
foreach ($this->existingCustomCode as $code)
{
@ -6903,7 +6903,7 @@ class Get
}
}
// check if the endfingerprint is ready to save
if (count($endFingerPrint) === 3)
if (count((array) $endFingerPrint) === 3)
{
$hashendtarget = '3__' . md5(implode('', $endFingerPrint));
// all new records we can do a bulk insert
@ -7045,15 +7045,15 @@ class Get
}
}
// make sure only a few lines is kept at a time
if (count($fingerPrint) > 10)
if (count((array) $fingerPrint) > 10)
{
$fingerPrint = array_slice($fingerPrint, -6, 6, true);
}
}
// if the code is at the end of the page and there were not three more lines
if (count($endFingerPrint) > 0 || $loadEndFingerPrint)
if (count((array) $endFingerPrint) > 0 || $loadEndFingerPrint)
{
if (count($endFingerPrint) > 0)
if (count((array) $endFingerPrint) > 0)
{
$leng = count($endFingerPrint);
$hashendtarget = $leng . '__' . md5(implode('', $endFingerPrint));

View File

@ -843,7 +843,7 @@ class Structure extends Get
{
// set the default view
$getter = explode('_', $this->componentData->dashboard);
if (count($getter) == 2 && is_numeric($getter[1]))
if (count((array) $getter) == 2 && is_numeric($getter[1]))
{
// the pointers
$t = ComponentbuilderHelper::safeString($getter[0], 'U');
@ -1212,7 +1212,7 @@ class Structure extends Get
$this->app->enqueueMessage(JText::sprintf('A method (setDynamicF0ld3rs) was added to the install <b>script.php</b> of this package to insure that the folder/s are copied into the correct place when this componet is installed!'), 'Notice');
}
}
elseif (count($checker) == 2 && ComponentbuilderHelper::checkString($checker[0]))
elseif (count((array) $checker) == 2 && ComponentbuilderHelper::checkString($checker[0]))
{
$add_to_extra = false;
// set the target

View File

@ -947,7 +947,7 @@ class Fields extends Structure
$this->fieldCount++;
}
// load the dynamic fields now
if (count($dynamicFieldsXML))
if (count((array) $dynamicFieldsXML))
{
ComponentbuilderHelper::xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields.");
foreach ($dynamicFieldsXML as $dynamicfield)
@ -2331,7 +2331,7 @@ class Fields extends Structure
* @param string $langLabel The language string for field label
* @param string $langView The language string of the view
* @param string $view_name_list The list view name
* @param string $view_name_single The singel view name
* @param string $view_name_single The single view name
* @param array $placeholders The place holder and replace values
* @param boolean $repeatable The repeatable field switch
*
@ -2657,7 +2657,7 @@ class Fields extends Structure
*
* @param string $langLabel The language string for field label
* @param string $langView The language string of the view
* @param string $view_name_single The singel view name
* @param string $view_name_single The single view name
* @param string $view_name_list The list view name
* @param string $name The field name
* @param array $view The view data
@ -3073,7 +3073,7 @@ class Fields extends Structure
// so we have name spacing in custom field type name
$dotTypeArray = explode('.', $data['type']);
// set the J prefix
if (count($dotTypeArray) > 1)
if (count((array) $dotTypeArray) > 1)
{
$jprefix = strtoupper(array_shift($dotTypeArray));
}

View File

@ -3341,7 +3341,7 @@ class Interpretation extends Fields
$method .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Check for errors.";
$method .= PHP_EOL . $this->_t(2) . "if (count(\$errors = \$this->get('Errors')))";
$method .= PHP_EOL . $this->_t(2) . "{";
$method .= PHP_EOL . $this->_t(3) . "throw new Exception(implode(" . '"\n", $errors), 500);';
$method .= PHP_EOL . $this->_t(3) . "throw new Exception(implode(PHP_EOL, \$errors), 500);";
$method .= PHP_EOL . $this->_t(2) . "}";
// add events if needed
if ($view['settings']->main_get->gettype == 1 && ComponentbuilderHelper::checkArray($view['settings']->main_get->plugin_events))
@ -6005,11 +6005,11 @@ class Interpretation extends Fields
}
$fixUniqe[] = PHP_EOL . $this->_t(3) . "if (" . implode(' || ', $ifStatment) . ")";
$fixUniqe[] = $this->_t(3) . "{";
if ($setCategory && count($titles) == 1)
if ($setCategory && count((array) $titles) == 1)
{
$fixUniqe[] = $this->_t(4) . "list(" . implode('', $titleVars) . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], " . implode('', $titleData) . ");";
}
elseif (count($titles) == 1)
elseif (count((array) $titles) == 1)
{
$fixUniqe[] = $this->_t(4) . "list(" . implode(', ', $titleVars) . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], " . implode('', $titleData) . ");";
}
@ -9125,29 +9125,38 @@ class Interpretation extends Fields
}
/**
* @param $viewName_single
* @param $viewName_list
* A function that builds get Items Method for model
*
* @param string $viewName_single The single view name
* @param string $viewName_list The list view name
* @param array $config The config details to adapt the method being build
*
* @return string
*/
public function setModelExportMethod($viewName_single, $viewName_list)
public function setGetItemsModelMethod($viewName_single, $viewName_list, $config = array('functionName' => 'getExportData', 'docDesc' => 'Method to get list export data.', 'type' => 'export'))
{
$query = '';
if ($this->eximportView[$viewName_list])
if ($this->eximportView[$viewName_list] || 'export' !== $config['type'])
{
$isExport = ('export' === $config['type']);
$query = PHP_EOL . PHP_EOL . $this->_t(1) . "/**";
$query .= PHP_EOL . $this->_t(1) . " * Method to get list export data.";
$query .= PHP_EOL . $this->_t(1) . " * " . $config['docDesc'];
$query .= PHP_EOL . $this->_t(1) . " *";
$query .= PHP_EOL . $this->_t(1) . " * @param array \$pks The ids of the items to get";
$query .= PHP_EOL . $this->_t(1) . " * @param JUser \$user The user making the request";
$query .= PHP_EOL . $this->_t(1) . " *";
$query .= PHP_EOL . $this->_t(1) . " * @return mixed An array of data items on success, false on failure.";
$query .= PHP_EOL . $this->_t(1) . " */";
$query .= PHP_EOL . $this->_t(1) . "public function getExportData(\$pks, \$user = null)";
$query .= PHP_EOL . $this->_t(1) . "public function " . $config['functionName'] . "(\$pks, \$user = null)";
$query .= PHP_EOL . $this->_t(1) . "{";
$query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " setup the query";
$query .= PHP_EOL . $this->_t(2) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkArray(\$pks))";
$query .= PHP_EOL . $this->_t(2) . "{";
$query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)";
$query .= PHP_EOL . $this->_t(3) . "\$_export = true;";
$query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set a value to know this is " . $config['type'] . " method. (USE IN CUSTOM CODE TO ALTER OUTCOME)";
$query .= PHP_EOL . $this->_t(3) . "\$_" . $config['type'] . " = true;";
$query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the user object if not set.";
$query .= PHP_EOL . $this->_t(3) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkObject(\$user))";
$query .= PHP_EOL . $this->_t(3) . "if (!isset(\$user) || !" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkObject(\$user))";
$query .= PHP_EOL . $this->_t(3) . "{";
$query .= PHP_EOL . $this->_t(4) . "\$user = JFactory::getUser();";
$query .= PHP_EOL . $this->_t(3) . "}";
@ -9161,7 +9170,7 @@ class Interpretation extends Fields
$query .= PHP_EOL . $this->_t(3) . "\$query->where('a.id IN (' . implode(',',\$pks) . ')');";
// add custom filtering php
$query .= $this->getCustomScriptBuilder('php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL . $this->_t(1));
// add access levels if the view has access set
if (isset($this->accessBuilder[$viewName_single]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName_single]))
{
$query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Implement View Level Access";
@ -9179,16 +9188,22 @@ class Interpretation extends Fields
$query .= PHP_EOL . $this->_t(3) . "if (\$db->getNumRows())";
$query .= PHP_EOL . $this->_t(3) . "{";
$query .= PHP_EOL . $this->_t(4) . "\$items = \$db->loadObjectList();";
$query .= $this->setGetItemsMethodStringFix($viewName_single, $viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2), true);
// add custom php to getitems method after all
$query .= $this->setGetItemsMethodStringFix($viewName_single, $viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2), $isExport);
// add translations
if (!$isExport)
{
$query .= $this->setSelectionTranslationFix($viewName_list, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2));
}
// add custom php to getItems method after all
$query .= $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, PHP_EOL . PHP_EOL . $this->_t(2));
$query .= PHP_EOL . $this->_t(4) . "return \$items;";
$query .= PHP_EOL . $this->_t(3) . "}";
$query .= PHP_EOL . $this->_t(2) . "}";
$query .= PHP_EOL . $this->_t(2) . "return false;";
$query .= PHP_EOL . $this->_t(1) . "}";
// get the header script
if ($isExport)
{
$header = ComponentbuilderHelper::getDynamicScripts('headers');
// add getExImPortHeaders
@ -9196,6 +9211,7 @@ class Interpretation extends Fields
// set a default script for those with no custom script
PHP_EOL . PHP_EOL . $this->setPlaceholders($header, $this->placeholders));
}
}
return $query;
}
@ -12649,7 +12665,7 @@ class Interpretation extends Fields
return $checkin;
}
public function setGetItemsMethodStringFix($view, $viewName_list, $Component, $tab = '', $export = false)
public function setGetItemsMethodStringFix($viewName_single, $viewName_list, $Component, $tab = '', $export = false)
{
// add the fix if this view has the need for it
$fix = '';
@ -12661,16 +12677,17 @@ class Interpretation extends Fields
}
// setup correct core target
$coreLoad = false;
if (isset($this->permissionCore[$view]))
if (isset($this->permissionCore[$viewName_single]))
{
$core = $this->permissionCore[$view];
$core = $this->permissionCore[$viewName_single];
$coreLoad = true;
}
$component = ComponentbuilderHelper::safeString($Component);
// check if the item has permissions.
if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder[$core['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.access']]) && in_array($view, $this->permissionBuilder[$core['core.access']]))
if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder[$core['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder[$core['core.access']]) && in_array($viewName_single, $this->permissionBuilder[$core['core.access']]))
{
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$access = (JFactory::getUser()->authorise('" . $core['core.access'] . "', 'com_" . $component . "." . $view . ".' . (int) \$item->id) && JFactory::getUser()->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Remove items the user can't access.";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$access = (\$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "." . $viewName_single . ".' . (int) \$item->id) && \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (!\$access)";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "unset(\$items[\$nr]);";
@ -12700,9 +12717,9 @@ class Interpretation extends Fields
}
}
// open the values
if (isset($this->{$methodName}[$view]) && ComponentbuilderHelper::checkArray($this->{$methodName}[$view]))
if (isset($this->{$methodName}[$viewName_single]) && ComponentbuilderHelper::checkArray($this->{$methodName}[$viewName_single]))
{
foreach ($this->{$methodName}[$view] as $item)
foreach ($this->{$methodName}[$viewName_single] as $item)
{
switch ($item['method'])
{
@ -12749,21 +12766,12 @@ class Interpretation extends Fields
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$" . $item['name'] . "Array = " . $decode . "(\$item->" . $item['name'] . $suffix_decode . ");";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (" . $Component . "Helper::checkArray(\$" . $item['name'] . "Array))";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$" . $item['name'] . "Names = '';";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$counter = 0;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$" . $item['name'] . "Names = array();";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "foreach (\$" . $item['name'] . "Array as \$" . $item['name'] . ")";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "if (\$counter == 0)";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(6) . "\$" . $item['name'] . "Names .= " . $Component . "Helper::getGroupName(\$" . $item['name'] . ");";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "else";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(6) . "\$" . $item['name'] . "Names .= ', '." . $Component . "Helper::getGroupName(\$" . $item['name'] . ");";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "\$counter++;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "\$" . $item['name'] . "Names[] = " . $Component . "Helper::getGroupName(\$" . $item['name'] . ");";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$item->" . $item['name'] . " = \$" . $item['name'] . "Names;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$item->" . $item['name'] . " = implode(', ', \$" . $item['name'] . "Names);";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}";
}
/* elseif ($item['type'] === 'usergroup' && $export)
@ -12777,25 +12785,16 @@ class Interpretation extends Fields
} */
elseif ($item['translation'] && !$export)
{
$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) . "//" . $this->setLine(__LINE__) . " decode " . $item['name'];
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$" . $item['name'] . "Array = " . $decode . "(\$item->" . $item['name'] . $suffix_decode . ");";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (" . $Component . "Helper::checkArray(\$" . $item['name'] . "Array))";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$" . $item['name'] . "Names = '';";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$counter = 0;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$" . $item['name'] . "Names = array();";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "foreach (\$" . $item['name'] . "Array as \$" . $item['name'] . ")";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "if (\$counter == 0)";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(6) . "\$" . $item['name'] . "Names .= JText:" . ":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "else";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "{";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(6) . "\$" . $item['name'] . "Names .= ', '.JText:" . ":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "\$counter++;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "\$" . $item['name'] . "Names[] = JText:" . ":_(\$this->selectionTranslation(\$" . $item['name'] . ", '" . $item['name'] . "'));";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$item->" . $item['name'] . " = \$" . $item['name'] . "Names;";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "\$item->" . $item['name'] . " = implode(', ', \$" . $item['name'] . "Names);";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}";
}
else
@ -12899,15 +12898,15 @@ class Interpretation extends Fields
}
}
}
// set translation (TODO) would be nice to cut down on double loops..
// if (!$export && isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]))
// {
// foreach ($this->selectionTranslationFixBuilder[$viewName_list] as $name => $values)
// {
// $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " convert " . $name;
// $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$item->" . $name . " = \$this->selectionTranslation(\$item->" . $name . ", '" . $name . "');";
// }
// }
/* // set translation (TODO) would be nice to cut down on double loops..
if (!$export && isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list]))
{
foreach ($this->selectionTranslationFixBuilder[$viewName_list] as $name => $values)
{
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " convert " . $name;
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$item->" . $name . " = \$this->selectionTranslation(\$item->" . $name . ", '" . $name . "');";
}
} */
// load the relations after modeling
if (isset($this->fieldRelations[$viewName_list]) && ComponentbuilderHelper::checkArray($this->fieldRelations[$viewName_list]))
{
@ -12929,8 +12928,53 @@ class Interpretation extends Fields
$forEachStart = PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " set values to display correctly.";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "if (" . $Component . "Helper::checkArray(\$items))";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{";
// do not add to export since it is already done
if (!$export)
{
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the user object if not set.";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "if (!isset(\$user) || !" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkObject(\$user))";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "{";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$user = JFactory::getUser();";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "}";
}
// add the permissional removal of values the user has not right to view or access
if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single]))
{
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " -- get global permissional control activation. (default is inactive) ---";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " to use this feature add a global option radio button to your";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " component with a value of 1 as on/activate and 0 as inactive/off";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " make sure it has the name: strict_permission_per_field";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "\$strict_permission_per_field = JComponentHelper::getParams('com_" . $component . "')->get('strict_permission_per_field', 0);" . PHP_EOL;
}
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "foreach (\$items as \$nr => &\$item)";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "{";
// add the permissional removal of values the user has not right to view or access
if (isset($this->permissionFields[$viewName_single]) && ComponentbuilderHelper::checkArray($this->permissionFields[$viewName_single]))
{
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " use permissional control if globaly set.";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "if (\$strict_permission_per_field)";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{";
foreach ($this->permissionFields[$viewName_single] as $fieldName => $permission_options)
{
foreach($permission_options as $permission_option => $fieldType)
{
switch ($permission_option)
{
case 'access':
case 'view':
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "//" . $this->setLine(__LINE__) . " set " . $permission_option . " permissional control for " . $fieldName . " value.";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "if (isset(\$item->" . $fieldName . ") && (!\$user->authorise('" . $viewName_single . "." . $permission_option . "." . $fieldName . "', 'com_" . $component . "." . $viewName_single . ".' . (int) \$item->id)";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "|| !\$user->authorise('" . $viewName_single . "." . $permission_option . "." . $fieldName . "', 'com_" . $component . "')))";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "{";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "//" . $this->setLine(__LINE__) . " We JUST empty the value (do you have a better idea)";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "\$item->" . $fieldName . " = '';";
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "}";
break;
}
}
}
$forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}";
}
// remove these values if export
if ($export)
{
@ -12939,6 +12983,7 @@ class Interpretation extends Fields
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "unset(\$item->checked_out);";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "unset(\$item->checked_out_time);";
}
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(2) . "}";
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}";
if ($export)
@ -12953,7 +12998,7 @@ class Interpretation extends Fields
}
// add custom php to getitems method
$fix .= $this->getCustomScriptBuilder('php_getitems', $view, PHP_EOL . PHP_EOL . $tab);
$fix .= $this->getCustomScriptBuilder('php_getitems', $viewName_single, PHP_EOL . PHP_EOL . $tab);
// load the encryption object if needed
$script = '';
@ -13260,7 +13305,7 @@ class Interpretation extends Fields
foreach ($this->iconBuilder as $icon => $path)
{
$array_buket = explode('.', $icon);
if (count($array_buket) == 3)
if (count((array) $array_buket) == 3)
{
list($type, $name, $action) = $array_buket;
}

View File

@ -475,7 +475,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_list][$this->hhh . 'LISTQUERY' . $this->hhh] = $this->setListQuery($viewName_single, $viewName_list);
// MODELEXPORTMETHOD <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list][$this->hhh . 'MODELEXPORTMETHOD' . $this->hhh] = $this->setModelExportMethod($viewName_single, $viewName_list);
$this->fileContentDynamic[$viewName_list][$this->hhh . 'MODELEXPORTMETHOD' . $this->hhh] = $this->setGetItemsModelMethod($viewName_single, $viewName_list);
// MODELEXIMPORTMETHOD <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list][$this->hhh . 'CONTROLLEREXIMPORTMETHOD' . $this->hhh] = $this->setControllerEximportMethod($viewName_single, $viewName_list);

View File

@ -1826,7 +1826,7 @@ abstract class ComponentbuilderHelper
$field = $db->loadObject();
// load the values form params
$field->xml = json_decode($field->xml);
$field->type_name = self::safeString($field->type_name);
$field->type_name = self::safeTypeName($field->type_name);
$load = true;
// if category then name must be catid (only one per view)
if ($field->type_name == 'category')
@ -6331,7 +6331,7 @@ abstract class ComponentbuilderHelper
}
}
// check if there are any view values remaining
if (count($_result))
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);

View File

@ -117,9 +117,15 @@ class ComponentbuilderModelAdmin_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $item->id) && JFactory::getUser()->authorise('admin_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $item->id) && $user->authorise('admin_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -326,6 +332,9 @@ class ComponentbuilderModelAdmin_views extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -333,10 +342,10 @@ class ComponentbuilderModelAdmin_views extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -372,7 +381,8 @@ class ComponentbuilderModelAdmin_views extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $item->id) && JFactory::getUser()->authorise('admin_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_view.access', 'com_componentbuilder.admin_view.' . (int) $item->id) && $user->authorise('admin_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_custom_tabs.access', 'com_componentbuilder.admin_custom_tabs.' . (int) $item->id) && JFactory::getUser()->authorise('admin_custom_tabs.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_custom_tabs.access', 'com_componentbuilder.admin_custom_tabs.' . (int) $item->id) && $user->authorise('admin_custom_tabs.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelAdmins_fields extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_fields.access', 'com_componentbuilder.admin_fields.' . (int) $item->id) && JFactory::getUser()->authorise('admin_fields.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_fields.access', 'com_componentbuilder.admin_fields.' . (int) $item->id) && $user->authorise('admin_fields.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_fields_conditions.access', 'com_componentbuilder.admin_fields_conditions.' . (int) $item->id) && JFactory::getUser()->authorise('admin_fields_conditions.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_fields_conditions.access', 'com_componentbuilder.admin_fields_conditions.' . (int) $item->id) && $user->authorise('admin_fields_conditions.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('admin_fields_relations.access', 'com_componentbuilder.admin_fields_relations.' . (int) $item->id) && JFactory::getUser()->authorise('admin_fields_relations.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('admin_fields_relations.access', 'com_componentbuilder.admin_fields_relations.' . (int) $item->id) && $user->authorise('admin_fields_relations.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -93,9 +93,15 @@ class ComponentbuilderModelClass_extendings extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $item->id) && JFactory::getUser()->authorise('class_extends.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('class_extends.access', 'com_componentbuilder.class_extends.' . (int) $item->id) && $user->authorise('class_extends.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -97,9 +97,15 @@ class ComponentbuilderModelClass_methods extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && $user->authorise('class_method.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -253,6 +259,9 @@ class ComponentbuilderModelClass_methods extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -260,10 +269,10 @@ class ComponentbuilderModelClass_methods extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -299,7 +308,8 @@ class ComponentbuilderModelClass_methods extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && JFactory::getUser()->authorise('class_method.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('class_method.access', 'com_componentbuilder.class_method.' . (int) $item->id) && $user->authorise('class_method.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -97,9 +97,15 @@ class ComponentbuilderModelClass_properties extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && $user->authorise('class_property.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -253,6 +259,9 @@ class ComponentbuilderModelClass_properties extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -260,10 +269,10 @@ class ComponentbuilderModelClass_properties extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -299,7 +308,8 @@ class ComponentbuilderModelClass_properties extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && JFactory::getUser()->authorise('class_property.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('class_property.access', 'com_componentbuilder.class_property.' . (int) $item->id) && $user->authorise('class_property.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_admin_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_admin_views.access', 'com_componentbuilder.component_admin_views.' . (int) $item->id) && JFactory::getUser()->authorise('component_admin_views.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_admin_views.access', 'com_componentbuilder.component_admin_views.' . (int) $item->id) && $user->authorise('component_admin_views.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_config extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_config.access', 'com_componentbuilder.component_config.' . (int) $item->id) && JFactory::getUser()->authorise('component_config.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_config.access', 'com_componentbuilder.component_config.' . (int) $item->id) && $user->authorise('component_config.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_custom_admin_menus.access', 'com_componentbuilder.component_custom_admin_menus.' . (int) $item->id) && JFactory::getUser()->authorise('component_custom_admin_menus.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_custom_admin_menus.access', 'com_componentbuilder.component_custom_admin_menus.' . (int) $item->id) && $user->authorise('component_custom_admin_menus.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_custom_admin_views.access', 'com_componentbuilder.component_custom_admin_views.' . (int) $item->id) && JFactory::getUser()->authorise('component_custom_admin_views.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_custom_admin_views.access', 'com_componentbuilder.component_custom_admin_views.' . (int) $item->id) && $user->authorise('component_custom_admin_views.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_dashboard extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_dashboard.access', 'com_componentbuilder.component_dashboard.' . (int) $item->id) && JFactory::getUser()->authorise('component_dashboard.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_dashboard.access', 'com_componentbuilder.component_dashboard.' . (int) $item->id) && $user->authorise('component_dashboard.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_files_folders extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_files_folders.access', 'com_componentbuilder.component_files_folders.' . (int) $item->id) && JFactory::getUser()->authorise('component_files_folders.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_files_folders.access', 'com_componentbuilder.component_files_folders.' . (int) $item->id) && $user->authorise('component_files_folders.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_mysql_tweaks.access', 'com_componentbuilder.component_mysql_tweaks.' . (int) $item->id) && JFactory::getUser()->authorise('component_mysql_tweaks.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_mysql_tweaks.access', 'com_componentbuilder.component_mysql_tweaks.' . (int) $item->id) && $user->authorise('component_mysql_tweaks.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_placeholders extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_placeholders.access', 'com_componentbuilder.component_placeholders.' . (int) $item->id) && JFactory::getUser()->authorise('component_placeholders.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_placeholders.access', 'com_componentbuilder.component_placeholders.' . (int) $item->id) && $user->authorise('component_placeholders.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_plugins extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $item->id) && JFactory::getUser()->authorise('component_plugins.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_plugins.access', 'com_componentbuilder.component_plugins.' . (int) $item->id) && $user->authorise('component_plugins.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_site_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_site_views.access', 'com_componentbuilder.component_site_views.' . (int) $item->id) && JFactory::getUser()->authorise('component_site_views.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_site_views.access', 'com_componentbuilder.component_site_views.' . (int) $item->id) && $user->authorise('component_site_views.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelComponents_updates extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('component_updates.access', 'com_componentbuilder.component_updates.' . (int) $item->id) && JFactory::getUser()->authorise('component_updates.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('component_updates.access', 'com_componentbuilder.component_updates.' . (int) $item->id) && $user->authorise('component_updates.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -109,9 +109,15 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $item->id) && JFactory::getUser()->authorise('custom_admin_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $item->id) && $user->authorise('custom_admin_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -267,6 +273,9 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -274,10 +283,10 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -313,7 +322,8 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $item->id) && JFactory::getUser()->authorise('custom_admin_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('custom_admin_view.access', 'com_componentbuilder.custom_admin_view.' . (int) $item->id) && $user->authorise('custom_admin_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -105,9 +105,15 @@ class ComponentbuilderModelCustom_codes extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && $user->authorise('custom_code.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -300,6 +306,9 @@ class ComponentbuilderModelCustom_codes extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -307,10 +316,10 @@ class ComponentbuilderModelCustom_codes extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -346,7 +355,8 @@ class ComponentbuilderModelCustom_codes extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && $user->authorise('custom_code.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -97,9 +97,15 @@ class ComponentbuilderModelDynamic_gets extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $item->id) && JFactory::getUser()->authorise('dynamic_get.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $item->id) && $user->authorise('dynamic_get.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -250,6 +256,9 @@ class ComponentbuilderModelDynamic_gets extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -257,10 +266,10 @@ class ComponentbuilderModelDynamic_gets extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -296,7 +305,8 @@ class ComponentbuilderModelDynamic_gets extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $item->id) && JFactory::getUser()->authorise('dynamic_get.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('dynamic_get.access', 'com_componentbuilder.dynamic_get.' . (int) $item->id) && $user->authorise('dynamic_get.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -121,9 +121,15 @@ class ComponentbuilderModelFields extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && JFactory::getUser()->authorise('field.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && $user->authorise('field.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -365,6 +371,9 @@ class ComponentbuilderModelFields extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -372,10 +381,10 @@ class ComponentbuilderModelFields extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -411,7 +420,8 @@ class ComponentbuilderModelFields extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && JFactory::getUser()->authorise('field.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && $user->authorise('field.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -267,9 +267,15 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && JFactory::getUser()->authorise('field.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('field.access', 'com_componentbuilder.field.' . (int) $item->id) && $user->authorise('field.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -105,9 +105,15 @@ class ComponentbuilderModelFieldtypes extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder.fieldtype.' . (int) $item->id) && JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('fieldtype.access', 'com_componentbuilder.fieldtype.' . (int) $item->id) && $user->authorise('fieldtype.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -219,6 +225,9 @@ class ComponentbuilderModelFieldtypes extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -226,10 +235,10 @@ class ComponentbuilderModelFieldtypes extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -265,7 +274,8 @@ class ComponentbuilderModelFieldtypes extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder.fieldtype.' . (int) $item->id) && JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('fieldtype.access', 'com_componentbuilder.fieldtype.' . (int) $item->id) && $user->authorise('fieldtype.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -105,9 +105,15 @@ class ComponentbuilderModelHelp_documents extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -118,21 +124,12 @@ class ComponentbuilderModelHelp_documents extends JModelList
$groupsArray = json_decode($item->groups, true);
if (ComponentbuilderHelper::checkArray($groupsArray))
{
$groupsNames = '';
$counter = 0;
$groupsNames = array();
foreach ($groupsArray as $groups)
{
if ($counter == 0)
{
$groupsNames .= ComponentbuilderHelper::getGroupName($groups);
$groupsNames[] = ComponentbuilderHelper::getGroupName($groups);
}
else
{
$groupsNames .= ', '.ComponentbuilderHelper::getGroupName($groups);
}
$counter++;
}
$item->groups = $groupsNames;
$item->groups = implode(', ', $groupsNames);
}
}
}
@ -271,6 +268,9 @@ class ComponentbuilderModelHelp_documents extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -278,10 +278,10 @@ class ComponentbuilderModelHelp_documents extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -311,7 +311,8 @@ class ComponentbuilderModelHelp_documents extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('help_document.access', 'com_componentbuilder.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -2035,9 +2035,15 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -2135,6 +2141,9 @@ class ComponentbuilderModelJoomla_components extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -2142,10 +2151,10 @@ class ComponentbuilderModelJoomla_components extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -2186,7 +2195,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -276,9 +276,15 @@ class ComponentbuilderModelJoomla_plugins extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_plugin.access', 'com_componentbuilder.joomla_plugin.' . (int) $item->id) && $user->authorise('joomla_plugin.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder.joomla_plugin_files_folders_urls.' . (int) $item->id) && $user->authorise('joomla_plugin_files_folders_urls.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_plugin_updates.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_plugin_updates.access', 'com_componentbuilder.joomla_plugin_updates.' . (int) $item->id) && $user->authorise('joomla_plugin_updates.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -89,9 +89,15 @@ class ComponentbuilderModelLanguage_translations extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && $user->authorise('language_translation.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -268,6 +274,9 @@ class ComponentbuilderModelLanguage_translations extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -275,10 +284,10 @@ class ComponentbuilderModelLanguage_translations extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -314,7 +323,8 @@ class ComponentbuilderModelLanguage_translations extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $item->id) && $user->authorise('language_translation.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -216,9 +216,15 @@ class ComponentbuilderModelLanguages extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('language.access', 'com_componentbuilder.language.' . (int) $item->id) && JFactory::getUser()->authorise('language.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('language.access', 'com_componentbuilder.language.' . (int) $item->id) && $user->authorise('language.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -306,6 +312,9 @@ class ComponentbuilderModelLanguages extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -313,10 +322,10 @@ class ComponentbuilderModelLanguages extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -352,7 +361,8 @@ class ComponentbuilderModelLanguages extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('language.access', 'com_componentbuilder.language.' . (int) $item->id) && JFactory::getUser()->authorise('language.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('language.access', 'com_componentbuilder.language.' . (int) $item->id) && $user->authorise('language.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -101,9 +101,15 @@ class ComponentbuilderModelLayouts extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $item->id) && JFactory::getUser()->authorise('layout.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $item->id) && $user->authorise('layout.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -239,6 +245,9 @@ class ComponentbuilderModelLayouts extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -246,10 +255,10 @@ class ComponentbuilderModelLayouts extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -285,7 +294,8 @@ class ComponentbuilderModelLayouts extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $item->id) && JFactory::getUser()->authorise('layout.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('layout.access', 'com_componentbuilder.layout.' . (int) $item->id) && $user->authorise('layout.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -101,9 +101,15 @@ class ComponentbuilderModelLibraries extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('library.access', 'com_componentbuilder.library.' . (int) $item->id) && JFactory::getUser()->authorise('library.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('library.access', 'com_componentbuilder.library.' . (int) $item->id) && $user->authorise('library.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelLibraries_config extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('library_config.access', 'com_componentbuilder.library_config.' . (int) $item->id) && JFactory::getUser()->authorise('library_config.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('library_config.access', 'com_componentbuilder.library_config.' . (int) $item->id) && $user->authorise('library_config.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -87,9 +87,15 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('library_files_folders_urls.access', 'com_componentbuilder.library_files_folders_urls.' . (int) $item->id) && JFactory::getUser()->authorise('library_files_folders_urls.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('library_files_folders_urls.access', 'com_componentbuilder.library_files_folders_urls.' . (int) $item->id) && $user->authorise('library_files_folders_urls.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -93,9 +93,15 @@ class ComponentbuilderModelPlaceholders extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $item->id) && JFactory::getUser()->authorise('placeholder.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $item->id) && $user->authorise('placeholder.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -185,6 +191,9 @@ class ComponentbuilderModelPlaceholders extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -192,10 +201,10 @@ class ComponentbuilderModelPlaceholders extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -231,7 +240,8 @@ class ComponentbuilderModelPlaceholders extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $item->id) && JFactory::getUser()->authorise('placeholder.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('placeholder.access', 'com_componentbuilder.placeholder.' . (int) $item->id) && $user->authorise('placeholder.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -247,9 +247,15 @@ class ComponentbuilderModelServer extends JModelAdmin
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -93,9 +93,15 @@ class ComponentbuilderModelServers extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && JFactory::getUser()->authorise('server.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && $user->authorise('server.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -228,6 +234,9 @@ class ComponentbuilderModelServers extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -235,10 +244,10 @@ class ComponentbuilderModelServers extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -279,7 +288,8 @@ class ComponentbuilderModelServers extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && JFactory::getUser()->authorise('server.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('server.access', 'com_componentbuilder.server.' . (int) $item->id) && $user->authorise('server.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -113,9 +113,15 @@ class ComponentbuilderModelSite_views extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $item->id) && JFactory::getUser()->authorise('site_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $item->id) && $user->authorise('site_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -271,6 +277,9 @@ class ComponentbuilderModelSite_views extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -278,10 +287,10 @@ class ComponentbuilderModelSite_views extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -317,7 +326,8 @@ class ComponentbuilderModelSite_views extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $item->id) && JFactory::getUser()->authorise('site_view.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('site_view.access', 'com_componentbuilder.site_view.' . (int) $item->id) && $user->authorise('site_view.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -93,9 +93,15 @@ class ComponentbuilderModelSnippet_types extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $item->id) && JFactory::getUser()->authorise('snippet_type.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('snippet_type.access', 'com_componentbuilder.snippet_type.' . (int) $item->id) && $user->authorise('snippet_type.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -219,9 +219,15 @@ class ComponentbuilderModelSnippets extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $item->id) && JFactory::getUser()->authorise('snippet.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $item->id) && $user->authorise('snippet.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -327,6 +333,9 @@ class ComponentbuilderModelSnippets extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -334,10 +343,10 @@ class ComponentbuilderModelSnippets extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -373,7 +382,8 @@ class ComponentbuilderModelSnippets extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $item->id) && JFactory::getUser()->authorise('snippet.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('snippet.access', 'com_componentbuilder.snippet.' . (int) $item->id) && $user->authorise('snippet.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -101,9 +101,15 @@ class ComponentbuilderModelTemplates extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('template.access', 'com_componentbuilder.template.' . (int) $item->id) && JFactory::getUser()->authorise('template.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $item->id) && $user->authorise('template.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -239,6 +245,9 @@ class ComponentbuilderModelTemplates extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -246,10 +255,10 @@ class ComponentbuilderModelTemplates extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -285,7 +294,8 @@ class ComponentbuilderModelTemplates extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('template.access', 'com_componentbuilder.template.' . (int) $item->id) && JFactory::getUser()->authorise('template.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('template.access', 'com_componentbuilder.template.' . (int) $item->id) && $user->authorise('template.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -93,9 +93,15 @@ class ComponentbuilderModelValidation_rules extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// Get the user object if not set.
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
@ -183,6 +189,9 @@ class ComponentbuilderModelValidation_rules extends JModelList
/**
* Method to get list export data.
*
* @param array $pks The ids of the items to get
* @param JUser $user The user making the request
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks, $user = null)
@ -190,10 +199,10 @@ class ComponentbuilderModelValidation_rules extends JModelList
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
{
// Set a value to know this is exporting method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
// Get the user object if not set.
if (ComponentbuilderHelper::checkObject($user))
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
{
$user = JFactory::getUser();
}
@ -229,7 +238,8 @@ class ComponentbuilderModelValidation_rules extends JModelList
{
foreach ($items as $nr => &$item)
{
$access = (JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder'));
// Remove items the user can't access.
$access = ($user->authorise('validation_rule.access', 'com_componentbuilder.validation_rule.' . (int) $item->id) && $user->authorise('validation_rule.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);

View File

@ -53,7 +53,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);

View File

@ -44,7 +44,7 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);

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>4th September, 2019</creationDate>
<creationDate>5th September, 2019</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -1826,7 +1826,7 @@ abstract class ComponentbuilderHelper
$field = $db->loadObject();
// load the values form params
$field->xml = json_decode($field->xml);
$field->type_name = self::safeString($field->type_name);
$field->type_name = self::safeTypeName($field->type_name);
$load = true;
// if category then name must be catid (only one per view)
if ($field->type_name == 'category')
@ -5601,7 +5601,7 @@ abstract class ComponentbuilderHelper
}
}
// check if there are any view values remaining
if (count($_result))
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);

View File

@ -40,7 +40,7 @@ class ComponentbuilderViewApi extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
throw new Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);