diff --git a/README.md b/README.md index fff3d7b47..b8ba3cba6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.5) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.6) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 7th August, 2018 -+ *Version*: 2.8.5 ++ *Last Build*: 14th August, 2018 ++ *Version*: 2.8.6 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **187020** -+ *Field count*: **1059** -+ *File count*: **1239** ++ *Line count*: **186762** ++ *Field count*: **1061** ++ *File count*: **1240** + *Folder count*: **197** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index fff3d7b47..b8ba3cba6 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.5) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.6) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 7th August, 2018 -+ *Version*: 2.8.5 ++ *Last Build*: 14th August, 2018 ++ *Version*: 2.8.6 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **187020** -+ *Field count*: **1059** -+ *File count*: **1239** ++ *Line count*: **186762** ++ *Field count*: **1061** ++ *File count*: **1240** + *Folder count*: **197** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/compiler/joomla_3/JControllerForm.php b/admin/compiler/joomla_3/JControllerForm.php index f7d9a446f..305a23fec 100644 --- a/admin/compiler/joomla_3/JControllerForm.php +++ b/admin/compiler/joomla_3/JControllerForm.php @@ -145,48 +145,36 @@ class ###Component###Controller###View### extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -221,43 +209,40 @@ class ###Component###Controller###View### extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/compiler/joomla_3/JControllerForm_site.php b/admin/compiler/joomla_3/JControllerForm_site.php index cd3836666..01a76de19 100644 --- a/admin/compiler/joomla_3/JControllerForm_site.php +++ b/admin/compiler/joomla_3/JControllerForm_site.php @@ -145,48 +145,36 @@ class ###Component###Controller###View### extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -221,43 +209,40 @@ class ###Component###Controller###View### extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/admin_fields.php b/admin/controllers/admin_fields.php index d4869b407..98ec4da90 100644 --- a/admin/controllers/admin_fields.php +++ b/admin/controllers/admin_fields.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('admin_fields.access', 'com_componentbuilder'); + $access = $user->authorise('admin_fields.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('admin_fields.create', $this->option); + return $user->authorise('admin_fields.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/admin_fields_conditions.php b/admin/controllers/admin_fields_conditions.php index cc194551f..741c5964c 100644 --- a/admin/controllers/admin_fields_conditions.php +++ b/admin/controllers/admin_fields_conditions.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('admin_fields_conditions.access', 'com_componentbuilder'); + $access = $user->authorise('admin_fields_conditions.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('admin_fields_conditions.create', $this->option); + return $user->authorise('admin_fields_conditions.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/admin_fields_relations.php b/admin/controllers/admin_fields_relations.php index 67c8444c9..66aa9238d 100644 --- a/admin/controllers/admin_fields_relations.php +++ b/admin/controllers/admin_fields_relations.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('admin_fields_relations.access', 'com_componentbuilder'); + $access = $user->authorise('admin_fields_relations.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('admin_fields_relations.create', $this->option); + return $user->authorise('admin_fields_relations.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/admin_view.php b/admin/controllers/admin_view.php index 5d737bc47..d58bda581 100644 --- a/admin/controllers/admin_view.php +++ b/admin/controllers/admin_view.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('admin_view.access', 'com_componentbuilder'); + $access = $user->authorise('admin_view.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('admin_view.create', $this->option); + return $user->authorise('admin_view.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_admin_views.php b/admin/controllers/component_admin_views.php index 1fa960484..7abb1dc4f 100644 --- a/admin/controllers/component_admin_views.php +++ b/admin/controllers/component_admin_views.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_admin_views.access', 'com_componentbuilder'); + $access = $user->authorise('component_admin_views.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_admin_views.create', $this->option); + return $user->authorise('component_admin_views.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_config.php b/admin/controllers/component_config.php index b7920b637..92b967c28 100644 --- a/admin/controllers/component_config.php +++ b/admin/controllers/component_config.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_config extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_config.access', 'com_componentbuilder'); + $access = $user->authorise('component_config.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_config.create', $this->option); + return $user->authorise('component_config.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_config extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_config extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_custom_admin_menus.php b/admin/controllers/component_custom_admin_menus.php index 45591980a..72cf18100 100644 --- a/admin/controllers/component_custom_admin_menus.php +++ b/admin/controllers/component_custom_admin_menus.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_custom_admin_menus.access', 'com_componentbuilder'); + $access = $user->authorise('component_custom_admin_menus.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_custom_admin_menus.create', $this->option); + return $user->authorise('component_custom_admin_menus.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_custom_admin_views.php b/admin/controllers/component_custom_admin_views.php index f9a2c2875..b3709f96c 100644 --- a/admin/controllers/component_custom_admin_views.php +++ b/admin/controllers/component_custom_admin_views.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_custom_admin_views.access', 'com_componentbuilder'); + $access = $user->authorise('component_custom_admin_views.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_custom_admin_views.create', $this->option); + return $user->authorise('component_custom_admin_views.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_dashboard.php b/admin/controllers/component_dashboard.php index 3be38033f..69d4a25fa 100644 --- a/admin/controllers/component_dashboard.php +++ b/admin/controllers/component_dashboard.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_dashboard.access', 'com_componentbuilder'); + $access = $user->authorise('component_dashboard.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_dashboard.create', $this->option); + return $user->authorise('component_dashboard.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_files_folders.php b/admin/controllers/component_files_folders.php index a468a56c4..91c24208b 100644 --- a/admin/controllers/component_files_folders.php +++ b/admin/controllers/component_files_folders.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_files_folders.access', 'com_componentbuilder'); + $access = $user->authorise('component_files_folders.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_files_folders.create', $this->option); + return $user->authorise('component_files_folders.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_mysql_tweaks.php b/admin/controllers/component_mysql_tweaks.php index bbe29a194..c71880b2d 100644 --- a/admin/controllers/component_mysql_tweaks.php +++ b/admin/controllers/component_mysql_tweaks.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_mysql_tweaks.access', 'com_componentbuilder'); + $access = $user->authorise('component_mysql_tweaks.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_mysql_tweaks.create', $this->option); + return $user->authorise('component_mysql_tweaks.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_site_views.php b/admin/controllers/component_site_views.php index 5b6988fa1..ce29f1b87 100644 --- a/admin/controllers/component_site_views.php +++ b/admin/controllers/component_site_views.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_site_views.access', 'com_componentbuilder'); + $access = $user->authorise('component_site_views.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_site_views.create', $this->option); + return $user->authorise('component_site_views.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/component_updates.php b/admin/controllers/component_updates.php index 5f7bf9fcc..ab3308581 100644 --- a/admin/controllers/component_updates.php +++ b/admin/controllers/component_updates.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('component_updates.access', 'com_componentbuilder'); + $access = $user->authorise('component_updates.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('component_updates.create', $this->option); + return $user->authorise('component_updates.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/custom_admin_view.php b/admin/controllers/custom_admin_view.php index 55413a5b1..f9b28c219 100644 --- a/admin/controllers/custom_admin_view.php +++ b/admin/controllers/custom_admin_view.php @@ -50,12 +50,15 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('custom_admin_view.access', 'com_componentbuilder'); + $access = $user->authorise('custom_admin_view.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -197,48 +200,36 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/custom_code.php b/admin/controllers/custom_code.php index f83c19b46..b29f4ae23 100644 --- a/admin/controllers/custom_code.php +++ b/admin/controllers/custom_code.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerCustom_code extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('custom_code.access', 'com_componentbuilder'); + $access = $user->authorise('custom_code.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('custom_code.create', $this->option); + return $user->authorise('custom_code.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerCustom_code extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerCustom_code extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/dynamic_get.php b/admin/controllers/dynamic_get.php index 9165141da..bd9522f04 100644 --- a/admin/controllers/dynamic_get.php +++ b/admin/controllers/dynamic_get.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('dynamic_get.access', 'com_componentbuilder'); + $access = $user->authorise('dynamic_get.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('dynamic_get.create', $this->option); + return $user->authorise('dynamic_get.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/field.php b/admin/controllers/field.php index 9774bb407..9955e339c 100644 --- a/admin/controllers/field.php +++ b/admin/controllers/field.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerField extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('field.access', 'com_componentbuilder'); + $access = $user->authorise('field.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('field.create', $this->option); + return $user->authorise('field.create', $this->option); } /** @@ -196,48 +199,36 @@ class ComponentbuilderControllerField extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -272,43 +263,40 @@ class ComponentbuilderControllerField extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/fieldtype.php b/admin/controllers/fieldtype.php index 7a69059aa..dd95d2e7a 100644 --- a/admin/controllers/fieldtype.php +++ b/admin/controllers/fieldtype.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerFieldtype extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder'); + $access = $user->authorise('fieldtype.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('fieldtype.create', $this->option); + return $user->authorise('fieldtype.create', $this->option); } /** @@ -196,48 +199,36 @@ class ComponentbuilderControllerFieldtype extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -272,43 +263,40 @@ class ComponentbuilderControllerFieldtype extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/help_document.php b/admin/controllers/help_document.php index b348e5f35..825780a9c 100644 --- a/admin/controllers/help_document.php +++ b/admin/controllers/help_document.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerHelp_document extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('help_document.access', 'com_componentbuilder'); + $access = $user->authorise('help_document.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('help_document.create', $this->option); + return $user->authorise('help_document.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerHelp_document extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerHelp_document extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index 21f35b7f4..beb6c1fec 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -75,14 +75,17 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder'); + $access = $user->authorise('joomla_component.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('joomla_component.create', $this->option); + return $user->authorise('joomla_component.create', $this->option); } /** @@ -222,48 +225,36 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -298,43 +289,40 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/language.php b/admin/controllers/language.php index 07749d167..edae57948 100644 --- a/admin/controllers/language.php +++ b/admin/controllers/language.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerLanguage extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('language.access', 'com_componentbuilder'); + $access = $user->authorise('language.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('language.create', $this->option); + return $user->authorise('language.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerLanguage extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLanguage extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/language_translation.php b/admin/controllers/language_translation.php index a2fe2b007..3d1f4793c 100644 --- a/admin/controllers/language_translation.php +++ b/admin/controllers/language_translation.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerLanguage_translation extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder'); + $access = $user->authorise('language_translation.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('language_translation.create', $this->option); + return $user->authorise('language_translation.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerLanguage_translation extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLanguage_translation extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/layout.php b/admin/controllers/layout.php index 60951533e..e93bdf242 100644 --- a/admin/controllers/layout.php +++ b/admin/controllers/layout.php @@ -50,12 +50,15 @@ class ComponentbuilderControllerLayout extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('layout.access', 'com_componentbuilder'); + $access = $user->authorise('layout.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -197,48 +200,36 @@ class ComponentbuilderControllerLayout extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLayout extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/library.php b/admin/controllers/library.php index 196e144a4..d9ca74c27 100644 --- a/admin/controllers/library.php +++ b/admin/controllers/library.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerLibrary extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('library.access', 'com_componentbuilder'); + $access = $user->authorise('library.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('library.create', $this->option); + return $user->authorise('library.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerLibrary extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLibrary extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/library_config.php b/admin/controllers/library_config.php index 26844d4ff..ec8159bcd 100644 --- a/admin/controllers/library_config.php +++ b/admin/controllers/library_config.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerLibrary_config extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('library_config.access', 'com_componentbuilder'); + $access = $user->authorise('library_config.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('library_config.create', $this->option); + return $user->authorise('library_config.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerLibrary_config extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLibrary_config extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/library_files_folders_urls.php b/admin/controllers/library_files_folders_urls.php index a14a01990..5b5d1b758 100644 --- a/admin/controllers/library_files_folders_urls.php +++ b/admin/controllers/library_files_folders_urls.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends JControllerFo */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('library_files_folders_urls.access', 'com_componentbuilder'); + $access = $user->authorise('library_files_folders_urls.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('library_files_folders_urls.create', $this->option); + return $user->authorise('library_files_folders_urls.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends JControllerFo $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerLibrary_files_folders_urls extends JControllerFo $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/server.php b/admin/controllers/server.php index f13572a81..f14870b6c 100644 --- a/admin/controllers/server.php +++ b/admin/controllers/server.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerServer extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('server.access', 'com_componentbuilder'); + $access = $user->authorise('server.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('server.create', $this->option); + return $user->authorise('server.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerServer extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerServer extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/site_view.php b/admin/controllers/site_view.php index 206ed3149..0f682912a 100644 --- a/admin/controllers/site_view.php +++ b/admin/controllers/site_view.php @@ -50,12 +50,15 @@ class ComponentbuilderControllerSite_view extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('site_view.access', 'com_componentbuilder'); + $access = $user->authorise('site_view.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -197,48 +200,36 @@ class ComponentbuilderControllerSite_view extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerSite_view extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/snippet.php b/admin/controllers/snippet.php index d512ac34a..4d8647945 100644 --- a/admin/controllers/snippet.php +++ b/admin/controllers/snippet.php @@ -50,12 +50,15 @@ class ComponentbuilderControllerSnippet extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('snippet.access', 'com_componentbuilder'); + $access = $user->authorise('snippet.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -197,48 +200,36 @@ class ComponentbuilderControllerSnippet extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerSnippet extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/snippet_type.php b/admin/controllers/snippet_type.php index 20e1a191b..e2c452b8a 100644 --- a/admin/controllers/snippet_type.php +++ b/admin/controllers/snippet_type.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerSnippet_type extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('snippet_type.access', 'com_componentbuilder'); + $access = $user->authorise('snippet_type.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('snippet_type.create', $this->option); + return $user->authorise('snippet_type.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerSnippet_type extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerSnippet_type extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/template.php b/admin/controllers/template.php index d06f5a160..5b003b296 100644 --- a/admin/controllers/template.php +++ b/admin/controllers/template.php @@ -50,12 +50,15 @@ class ComponentbuilderControllerTemplate extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('template.access', 'com_componentbuilder'); + $access = $user->authorise('template.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. return parent::allowAdd($data); } @@ -197,48 +200,36 @@ class ComponentbuilderControllerTemplate extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerTemplate extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/controllers/validation_rule.php b/admin/controllers/validation_rule.php index 7c93d27f2..737370f91 100644 --- a/admin/controllers/validation_rule.php +++ b/admin/controllers/validation_rule.php @@ -50,14 +50,17 @@ class ComponentbuilderControllerValidation_rule extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('validation_rule.access', 'com_componentbuilder'); + $access = $user->authorise('validation_rule.access', 'com_componentbuilder'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('validation_rule.create', $this->option); + return $user->authorise('validation_rule.create', $this->option); } /** @@ -197,48 +200,36 @@ class ComponentbuilderControllerValidation_rule extends JControllerForm $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -273,43 +264,40 @@ class ComponentbuilderControllerValidation_rule extends JControllerForm $saved = parent::save($key, $urlVar); - if ($saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); + $redirect = base64_decode($return); - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); } return $saved; } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index a78f18bf7..2ba5e9fc3 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -10469,6 +10469,8 @@ class Interpretation extends Fields $allow = array(); // set component name $component = ComponentbuilderHelper::safeString($this->componentData->name_code); + // prepare custom permission script + $customAllow = $this->getCustomScriptBuilder('php_allowadd', $viewName_single, '', null, true); // setup correct core target $coreLoad = false; if (isset($this->permissionCore[$viewName_single])) @@ -10533,22 +10535,26 @@ class Interpretation extends Fields } else { + $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get user object."; + $allow[] = $this->_t(2) . "\$user = JFactory::getUser();"; // check if the item has permissions. if ($coreLoad && isset($core['core.access']) && isset($this->permissionBuilder['global'][$core['core.access']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.access']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.access']])) { - $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Access check."; - $allow[] = $this->_t(2) . "\$access = JFactory::getUser()->authorise('" . $core['core.access'] . "', 'com_" . $component . "');"; + $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Access check."; + $allow[] = $this->_t(2) . "\$access = \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "');"; $allow[] = $this->_t(2) . "if (!\$access)"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "return false;"; $allow[] = $this->_t(2) . "}"; } + // load custom permission script + $allow[] = $customAllow; // check if the item has permissions. if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) && ComponentbuilderHelper::checkArray($this->permissionBuilder['global'][$core['core.create']]) && in_array($viewName_single, $this->permissionBuilder['global'][$core['core.create']])) { // setup the default script $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " In the absense of better information, revert to the component permissions."; - $allow[] = $this->_t(2) . "return JFactory::getUser()->authorise('" . $core['core.create'] . "', \$this->option);"; + $allow[] = $this->_t(2) . "return \$user->authorise('" . $core['core.create'] . "', \$this->option);"; } else { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 5c956fa3c..8ff85f09d 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -412,6 +412,8 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_PUBLISH="Add Php After Publish" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AFTER_PUBLISH_LABEL="Add PHP (script - after publish)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX="Add Php Ajax" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX_LABEL="Add PHP (AJAX)" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWADD="Add Php Allowadd" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWADD_LABEL="Add PHP (allowAdd Method)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWEDIT="Add Php Allowedit" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_ALLOWEDIT_LABEL="Add PHP (allowEdit Method)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_BATCHCOPY="Add Php Batchcopy" @@ -754,6 +756,9 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AFTER_PUBLISH_LABEL="PHP publish Method afte COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AJAXMETHOD="Php Ajaxmethod" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AJAXMETHOD_DESCRIPTION="Add PHP Methods that should run in the AJAX Model. Do not add the php tags." COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AJAXMETHOD_LABEL="PHP Ajax Methods" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWADD="Php Allowadd" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWADD_DESCRIPTION="Add PHP Here that should run in the allowAdd Method to add custom access control. Do not add the php tags." +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWADD_LABEL="PHP allowAdd Method
An array of input data. => ($data) and the user object => ($user) are already set." COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWEDIT="Php Allowedit" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWEDIT_DESCRIPTION="Add PHP Here that should run in the allowEdit Method to add custom access control. Do not add the php tags." COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWEDIT_LABEL="PHP allowEdit Method
The record ID => ($recordId) and the user object => ($user) are already set." diff --git a/admin/layouts/admin_view/php_fullwidth.php b/admin/layouts/admin_view/php_fullwidth.php index da2caf42f..8e7e3809c 100644 --- a/admin/layouts/admin_view/php_fullwidth.php +++ b/admin/layouts/admin_view/php_fullwidth.php @@ -34,6 +34,8 @@ $fields = $displayData->get('fields') ?: array( 'php_save', 'add_php_postsavehook', 'php_postsavehook', + 'add_php_allowadd', + 'php_allowadd', 'add_php_allowedit', 'php_allowedit', 'add_php_batchcopy', diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index 46191ebd3..820b42de9 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->waefields; +$items = $displayData->waffields; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; diff --git a/admin/layouts/server/linked_components_fullwidth.php b/admin/layouts/server/linked_components_fullwidth.php index f17ddb13c..81d32dd22 100644 --- a/admin/layouts/server/linked_components_fullwidth.php +++ b/admin/layouts/server/linked_components_fullwidth.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->waolinked_components; +$items = $displayData->waplinked_components; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 2668adfbc..00f860107 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -86,10 +86,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->php_import_headers)) + if (!empty($item->php_import_save)) { - // base64 Decode php_import_headers. - $item->php_import_headers = base64_decode($item->php_import_headers); + // base64 Decode php_import_save. + $item->php_import_save = base64_decode($item->php_import_save); } if (!empty($item->html_import_view)) @@ -98,16 +98,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->html_import_view = base64_decode($item->html_import_view); } - if (!empty($item->php_import_save)) + if (!empty($item->php_import_headers)) { - // base64 Decode php_import_save. - $item->php_import_save = base64_decode($item->php_import_save); - } - - if (!empty($item->php_getitem)) - { - // base64 Decode php_getitem. - $item->php_getitem = base64_decode($item->php_getitem); + // base64 Decode php_import_headers. + $item->php_import_headers = base64_decode($item->php_import_headers); } if (!empty($item->php_getitems)) @@ -170,10 +164,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_postsavehook = base64_decode($item->php_postsavehook); } - if (!empty($item->php_allowedit)) + if (!empty($item->php_allowadd)) { - // base64 Decode php_allowedit. - $item->php_allowedit = base64_decode($item->php_allowedit); + // base64 Decode php_allowadd. + $item->php_allowadd = base64_decode($item->php_allowadd); } if (!empty($item->javascript_view_footer)) @@ -182,42 +176,48 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->javascript_view_footer = base64_decode($item->javascript_view_footer); } + if (!empty($item->php_allowedit)) + { + // base64 Decode php_allowedit. + $item->php_allowedit = base64_decode($item->php_allowedit); + } + if (!empty($item->php_batchcopy)) { // base64 Decode php_batchcopy. $item->php_batchcopy = base64_decode($item->php_batchcopy); } - if (!empty($item->php_batchmove)) - { - // base64 Decode php_batchmove. - $item->php_batchmove = base64_decode($item->php_batchmove); - } - if (!empty($item->javascript_views_file)) { // base64 Decode javascript_views_file. $item->javascript_views_file = base64_decode($item->javascript_views_file); } + if (!empty($item->php_batchmove)) + { + // base64 Decode php_batchmove. + $item->php_batchmove = base64_decode($item->php_batchmove); + } + if (!empty($item->php_before_publish)) { // base64 Decode php_before_publish. $item->php_before_publish = base64_decode($item->php_before_publish); } - if (!empty($item->php_after_publish)) - { - // base64 Decode php_after_publish. - $item->php_after_publish = base64_decode($item->php_after_publish); - } - if (!empty($item->javascript_views_footer)) { // base64 Decode javascript_views_footer. $item->javascript_views_footer = base64_decode($item->javascript_views_footer); } + if (!empty($item->php_after_publish)) + { + // base64 Decode php_after_publish. + $item->php_after_publish = base64_decode($item->php_after_publish); + } + if (!empty($item->php_before_delete)) { // base64 Decode php_before_delete. @@ -230,36 +230,36 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_after_delete = base64_decode($item->php_after_delete); } - if (!empty($item->php_document)) - { - // base64 Decode php_document. - $item->php_document = base64_decode($item->php_document); - } - if (!empty($item->php_controller)) { // base64 Decode php_controller. $item->php_controller = base64_decode($item->php_controller); } + if (!empty($item->php_document)) + { + // base64 Decode php_document. + $item->php_document = base64_decode($item->php_document); + } + if (!empty($item->php_model)) { // base64 Decode php_model. $item->php_model = base64_decode($item->php_model); } - if (!empty($item->sql)) - { - // base64 Decode sql. - $item->sql = base64_decode($item->sql); - } - if (!empty($item->php_controller_list)) { // base64 Decode php_controller_list. $item->php_controller_list = base64_decode($item->php_controller_list); } + if (!empty($item->sql)) + { + // base64 Decode sql. + $item->sql = base64_decode($item->sql); + } + if (!empty($item->php_model_list)) { // base64 Decode php_model_list. @@ -272,18 +272,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_display = base64_decode($item->php_import_display); } - if (!empty($item->php_import)) - { - // base64 Decode php_import. - $item->php_import = base64_decode($item->php_import); - } - if (!empty($item->php_ajaxmethod)) { // base64 Decode php_ajaxmethod. $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); } + if (!empty($item->php_import)) + { + // base64 Decode php_import. + $item->php_import = base64_decode($item->php_import); + } + if (!empty($item->php_import_setdata)) { // base64 Decode php_import_setdata. @@ -296,12 +296,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_ext = base64_decode($item->php_import_ext); } - if (!empty($item->addtables)) + if (!empty($item->php_getitem)) { - // Convert the addtables field to an array. - $addtables = new Registry; - $addtables->loadString($item->addtables); - $item->addtables = $addtables->toArray(); + // base64 Decode php_getitem. + $item->php_getitem = base64_decode($item->php_getitem); } if (!empty($item->addpermissions)) @@ -336,6 +334,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->alias_builder = $alias_builder->toArray(); } + if (!empty($item->addtables)) + { + // Convert the addtables field to an array. + $addtables = new Registry; + $addtables->loadString($item->addtables); + $item->addtables = $addtables->toArray(); + } + if (!empty($item->custom_button)) { // Convert the custom_button field to an array. @@ -1206,19 +1212,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['system_name'] = $data['name_single']; } - // Set the addtables items to data. - if (isset($data['addtables']) && is_array($data['addtables'])) - { - $addtables = new JRegistry; - $addtables->loadArray($data['addtables']); - $data['addtables'] = (string) $addtables; - } - elseif (!isset($data['addtables'])) - { - // Set the empty addtables to data - $data['addtables'] = ''; - } - // Set the addpermissions items to data. if (isset($data['addpermissions']) && is_array($data['addpermissions'])) { @@ -1271,6 +1264,19 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['alias_builder'] = ''; } + // Set the addtables items to data. + if (isset($data['addtables']) && is_array($data['addtables'])) + { + $addtables = new JRegistry; + $addtables->loadArray($data['addtables']); + $data['addtables'] = (string) $addtables; + } + elseif (!isset($data['addtables'])) + { + // Set the empty addtables to data + $data['addtables'] = ''; + } + // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { @@ -1297,10 +1303,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['ajax_input'] = ''; } - // Set the php_import_headers string to base64 string. - if (isset($data['php_import_headers'])) + // Set the php_import_save string to base64 string. + if (isset($data['php_import_save'])) { - $data['php_import_headers'] = base64_encode($data['php_import_headers']); + $data['php_import_save'] = base64_encode($data['php_import_save']); } // Set the html_import_view string to base64 string. @@ -1309,16 +1315,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['html_import_view'] = base64_encode($data['html_import_view']); } - // Set the php_import_save string to base64 string. - if (isset($data['php_import_save'])) + // Set the php_import_headers string to base64 string. + if (isset($data['php_import_headers'])) { - $data['php_import_save'] = base64_encode($data['php_import_save']); - } - - // Set the php_getitem string to base64 string. - if (isset($data['php_getitem'])) - { - $data['php_getitem'] = base64_encode($data['php_getitem']); + $data['php_import_headers'] = base64_encode($data['php_import_headers']); } // Set the php_getitems string to base64 string. @@ -1381,10 +1381,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_postsavehook'] = base64_encode($data['php_postsavehook']); } - // Set the php_allowedit string to base64 string. - if (isset($data['php_allowedit'])) + // Set the php_allowadd string to base64 string. + if (isset($data['php_allowadd'])) { - $data['php_allowedit'] = base64_encode($data['php_allowedit']); + $data['php_allowadd'] = base64_encode($data['php_allowadd']); } // Set the javascript_view_footer string to base64 string. @@ -1393,42 +1393,48 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } + // Set the php_allowedit string to base64 string. + if (isset($data['php_allowedit'])) + { + $data['php_allowedit'] = base64_encode($data['php_allowedit']); + } + // Set the php_batchcopy string to base64 string. if (isset($data['php_batchcopy'])) { $data['php_batchcopy'] = base64_encode($data['php_batchcopy']); } - // Set the php_batchmove string to base64 string. - if (isset($data['php_batchmove'])) - { - $data['php_batchmove'] = base64_encode($data['php_batchmove']); - } - // Set the javascript_views_file string to base64 string. if (isset($data['javascript_views_file'])) { $data['javascript_views_file'] = base64_encode($data['javascript_views_file']); } + // Set the php_batchmove string to base64 string. + if (isset($data['php_batchmove'])) + { + $data['php_batchmove'] = base64_encode($data['php_batchmove']); + } + // Set the php_before_publish string to base64 string. if (isset($data['php_before_publish'])) { $data['php_before_publish'] = base64_encode($data['php_before_publish']); } - // Set the php_after_publish string to base64 string. - if (isset($data['php_after_publish'])) - { - $data['php_after_publish'] = base64_encode($data['php_after_publish']); - } - // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } + // Set the php_after_publish string to base64 string. + if (isset($data['php_after_publish'])) + { + $data['php_after_publish'] = base64_encode($data['php_after_publish']); + } + // Set the php_before_delete string to base64 string. if (isset($data['php_before_delete'])) { @@ -1441,36 +1447,36 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_after_delete'] = base64_encode($data['php_after_delete']); } - // Set the php_document string to base64 string. - if (isset($data['php_document'])) - { - $data['php_document'] = base64_encode($data['php_document']); - } - // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } + // Set the php_document string to base64 string. + if (isset($data['php_document'])) + { + $data['php_document'] = base64_encode($data['php_document']); + } + // Set the php_model string to base64 string. if (isset($data['php_model'])) { $data['php_model'] = base64_encode($data['php_model']); } - // Set the sql string to base64 string. - if (isset($data['sql'])) - { - $data['sql'] = base64_encode($data['sql']); - } - // Set the php_controller_list string to base64 string. if (isset($data['php_controller_list'])) { $data['php_controller_list'] = base64_encode($data['php_controller_list']); } + // Set the sql string to base64 string. + if (isset($data['sql'])) + { + $data['sql'] = base64_encode($data['sql']); + } + // Set the php_model_list string to base64 string. if (isset($data['php_model_list'])) { @@ -1483,18 +1489,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_import_display'] = base64_encode($data['php_import_display']); } - // Set the php_import string to base64 string. - if (isset($data['php_import'])) - { - $data['php_import'] = base64_encode($data['php_import']); - } - // Set the php_ajaxmethod string to base64 string. if (isset($data['php_ajaxmethod'])) { $data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']); } + // Set the php_import string to base64 string. + if (isset($data['php_import'])) + { + $data['php_import'] = base64_encode($data['php_import']); + } + // Set the php_import_setdata string to base64 string. if (isset($data['php_import_setdata'])) { @@ -1505,6 +1511,12 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin if (isset($data['php_import_ext'])) { $data['php_import_ext'] = base64_encode($data['php_import_ext']); + } + + // Set the php_getitem string to base64 string. + if (isset($data['php_getitem'])) + { + $data['php_getitem'] = base64_encode($data['php_getitem']); } // Set the Params Items to data diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 6f2df64d0..57ef44c0b 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -241,14 +241,12 @@ class ComponentbuilderModelAdmin_views extends JModelList continue; } - // decode php_import_headers - $item->php_import_headers = base64_decode($item->php_import_headers); - // decode html_import_view - $item->html_import_view = base64_decode($item->html_import_view); // decode php_import_save $item->php_import_save = base64_decode($item->php_import_save); - // decode php_getitem - $item->php_getitem = base64_decode($item->php_getitem); + // decode html_import_view + $item->html_import_view = base64_decode($item->html_import_view); + // decode php_import_headers + $item->php_import_headers = base64_decode($item->php_import_headers); // decode php_getitems $item->php_getitems = base64_decode($item->php_getitems); // decode php_getitems_after_all @@ -269,48 +267,52 @@ class ComponentbuilderModelAdmin_views extends JModelList $item->javascript_view_file = base64_decode($item->javascript_view_file); // decode php_postsavehook $item->php_postsavehook = base64_decode($item->php_postsavehook); - // decode php_allowedit - $item->php_allowedit = base64_decode($item->php_allowedit); + // decode php_allowadd + $item->php_allowadd = base64_decode($item->php_allowadd); // decode javascript_view_footer $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + // decode php_allowedit + $item->php_allowedit = base64_decode($item->php_allowedit); // decode php_batchcopy $item->php_batchcopy = base64_decode($item->php_batchcopy); - // decode php_batchmove - $item->php_batchmove = base64_decode($item->php_batchmove); // decode javascript_views_file $item->javascript_views_file = base64_decode($item->javascript_views_file); + // decode php_batchmove + $item->php_batchmove = base64_decode($item->php_batchmove); // decode php_before_publish $item->php_before_publish = base64_decode($item->php_before_publish); - // decode php_after_publish - $item->php_after_publish = base64_decode($item->php_after_publish); // decode javascript_views_footer $item->javascript_views_footer = base64_decode($item->javascript_views_footer); + // decode php_after_publish + $item->php_after_publish = base64_decode($item->php_after_publish); // decode php_before_delete $item->php_before_delete = base64_decode($item->php_before_delete); // decode php_after_delete $item->php_after_delete = base64_decode($item->php_after_delete); - // decode php_document - $item->php_document = base64_decode($item->php_document); // decode php_controller $item->php_controller = base64_decode($item->php_controller); + // decode php_document + $item->php_document = base64_decode($item->php_document); // decode php_model $item->php_model = base64_decode($item->php_model); - // decode sql - $item->sql = base64_decode($item->sql); // decode php_controller_list $item->php_controller_list = base64_decode($item->php_controller_list); + // decode sql + $item->sql = base64_decode($item->sql); // decode php_model_list $item->php_model_list = base64_decode($item->php_model_list); // decode php_import_display $item->php_import_display = base64_decode($item->php_import_display); - // decode php_import - $item->php_import = base64_decode($item->php_import); // decode php_ajaxmethod $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); + // decode php_import + $item->php_import = base64_decode($item->php_import); // decode php_import_setdata $item->php_import_setdata = base64_decode($item->php_import_setdata); // decode php_import_ext $item->php_import_ext = base64_decode($item->php_import_ext); + // decode php_getitem + $item->php_getitem = base64_decode($item->php_getitem); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); diff --git a/admin/models/fields/fields.php b/admin/models/fields/fields.php index 2595b3fbc..ee76f9120 100644 --- a/admin/models/fields/fields.php +++ b/admin/models/fields/fields.php @@ -35,24 +35,25 @@ class JFormFieldFields extends JFormFieldList */ public function getOptions() { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.name','b.name'),array('id','field_name','type'))); - $query->from($db->quoteName('#__componentbuilder_field', 'a')); - $query->join('LEFT', '#__componentbuilder_fieldtype AS b ON b.id = a.fieldtype'); - $query->where($db->quoteName('a.published') . ' >= 1'); - $query->order('a.name ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $options[] = JHtml::_('select.option', '', 'Select an option'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [' . $item->type . ']'); - } - } - return $options; + $db = JFactory::getDBO(); +$query = $db->getQuery(true); +$query->select($db->quoteName(array('a.id','a.name','b.name'),array('id','field_name','type'))); +$query->from($db->quoteName('#__componentbuilder_field', 'a')); + $query->join('LEFT', '#__componentbuilder_fieldtype AS b ON b.id = a.fieldtype'); +$query->where($db->quoteName('a.published') . ' >= 1'); +$query->order('a.name ASC'); +$db->setQuery((string)$query); +$items = $db->loadObjectList(); +$options = array(); +if ($items) +{ + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->field_name . ' [' . $item->type . ']'); + } +} + +return $options; } } diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 3dc229162..03aa3f4a2 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -125,7 +125,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWaefields() + public function getWaffields() { // Get the user object. $user = JFactory::getUser(); @@ -207,13 +207,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin foreach ($items as $nr => &$item) { // convert datatype - $item->datatype = $this->selectionTranslationWaefields($item->datatype, 'datatype'); + $item->datatype = $this->selectionTranslationWaffields($item->datatype, 'datatype'); // convert indexes - $item->indexes = $this->selectionTranslationWaefields($item->indexes, 'indexes'); + $item->indexes = $this->selectionTranslationWaffields($item->indexes, 'indexes'); // convert null_switch - $item->null_switch = $this->selectionTranslationWaefields($item->null_switch, 'null_switch'); + $item->null_switch = $this->selectionTranslationWaffields($item->null_switch, 'null_switch'); // convert store - $item->store = $this->selectionTranslationWaefields($item->store, 'store'); + $item->store = $this->selectionTranslationWaffields($item->store, 'store'); } } @@ -227,7 +227,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return translatable string */ - public function selectionTranslationWaefields($value,$name) + public function selectionTranslationWaffields($value,$name) { // Array of datatype language strings if ($name === 'datatype') diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml index 61a6ee536..e72456dbc 100644 --- a/admin/models/forms/admin_fields.xml +++ b/admin/models/forms/admin_fields.xml @@ -114,7 +114,7 @@ name="field" label="COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_LABEL" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_DESCRIPTION" - class="list_class" + class="list_class fieldFull" multiple="false" required="false" button="false" diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index 23c22d172..aa2e0ff50 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -34,17 +34,18 @@ jform_vvvvvxvvxj_required = false; jform_vvvvvxwvxk_required = false; jform_vvvvvxxvxl_required = false; jform_vvvvvxyvxm_required = false; -jform_vvvvvycvxn_required = false; -jform_vvvvvycvxo_required = false; -jform_vvvvvycvxp_required = false; -jform_vvvvvycvxq_required = false; -jform_vvvvvycvxr_required = false; -jform_vvvvvycvxs_required = false; -jform_vvvvvycvxt_required = false; -jform_vvvvvyevxu_required = false; -jform_vvvvvyevxv_required = false; -jform_vvvvvyevxw_required = false; -jform_vvvvvyevxx_required = false; +jform_vvvvvxzvxn_required = false; +jform_vvvvvydvxo_required = false; +jform_vvvvvydvxp_required = false; +jform_vvvvvydvxq_required = false; +jform_vvvvvydvxr_required = false; +jform_vvvvvydvxs_required = false; +jform_vvvvvydvxt_required = false; +jform_vvvvvydvxu_required = false; +jform_vvvvvyfvxv_required = false; +jform_vvvvvyfvxw_required = false; +jform_vvvvvyfvxx_required = false; +jform_vvvvvyfvxy_required = false; // Initial Script jQuery(document).ready(function() @@ -94,49 +95,52 @@ jQuery(document).ready(function() var add_php_postsavehook_vvvvvxo = jQuery("#jform_add_php_postsavehook input[type='radio']:checked").val(); vvvvvxo(add_php_postsavehook_vvvvvxo); - var add_php_allowedit_vvvvvxp = jQuery("#jform_add_php_allowedit input[type='radio']:checked").val(); - vvvvvxp(add_php_allowedit_vvvvvxp); + var add_php_allowadd_vvvvvxp = jQuery("#jform_add_php_allowadd input[type='radio']:checked").val(); + vvvvvxp(add_php_allowadd_vvvvvxp); - var add_php_batchcopy_vvvvvxq = jQuery("#jform_add_php_batchcopy input[type='radio']:checked").val(); - vvvvvxq(add_php_batchcopy_vvvvvxq); + var add_php_allowedit_vvvvvxq = jQuery("#jform_add_php_allowedit input[type='radio']:checked").val(); + vvvvvxq(add_php_allowedit_vvvvvxq); - var add_php_batchmove_vvvvvxr = jQuery("#jform_add_php_batchmove input[type='radio']:checked").val(); - vvvvvxr(add_php_batchmove_vvvvvxr); + var add_php_batchcopy_vvvvvxr = jQuery("#jform_add_php_batchcopy input[type='radio']:checked").val(); + vvvvvxr(add_php_batchcopy_vvvvvxr); - var add_php_before_publish_vvvvvxs = jQuery("#jform_add_php_before_publish input[type='radio']:checked").val(); - vvvvvxs(add_php_before_publish_vvvvvxs); + var add_php_batchmove_vvvvvxs = jQuery("#jform_add_php_batchmove input[type='radio']:checked").val(); + vvvvvxs(add_php_batchmove_vvvvvxs); - var add_php_after_publish_vvvvvxt = jQuery("#jform_add_php_after_publish input[type='radio']:checked").val(); - vvvvvxt(add_php_after_publish_vvvvvxt); + var add_php_before_publish_vvvvvxt = jQuery("#jform_add_php_before_publish input[type='radio']:checked").val(); + vvvvvxt(add_php_before_publish_vvvvvxt); - var add_php_before_delete_vvvvvxu = jQuery("#jform_add_php_before_delete input[type='radio']:checked").val(); - vvvvvxu(add_php_before_delete_vvvvvxu); + var add_php_after_publish_vvvvvxu = jQuery("#jform_add_php_after_publish input[type='radio']:checked").val(); + vvvvvxu(add_php_after_publish_vvvvvxu); - var add_php_after_delete_vvvvvxv = jQuery("#jform_add_php_after_delete input[type='radio']:checked").val(); - vvvvvxv(add_php_after_delete_vvvvvxv); + var add_php_before_delete_vvvvvxv = jQuery("#jform_add_php_before_delete input[type='radio']:checked").val(); + vvvvvxv(add_php_before_delete_vvvvvxv); - var add_php_document_vvvvvxw = jQuery("#jform_add_php_document input[type='radio']:checked").val(); - vvvvvxw(add_php_document_vvvvvxw); + var add_php_after_delete_vvvvvxw = jQuery("#jform_add_php_after_delete input[type='radio']:checked").val(); + vvvvvxw(add_php_after_delete_vvvvvxw); - var add_sql_vvvvvxx = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvxx(add_sql_vvvvvxx); + var add_php_document_vvvvvxx = jQuery("#jform_add_php_document input[type='radio']:checked").val(); + vvvvvxx(add_php_document_vvvvvxx); - var source_vvvvvxy = jQuery("#jform_source input[type='radio']:checked").val(); var add_sql_vvvvvxy = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvxy(source_vvvvvxy,add_sql_vvvvvxy); + vvvvvxy(add_sql_vvvvvxy); - var source_vvvvvya = jQuery("#jform_source input[type='radio']:checked").val(); - var add_sql_vvvvvya = jQuery("#jform_add_sql input[type='radio']:checked").val(); - vvvvvya(source_vvvvvya,add_sql_vvvvvya); + var source_vvvvvxz = jQuery("#jform_source input[type='radio']:checked").val(); + var add_sql_vvvvvxz = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvxz(source_vvvvvxz,add_sql_vvvvvxz); - var add_custom_import_vvvvvyc = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); - vvvvvyc(add_custom_import_vvvvvyc); + var source_vvvvvyb = jQuery("#jform_source input[type='radio']:checked").val(); + var add_sql_vvvvvyb = jQuery("#jform_add_sql input[type='radio']:checked").val(); + vvvvvyb(source_vvvvvyb,add_sql_vvvvvyb); var add_custom_import_vvvvvyd = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); vvvvvyd(add_custom_import_vvvvvyd); - var add_custom_button_vvvvvye = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); - vvvvvye(add_custom_button_vvvvvye); + var add_custom_import_vvvvvye = jQuery("#jform_add_custom_import input[type='radio']:checked").val(); + vvvvvye(add_custom_import_vvvvvye); + + var add_custom_button_vvvvvyf = jQuery("#jform_add_custom_button input[type='radio']:checked").val(); + vvvvvyf(add_custom_button_vvvvvyf); }); // the vvvvvxa function @@ -607,320 +611,351 @@ function vvvvvxo(add_php_postsavehook_vvvvvxo) } // the vvvvvxp function -function vvvvvxp(add_php_allowedit_vvvvvxp) +function vvvvvxp(add_php_allowadd_vvvvvxp) { // set the function logic - if (add_php_allowedit_vvvvvxp == 1) + if (add_php_allowadd_vvvvvxp == 1) { - jQuery('#jform_php_allowedit-lbl').closest('.control-group').show(); + jQuery('#jform_php_allowadd-lbl').closest('.control-group').show(); if (jform_vvvvvxpvxd_required) { - updateFieldRequired('php_allowedit',0); - jQuery('#jform_php_allowedit').prop('required','required'); - jQuery('#jform_php_allowedit').attr('aria-required',true); - jQuery('#jform_php_allowedit').addClass('required'); + updateFieldRequired('php_allowadd',0); + jQuery('#jform_php_allowadd').prop('required','required'); + jQuery('#jform_php_allowadd').attr('aria-required',true); + jQuery('#jform_php_allowadd').addClass('required'); jform_vvvvvxpvxd_required = false; } } else { - jQuery('#jform_php_allowedit-lbl').closest('.control-group').hide(); + jQuery('#jform_php_allowadd-lbl').closest('.control-group').hide(); if (!jform_vvvvvxpvxd_required) { - updateFieldRequired('php_allowedit',1); - jQuery('#jform_php_allowedit').removeAttr('required'); - jQuery('#jform_php_allowedit').removeAttr('aria-required'); - jQuery('#jform_php_allowedit').removeClass('required'); + updateFieldRequired('php_allowadd',1); + jQuery('#jform_php_allowadd').removeAttr('required'); + jQuery('#jform_php_allowadd').removeAttr('aria-required'); + jQuery('#jform_php_allowadd').removeClass('required'); jform_vvvvvxpvxd_required = true; } } } // the vvvvvxq function -function vvvvvxq(add_php_batchcopy_vvvvvxq) +function vvvvvxq(add_php_allowedit_vvvvvxq) { // set the function logic - if (add_php_batchcopy_vvvvvxq == 1) + if (add_php_allowedit_vvvvvxq == 1) { - jQuery('#jform_php_batchcopy-lbl').closest('.control-group').show(); + jQuery('#jform_php_allowedit-lbl').closest('.control-group').show(); if (jform_vvvvvxqvxe_required) { - updateFieldRequired('php_batchcopy',0); - jQuery('#jform_php_batchcopy').prop('required','required'); - jQuery('#jform_php_batchcopy').attr('aria-required',true); - jQuery('#jform_php_batchcopy').addClass('required'); + updateFieldRequired('php_allowedit',0); + jQuery('#jform_php_allowedit').prop('required','required'); + jQuery('#jform_php_allowedit').attr('aria-required',true); + jQuery('#jform_php_allowedit').addClass('required'); jform_vvvvvxqvxe_required = false; } } else { - jQuery('#jform_php_batchcopy-lbl').closest('.control-group').hide(); + jQuery('#jform_php_allowedit-lbl').closest('.control-group').hide(); if (!jform_vvvvvxqvxe_required) { - updateFieldRequired('php_batchcopy',1); - jQuery('#jform_php_batchcopy').removeAttr('required'); - jQuery('#jform_php_batchcopy').removeAttr('aria-required'); - jQuery('#jform_php_batchcopy').removeClass('required'); + updateFieldRequired('php_allowedit',1); + jQuery('#jform_php_allowedit').removeAttr('required'); + jQuery('#jform_php_allowedit').removeAttr('aria-required'); + jQuery('#jform_php_allowedit').removeClass('required'); jform_vvvvvxqvxe_required = true; } } } // the vvvvvxr function -function vvvvvxr(add_php_batchmove_vvvvvxr) +function vvvvvxr(add_php_batchcopy_vvvvvxr) { // set the function logic - if (add_php_batchmove_vvvvvxr == 1) + if (add_php_batchcopy_vvvvvxr == 1) { - jQuery('#jform_php_batchmove-lbl').closest('.control-group').show(); + jQuery('#jform_php_batchcopy-lbl').closest('.control-group').show(); if (jform_vvvvvxrvxf_required) { - updateFieldRequired('php_batchmove',0); - jQuery('#jform_php_batchmove').prop('required','required'); - jQuery('#jform_php_batchmove').attr('aria-required',true); - jQuery('#jform_php_batchmove').addClass('required'); + updateFieldRequired('php_batchcopy',0); + jQuery('#jform_php_batchcopy').prop('required','required'); + jQuery('#jform_php_batchcopy').attr('aria-required',true); + jQuery('#jform_php_batchcopy').addClass('required'); jform_vvvvvxrvxf_required = false; } } else { - jQuery('#jform_php_batchmove-lbl').closest('.control-group').hide(); + jQuery('#jform_php_batchcopy-lbl').closest('.control-group').hide(); if (!jform_vvvvvxrvxf_required) { - updateFieldRequired('php_batchmove',1); - jQuery('#jform_php_batchmove').removeAttr('required'); - jQuery('#jform_php_batchmove').removeAttr('aria-required'); - jQuery('#jform_php_batchmove').removeClass('required'); + updateFieldRequired('php_batchcopy',1); + jQuery('#jform_php_batchcopy').removeAttr('required'); + jQuery('#jform_php_batchcopy').removeAttr('aria-required'); + jQuery('#jform_php_batchcopy').removeClass('required'); jform_vvvvvxrvxf_required = true; } } } // the vvvvvxs function -function vvvvvxs(add_php_before_publish_vvvvvxs) +function vvvvvxs(add_php_batchmove_vvvvvxs) { // set the function logic - if (add_php_before_publish_vvvvvxs == 1) + if (add_php_batchmove_vvvvvxs == 1) { - jQuery('#jform_php_before_publish-lbl').closest('.control-group').show(); + jQuery('#jform_php_batchmove-lbl').closest('.control-group').show(); if (jform_vvvvvxsvxg_required) { - updateFieldRequired('php_before_publish',0); - jQuery('#jform_php_before_publish').prop('required','required'); - jQuery('#jform_php_before_publish').attr('aria-required',true); - jQuery('#jform_php_before_publish').addClass('required'); + updateFieldRequired('php_batchmove',0); + jQuery('#jform_php_batchmove').prop('required','required'); + jQuery('#jform_php_batchmove').attr('aria-required',true); + jQuery('#jform_php_batchmove').addClass('required'); jform_vvvvvxsvxg_required = false; } } else { - jQuery('#jform_php_before_publish-lbl').closest('.control-group').hide(); + jQuery('#jform_php_batchmove-lbl').closest('.control-group').hide(); if (!jform_vvvvvxsvxg_required) { - updateFieldRequired('php_before_publish',1); - jQuery('#jform_php_before_publish').removeAttr('required'); - jQuery('#jform_php_before_publish').removeAttr('aria-required'); - jQuery('#jform_php_before_publish').removeClass('required'); + updateFieldRequired('php_batchmove',1); + jQuery('#jform_php_batchmove').removeAttr('required'); + jQuery('#jform_php_batchmove').removeAttr('aria-required'); + jQuery('#jform_php_batchmove').removeClass('required'); jform_vvvvvxsvxg_required = true; } } } // the vvvvvxt function -function vvvvvxt(add_php_after_publish_vvvvvxt) +function vvvvvxt(add_php_before_publish_vvvvvxt) { // set the function logic - if (add_php_after_publish_vvvvvxt == 1) + if (add_php_before_publish_vvvvvxt == 1) { - jQuery('#jform_php_after_publish-lbl').closest('.control-group').show(); + jQuery('#jform_php_before_publish-lbl').closest('.control-group').show(); if (jform_vvvvvxtvxh_required) { - updateFieldRequired('php_after_publish',0); - jQuery('#jform_php_after_publish').prop('required','required'); - jQuery('#jform_php_after_publish').attr('aria-required',true); - jQuery('#jform_php_after_publish').addClass('required'); + updateFieldRequired('php_before_publish',0); + jQuery('#jform_php_before_publish').prop('required','required'); + jQuery('#jform_php_before_publish').attr('aria-required',true); + jQuery('#jform_php_before_publish').addClass('required'); jform_vvvvvxtvxh_required = false; } } else { - jQuery('#jform_php_after_publish-lbl').closest('.control-group').hide(); + jQuery('#jform_php_before_publish-lbl').closest('.control-group').hide(); if (!jform_vvvvvxtvxh_required) { - updateFieldRequired('php_after_publish',1); - jQuery('#jform_php_after_publish').removeAttr('required'); - jQuery('#jform_php_after_publish').removeAttr('aria-required'); - jQuery('#jform_php_after_publish').removeClass('required'); + updateFieldRequired('php_before_publish',1); + jQuery('#jform_php_before_publish').removeAttr('required'); + jQuery('#jform_php_before_publish').removeAttr('aria-required'); + jQuery('#jform_php_before_publish').removeClass('required'); jform_vvvvvxtvxh_required = true; } } } // the vvvvvxu function -function vvvvvxu(add_php_before_delete_vvvvvxu) +function vvvvvxu(add_php_after_publish_vvvvvxu) { // set the function logic - if (add_php_before_delete_vvvvvxu == 1) + if (add_php_after_publish_vvvvvxu == 1) { - jQuery('#jform_php_before_delete-lbl').closest('.control-group').show(); + jQuery('#jform_php_after_publish-lbl').closest('.control-group').show(); if (jform_vvvvvxuvxi_required) { - updateFieldRequired('php_before_delete',0); - jQuery('#jform_php_before_delete').prop('required','required'); - jQuery('#jform_php_before_delete').attr('aria-required',true); - jQuery('#jform_php_before_delete').addClass('required'); + updateFieldRequired('php_after_publish',0); + jQuery('#jform_php_after_publish').prop('required','required'); + jQuery('#jform_php_after_publish').attr('aria-required',true); + jQuery('#jform_php_after_publish').addClass('required'); jform_vvvvvxuvxi_required = false; } } else { - jQuery('#jform_php_before_delete-lbl').closest('.control-group').hide(); + jQuery('#jform_php_after_publish-lbl').closest('.control-group').hide(); if (!jform_vvvvvxuvxi_required) { - updateFieldRequired('php_before_delete',1); - jQuery('#jform_php_before_delete').removeAttr('required'); - jQuery('#jform_php_before_delete').removeAttr('aria-required'); - jQuery('#jform_php_before_delete').removeClass('required'); + updateFieldRequired('php_after_publish',1); + jQuery('#jform_php_after_publish').removeAttr('required'); + jQuery('#jform_php_after_publish').removeAttr('aria-required'); + jQuery('#jform_php_after_publish').removeClass('required'); jform_vvvvvxuvxi_required = true; } } } // the vvvvvxv function -function vvvvvxv(add_php_after_delete_vvvvvxv) +function vvvvvxv(add_php_before_delete_vvvvvxv) { // set the function logic - if (add_php_after_delete_vvvvvxv == 1) + if (add_php_before_delete_vvvvvxv == 1) { - jQuery('#jform_php_after_delete-lbl').closest('.control-group').show(); + jQuery('#jform_php_before_delete-lbl').closest('.control-group').show(); if (jform_vvvvvxvvxj_required) { - updateFieldRequired('php_after_delete',0); - jQuery('#jform_php_after_delete').prop('required','required'); - jQuery('#jform_php_after_delete').attr('aria-required',true); - jQuery('#jform_php_after_delete').addClass('required'); + updateFieldRequired('php_before_delete',0); + jQuery('#jform_php_before_delete').prop('required','required'); + jQuery('#jform_php_before_delete').attr('aria-required',true); + jQuery('#jform_php_before_delete').addClass('required'); jform_vvvvvxvvxj_required = false; } } else { - jQuery('#jform_php_after_delete-lbl').closest('.control-group').hide(); + jQuery('#jform_php_before_delete-lbl').closest('.control-group').hide(); if (!jform_vvvvvxvvxj_required) { - updateFieldRequired('php_after_delete',1); - jQuery('#jform_php_after_delete').removeAttr('required'); - jQuery('#jform_php_after_delete').removeAttr('aria-required'); - jQuery('#jform_php_after_delete').removeClass('required'); + updateFieldRequired('php_before_delete',1); + jQuery('#jform_php_before_delete').removeAttr('required'); + jQuery('#jform_php_before_delete').removeAttr('aria-required'); + jQuery('#jform_php_before_delete').removeClass('required'); jform_vvvvvxvvxj_required = true; } } } // the vvvvvxw function -function vvvvvxw(add_php_document_vvvvvxw) +function vvvvvxw(add_php_after_delete_vvvvvxw) { // set the function logic - if (add_php_document_vvvvvxw == 1) + if (add_php_after_delete_vvvvvxw == 1) { - jQuery('#jform_php_document-lbl').closest('.control-group').show(); + jQuery('#jform_php_after_delete-lbl').closest('.control-group').show(); if (jform_vvvvvxwvxk_required) { - updateFieldRequired('php_document',0); - jQuery('#jform_php_document').prop('required','required'); - jQuery('#jform_php_document').attr('aria-required',true); - jQuery('#jform_php_document').addClass('required'); + updateFieldRequired('php_after_delete',0); + jQuery('#jform_php_after_delete').prop('required','required'); + jQuery('#jform_php_after_delete').attr('aria-required',true); + jQuery('#jform_php_after_delete').addClass('required'); jform_vvvvvxwvxk_required = false; } } else { - jQuery('#jform_php_document-lbl').closest('.control-group').hide(); + jQuery('#jform_php_after_delete-lbl').closest('.control-group').hide(); if (!jform_vvvvvxwvxk_required) { - updateFieldRequired('php_document',1); - jQuery('#jform_php_document').removeAttr('required'); - jQuery('#jform_php_document').removeAttr('aria-required'); - jQuery('#jform_php_document').removeClass('required'); + updateFieldRequired('php_after_delete',1); + jQuery('#jform_php_after_delete').removeAttr('required'); + jQuery('#jform_php_after_delete').removeAttr('aria-required'); + jQuery('#jform_php_after_delete').removeClass('required'); jform_vvvvvxwvxk_required = true; } } } // the vvvvvxx function -function vvvvvxx(add_sql_vvvvvxx) +function vvvvvxx(add_php_document_vvvvvxx) { // set the function logic - if (add_sql_vvvvvxx == 1) + if (add_php_document_vvvvvxx == 1) { - jQuery('#jform_source').closest('.control-group').show(); + jQuery('#jform_php_document-lbl').closest('.control-group').show(); if (jform_vvvvvxxvxl_required) { - updateFieldRequired('source',0); - jQuery('#jform_source').prop('required','required'); - jQuery('#jform_source').attr('aria-required',true); - jQuery('#jform_source').addClass('required'); + updateFieldRequired('php_document',0); + jQuery('#jform_php_document').prop('required','required'); + jQuery('#jform_php_document').attr('aria-required',true); + jQuery('#jform_php_document').addClass('required'); jform_vvvvvxxvxl_required = false; } } else { - jQuery('#jform_source').closest('.control-group').hide(); + jQuery('#jform_php_document-lbl').closest('.control-group').hide(); if (!jform_vvvvvxxvxl_required) { - updateFieldRequired('source',1); - jQuery('#jform_source').removeAttr('required'); - jQuery('#jform_source').removeAttr('aria-required'); - jQuery('#jform_source').removeClass('required'); + updateFieldRequired('php_document',1); + jQuery('#jform_php_document').removeAttr('required'); + jQuery('#jform_php_document').removeAttr('aria-required'); + jQuery('#jform_php_document').removeClass('required'); jform_vvvvvxxvxl_required = true; } } } // the vvvvvxy function -function vvvvvxy(source_vvvvvxy,add_sql_vvvvvxy) +function vvvvvxy(add_sql_vvvvvxy) { // set the function logic - if (source_vvvvvxy == 2 && add_sql_vvvvvxy == 1) + if (add_sql_vvvvvxy == 1) { - jQuery('#jform_sql').closest('.control-group').show(); + jQuery('#jform_source').closest('.control-group').show(); if (jform_vvvvvxyvxm_required) { - updateFieldRequired('sql',0); - jQuery('#jform_sql').prop('required','required'); - jQuery('#jform_sql').attr('aria-required',true); - jQuery('#jform_sql').addClass('required'); + updateFieldRequired('source',0); + jQuery('#jform_source').prop('required','required'); + jQuery('#jform_source').attr('aria-required',true); + jQuery('#jform_source').addClass('required'); jform_vvvvvxyvxm_required = false; } } else { - jQuery('#jform_sql').closest('.control-group').hide(); + jQuery('#jform_source').closest('.control-group').hide(); if (!jform_vvvvvxyvxm_required) { - updateFieldRequired('sql',1); - jQuery('#jform_sql').removeAttr('required'); - jQuery('#jform_sql').removeAttr('aria-required'); - jQuery('#jform_sql').removeClass('required'); + updateFieldRequired('source',1); + jQuery('#jform_source').removeAttr('required'); + jQuery('#jform_source').removeAttr('aria-required'); + jQuery('#jform_source').removeClass('required'); jform_vvvvvxyvxm_required = true; } } } -// the vvvvvya function -function vvvvvya(source_vvvvvya,add_sql_vvvvvya) +// the vvvvvxz function +function vvvvvxz(source_vvvvvxz,add_sql_vvvvvxz) { // set the function logic - if (source_vvvvvya == 1 && add_sql_vvvvvya == 1) + if (source_vvvvvxz == 2 && add_sql_vvvvvxz == 1) + { + jQuery('#jform_sql').closest('.control-group').show(); + if (jform_vvvvvxzvxn_required) + { + updateFieldRequired('sql',0); + jQuery('#jform_sql').prop('required','required'); + jQuery('#jform_sql').attr('aria-required',true); + jQuery('#jform_sql').addClass('required'); + jform_vvvvvxzvxn_required = false; + } + + } + else + { + jQuery('#jform_sql').closest('.control-group').hide(); + if (!jform_vvvvvxzvxn_required) + { + updateFieldRequired('sql',1); + jQuery('#jform_sql').removeAttr('required'); + jQuery('#jform_sql').removeAttr('aria-required'); + jQuery('#jform_sql').removeClass('required'); + jform_vvvvvxzvxn_required = true; + } + } +} + +// the vvvvvyb function +function vvvvvyb(source_vvvvvyb,add_sql_vvvvvyb) +{ + // set the function logic + if (source_vvvvvyb == 1 && add_sql_vvvvvyb == 1) { jQuery('#jform_addtables-lbl').closest('.control-group').show(); } @@ -930,158 +965,158 @@ function vvvvvya(source_vvvvvya,add_sql_vvvvvya) } } -// the vvvvvyc function -function vvvvvyc(add_custom_import_vvvvvyc) +// the vvvvvyd function +function vvvvvyd(add_custom_import_vvvvvyd) { // set the function logic - if (add_custom_import_vvvvvyc == 1) + if (add_custom_import_vvvvvyd == 1) { jQuery('#jform_html_import_view').closest('.control-group').show(); - if (jform_vvvvvycvxn_required) + if (jform_vvvvvydvxo_required) { updateFieldRequired('html_import_view',0); jQuery('#jform_html_import_view').prop('required','required'); jQuery('#jform_html_import_view').attr('aria-required',true); jQuery('#jform_html_import_view').addClass('required'); - jform_vvvvvycvxn_required = false; + jform_vvvvvydvxo_required = false; } jQuery('.note_advanced_import').closest('.control-group').show(); jQuery('#jform_php_import_display').closest('.control-group').show(); - if (jform_vvvvvycvxo_required) + if (jform_vvvvvydvxp_required) { updateFieldRequired('php_import_display',0); jQuery('#jform_php_import_display').prop('required','required'); jQuery('#jform_php_import_display').attr('aria-required',true); jQuery('#jform_php_import_display').addClass('required'); - jform_vvvvvycvxo_required = false; + jform_vvvvvydvxp_required = false; } jQuery('#jform_php_import_ext').closest('.control-group').show(); - if (jform_vvvvvycvxp_required) + if (jform_vvvvvydvxq_required) { updateFieldRequired('php_import_ext',0); jQuery('#jform_php_import_ext').prop('required','required'); jQuery('#jform_php_import_ext').attr('aria-required',true); jQuery('#jform_php_import_ext').addClass('required'); - jform_vvvvvycvxp_required = false; + jform_vvvvvydvxq_required = false; } jQuery('#jform_php_import_headers').closest('.control-group').show(); - if (jform_vvvvvycvxq_required) + if (jform_vvvvvydvxr_required) { updateFieldRequired('php_import_headers',0); jQuery('#jform_php_import_headers').prop('required','required'); jQuery('#jform_php_import_headers').attr('aria-required',true); jQuery('#jform_php_import_headers').addClass('required'); - jform_vvvvvycvxq_required = false; + jform_vvvvvydvxr_required = false; } jQuery('#jform_php_import').closest('.control-group').show(); - if (jform_vvvvvycvxr_required) + if (jform_vvvvvydvxs_required) { updateFieldRequired('php_import',0); jQuery('#jform_php_import').prop('required','required'); jQuery('#jform_php_import').attr('aria-required',true); jQuery('#jform_php_import').addClass('required'); - jform_vvvvvycvxr_required = false; + jform_vvvvvydvxs_required = false; } jQuery('#jform_php_import_save').closest('.control-group').show(); - if (jform_vvvvvycvxs_required) + if (jform_vvvvvydvxt_required) { updateFieldRequired('php_import_save',0); jQuery('#jform_php_import_save').prop('required','required'); jQuery('#jform_php_import_save').attr('aria-required',true); jQuery('#jform_php_import_save').addClass('required'); - jform_vvvvvycvxs_required = false; + jform_vvvvvydvxt_required = false; } jQuery('#jform_php_import_setdata').closest('.control-group').show(); - if (jform_vvvvvycvxt_required) + if (jform_vvvvvydvxu_required) { updateFieldRequired('php_import_setdata',0); jQuery('#jform_php_import_setdata').prop('required','required'); jQuery('#jform_php_import_setdata').attr('aria-required',true); jQuery('#jform_php_import_setdata').addClass('required'); - jform_vvvvvycvxt_required = false; + jform_vvvvvydvxu_required = false; } } else { jQuery('#jform_html_import_view').closest('.control-group').hide(); - if (!jform_vvvvvycvxn_required) + if (!jform_vvvvvydvxo_required) { updateFieldRequired('html_import_view',1); jQuery('#jform_html_import_view').removeAttr('required'); jQuery('#jform_html_import_view').removeAttr('aria-required'); jQuery('#jform_html_import_view').removeClass('required'); - jform_vvvvvycvxn_required = true; + jform_vvvvvydvxo_required = true; } jQuery('.note_advanced_import').closest('.control-group').hide(); jQuery('#jform_php_import_display').closest('.control-group').hide(); - if (!jform_vvvvvycvxo_required) + if (!jform_vvvvvydvxp_required) { updateFieldRequired('php_import_display',1); jQuery('#jform_php_import_display').removeAttr('required'); jQuery('#jform_php_import_display').removeAttr('aria-required'); jQuery('#jform_php_import_display').removeClass('required'); - jform_vvvvvycvxo_required = true; + jform_vvvvvydvxp_required = true; } jQuery('#jform_php_import_ext').closest('.control-group').hide(); - if (!jform_vvvvvycvxp_required) + if (!jform_vvvvvydvxq_required) { updateFieldRequired('php_import_ext',1); jQuery('#jform_php_import_ext').removeAttr('required'); jQuery('#jform_php_import_ext').removeAttr('aria-required'); jQuery('#jform_php_import_ext').removeClass('required'); - jform_vvvvvycvxp_required = true; + jform_vvvvvydvxq_required = true; } jQuery('#jform_php_import_headers').closest('.control-group').hide(); - if (!jform_vvvvvycvxq_required) + if (!jform_vvvvvydvxr_required) { updateFieldRequired('php_import_headers',1); jQuery('#jform_php_import_headers').removeAttr('required'); jQuery('#jform_php_import_headers').removeAttr('aria-required'); jQuery('#jform_php_import_headers').removeClass('required'); - jform_vvvvvycvxq_required = true; + jform_vvvvvydvxr_required = true; } jQuery('#jform_php_import').closest('.control-group').hide(); - if (!jform_vvvvvycvxr_required) + if (!jform_vvvvvydvxs_required) { updateFieldRequired('php_import',1); jQuery('#jform_php_import').removeAttr('required'); jQuery('#jform_php_import').removeAttr('aria-required'); jQuery('#jform_php_import').removeClass('required'); - jform_vvvvvycvxr_required = true; + jform_vvvvvydvxs_required = true; } jQuery('#jform_php_import_save').closest('.control-group').hide(); - if (!jform_vvvvvycvxs_required) + if (!jform_vvvvvydvxt_required) { updateFieldRequired('php_import_save',1); jQuery('#jform_php_import_save').removeAttr('required'); jQuery('#jform_php_import_save').removeAttr('aria-required'); jQuery('#jform_php_import_save').removeClass('required'); - jform_vvvvvycvxs_required = true; + jform_vvvvvydvxt_required = true; } jQuery('#jform_php_import_setdata').closest('.control-group').hide(); - if (!jform_vvvvvycvxt_required) + if (!jform_vvvvvydvxu_required) { updateFieldRequired('php_import_setdata',1); jQuery('#jform_php_import_setdata').removeAttr('required'); jQuery('#jform_php_import_setdata').removeAttr('aria-required'); jQuery('#jform_php_import_setdata').removeClass('required'); - jform_vvvvvycvxt_required = true; + jform_vvvvvydvxu_required = true; } } } -// the vvvvvyd function -function vvvvvyd(add_custom_import_vvvvvyd) +// the vvvvvye function +function vvvvvye(add_custom_import_vvvvvye) { // set the function logic - if (add_custom_import_vvvvvyd == 0) + if (add_custom_import_vvvvvye == 0) { jQuery('.note_beginner_import').closest('.control-group').show(); } @@ -1091,51 +1126,51 @@ function vvvvvyd(add_custom_import_vvvvvyd) } } -// the vvvvvye function -function vvvvvye(add_custom_button_vvvvvye) +// the vvvvvyf function +function vvvvvyf(add_custom_button_vvvvvyf) { // set the function logic - if (add_custom_button_vvvvvye == 1) + if (add_custom_button_vvvvvyf == 1) { jQuery('#jform_custom_button-lbl').closest('.control-group').show(); jQuery('#jform_php_controller-lbl').closest('.control-group').show(); - if (jform_vvvvvyevxu_required) + if (jform_vvvvvyfvxv_required) { updateFieldRequired('php_controller',0); jQuery('#jform_php_controller').prop('required','required'); jQuery('#jform_php_controller').attr('aria-required',true); jQuery('#jform_php_controller').addClass('required'); - jform_vvvvvyevxu_required = false; + jform_vvvvvyfvxv_required = false; } jQuery('#jform_php_controller_list-lbl').closest('.control-group').show(); - if (jform_vvvvvyevxv_required) + if (jform_vvvvvyfvxw_required) { updateFieldRequired('php_controller_list',0); jQuery('#jform_php_controller_list').prop('required','required'); jQuery('#jform_php_controller_list').attr('aria-required',true); jQuery('#jform_php_controller_list').addClass('required'); - jform_vvvvvyevxv_required = false; + jform_vvvvvyfvxw_required = false; } jQuery('#jform_php_model-lbl').closest('.control-group').show(); - if (jform_vvvvvyevxw_required) + if (jform_vvvvvyfvxx_required) { updateFieldRequired('php_model',0); jQuery('#jform_php_model').prop('required','required'); jQuery('#jform_php_model').attr('aria-required',true); jQuery('#jform_php_model').addClass('required'); - jform_vvvvvyevxw_required = false; + jform_vvvvvyfvxx_required = false; } jQuery('#jform_php_model_list-lbl').closest('.control-group').show(); - if (jform_vvvvvyevxx_required) + if (jform_vvvvvyfvxy_required) { updateFieldRequired('php_model_list',0); jQuery('#jform_php_model_list').prop('required','required'); jQuery('#jform_php_model_list').attr('aria-required',true); jQuery('#jform_php_model_list').addClass('required'); - jform_vvvvvyevxx_required = false; + jform_vvvvvyfvxy_required = false; } } @@ -1143,40 +1178,40 @@ function vvvvvye(add_custom_button_vvvvvye) { jQuery('#jform_custom_button-lbl').closest('.control-group').hide(); jQuery('#jform_php_controller-lbl').closest('.control-group').hide(); - if (!jform_vvvvvyevxu_required) + if (!jform_vvvvvyfvxv_required) { updateFieldRequired('php_controller',1); jQuery('#jform_php_controller').removeAttr('required'); jQuery('#jform_php_controller').removeAttr('aria-required'); jQuery('#jform_php_controller').removeClass('required'); - jform_vvvvvyevxu_required = true; + jform_vvvvvyfvxv_required = true; } jQuery('#jform_php_controller_list-lbl').closest('.control-group').hide(); - if (!jform_vvvvvyevxv_required) + if (!jform_vvvvvyfvxw_required) { updateFieldRequired('php_controller_list',1); jQuery('#jform_php_controller_list').removeAttr('required'); jQuery('#jform_php_controller_list').removeAttr('aria-required'); jQuery('#jform_php_controller_list').removeClass('required'); - jform_vvvvvyevxv_required = true; + jform_vvvvvyfvxw_required = true; } jQuery('#jform_php_model-lbl').closest('.control-group').hide(); - if (!jform_vvvvvyevxw_required) + if (!jform_vvvvvyfvxx_required) { updateFieldRequired('php_model',1); jQuery('#jform_php_model').removeAttr('required'); jQuery('#jform_php_model').removeAttr('aria-required'); jQuery('#jform_php_model').removeClass('required'); - jform_vvvvvyevxw_required = true; + jform_vvvvvyfvxx_required = true; } jQuery('#jform_php_model_list-lbl').closest('.control-group').hide(); - if (!jform_vvvvvyevxx_required) + if (!jform_vvvvvyfvxy_required) { updateFieldRequired('php_model_list',1); jQuery('#jform_php_model_list').removeAttr('required'); jQuery('#jform_php_model_list').removeAttr('aria-required'); jQuery('#jform_php_model_list').removeClass('required'); - jform_vvvvvyevxx_required = true; + jform_vvvvvyfvxy_required = true; } } } diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index 271ab8760..9412af4c2 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -144,25 +144,11 @@ message="COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_MESSAGE" hint="COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_HINT" /> - + - - - - - - @@ -200,61 +186,48 @@ - + - + type="radio" + name="add_php_getlistquery" + label="COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_GETLISTQUERY_LABEL" + class="btn-group btn-group-yesno" + default="0" + required="true"> + + + + + - + + + -