- md5
- 4e7f4c1bd9f5679b94604493bc3168f5
- sha1
- 0fde2fd3faa91b94c93a00755fba48b23d312cc3
- sha256
- 842d2f238a9cd8eb1c37835923617efb252c0b17a5e974cda67f40dce58c5393
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\Logged\Administrator\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
/**
* Helper for mod_logged
*
* @since 1.5
*/
abstract class LoggedHelper
{
/**
* Get a list of logged users.
*
* @param \Joomla\Registry\Registry &$params The module parameters.
*
* @return mixed An array of users, or false on error.
*
* @throws \RuntimeException
*/
public static function getList(&$params)
{
$db = Factory::getDbo();
$user = Factory::getUser();
$query = $db->getQuery(true)
->select('s.time, s.client_id, u.id, u.name, u.username')
->from('#__session AS s')
->join('LEFT', '#__users AS u ON s.userid = u.id')
->where('s.guest = 0');
$db->setQuery($query, 0, $params->get('count', 5));
try
{
$results = $db->loadObjectList();
}
catch (\RuntimeException $e)
{
throw $e;
}
foreach ($results as $k => $result)
{
$results[$k]->logoutLink = '';
if ($user->authorise('core.manage', 'com_users'))
{
$results[$k]->editLink = \JRoute::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
$results[$k]->logoutLink = \JRoute::_('index.php?option=com_login&task=logout&uid=' . $result->id . '&' . \JSession::getFormToken() . '=1');
}
if ($params->get('name', 1) == 0)
{
$results[$k]->name = $results[$k]->username;
}
}
return $results;
}
/**
* Get the alternate title for the module
*
* @param \Joomla\Registry\Registry $params The module parameters.
*
* @return string The alternate title for the module.
*/
public static function getTitle($params)
{
return \JText::plural('MOD_LOGGED_TITLE', $params->get('count'));
}
}
No other release has this exact content. See every version of this file.