Spade
Mini Shell
helper.php000064400000003515151165511170006543 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_logged
*
* @since 1.5
*/
abstract class ModLoggedHelper
{
/**
* 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 = JFactory::getDbo();
$user = JFactory::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', 5));
}
}
mod_logged.php000064400000001125151165511170007357 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Include dependencies.
JLoader::register('ModLoggedHelper', __DIR__ .
'/helper.php');
$users = ModLoggedHelper::getList($params);
if ($params->get('automatic_title', 0))
{
$module->title = ModLoggedHelper::getTitle($params);
}
require JModuleHelper::getLayoutPath('mod_logged',
$params->get('layout', 'default'));
mod_logged.xml000064400000004165151165511200007371 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1"
client="administrator" method="upgrade">
<name>mod_logged</name>
<author>Joomla! Project</author>
<creationDate>January 2005</creationDate>
<copyright>Copyright (C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_LOGGED_XML_DESCRIPTION</description>
<files>
<filename
module="mod_logged">mod_logged.php</filename>
<folder>tmpl</folder>
</files>
<languages>
<language
tag="en-GB">en-GB.mod_logged.ini</language>
<language
tag="en-GB">en-GB.mod_logged.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_LOGGED"
/>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="count"
type="number"
label="MOD_LOGGED_FIELD_COUNT_LABEL"
description="MOD_LOGGED_FIELD_COUNT_DESC"
default="5"
filter="integer"
/>
<field
name="name"
type="list"
label="MOD_LOGGED_NAME"
description="MOD_LOGGED_FIELD_NAME_DESC"
default="1"
filter="integer"
>
<option value="1">MOD_LOGGED_NAME</option>
<option value="0">JGLOBAL_USERNAME</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="automatic_title"
type="radio"
label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL"
description="COM_MODULES_FIELD_AUTOMATIC_TITLE_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
tmpl/default.php000064400000003527151165511250007666 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('bootstrap.tooltip');
?>
<div class="row-striped">
<?php foreach ($users as $user) : ?>
<div class="row-fluid">
<div class="span8">
<?php if ($user->client_id == 0) : ?>
<a title="<?php echo JHtml::_('tooltipText',
'MOD_LOGGED_LOGOUT'); ?>" href="<?php echo
$user->logoutLink; ?>" class="btn btn-danger btn-mini
hasTooltip">
<span class="icon-remove icon-white"
aria-hidden="true"><span
class="element-invisible"><?php echo
JText::_('JLOGOUT'); ?></span></span>
</a>
<?php endif; ?>
<strong class="row-title">
<?php if (isset($user->editLink)) : ?>
<a href="<?php echo $user->editLink; ?>"
class="hasTooltip" title="<?php echo
JHtml::_('tooltipText', 'JGRID_HEADING_ID'); ?> :
<?php echo $user->id; ?>">
<?php echo $user->name; ?></a>
<?php else : ?>
<?php echo $user->name; ?>
<?php endif; ?>
</strong>
<small class="small hasTooltip" title="<?php echo
JHtml::_('tooltipText', 'JCLIENT'); ?>">
<?php if ($user->client_id === null) : ?>
<?php // Don't display a client ?>
<?php elseif ($user->client_id) : ?>
<?php echo JText::_('JADMINISTRATION'); ?>
<?php else : ?>
<?php echo JText::_('JSITE'); ?>
<?php endif; ?>
</small>
</div>
<div class="span4">
<div class="small pull-right hasTooltip"
title="<?php echo JHtml::_('tooltipText',
'MOD_LOGGED_LAST_ACTIVITY'); ?>">
<span class="icon-calendar"
aria-hidden="true"></span> <?php echo
JHtml::_('date', $user->time,
JText::_('DATE_FORMAT_LC5')); ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>