Fixed the compiler to allow edit views be build even if no other site views are set. Removed all the depreciated joomla jimport statments. Update the getModel method in the controller. Updated the getRedirectToItemAppend, cancel and save method in the controller to also use the return value if internal. Added the addTablePath to the getTable method in the model to insure table is found when called from outside the in another component. Updated the diplay method in the JViewLagacy class to also use the return value if not null. Updated the component core to use JAccessExceptionNotallowed instead of JError::raiseWaring when user not have access to core.

This commit is contained in:
Llewellyn van der Merwe 2018-08-07 14:25:26 +02:00
parent f5c6fa899d
commit 78208d1525
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
568 changed files with 4230 additions and 3609 deletions

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 2nd August, 2018 + *Last Build*: 7th August, 2018
+ *Version*: 2.8.5 + *Version*: 2.8.5
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **186364** + *Line count*: **187020**
+ *Field count*: **1059** + *Field count*: **1059**
+ *File count*: **1239** + *File count*: **1239**
+ *Folder count*: **197** + *Folder count*: **197**

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 2nd August, 2018 + *Last Build*: 7th August, 2018
+ *Version*: 2.8.5 + *Version*: 2.8.5
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **186364** + *Line count*: **187020**
+ *Field count*: **1059** + *Field count*: **1059**
+ *File count*: **1239** + *File count*: **1239**
+ *Folder count*: **197** + *Folder count*: **197**

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* ###Component### Controller * ###Component### Controller
*/ */

View File

@ -29,10 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
jimport('joomla.application.component.helper');
/** /**
* ###Component### Model * ###Component### Model
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###Component### View class * ###Component### View class
*/ */

View File

@ -319,7 +319,7 @@ abstract class ###Component###Email
$body[] = "<head>"; $body[] = "<head>";
$body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; $body[] = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
$body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>"; $body[] = "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>";
$body[] = "<title>".$subject."</title>"; $body[] = "<title>" . $subject . "</title>";
$body[] = "<style type=\"text/css\">"; $body[] = "<style type=\"text/css\">";
$body[] = "#outlook a {padding:0;}"; $body[] = "#outlook a {padding:0;}";
$body[] = ".ExternalClass {width:100%;}"; $body[] = ".ExternalClass {width:100%;}";

View File

@ -29,23 +29,32 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* ###Views### Controller * ###Views### Controller
*/ */
class ###Component###Controller###Views### extends JControllerAdmin class ###Component###Controller###Views### extends JControllerAdmin
{ {
protected $text_prefix = 'COM_###COMPONENT###_###VIEWS###';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = '###View###', $prefix = '###Component###Model', $config = array()) protected $text_prefix = 'COM_###COMPONENT###_###VIEWS###';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = '###View###', $prefix = '###Component###Model', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### ###ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST### }###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### ###ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST###
} }

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* ###SViews### Controller * ###SViews### Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* ###View### Controller * ###View### Controller
*/ */
@ -46,6 +43,13 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = '###Views###'; // safeguard for setting the return view listing to the main view. $this->view_list = '###Views###'; // safeguard for setting the return view listing to the main view.
@ -87,42 +91,25 @@ class ###Component###Controller###View### extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -161,17 +148,31 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -216,11 +217,15 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -228,27 +233,43 @@ class ###Component###Controller###View### extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### ###SView### Controller * ###Component### ###SView### Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* ###View### Controller * ###View### Controller
*/ */
@ -46,6 +43,13 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = '###SITE_DEFAULT_VIEW###'; // safeguard for setting the return view listing to the default site view. $this->view_list = '###SITE_DEFAULT_VIEW###'; // safeguard for setting the return view listing to the default site view.
@ -87,42 +91,25 @@ class ###Component###Controller###View### extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = ''; {
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
if ($refid)
{
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -161,17 +148,31 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -182,7 +183,7 @@ class ###Component###Controller###View### extends JControllerForm
} }
elseif ($this->ref) elseif ($this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen. // Redirect to the list screen.
$this->setRedirect( $this->setRedirect(
@ -216,11 +217,15 @@ class ###Component###Controller###View### extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -228,27 +233,43 @@ class ###Component###Controller###View### extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/** /**
* General Controller of ###Component### component * General Controller of ###Component### component
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Ajax Controller * ###Component### Ajax Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Ajax Controller * ###Component### Ajax Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Help Controller * ###Component### Help Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Help Controller * ###Component### Help Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Component Controller * ###Component### Component Controller
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### ###SView### Controller * ###Component### ###SView### Controller
*/ */

View File

@ -31,9 +31,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model
*/ */
@ -66,6 +63,9 @@ class ###Component###Model###View### extends JModelAdmin
*/ */
public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array()) public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array())
{ {
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_###component###/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
}###ADMIN_CUSTOM_BUTTONS_METHOD### }###ADMIN_CUSTOM_BUTTONS_METHOD###

View File

@ -31,9 +31,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/** /**
* ###Component### ###View### Model * ###Component### ###View### Model
*/ */
@ -66,6 +63,9 @@ class ###Component###Model###View### extends JModelAdmin
*/ */
public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array()) public function getTable($type = '###view###', $prefix = '###Component###Table', $config = array())
{ {
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_###component###/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
}###ADMIN_CUSTOM_BUTTONS_METHOD### }###ADMIN_CUSTOM_BUTTONS_METHOD###

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla modelitem library
jimport('joomla.application.component.modelitem');
/** /**
* ###Component### ###SView### Model * ###Component### ###SView### Model
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla modelitem library
jimport('joomla.application.component.modelitem');
/** /**
* ###Component### ###SView### Model * ###Component### ###SView### Model
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/** /**
* ###Views### Model * ###Views### Model
*/ */

View File

@ -29,8 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper');
/** /**
* ###Component### Ajax Model * ###Component### Ajax Model
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/** /**
* ###Component### Model for ###SViews### * ###Component### Model for ###SViews###
*/ */

View File

@ -31,9 +31,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla table library
jimport('joomla.database.table');
/** /**
* ###Views### Table class * ###Views### Table class
*/ */

View File

@ -27,10 +27,7 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
// import Joomla view library
jimport('joomla.application.component.view');###CUSTOM_ADMIN_GET_MODULE_JIMPORT###
/** /**
* ###Component### View class for the ###SView### * ###Component### View class for the ###SView###

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###View### View class * ###View### View class
*/ */
@ -54,16 +51,24 @@ class ###Component###View###View### extends JViewLegacy
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = ''; $this->referral = '';
if ($this->refid) if ($this->refid && $this->ref)
{ {
// return to the item that refered to this item // return to the item that referred to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that refered to this item // return to the list view that referred to this item
$this->referral = '&ref='.(string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}###LINKEDVIEWITEMS### }###LINKEDVIEWITEMS###
// Set the toolbar // Set the toolbar

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###View### View class * ###View### View class
*/ */
@ -44,26 +41,34 @@ class ###Component###View###View### extends JViewLegacy
public function display($tpl = null) public function display($tpl = null)
{ {
// Assign the variables // Assign the variables
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->script = $this->get('Script'); $this->script = $this->get('Script');
$this->state = $this->get('State'); $this->state = $this->get('State');
// get action permissions // get action permissions
$this->canDo = ###Component###Helper::getActions('###view###',$this->item); $this->canDo = ###Component###Helper::getActions('###view###',$this->item);
// get input // get input
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$this->referral = ''; $return = $jinput->get('return', null, 'base64');
if ($this->refid) // set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{ {
// return to the item that refered to this item // return to the item that referred to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that refered to this item // return to the list view that referred to this item
$this->referral = '&ref='.(string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
}###LINKEDVIEWITEMS### }###LINKEDVIEWITEMS###
// Set the toolbar // Set the toolbar

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###Component### Import View * ###Component### Import View
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###Component### ###View### View * ###Component### ###View### View
*/ */

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* ###Component### View class for the ###Views### * ###Component### View class for the ###Views###
*/ */

View File

@ -27,10 +27,7 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_GET_MODULE_JIMPORT###
// import Joomla view library
jimport('joomla.application.component.view');###CUSTOM_ADMIN_GET_MODULE_JIMPORT###
/** /**
* ###Component### View class for the ###SViews### * ###Component### View class for the ###SViews###

View File

@ -27,10 +27,7 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT###
// import Joomla view library
jimport('joomla.application.component.view');###SITE_GET_MODULE_JIMPORT###
/** /**
* ###Component### View class for the ###SViews### * ###Component### View class for the ###SViews###

View File

@ -27,10 +27,7 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_GET_MODULE_JIMPORT###
// import Joomla view library
jimport('joomla.application.component.view');###SITE_GET_MODULE_JIMPORT###
/** /**
* ###Component### View class for the ###SView### * ###Component### View class for the ###SView###

View File

@ -29,9 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* ###Component### Ajax Controller * ###Component### Ajax Controller
*/ */
@ -47,14 +44,14 @@ class ###Component###ControllerAjax extends JControllerLegacy
// load the tasks // load the tasks
$this->registerTask('fieldRequired', 'ajax'); $this->registerTask('fieldRequired', 'ajax');
} }
public function ajax() public function ajax()
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// Check Token! // Check Token!
$token = JSession::getFormToken(); $token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM'); $call_token = $jinput->get('token', 0, 'ALNUM');
if($user->id != 0 && $token == $call_token) if($user->id != 0 && $token == $call_token)
{ {
$task = $this->getTask(); $task = $this->getTask();

View File

@ -29,29 +29,26 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper');
/** /**
* ###Component### Ajax Model * ###Component### Ajax Model
*/ */
class ###Component###ModelAjax extends JModelList class ###Component###ModelAjax extends JModelList
{ {
protected $app_params; protected $app_params;
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
// get params // get params
$this->app_params = JComponentHelper::getParams('com_###component###'); $this->app_params = JComponentHelper::getParams('com_###component###');
} }
public function setFieldRequired($name,$form,$status) public function setFieldRequired($name,$form,$status)
{ {
// get the session // get the session
$session = JFactory::getSession(); $session = JFactory::getSession();
// get this forms set fields // get this forms set fields
$fields = $session->get($form.'_requiredFieldFix'); $fields = $session->get($form.'_requiredFieldFix');
if(###Component###Helper::checkArray($fields)) if(###Component###Helper::checkArray($fields))
{ {
if ($status == 1) if ($status == 1)
@ -62,7 +59,8 @@ class ###Component###ModelAjax extends JModelList
else else
{ {
// remove from array // remove from array
if(($key = array_search($name, $fields)) !== false) { if(($key = array_search($name, $fields)) !== false)
{
unset($fields[$key]); unset($fields[$key]);
} }
} }

View File

@ -30,8 +30,8 @@ defined('_JEXEC') or die('Restricted access');
defined('JPATH_BASE') or die; defined('JPATH_BASE') or die;
JHtmlBehavior::core(); JHtmlBehavior::core();
$divWrapper = range(1,120,2); $divWrapper = range(1,120,2);
$counter = 0; $counter = 0;
?> ?>
<?php if ($displayData->ListSelection) : ?> <?php if ($displayData->ListSelection) : ?>
<div class="row-fluid"> <div class="row-fluid">

View File

@ -28,29 +28,22 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check. // Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_###component###')) if (!JFactory::getUser()->authorise('core.manage', 'com_###component###'))
{ {
return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR')); throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}; };
// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// Add CSS file for all pages // Add CSS file for all pages
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addStyleSheet('components/com_###component###/assets/css/admin.css'); $document->addStyleSheet('components/com_###component###/assets/css/admin.css');
$document->addScript('components/com_###component###/assets/js/admin.js'); $document->addScript('components/com_###component###/assets/js/admin.js');
// require helper files // require helper files
JLoader::register('###Component###Helper', dirname(__FILE__) . '/helpers/###component###.php'); ###HELPER_EMAIL### JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php'); ###HELPER_EMAIL###
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');###LICENSE_LOCKED_INT### ###ADMIN_GLOBAL_EVENT### JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');###LICENSE_LOCKED_INT### ###ADMIN_GLOBAL_EVENT###
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by ###Component### // Get an instance of the controller prefixed by ###Component###
$controller = JControllerLegacy::getInstance('###Component###'); $controller = JControllerLegacy::getInstance('###Component###');

View File

@ -28,6 +28,7 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Set the component css/js // Set the component css/js
$document = JFactory::getDocument(); $document = JFactory::getDocument();
@ -35,18 +36,14 @@ $document->addStyleSheet('components/com_###component###/assets/css/site.css');
$document->addScript('components/com_###component###/assets/js/site.js'); $document->addScript('components/com_###component###/assets/js/site.js');
// Require helper files // Require helper files
JLoader::register('###Component###Helper', dirname(__FILE__) . '/helpers/###component###.php'); ###HELPER_EMAIL### JLoader::register('###Component###Helper', __DIR__ . '/helpers/###component###.php'); ###HELPER_EMAIL###
JLoader::register('###Component###HelperRoute', dirname(__FILE__) . '/helpers/route.php');###LICENSE_LOCKED_INT### ###SITE_GLOBAL_EVENT### JLoader::register('###Component###HelperRoute', __DIR__ . '/helpers/route.php');###LICENSE_LOCKED_INT### ###SITE_GLOBAL_EVENT###
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by ###Component### // Get an instance of the controller prefixed by ###Component###
$controller = JControllerLegacy::getInstance('###Component###'); $controller = JControllerLegacy::getInstance('###Component###');
// Perform the request task // Perform the request task
$jinput = JFactory::getApplication()->input; $controller->execute(JFactory::getApplication()->input->get('task'));
$controller->execute($jinput->get('task', null, 'CMD'));
// Redirect if set by the controller // Redirect if set by the controller
$controller->redirect(); $controller->redirect();

View File

@ -37,7 +37,7 @@ JHtml::_('behavior.keepalive');
$componentParams = JComponentHelper::getParams('com_###component###'); $componentParams = JComponentHelper::getParams('com_###component###');
?> ?>
###EDITBODYFADEIN### ###EDITBODYFADEIN###
<form action="<?php echo JRoute::_('index.php?option=com_###component###&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_###component###&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
###EDITBODY### ###EDITBODY###
</form> </form>
</div>###EDITBODYSCRIPT### </div>###EDITBODYSCRIPT###

View File

@ -39,6 +39,6 @@ JHtml::_('behavior.calendar');
$componentParams = JComponentHelper::getParams('com_###component###'); $componentParams = JComponentHelper::getParams('com_###component###');
?> ?>
<?php echo $this->toolbar->render(); ?> <?php echo $this->toolbar->render(); ?>
<form action="<?php echo JRoute::_('index.php?option=com_###component###&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_###component###&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
###EDITBODY### ###EDITBODY###
</form>###EDITBODYSCRIPT### </form>###EDITBODYSCRIPT###

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication(); $app = JFactory::getApplication();

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('JPATH_BASE') or die('Restricted access');###CUSTOM_ADMIN_LAYOUT_CODE### defined('JPATH_BASE') or die('Restricted access');###CUSTOM_ADMIN_LAYOUT_CODE###
?>###CUSTOM_ADMIN_LAYOUT_BODY### ?>###CUSTOM_ADMIN_LAYOUT_BODY###

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('JPATH_BASE') or die('Restricted access');###SITE_LAYOUT_CODE### defined('JPATH_BASE') or die('Restricted access');###SITE_LAYOUT_CODE###
?>###SITE_LAYOUT_BODY### ?>###SITE_LAYOUT_BODY###

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// set the defaults // set the defaults

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication(); $app = JFactory::getApplication();

View File

@ -27,7 +27,6 @@ defined('_JEXEC') or die('Restricted access');
###BOM### ###BOM###
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -29,10 +29,6 @@ defined('_JEXEC') or die('Restricted access');
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// Component Helper
jimport('joomla.application.component.helper');
jimport('joomla.application.categories');
/** /**
* ###Component### Route Helper * ###Component### Route Helper
**/ **/

View File

@ -30,8 +30,6 @@ defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal'); JHTML::_('behavior.modal');
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
/** /**
* Script File of ###Component### Component * Script File of ###Component### Component

View File

@ -11,34 +11,27 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check. // Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_componentbuilder')) if (!JFactory::getUser()->authorise('core.manage', 'com_componentbuilder'))
{ {
return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR')); throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}; };
// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// Add CSS file for all pages // Add CSS file for all pages
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addStyleSheet('components/com_componentbuilder/assets/css/admin.css'); $document->addStyleSheet('components/com_componentbuilder/assets/css/admin.css');
$document->addScript('components/com_componentbuilder/assets/js/admin.js'); $document->addScript('components/com_componentbuilder/assets/js/admin.js');
// require helper files // require helper files
JLoader::register('ComponentbuilderHelper', dirname(__FILE__) . '/helpers/componentbuilder.php'); JLoader::register('ComponentbuilderHelper', __DIR__ . '/helpers/componentbuilder.php');
JLoader::register('ComponentbuilderEmail', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/componentbuilderemail.php'); JLoader::register('ComponentbuilderEmail', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/componentbuilderemail.php');
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Triger the Global Admin Event // Triger the Global Admin Event
ComponentbuilderHelper::globalEvent($document); ComponentbuilderHelper::globalEvent($document);
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Componentbuilder // Get an instance of the controller prefixed by Componentbuilder
$controller = JControllerLegacy::getInstance('Componentbuilder'); $controller = JControllerLegacy::getInstance('Componentbuilder');

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/** /**
* General Controller of Componentbuilder component * General Controller of Componentbuilder component
*/ */

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Admin_fields Controller * Admin_fields Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Admins_fields'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Admins_fields'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerAdmin_fields extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Admin_fields_conditions Controller * Admin_fields_conditions Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Admins_fields_conditions'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Admins_fields_conditions'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerAdmin_fields_conditions extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Admin_fields_relations Controller * Admin_fields_relations Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Admins_fields_relations'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Admins_fields_relations'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerAdmin_fields_relations extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Admin_view Controller * Admin_view Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Admin_views'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Admin_views'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerAdmin_view extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Admin_views Controller * Admin_views Controller
*/ */
class ComponentbuilderControllerAdmin_views extends JControllerAdmin class ComponentbuilderControllerAdmin_views extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_ADMIN_VIEWS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Admin_view', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_ADMIN_VIEWS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Admin_view', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Admins_fields Controller * Admins_fields Controller
*/ */
class ComponentbuilderControllerAdmins_fields extends JControllerAdmin class ComponentbuilderControllerAdmins_fields extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Admin_fields', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Admin_fields', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Admins_fields_conditions Controller * Admins_fields_conditions Controller
*/ */
class ComponentbuilderControllerAdmins_fields_conditions extends JControllerAdmin class ComponentbuilderControllerAdmins_fields_conditions extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Admin_fields_conditions', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Admin_fields_conditions', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Admins_fields_relations Controller * Admins_fields_relations Controller
*/ */
class ComponentbuilderControllerAdmins_fields_relations extends JControllerAdmin class ComponentbuilderControllerAdmins_fields_relations extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Admin_fields_relations', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Admin_fields_relations', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Componentbuilder Ajax Controller * Componentbuilder Ajax Controller
*/ */

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Compiler Controller * Compiler Controller
*/ */

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_admin_views Controller * Component_admin_views Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_admin_views'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_admin_views'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_admin_views extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_config Controller * Component_config Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_config extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_config'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_config'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_config extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_config extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_config extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_config extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_custom_admin_menus Controller * Component_custom_admin_menus Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_custom_admin_menus'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_custom_admin_menus'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_custom_admin_menus extends JController
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_custom_admin_views Controller * Component_custom_admin_views Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_custom_admin_views'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_custom_admin_views'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_custom_admin_views extends JController
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_dashboard Controller * Component_dashboard Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_dashboard'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_dashboard'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_dashboard extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_files_folders Controller * Component_files_folders Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_files_folders'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_files_folders'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_files_folders extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_mysql_tweaks Controller * Component_mysql_tweaks Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_mysql_tweaks'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_mysql_tweaks'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_mysql_tweaks extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_site_views Controller * Component_site_views Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_site_views'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_site_views'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_site_views extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Component_updates Controller * Component_updates Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Components_updates'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Components_updates'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerComponent_updates extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Componentbuilder Controller * Componentbuilder Controller
*/ */

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_admin_views Controller * Components_admin_views Controller
*/ */
class ComponentbuilderControllerComponents_admin_views extends JControllerAdmin class ComponentbuilderControllerComponents_admin_views extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_admin_views', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_admin_views', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_config Controller * Components_config Controller
*/ */
class ComponentbuilderControllerComponents_config extends JControllerAdmin class ComponentbuilderControllerComponents_config extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CONFIG';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_config', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CONFIG';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_config', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_custom_admin_menus Controller * Components_custom_admin_menus Controller
*/ */
class ComponentbuilderControllerComponents_custom_admin_menus extends JControllerAdmin class ComponentbuilderControllerComponents_custom_admin_menus extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_custom_admin_menus', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_custom_admin_menus', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_custom_admin_views Controller * Components_custom_admin_views Controller
*/ */
class ComponentbuilderControllerComponents_custom_admin_views extends JControllerAdmin class ComponentbuilderControllerComponents_custom_admin_views extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_custom_admin_views', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_custom_admin_views', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_dashboard Controller * Components_dashboard Controller
*/ */
class ComponentbuilderControllerComponents_dashboard extends JControllerAdmin class ComponentbuilderControllerComponents_dashboard extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_dashboard', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_dashboard', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_files_folders Controller * Components_files_folders Controller
*/ */
class ComponentbuilderControllerComponents_files_folders extends JControllerAdmin class ComponentbuilderControllerComponents_files_folders extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_files_folders', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_files_folders', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_mysql_tweaks Controller * Components_mysql_tweaks Controller
*/ */
class ComponentbuilderControllerComponents_mysql_tweaks extends JControllerAdmin class ComponentbuilderControllerComponents_mysql_tweaks extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_mysql_tweaks', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_mysql_tweaks', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_site_views Controller * Components_site_views Controller
*/ */
class ComponentbuilderControllerComponents_site_views extends JControllerAdmin class ComponentbuilderControllerComponents_site_views extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_site_views', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_site_views', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,23 +12,32 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Components_updates Controller * Components_updates Controller
*/ */
class ComponentbuilderControllerComponents_updates extends JControllerAdmin class ComponentbuilderControllerComponents_updates extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_UPDATES';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Component_updates', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS_UPDATES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Component_updates', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
} }

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Custom_admin_view Controller * Custom_admin_view Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Custom_admin_views'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Custom_admin_views'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerCustom_admin_view extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Custom_admin_views Controller * Custom_admin_views Controller
*/ */
class ComponentbuilderControllerCustom_admin_views extends JControllerAdmin class ComponentbuilderControllerCustom_admin_views extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Custom_admin_view', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Custom_admin_view', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Custom_code Controller * Custom_code Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerCustom_code extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Custom_codes'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Custom_codes'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerCustom_code extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerCustom_code extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerCustom_code extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerCustom_code extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Custom_codes Controller * Custom_codes Controller
*/ */
class ComponentbuilderControllerCustom_codes extends JControllerAdmin class ComponentbuilderControllerCustom_codes extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_CUSTOM_CODES';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Custom_code', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_CUSTOM_CODES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Custom_code', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Dynamic_get Controller * Dynamic_get Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Dynamic_gets'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Dynamic_gets'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerDynamic_get extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Dynamic_gets Controller * Dynamic_gets Controller
*/ */
class ComponentbuilderControllerDynamic_gets extends JControllerAdmin class ComponentbuilderControllerDynamic_gets extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_DYNAMIC_GETS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Dynamic_get', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_DYNAMIC_GETS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Dynamic_get', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Field Controller * Field Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerField extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Fields'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Fields'; // safeguard for setting the return view listing to the main view.
@ -126,42 +130,25 @@ class ComponentbuilderControllerField extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -200,17 +187,31 @@ class ComponentbuilderControllerField extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -255,11 +256,15 @@ class ComponentbuilderControllerField extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -267,27 +272,43 @@ class ComponentbuilderControllerField extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Fields Controller * Fields Controller
*/ */
class ComponentbuilderControllerFields extends JControllerAdmin class ComponentbuilderControllerFields extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_FIELDS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Field', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_FIELDS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Field', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Fieldtype Controller * Fieldtype Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Fieldtypes'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Fieldtypes'; // safeguard for setting the return view listing to the main view.
@ -126,42 +130,25 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -200,17 +187,31 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -255,11 +256,15 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -267,27 +272,43 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Fieldtypes Controller * Fieldtypes Controller
*/ */
class ComponentbuilderControllerFieldtypes extends JControllerAdmin class ComponentbuilderControllerFieldtypes extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_FIELDTYPES';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Fieldtype', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_FIELDTYPES';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Fieldtype', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Get_snippets Controller * Get_snippets Controller
*/ */

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Componentbuilder Help Controller * Componentbuilder Help Controller
*/ */

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Help_document Controller * Help_document Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerHelp_document extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view.
@ -127,42 +131,25 @@ class ComponentbuilderControllerHelp_document extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -201,17 +188,31 @@ class ComponentbuilderControllerHelp_document extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -256,11 +257,15 @@ class ComponentbuilderControllerHelp_document extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -268,27 +273,43 @@ class ComponentbuilderControllerHelp_document extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

View File

@ -12,24 +12,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Help_documents Controller * Help_documents Controller
*/ */
class ComponentbuilderControllerHelp_documents extends JControllerAdmin class ComponentbuilderControllerHelp_documents extends JControllerAdmin
{ {
protected $text_prefix = 'COM_COMPONENTBUILDER_HELP_DOCUMENTS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Help_document', $prefix = 'ComponentbuilderModel', $config = array()) protected $text_prefix = 'COM_COMPONENTBUILDER_HELP_DOCUMENTS';
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Help_document', $prefix = 'ComponentbuilderModel', $config = array('ignore_request' => true))
{ {
$model = parent::getModel($name, $prefix, array('ignore_request' => true)); return parent::getModel($name, $prefix, $config);
return $model;
} }
public function exportData() public function exportData()

View File

@ -12,9 +12,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Joomla_component Controller * Joomla_component Controller
*/ */
@ -29,6 +26,13 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view.
@ -152,42 +156,25 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
$ref = $this->input->get('ref', 0, 'string'); // get redirect info.
$refid = $this->input->get('refid', 0, 'int'); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
// Setup redirect info. // set the referral options
if ($refid && $ref)
$append = '';
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -226,17 +213,31 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if ($cancel)
{ {
if ($this->refid) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $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. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -281,11 +282,15 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -293,27 +298,43 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) if ($saved)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; // 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 to the item screen. // Redirect to the return value.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false $redirect, false
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the list screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
JRoute::_( JRoute::_(
'index.php?option=' . $this->option . $redirect, false '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
)
);
}
} }
return $saved; return $saved;
} }

Some files were not shown because too many files have changed in this diff Show More