first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="upgrade">
<name>mod_users_latest</name>
<author>Joomla! Project</author>
<creationDate>2009-12</creationDate>
<copyright>(C) 2009 Open Source Matters, Inc.</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_USERS_LATEST_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\UsersLatest</namespace>
<files>
<folder module="mod_users_latest">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/mod_users_latest.ini</language>
<language tag="en-GB">language/en-GB/mod_users_latest.sys.ini</language>
</languages>
<help key="Site_Modules:_Latest_Users" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="shownumber"
type="number"
label="MOD_USERS_LATEST_FIELD_NUMBER_LABEL"
default="5"
filter="integer"
min="1"
validate="number"
/>
<field
name="filter_groups"
type="radio"
label="MOD_USERS_LATEST_FIELD_FILTER_GROUPS_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
class="form-select"
validate="moduleLayout"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
rows="3"
validate="CssIdentifier"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
default="1"
filter="integer"
validate="options"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_users_latest
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The users latest module service provider.
*
* @since 4.4.0
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\UsersLatest'));
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\UsersLatest\\Site\\Helper'));
$container->registerServiceProvider(new Module());
}
};

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_users_latest
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\UsersLatest\Site\Dispatcher;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Dispatcher class for mod_users_latest
*
* @since 4.4.0
*/
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
/**
* Returns the layout data.
*
* @return array
*
* @since 4.4.0
*/
protected function getLayoutData(): array
{
$data = parent::getLayoutData();
$data['names'] = $this->getHelperFactory()->getHelper('UsersLatestHelper')->getLatestUsers($data['params'], $this->getApplication());
return $data;
}
}

View File

@ -0,0 +1,98 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_users_latest
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\UsersLatest\Site\Helper;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Registry\Registry;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Helper for mod_users_latest
*
* @since 1.6
*/
class UsersLatestHelper implements DatabaseAwareInterface
{
use DatabaseAwareTrait;
/**
* Get users sorted by activation date
*
* @param Registry $params Object holding the models parameters
* @param SiteApplication $app The app
*
* @return array The array of users
*
* @since 4.4.0
*/
public function getLatestUsers(Registry $params, SiteApplication $app): array
{
// Get the Dbo and User object
$db = $this->getDatabase();
$user = $app->getIdentity();
$query = $db->getQuery(true)
->select($db->quoteName(['a.id', 'a.name', 'a.username', 'a.registerDate']))
->order($db->quoteName('a.registerDate') . ' DESC')
->from($db->quoteName('#__users', 'a'));
if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1) {
$groups = $user->getAuthorisedGroups();
if (empty($groups)) {
return [];
}
$query->leftJoin($db->quoteName('#__user_usergroup_map', 'm'), $db->quoteName('m.user_id') . ' = ' . $db->quoteName('a.id'))
->leftJoin($db->quoteName('#__usergroups', 'ug'), $db->quoteName('ug.id') . ' = ' . $db->quoteName('m.group_id'))
->whereIn($db->quoteName('ug.id'), $groups)
->where($db->quoteName('ug.id') . ' <> 1');
}
$query->setLimit((int) $params->get('shownumber', 5));
$db->setQuery($query);
try {
return (array) $db->loadObjectList();
} catch (\RuntimeException $e) {
$app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return [];
}
}
/**
* Get users sorted by activation date
*
* @param \Joomla\Registry\Registry $params module parameters
*
* @return array The array of users
*
* @since 1.6
*
* @deprecated 4.4.0 will be removed in 6.0
* Use the non-static method getLatestUsers
* Example: Factory::getApplication()->bootModule('mod_users_latest', 'site')
* ->getHelper('UsersLatestHelper')
* ->getLatestUsers($params, Factory::getApplication())
*/
public static function getUsers($params)
{
return (new self())->getLatestUsers($params, Factory::getApplication());
}
}

View File

@ -0,0 +1,21 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_users_latest
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if (!empty($names)) : ?>
<ul class="mod-userslatest latestusers mod-list">
<?php foreach ($names as $name) : ?>
<li>
<?php echo $name->username; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>