Skip to content

Commit

Permalink
JSession
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed Jun 29, 2018
1 parent db3253f commit 8d5fa34
Show file tree
Hide file tree
Showing 75 changed files with 223 additions and 149 deletions.
Expand Up @@ -14,6 +14,7 @@
use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;

/**
* Association edit controller class.
Expand Down Expand Up @@ -62,7 +63,7 @@ public function edit($key = null, $urlVar = null)
*/
public function cancel($key = null)
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

list($extensionName, $typeName) = explode('.', $this->input->get('itemtype', '', 'string'), 2);

Expand Down
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Supports a modal item picker.
Expand Down Expand Up @@ -53,7 +54,7 @@ protected function getInput()

$linkAssociations .= "&forcedLanguage=' + document.getElementById('target-association').getAttribute('data-language') + '";

$urlSelect = $linkAssociations . '&' . \JSession::getFormToken() . '=1';
$urlSelect = $linkAssociations . '&' . Session::getFormToken() . '=1';

// Select custom association button
$html[] = '<a'
Expand Down
Expand Up @@ -13,12 +13,13 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;

$app = JFactory::getApplication();

if ($app->isClient('site'))
{
JSession::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
Session::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
}

JHtml::_('jquery.framework');
Expand All @@ -42,7 +43,7 @@
JHtml::_('script', 'com_associations/admin-associations-modal.min.js', false, true);
?>
<form action="<?php echo Route::_('index.php?option=com_associations&view=associations&layout=modal&tmpl=component&function='
. $function . '&' . JSession::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">
. $function . '&' . Session::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">

<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="col-md-2">
Expand Down
Expand Up @@ -14,6 +14,7 @@
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;

/**
* Banner controller class.
Expand Down Expand Up @@ -101,7 +102,7 @@ protected function allowEdit($data = array(), $key = 'id')
*/
public function batch($model = null)
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Set the model
$model = $this->getModel('Banner', '', array());
Expand Down
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Banners list controller class.
Expand Down Expand Up @@ -74,7 +75,7 @@ public function getModel($name = 'Banner', $prefix = 'Administrator', $config =
public function sticky_publish()
{
// Check for request forgeries.
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$ids = $this->input->get('cid', array(), 'array');
$values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
Expand Down
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Tracks list controller class.
Expand Down Expand Up @@ -55,7 +56,7 @@ public function getModel($name = 'Tracks', $prefix = 'Administrator', $config =
public function delete()
{
// Check for request forgeries.
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Get the model.
/** @var \Joomla\Component\Banners\Administrator\Model\TracksModel $model */
Expand Down
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Expand All @@ -27,7 +28,7 @@

if ($saveOrder && !empty($this->items))
{
$saveOrderingUrl = 'index.php?option=com_banners&task=banners.saveOrderAjax&tmpl=component' . JSession::getFormToken() . '=1';
$saveOrderingUrl = 'index.php?option=com_banners&task=banners.saveOrderAjax&tmpl=component' . Session::getFormToken() . '=1';
JHtml::_('draggablelist.draggable');
}
?>
Expand Down
Expand Up @@ -13,7 +13,7 @@
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\Component\Cache\Administrator\Helper\CacheHelper;
use Joomla\CMS\Language\Text;

use Joomla\CMS\Session\Session;

/**
* Cache Controller
Expand Down Expand Up @@ -77,7 +77,7 @@ public function display($cachable = false, $urlparams = false)
public function delete()
{
// Check for request forgeries
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$cid = $this->input->post->get('cid', array(), 'array');

Expand Down Expand Up @@ -112,7 +112,7 @@ public function delete()
public function deleteAll()
{
// Check for request forgeries
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$app = $this->app;
$model = $this->getModel('cache');
Expand Down Expand Up @@ -153,7 +153,7 @@ public function deleteAll()
public function purge()
{
// Check for request forgeries
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

if (!$this->getModel('cache')->purge())
{
Expand Down
Expand Up @@ -14,6 +14,7 @@
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;

/**
* The Categories List Controller
Expand Down Expand Up @@ -47,7 +48,7 @@ public function getModel($name = 'Category', $prefix = 'Administrator', $config
*/
public function rebuild()
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$extension = $this->input->get('extension');
$this->setRedirect(Route::_('index.php?option=com_categories&view=categories&extension=' . $extension, false));
Expand Down Expand Up @@ -78,7 +79,7 @@ public function rebuild()
*/
public function delete()
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Get items to remove from the request.
$cid = $this->input->get('cid', array(), 'array');
Expand Down
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Registry\Registry;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* The Category Controller
Expand Down Expand Up @@ -123,7 +124,7 @@ protected function allowEdit($data = array(), $key = 'parent_id')
*/
public function batch($model = null)
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Set the model
/** @var \Joomla\Component\Categories\Administrator\Model\CategoryModel $model */
Expand Down
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Supports a modal category picker.
Expand Down Expand Up @@ -87,9 +88,9 @@ function jSelectCategory_" . $this->id . "(id, title, object) {
}

// Setup variables for display.
$linkCategories = 'index.php?option=com_categories&amp;view=categories&amp;layout=modal&amp;tmpl=component&amp;' . \JSession::getFormToken() . '=1'
$linkCategories = 'index.php?option=com_categories&amp;view=categories&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1'
. '&amp;extension=' . $extension;
$linkCategory = 'index.php?option=com_categories&amp;view=category&amp;layout=modal&amp;tmpl=component&amp;' . \JSession::getFormToken() . '=1'
$linkCategory = 'index.php?option=com_categories&amp;view=category&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1'
. '&amp;extension=' . $extension;
$modalTitle = Text::_('COM_CATEGORIES_CHANGE_CATEGORY');

Expand Down
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Expand Down Expand Up @@ -47,7 +48,7 @@

if ($saveOrder && !empty($this->items))
{
$saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component' . JSession::getFormToken() . '=1';
$saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component' . Session::getFormToken() . '=1';
JHtml::_('draggablelist.draggable');
}
?>
Expand Down
Expand Up @@ -13,12 +13,13 @@
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;

$app = JFactory::getApplication();

if ($app->isClient('site'))
{
JSession::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
Session::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
}

JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php');
Expand All @@ -36,7 +37,7 @@
?>
<div class="container-popup">

<form action="<?php echo Route::_('index.php?option=com_categories&view=categories&layout=modal&tmpl=component&function=' . $function . '&' . JSession::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo Route::_('index.php?option=com_categories&view=categories&layout=modal&tmpl=component&function=' . $function . '&' . Session::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">

<?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>

Expand Down
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Checkin Controller
Expand Down Expand Up @@ -52,7 +53,7 @@ public function display($cachable = false, $urlparams = array())
public function checkin()
{
// Check for request forgeries
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$ids = $this->input->get('cid', array(), 'array');

Expand Down
Expand Up @@ -68,7 +68,7 @@ public function cancel()
public function save()
{
// Check for request forgeries.
if (!\JSession::checkToken())
if (!Session::checkToken())
{
$this->setRedirect('index.php', Text::_('JINVALID_TOKEN'), 'error');
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public function save()
public function removeroot()
{
// Check for request forgeries.
if (!\JSession::checkToken('get'))
if (!Session::checkToken('get'))
{
$this->setRedirect('index.php', Text::_('JINVALID_TOKEN'), 'error');
}
Expand Down Expand Up @@ -249,7 +249,7 @@ public function store()
$this->app->sendHeaders();

// Check if user token is valid.
if (!\JSession::checkToken('get'))
if (!Session::checkToken('get'))
{
$this->app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error');
echo new JsonResponse;
Expand Down
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;

/**
* Note: this view is intended only to be opened in a popup
Expand Down Expand Up @@ -53,7 +54,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
public function save()
{
// Check for request forgeries.
if (!\JSession::checkToken())
if (!Session::checkToken())
{
$this->setRedirect(Route::_('index.php'), Text::_('JINVALID_TOKEN'), 'error');
}
Expand Down
Expand Up @@ -14,6 +14,7 @@
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;

/**
* Controller for a single contact
Expand Down Expand Up @@ -100,7 +101,7 @@ protected function allowEdit($data = array(), $key = 'id')
*/
public function batch($model = null)
{
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

// Set the model
/** @var \Joomla\Component\Contact\Administrator\Model\ContactModel $model */
Expand Down
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Contacts list controller class.
Expand Down Expand Up @@ -51,7 +52,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
public function featured()
{
// Check for request forgeries
\JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));

$ids = $this->input->get('cid', array(), 'array');
$values = array('featured' => 1, 'unfeatured' => 0);
Expand Down
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;

/**
* Supports a modal contact picker.
Expand Down Expand Up @@ -79,8 +80,8 @@ function jSelectContact_" . $this->id . "(id, title, object) {
}

// Setup variables for display.
$linkContacts = 'index.php?option=com_contact&amp;view=contacts&amp;layout=modal&amp;tmpl=component&amp;' . \JSession::getFormToken() . '=1';
$linkContact = 'index.php?option=com_contact&amp;view=contact&amp;layout=modal&amp;tmpl=component&amp;' . \JSession::getFormToken() . '=1';
$linkContacts = 'index.php?option=com_contact&amp;view=contacts&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1';
$linkContact = 'index.php?option=com_contact&amp;view=contact&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1';
$modalTitle = Text::_('COM_CONTACT_CHANGE_CONTACT');

if (isset($this->element['language']))
Expand Down
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Expand All @@ -28,7 +29,7 @@

if ($saveOrder && !empty($this->items))
{
$saveOrderingUrl = 'index.php?option=com_contact&task=contacts.saveOrderAjax&tmpl=component' . JSession::getFormToken() . '=1';
$saveOrderingUrl = 'index.php?option=com_contact&task=contacts.saveOrderAjax&tmpl=component' . Session::getFormToken() . '=1';
JHtml::_('draggablelist.draggable');
}
?>
Expand Down

0 comments on commit 8d5fa34

Please sign in to comment.