- md5
- c1bfb5243b4dd748f1626acd40117901
- sha1
- b1641ea57739a41b2e14ff1ccbd819e2c0862682
- sha256
- 02c6586eea1689aa397fdd67a6b675ff6bb5376b161f1c0331b1f7e688d8aaf9
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\Controller;
\defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
/**
* User profile controller class.
*
* @since 1.6
*/
class ProfileController extends FormController
{
/**
* Method to check if you can edit a record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = [], $key = 'id')
{
return isset($data['id']) && $data['id'] == $this->app->getIdentity()->id;
}
/**
* Overrides parent save method to check the submitted passwords match.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 3.2
*/
public function save($key = null, $urlVar = null)
{
$result = parent::save();
if ($this->getTask() !== 'apply')
{
$return = base64_decode($this->input->get('return', '', 'BASE64'));
if ($return !== '' && Uri::isInternal($return))
{
// Redirect to return URL.
$this->setRedirect(Route::_($return, false));
}
else
{
// Redirect to the main page.
$this->setRedirect(Route::_('index.php', false));
}
}
return $result;
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 1.6
*/
public function cancel($key = null)
{
$result = parent::cancel($key);
$return = base64_decode($this->input->get('return', '', 'BASE64'));
if ($return !== '' && Uri::isInternal($return))
{
// Redirect to return URL.
$this->setRedirect(Route::_($return, false));
}
else
{
// Redirect to the main page.
$this->setRedirect(Route::_('index.php', false));
}
return $result;
}
}
The same content is in 2 releases, Joomla 4.0.0-beta6 to 4.0.0-beta7. See them all, or every version of this file.