forked from joomla/Component-Builder
Added temp workaround for gh-238 to insure component behave correctly with cache enabled on website
This commit is contained in:
parent
45e1c33865
commit
0c243d75c8
@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
|
|||||||
+ *Version*: 2.6.17
|
+ *Version*: 2.6.17
|
||||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
+ *Line count*: **183530**
|
+ *Line count*: **183567**
|
||||||
+ *Field count*: **1645**
|
+ *Field count*: **1645**
|
||||||
+ *File count*: **1169**
|
+ *File count*: **1169**
|
||||||
+ *Folder count*: **189**
|
+ *Folder count*: **189**
|
||||||
|
@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
|
|||||||
+ *Version*: 2.6.17
|
+ *Version*: 2.6.17
|
||||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
+ *Line count*: **183530**
|
+ *Line count*: **183567**
|
||||||
+ *Field count*: **1645**
|
+ *Field count*: **1645**
|
||||||
+ *File count*: **1169**
|
+ *File count*: **1169**
|
||||||
+ *Folder count*: **189**
|
+ *Folder count*: **189**
|
||||||
|
@ -38,18 +38,30 @@ jimport('joomla.application.component.controller');
|
|||||||
class ###Component###Controller extends JControllerLegacy
|
class ###Component###Controller extends JControllerLegacy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* display task
|
* Method to display a view.
|
||||||
|
*
|
||||||
|
* @param boolean $cachable If true, the view output will be cached.
|
||||||
|
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||||
|
*
|
||||||
|
* @return JController This object to support chaining.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function display($cachable = false, $urlparams = false)
|
function display($cachable = false, $urlparams = false)
|
||||||
{
|
{
|
||||||
// set default view if not set
|
// set default view if not set
|
||||||
$view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###');
|
$view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###');
|
||||||
|
$this->input->set('view', $view);
|
||||||
$isEdit = $this->checkEditView($view);
|
$isEdit = $this->checkEditView($view);
|
||||||
$layout = $this->input->get('layout', null, 'WORD');
|
$layout = $this->input->get('layout', null, 'WORD');
|
||||||
$id = $this->input->getInt('id');
|
$id = $this->input->getInt('id');
|
||||||
$cachable = true;
|
// $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
|
||||||
|
|
||||||
|
// insure that the view is not cashable if edit view or if user is logged in
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->get('id') || $isEdit)
|
||||||
|
{
|
||||||
|
$cachable = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for edit form.
|
// Check for edit form.
|
||||||
if($isEdit)
|
if($isEdit)
|
||||||
@ -82,7 +94,32 @@ class ###Component###Controller extends JControllerLegacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::display($cachable, $urlparams);
|
// we may need to make this more dynamic in the future. (TODO)
|
||||||
|
$safeurlparams = array(
|
||||||
|
'catid' => 'INT',
|
||||||
|
'id' => 'INT',
|
||||||
|
'cid' => 'ARRAY',
|
||||||
|
'year' => 'INT',
|
||||||
|
'month' => 'INT',
|
||||||
|
'limit' => 'UINT',
|
||||||
|
'limitstart' => 'UINT',
|
||||||
|
'showall' => 'INT',
|
||||||
|
'return' => 'BASE64',
|
||||||
|
'filter' => 'STRING',
|
||||||
|
'filter_order' => 'CMD',
|
||||||
|
'filter_order_Dir' => 'CMD',
|
||||||
|
'filter-search' => 'STRING',
|
||||||
|
'print' => 'BOOLEAN',
|
||||||
|
'lang' => 'CMD',
|
||||||
|
'Itemid' => 'INT');
|
||||||
|
|
||||||
|
// should these not merge?
|
||||||
|
if (###Component###Helper::checkArray($urlparams))
|
||||||
|
{
|
||||||
|
$safeurlparams = ###Component###Helper::mergeArrays(array($urlparams, $safeurlparams));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::display($cachable, $safeurlparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkEditView($view)
|
protected function checkEditView($view)
|
||||||
|
@ -35,18 +35,30 @@ jimport('joomla.application.component.controller');
|
|||||||
class ComponentbuilderController extends JControllerLegacy
|
class ComponentbuilderController extends JControllerLegacy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* display task
|
* Method to display a view.
|
||||||
|
*
|
||||||
|
* @param boolean $cachable If true, the view output will be cached.
|
||||||
|
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||||
|
*
|
||||||
|
* @return JController This object to support chaining.
|
||||||
*
|
*
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function display($cachable = false, $urlparams = false)
|
function display($cachable = false, $urlparams = false)
|
||||||
{
|
{
|
||||||
// set default view if not set
|
// set default view if not set
|
||||||
$view = $this->input->getCmd('view', '');
|
$view = $this->input->getCmd('view', '');
|
||||||
|
$this->input->set('view', $view);
|
||||||
$isEdit = $this->checkEditView($view);
|
$isEdit = $this->checkEditView($view);
|
||||||
$layout = $this->input->get('layout', null, 'WORD');
|
$layout = $this->input->get('layout', null, 'WORD');
|
||||||
$id = $this->input->getInt('id');
|
$id = $this->input->getInt('id');
|
||||||
$cachable = true;
|
// $cachable = true; (TODO) working on a fix [gh-238](https://github.com/vdm-io/Joomla-Component-Builder/issues/238)
|
||||||
|
|
||||||
|
// insure that the view is not cashable if edit view or if user is logged in
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
if ($user->get('id') || $isEdit)
|
||||||
|
{
|
||||||
|
$cachable = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for edit form.
|
// Check for edit form.
|
||||||
if($isEdit)
|
if($isEdit)
|
||||||
@ -79,7 +91,32 @@ class ComponentbuilderController extends JControllerLegacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::display($cachable, $urlparams);
|
// we may need to make this more dynamic in the future. (TODO)
|
||||||
|
$safeurlparams = array(
|
||||||
|
'catid' => 'INT',
|
||||||
|
'id' => 'INT',
|
||||||
|
'cid' => 'ARRAY',
|
||||||
|
'year' => 'INT',
|
||||||
|
'month' => 'INT',
|
||||||
|
'limit' => 'UINT',
|
||||||
|
'limitstart' => 'UINT',
|
||||||
|
'showall' => 'INT',
|
||||||
|
'return' => 'BASE64',
|
||||||
|
'filter' => 'STRING',
|
||||||
|
'filter_order' => 'CMD',
|
||||||
|
'filter_order_Dir' => 'CMD',
|
||||||
|
'filter-search' => 'STRING',
|
||||||
|
'print' => 'BOOLEAN',
|
||||||
|
'lang' => 'CMD',
|
||||||
|
'Itemid' => 'INT');
|
||||||
|
|
||||||
|
// should these not merge?
|
||||||
|
if (ComponentbuilderHelper::checkArray($urlparams))
|
||||||
|
{
|
||||||
|
$safeurlparams = ComponentbuilderHelper::mergeArrays(array($urlparams, $safeurlparams));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::display($cachable, $safeurlparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkEditView($view)
|
protected function checkEditView($view)
|
||||||
|
Loading…
Reference in New Issue
Block a user