Skip to content

Commit

Permalink
JUser JUserHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed Jun 29, 2018
1 parent 8d5fa34 commit 25f2037
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Expand Up @@ -20,6 +20,7 @@
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\User\UserHelper;

/**
* Model for the global configuration
Expand Down Expand Up @@ -313,7 +314,7 @@ public function save($data)
if ($data['shared_session'] == 1 && $currentShared == 0)
{
// Generate a random shared session name
$data['session_name'] = \JUserHelper::genRandomPassword(16);
$data['session_name'] = UserHelper::genRandomPassword(16);
}

// Has the user disabled shared sessions?
Expand All @@ -333,7 +334,7 @@ public function save($data)
if ($data['shared_session'] == 1 && $currentShared == 0)
{
// Generate a random shared session name
$data['session_name'] = \JUserHelper::genRandomPassword(16);
$data['session_name'] = UserHelper::genRandomPassword(16);
}

// Has the user disabled shared sessions?
Expand Down
Expand Up @@ -16,6 +16,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Language\Text;
use Joomla\CMS\User\UserHelper;

jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
Expand Down Expand Up @@ -397,7 +398,7 @@ protected function downloadPackage($url, $target)
public function createRestorationFile($basename = null)
{
// Get a password
$password = \JUserHelper::genRandomPassword(32);
$password = UserHelper::genRandomPassword(32);
$app = \JFactory::getApplication();
$app->setUserState('com_joomlaupdate.password', $password);

Expand Down
7 changes: 4 additions & 3 deletions administrator/components/com_messages/Model/MessageModel.php
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Log\Log;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Language\Text;
use Joomla\CMS\User\User;

/**
* Private Message model.
Expand Down Expand Up @@ -172,7 +173,7 @@ public function getItem($pk = null)
}

// Get the user name for an existing messasge.
if ($this->item->user_id_from && $fromUser = new \JUser($this->item->user_id_from))
if ($this->item->user_id_from && $fromUser = new User($this->item->user_id_from))
{
$this->item->set('from_user_name', $fromUser->name);
}
Expand Down Expand Up @@ -341,8 +342,8 @@ public function save($data)
if ($config->get('mail_on_new', true))
{
// Load the user details (already valid from table check).
$fromUser = \JUser::getInstance($table->user_id_from);
$toUser = \JUser::getInstance($table->user_id_to);
$fromUser = User::getInstance($table->user_id_from);
$toUser = User::getInstance($table->user_id_to);
$debug = \JFactory::getConfig()->get('debug_lang');
$default_language = ComponentHelper::getParams('com_languages')->get('administrator');
$lang = Language::getInstance($toUser->getParam('admin_language', $default_language), $debug);
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_messages/Table/MessageTable.php
Expand Up @@ -54,7 +54,7 @@ public function check()
}

// Check the to and from users.
$user = new \JUser($this->user_id_from);
$user = new User($this->user_id_from);

if (empty($user->id))
{
Expand All @@ -63,7 +63,7 @@ public function check()
return false;
}

$user = new \JUser($this->user_id_to);
$user = new User($this->user_id_to);

if (empty($user->id))
{
Expand Down
Expand Up @@ -12,6 +12,7 @@

use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\User\User;

/**
* HTML View class for the Messages component
Expand Down Expand Up @@ -86,7 +87,7 @@ protected function addToolbar()
else
{
\JToolbarHelper::title(Text::_('COM_MESSAGES_VIEW_PRIVATE_MESSAGE'), 'envelope inbox');
$sender = \JUser::getInstance($this->item->user_id_from);
$sender = User::getInstance($this->item->user_id_from);

if ($sender->authorise('core.admin') || $sender->authorise('core.manage', 'com_messages') && $sender->authorise('core.login.admin'))
{
Expand Down

0 comments on commit 25f2037

Please sign in to comment.