first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
<IfModule mod_authz_core.c>
<RequireAll>
Require all denied
</RequireAll>
</IfModule>

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~
~ @package akeebabackup
~ @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
~ @license GNU General Public License version 3, or later
-->
<extension type="plugin" group="quickicon" method="upgrade">
<name>PLG_QUICKICON_AKEEBABACKUP</name>
<version>9.4.4</version>
<creationDate>2022-11-30</creationDate>
<author>Nicholas K. Dionysopoulos</author>
<authorEmail>nicholas@dionysopoulos.me</authorEmail>
<authorUrl>https://www.akeeba.com</authorUrl>
<copyright>Copyright (c)2006-2022 Nicholas K. Dionysopoulos</copyright>
<license>GNU General Public License version 3, or later</license>
<description>PLG_QUICKICON_AKEEBABACKUP_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\AkeebaBackup</namespace>
<files>
<folder plugin="akeebabackup">services</folder>
<folder>src</folder>
<filename>.htaccess</filename>
<filename>web.config</filename>
</files>
<media destination="plg_quickicon_akeebabackup" folder="media">
<folder>css</folder>
<file>joomla.asset.json</file>
</media>
<languages folder="language">
<language tag="en-GB">en-GB/plg_quickicon_akeebabackup.ini</language>
<language tag="en-GB">en-GB/plg_quickicon_akeebabackup.sys.ini</language>
</languages>
<config addfieldpath="/administrator/components/com_akeebabackup/src/Field"
addfieldprefix="Akeeba\Component\AkeebaBackup\Administrator\Field"
>
<fields name="params">
<fieldset name="basic">
<field name="enablewarning"
type="radio"
layout="joomla.form.field.radio.switcher"
label="PLG_QUICKICON_AKEEBABACKUP_LBL_WARNINGS"
description="PLG_QUICKICON_AKEEBABACKUP_DESC_WARNINGS"
default="1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="warnfailed"
type="radio"
layout="joomla.form.field.radio.switcher"
label="PLG_QUICKICON_AKEEBABACKUP_LBL_WARNFAILED"
description="PLG_QUICKICON_AKEEBABACKUP_DESC_WARNFAILED"
default="1"
showon="enablewarning:1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="maxbackupperiod"
type="number"
label="PLG_QUICKICON_AKEEBABACKUP_LBL_PERIOD"
description="PLG_QUICKICON_AKEEBABACKUP_DESC_PERIOD"
min="1"
max="87600"
step="1"
default="24"/>
<field name="profileid"
type="backupprofiles"
default="1"
label="PLG_QUICKICON_AKEEBABACKUP_PROFILE_LABEL"
class="advancedSelect"
description="PLG_QUICKICON_AKEEBABACKUP_PROFILE_DESC"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,55 @@
<?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\AkeebaBackup\Extension\AkeebaBackup;
return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 9.0.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new MVCFactory('Akeeba\\Component\\AkeebaBackup'));
$container->set(
PluginInterface::class,
function (Container $container)
{
$config = (array) PluginHelper::getPlugin('quickicon', 'akeebabackup');
$plugin = new AkeebaBackup(
$container->get(DispatcherInterface::class),
Factory::getApplication()->getDocument(),
$config
);
$plugin->setMVCFactory($container->get(MVCFactoryInterface::class));
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get('DatabaseDriver'));
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,245 @@
<?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Joomla\Plugin\Quickicon\AkeebaBackup\Extension;
defined('_JEXEC') || die;
use Akeeba\Component\AkeebaBackup\Administrator\Model\StatisticsModel;
use Akeeba\Engine\Factory;
use Akeeba\Engine\Platform;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Document\Document;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryAwareTrait;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Event\DispatcherInterface;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
class AkeebaBackup extends CMSPlugin implements SubscriberInterface, DatabaseAwareInterface
{
use DatabaseAwareTrait;
use MVCFactoryAwareTrait;
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* The document.
*
* @var Document
*
* @since 4.0.0
*/
private $document;
/**
* Constructor
*
* @param DispatcherInterface $subject The object to observe
* @param Document $document The document
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 9.0.0
*/
public function __construct(DispatcherInterface $subject, Document $document, array $config = [])
{
parent::__construct($subject, $config);
$this->document = $document;
}
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 9.0.0
*/
public static function getSubscribedEvents(): array
{
// Only subscribe events if the component is installed and enabled
if (!ComponentHelper::isEnabled('com_akeebabackup'))
{
return [];
}
return [
'onGetIcons' => 'getAkeebaBackupStatus',
];
}
/**
* This method is called when the Quick Icons module is constructing its set
* of icons. You can return an array which defines a single icon and it will
* be rendered right after the stock Quick Icons.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 9.0.0
*/
public function getAkeebaBackupStatus(QuickIconsEvent $event)
{
$context = $event->getContext();
$user = $this->getApplication()->getIdentity();
if ($context !== 'update_quickicon' || !$user->authorise('core.manage', 'com_installer'))
{
return;
}
// Load the Akeeba Engine, if required
if (!defined('AKEEBAENGINE'))
{
// Necessary defines for Akeeba Engine
define('AKEEBAENGINE', 1);
define('AKEEBAROOT', JPATH_ADMINISTRATOR . '/components/com_akeebabackup/engine');
// Make sure we have a profile set throughout the component's lifetime
$profile_id = $this->getApplication()->getSession()->get('akeebebackup.profile');
if (is_null($profile_id))
{
$this->getApplication()->getSession()->set('akeebabackup.profile', 1);
}
// Is Akeeba Engine available?
$engineFactoryFile = AKEEBAROOT . '/Factory.php';
if (!file_exists($engineFactoryFile) || !is_readable($engineFactoryFile))
{
return;
}
// Try to load the Akeeba Engine
@include_once $engineFactoryFile;
if (!class_exists('Akeeba\Engine\Factory'))
{
return;
}
Platform::addPlatform('joomla', JPATH_ADMINISTRATOR . '/components/com_akeebabackup/platform/Joomla');
// !!! IMPORTANT !!! DO NOT REMOVE! This triggers Akeeba Engine's autoloader. Without it the next line fails!
$DO_NOT_REMOVE = Platform::getInstance();
// Set the DBO to the Akeeba Engine platform for Joomla
Platform\Joomla::setDbDriver($this->getDatabase());
}
// Set up the default icon
$url = Uri::base();
$url = rtrim($url, '/');
$profileId = (int) $this->params->get('profileid', 1);
$token = $this->getApplication()->getSession()->getToken();
if ($profileId <= 0)
{
$profileId = 1;
}
$ret = [
'link' => Route::_('index.php?option=com_akeebabackup&view=Backup&autostart=1&returnurl=' . base64_encode($url) . '&profileid=' . $profileId . "&$token=1"),
'image' => 'icon-akeebabackup',
'icon' => '',
'text' => Text::_('PLG_QUICKICON_AKEEBABACKUP_OK'),
'class' => 'success',
'id' => 'plg_quickicon_akeebabackup',
'group' => 'MOD_QUICKICON_MAINTENANCE',
];
// Do I need to parse backup warnings?
if ($this->params->get('enablewarning', 0) == 0)
{
// Do not remove; required to load the Akeeba Engine configuration
$engineConfig = Factory::getConfiguration();
Platform::getInstance()->load_configuration(1);
// Get the latest backup ID
$filters = [
[
'field' => 'tag',
'operand' => '<>',
'value' => 'restorepoint',
],
];
$ordering = [
'by' => 'backupstart',
'order' => 'DESC',
];
/** @var StatisticsModel $model */
$model = $this->getMVCFactory()->createModel('Statistics', 'Administrator');
$list = $model->getStatisticsListWithMeta(false, $filters, $ordering);
$record = null;
if (!empty($list))
{
$record = (object) array_shift($list);
}
// Warn if there is no backup whatsoever
$warning = is_null($record);
// Process "failed backup" warnings, if specified
if ((!is_null($record) && $this->params->get('warnfailed', 0) == 0))
{
$warning = (($record->status == 'fail') || ($record->status == 'run'));
}
// Process "stale backup" warnings, if necessary
if (!$warning && !is_null($record))
{
$maxperiod = $this->params->get('maxbackupperiod', 24);
$lastBackupRaw = $record->backupstart;
$lastBackupObject = new Date($lastBackupRaw);
$lastBackup = $lastBackupObject->toUnix();
$maxBackup = time() - $maxperiod * 3600;
$warning = ($lastBackup < $maxBackup);
}
// If we have a warning we need to update the quick icon class and text
if ($warning)
{
$ret['text'] = Text::_('PLG_QUICKICON_AKEEBABACKUP_BACKUPREQUIRED');
$ret['class'] = 'danger';
}
}
// Load the CSS
$this->document->getWebAssetManager()
->getRegistry()->addExtensionRegistryFile('plg_quickicon_akeebabackup');
$this->document->getWebAssetManager()
->useStyle('plg_quickicon_akeebabackup.icons');
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
$ret,
];
$event->setArgument('result', $result);
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
This only works on IIS 7 or later. See https://www.iis.net/configreference/system.webserver/security/requestfiltering/fileextensions
-->
<configuration>
<system.webServer>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="false" >
<clear />
<add fileExtension=".html" allowed="true"/>
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</configuration>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_downloadkey</name>
<author>Joomla! Project</author>
<creationDate>2019-10</creationDate>
<copyright>(C) 2019 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>4.0.0</version>
<description>PLG_QUICKICON_DOWNLOADKEY_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\Downloadkey</namespace>
<files>
<folder plugin="downloadkey">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_downloadkey.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_downloadkey.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="context"
type="text"
label="PLG_QUICKICON_DOWNLOADKEY_GROUP_LABEL"
description="PLG_QUICKICON_DOWNLOADKEY_GROUP_DESC"
default="update_quickicon"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.downloadkey
*
* @copyright (C) 2022 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\Downloadkey\Extension\Downloadkey;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Downloadkey(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'downloadkey')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,150 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.downloadkey
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\Downloadkey\Extension;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as ComInstallerHelper;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! update notification plugin
*
* @since 4.0.0
*/
final class Downloadkey extends CMSPlugin implements SubscriberInterface
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 4.0.0
*/
protected $autoloadLanguage = true;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.3.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'onGetIcons',
];
}
/**
* Returns an icon definition for an icon which looks for extensions updates
* via AJAX and displays a notification when such updates are found.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 4.0.0
*/
public function onGetIcons(QuickIconsEvent $event): void
{
$context = $event->getContext();
if (
$context !== $this->params->get('context', 'update_quickicon')
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_installer')
) {
return;
}
$info = $this->getMissingDownloadKeyInfo();
// No extensions need a download key. The icon is not rendered.
if (!$info['supported']) {
return;
}
$iconDefinition = [
'link' => 'index.php?option=com_installer&view=updatesites&filter[supported]=1',
'image' => 'icon-key',
'icon' => '',
'text' => Text::_('PLG_QUICKICON_DOWNLOADKEY_OK'),
'class' => 'success',
'id' => 'plg_quickicon_downloadkey',
'group' => 'MOD_QUICKICON_MAINTENANCE',
];
if ($info['missing'] !== 0) {
$iconDefinition = array_merge(
$iconDefinition,
[
'link' => 'index.php?option=com_installer&view=updatesites&filter[supported]=-1',
'text' => Text::plural('PLG_QUICKICON_DOWNLOADKEY_N_MISSING', $info['missing']),
'class' => 'danger',
]
);
}
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
$iconDefinition,
];
$event->setArgument('result', $result);
}
/**
* Gets the information about update sites requiring but missing a download key.
*
* The return array has two keys:
* - supported Number of update sites supporting Download Key
* - missing Number of update sites missing a Download Key
*
* If 'supported' is zero you do not need to provide any download keys. All your extensions are free downloads.
*
* If 'supported' is non-zero and 'missing' is zero you have entered a download key for all paid extensions.
*
* If 'supported' is non-zero and 'missing' is also non-zero you need to enter one or more download keys.
*
* @return array
* @since 4.0.0
*/
private function getMissingDownloadKeyInfo(): array
{
$ret = [
'supported' => 0,
'missing' => 0,
];
if (!class_exists('Joomla\Component\Installer\Administrator\Helper\InstallerHelper')) {
require_once JPATH_ADMINISTRATOR . '/components/com_installer/Helper/InstallerHelper.php';
}
$supported = ComInstallerHelper::getDownloadKeySupportedSites(true);
$ret['supported'] = count($supported);
if ($ret['supported'] === 0) {
return $ret;
}
$missing = ComInstallerHelper::getDownloadKeyExistsSites(false, true);
$ret['missing'] = count($missing);
return $ret;
}
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_eos</name>
<author>Joomla! Project</author>
<creationDate>2023-05</creationDate>
<copyright>(C) 2023 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>4.4.0</version>
<description>PLG_QUICKICON_EOS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\Eos</namespace>
<files>
<folder plugin="eos">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_eos.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_eos.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="last_snoozed_id"
type="hidden"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,51 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.eos
*
* @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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\Eos\Extension\Eos;
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
*
* @throws Exception
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Eos(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'eos')
);
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get(DatabaseInterface::class));
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,305 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.eos
*
* @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\Plugin\Quickicon\Eos\Extension;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Application\CMSWebApplicationInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! end of support notification plugin
*
* @since 4.4.0
*/
final class Eos extends CMSPlugin implements SubscriberInterface
{
use DatabaseAwareTrait;
/**
* The EOS date for 4.4.
*
* @var string
* @since 4.4.0
*/
private const EOS_DATE = '2025-10-17';
/**
* Load the language file on instantiation.
*
* @var bool
* @since 4.4.0
*/
protected $autoloadLanguage = false;
/**
* Holding the current valid message to be shown.
*
* @var array
* @since 4.4.0
*/
private $currentMessage = [];
/**
* Are the messages initialized.
*
* @var bool
* @since 4.4.0
*/
private $messagesInitialized = false;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.4.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'getEndOfServiceNotification',
'onAjaxEos' => 'onAjaxEos',
];
}
/**
* Check and show the alert.
*
* This method is called when the Quick Icons module is constructing its set
* of icons.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 4.4.0
*
* @throws \Exception
*/
public function getEndOfServiceNotification(QuickIconsEvent $event): void
{
$app = $this->getApplication();
if (
$event->getContext() !== $this->params->get('context', 'update_quickicon')
|| !$this->shouldDisplayMessage()
|| (!$this->messagesInitialized && $this->setMessage() == [])
|| !$app instanceof CMSWebApplicationInterface
) {
return;
}
$this->loadLanguage();
// Show this only when not snoozed
if ($this->params->get('last_snoozed_id', 0) < $this->currentMessage['id']) {
// Build the message to be displayed in the cpanel
$messageText = sprintf(
$app->getLanguage()->_($this->currentMessage['messageText']),
HTMLHelper::_('date', Eos::EOS_DATE, $app->getLanguage()->_('DATE_FORMAT_LC3')),
$this->currentMessage['messageLink']
);
if ($this->currentMessage['snoozable']) {
$messageText .= '<p><button class="btn btn-warning eosnotify-snooze-btn" type="button" >';
$messageText .= $app->getLanguage()->_('PLG_QUICKICON_EOS_SNOOZE_BUTTON') . '</button></p>';
}
$app->enqueueMessage($messageText, $this->currentMessage['messageType']);
}
$app->getDocument()->getWebAssetManager()
->registerAndUseScript('plg_quickicon_eos.script', 'plg_quickicon_eos/snooze.js', [], ['type' => 'module']);
}
/**
* Save the plugin parameters.
*
* @return bool
*
* @since 4.4.0
*/
private function saveParams(): bool
{
$params = $this->params->toString('JSON');
$db = $this->getDatabase();
$query = $db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('params') . ' = :params')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote('quickicon'))
->where($db->quoteName('element') . ' = ' . $db->quote('eos'))
->bind(':params', $params);
return $db->setQuery($query)->execute();
}
/**
* Determines if the message and quickicon should be displayed.
*
* @return bool
*
* @since 4.4.0
*
* @throws \Exception
*/
private function shouldDisplayMessage(): bool
{
// Show only on administration part
return $this->getApplication()->isClient('administrator')
// Only show for HTML requests
&& $this->getApplication()->getDocument()->getType() === 'html'
// Don't show in modal
&& $this->getApplication()->getInput()->getCmd('tmpl', 'index') !== 'component'
// Only show in cpanel
&& $this->getApplication()->getInput()->get('option') === 'com_cpanel';
}
/**
* Return the texts to be displayed based on the time until we reach EOS.
*
* @param int $monthsUntilEOS The months until we reach EOS
* @param int $inverted Have we surpassed the EOS date
*
* @return array An array with the message to be displayed or false
*
* @since 4.4.0
*/
private function getMessageInfo(int $monthsUntilEOS, int $inverted): array
{
// The EOS date has passed - Support has ended
if ($inverted === 1) {
return [
'id' => 5,
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_ERROR_SUPPORT_ENDED',
'messageType' => 'error',
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
'snoozable' => false,
];
}
// The security support is ending in 6 months
if ($monthsUntilEOS < 6) {
return [
'id' => 4,
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SUPPORT_ENDING',
'messageType' => 'warning',
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
'snoozable' => true,
];
}
// We are in security only mode now, 12 month to go from now on
if ($monthsUntilEOS < 12) {
return [
'id' => 3,
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_WARNING_SECURITY_ONLY',
'messageType' => 'warning',
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step',
'snoozable' => true,
];
}
// We still have 16 month to go, lets remind our users about the pre upgrade checker
if ($monthsUntilEOS < 16) {
return [
'id' => 2,
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_INFO_02',
'messageType' => 'info',
'messageLink' => 'https://docs.joomla.org/Special:MyLanguage/Pre-Update_Check',
'snoozable' => true,
];
}
// Lets start our messages 2 month after the initial release, still 22 month to go
if ($monthsUntilEOS < 22) {
return [
'id' => 1,
'messageText' => 'PLG_QUICKICON_EOS_MESSAGE_INFO_01',
'messageType' => 'info',
'messageLink' => 'https://joomla.org/5',
'snoozable' => true,
];
}
return [];
}
/**
* Check if current user is allowed to send the data.
*
* @return bool
*
* @since 4.4.0
*
* @throws \Exception
*/
private function isAllowedUser(): bool
{
return $this->getApplication()->getIdentity()->authorise('core.login.admin');
}
/**
* User hit the snooze button.
*
* @return string
*
* @since 4.4.0
*
* @throws Notallowed If user is not allowed
*
* @throws \Exception
*/
public function onAjaxEos(): string
{
// No messages yet so nothing to snooze
if (!$this->messagesInitialized && $this->setMessage() == []) {
return '';
}
if (!$this->isAllowedUser()) {
throw new Notallowed($this->getApplication()->getLanguage()->_('JGLOBAL_AUTH_ACCESS_DENIED'), 403);
}
// Make sure only snoozable messages can be snoozed
if ($this->currentMessage['snoozable']) {
$this->params->set('last_snoozed_id', $this->currentMessage['id']);
$this->saveParams();
}
return '';
}
/**
* Calculates how many days and selects correct message.
*
* @return array
*
* @since 4.4.0
*/
private function setMessage(): array
{
$diff = Factory::getDate()->diff(Factory::getDate(Eos::EOS_DATE));
$message = $this->getMessageInfo(floor($diff->days / 30.417), $diff->invert);
$this->currentMessage = $message;
$this->messagesInitialized = true;
return $message;
}
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_extensionupdate</name>
<author>Joomla! Project</author>
<creationDate>2011-08</creationDate>
<copyright>(C) 2011 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>PLG_QUICKICON_EXTENSIONUPDATE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\Extensionupdate</namespace>
<files>
<folder plugin="extensionupdate">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_extensionupdate.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_extensionupdate.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="context"
type="text"
label="PLG_QUICKICON_EXTENSIONUPDATE_GROUP_LABEL"
description="PLG_QUICKICON_EXTENSIONUPDATE_GROUP_DESC"
default="update_quickicon"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.extensionupdate
*
* @copyright (C) 2022 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\Extensionupdate\Extension\Extensionupdate;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Extensionupdate(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'extensionupdate')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,117 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.extensionupdate
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\Extensionupdate\Extension;
use Joomla\CMS\Extension\ExtensionHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! update notification plugin
*
* @since 2.5
*/
final class Extensionupdate extends CMSPlugin implements SubscriberInterface
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.3.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'onGetIcons',
];
}
/**
* Returns an icon definition for an icon which looks for extensions updates
* via AJAX and displays a notification when such updates are found.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 2.5
*/
public function onGetIcons(QuickIconsEvent $event): void
{
$context = $event->getContext();
if (
$context !== $this->params->get('context', 'update_quickicon')
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_installer')
) {
return;
}
$token = Session::getFormToken() . '=1';
$options = [
'url' => Uri::base() . 'index.php?option=com_installer&view=update&task=update.find&' . $token,
'ajaxUrl' => Uri::base() . 'index.php?option=com_installer&view=update&task=update.ajax&' . $token
. '&cache_timeout=3600&eid=0&skip=' . ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id,
];
$this->getApplication()->getDocument()->addScriptOptions('js-extensions-update', $options);
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE');
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND');
Text::script('PLG_QUICKICON_EXTENSIONUPDATE_ERROR');
Text::script('MESSAGE');
Text::script('ERROR');
Text::script('INFO');
Text::script('WARNING');
$this->getApplication()->getDocument()->getWebAssetManager()
->registerAndUseScript(
'plg_quickicon_extensionupdate',
'plg_quickicon_extensionupdate/extensionupdatecheck.min.js',
[],
['defer' => true],
['core']
);
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
[
'link' => 'index.php?option=com_installer&view=update&task=update.find&' . $token,
'image' => 'icon-star',
'icon' => '',
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_EXTENSIONUPDATE_CHECKING'),
'id' => 'plg_quickicon_extensionupdate',
'group' => 'MOD_QUICKICON_MAINTENANCE',
],
];
$event->setArgument('result', $result);
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('_JEXEC') or die;
/**
* JCE File Browser Quick Icon plugin.
*
* @since 2.1
*/
class plgQuickiconJce extends JPlugin
{
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$app = JFactory::getApplication();
// only in Admin and only if the component is enabled
if ($app->getClientId() !== 1 || JComponentHelper::getComponent('com_jce', true)->enabled === false) {
return;
}
$this->loadLanguage();
}
public function onGetIcons($context)
{
if ($context != $this->params->get('context', 'mod_quickicon')) {
return;
}
$user = JFactory::getUser();
if (!$user->authorise('jce.browser', 'com_jce')) {
return;
}
$language = JFactory::getLanguage();
$language->load('com_jce', JPATH_ADMINISTRATOR);
return array(array(
'link' => 'index.php?option=com_jce&view=browser',
'image' => 'picture fas fa-image',
'access' => array('jce.browser', 'com_jce'),
'text' => JText::_('PLG_QUICKICON_JCE_TITLE'),
'id' => 'plg_quickicon_jce',
));
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8" type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_jce</name>
<version>2.9.32</version>
<creationDate>01-11-2022</creationDate>
<author>Ryan Demmer</author>
<authorEmail>info@joomlacontenteditor.net</authorEmail>
<authorUrl>http://www.joomlacontenteditor.net</authorUrl>
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<description>PLG_QUICKICON_JCE_XML_DESCRIPTION</description>
<files folder="plugins/quickicon/jce">
<filename plugin="jce">jce.php</filename>
</files>
<languages folder="administrator/language/en-GB">
<language tag="en-GB">en-GB.plg_quickicon_jce.ini</language>
<language tag="en-GB">en-GB.plg_quickicon_jce.sys.ini</language>
</languages>
</extension>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_joomlaupdate</name>
<author>Joomla! Project</author>
<creationDate>2011-08</creationDate>
<copyright>(C) 2011 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>PLG_QUICKICON_JOOMLAUPDATE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\Joomlaupdate</namespace>
<files>
<folder plugin="joomlaupdate">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_joomlaupdate.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_joomlaupdate.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="context"
type="text"
label="PLG_QUICKICON_JOOMLAUPDATE_GROUP_LABEL"
description="PLG_QUICKICON_JOOMLAUPDATE_GROUP_DESC"
default="update_quickicon"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.Joomlaupdate
*
* @copyright (C) 2019 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\Joomlaupdate\Extension\Joomlaupdate;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
// @Todo This needs to be changed to a proper factory
$plugin = \Joomla\CMS\Plugin\PluginHelper::getPlugin('quickicon', 'joomlaupdate');
$plugin = new Joomlaupdate(
$container->get(DispatcherInterface::class),
Factory::getApplication()->getDocument(),
(array) $plugin
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,141 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.Joomlaupdate
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\Joomlaupdate\Extension;
use Joomla\CMS\Document\Document;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Event\DispatcherInterface;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! update notification plugin
*
* @since 2.5
*/
class Joomlaupdate extends CMSPlugin implements SubscriberInterface
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* The document.
*
* @var Document
*
* @since 4.0.0
*/
private $document;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.0.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'getCoreUpdateNotification',
];
}
/**
* Constructor
*
* @param DispatcherInterface $subject The object to observe
* @param Document $document The document
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 4.0.0
*/
public function __construct($subject, Document $document, $config = [])
{
parent::__construct($subject, $config);
$this->document = $document;
}
/**
* This method is called when the Quick Icons module is constructing its set
* of icons. You can return an array which defines a single icon and it will
* be rendered right after the stock Quick Icons.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 4.0.0
*/
public function getCoreUpdateNotification(QuickIconsEvent $event)
{
$context = $event->getContext();
if (
$context !== $this->params->get('context', 'update_quickicon')
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_joomlaupdate')
) {
return;
}
Text::script('PLG_QUICKICON_JOOMLAUPDATE_ERROR');
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND');
Text::script('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE');
Text::script('MESSAGE');
Text::script('ERROR');
Text::script('INFO');
Text::script('WARNING');
$this->document->addScriptOptions(
'js-joomla-update',
[
'url' => Uri::base() . 'index.php?option=com_joomlaupdate',
'ajaxUrl' => Uri::base() . 'index.php?option=com_joomlaupdate&task=update.ajax&'
. Session::getFormToken() . '=1',
'version' => JVERSION,
]
);
$this->document->getWebAssetManager()
->registerAndUseScript('plg_quickicon_joomlaupdate', 'plg_quickicon_joomlaupdate/jupdatecheck.min.js', [], ['defer' => true], ['core']);
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
[
'link' => 'index.php?option=com_joomlaupdate',
'image' => 'icon-joomla',
'icon' => '',
'text' => Text::_('PLG_QUICKICON_JOOMLAUPDATE_CHECKING'),
'id' => 'plg_quickicon_joomlaupdate',
'group' => 'MOD_QUICKICON_MAINTENANCE',
],
];
$event->setArgument('result', $result);
}
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_overridecheck</name>
<author>Joomla! Project</author>
<creationDate>2018-06</creationDate>
<copyright>(C) 2018 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>4.0.0</version>
<description>PLG_QUICKICON_OVERRIDECHECK_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\OverrideCheck</namespace>
<files>
<folder plugin="overridecheck">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_overridecheck.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_overridecheck.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="context"
type="text"
label="PLG_QUICKICON_OVERRIDECHECK_GROUP_LABEL"
description="PLG_QUICKICON_OVERRIDECHECK_GROUP_DESC"
default="update_quickicon"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.overridecheck
*
* @copyright (C) 2022 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\OverrideCheck\Extension\OverrideCheck;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new OverrideCheck(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'overridecheck')
);
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get(DatabaseInterface::class));
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,137 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.overridecheck
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\OverrideCheck\Extension;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! template override notification plugin
*
* @since 4.0.0
*/
final class OverrideCheck extends CMSPlugin implements SubscriberInterface
{
use DatabaseAwareTrait;
/**
* Load the language file on instantiation.
*
* @var boolean
*
* @since 4.0.0
*/
protected $autoloadLanguage = true;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.3.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'onGetIcons',
];
}
/**
* Returns an icon definition for an icon which looks for overrides update
* via AJAX and displays a notification when such overrides are updated.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 4.0.0
*/
public function onGetIcons(QuickIconsEvent $event): void
{
$context = $event->getContext();
if (
$context !== $this->params->get('context', 'update_quickicon')
|| !$this->getApplication()->getIdentity()->authorise('core.manage', 'com_templates')
) {
return;
}
$token = Session::getFormToken() . '=1';
$options = [
'url' => Uri::base() . 'index.php?option=com_templates&view=templates',
'ajaxUrl' => Uri::base() . 'index.php?option=com_templates&view=templates&task=template.ajax&' . $token,
'pluginId' => $this->getOverridePluginId(),
];
$this->getApplication()->getDocument()->addScriptOptions('js-override-check', $options);
Text::script('PLG_QUICKICON_OVERRIDECHECK_ERROR', true);
Text::script('PLG_QUICKICON_OVERRIDECHECK_ERROR_ENABLE', true);
Text::script('PLG_QUICKICON_OVERRIDECHECK_UPTODATE', true);
Text::script('PLG_QUICKICON_OVERRIDECHECK_OVERRIDEFOUND', true);
$this->getApplication()->getDocument()->getWebAssetManager()
->registerAndUseScript('plg_quickicon_overridecheck', 'plg_quickicon_overridecheck/overridecheck.js', [], ['defer' => true], ['core']);
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
[
'link' => 'index.php?option=com_templates&view=templates',
'image' => 'icon-file',
'icon' => '',
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_OVERRIDECHECK_CHECKING'),
'id' => 'plg_quickicon_overridecheck',
'group' => 'MOD_QUICKICON_MAINTENANCE',
],
];
$event->setArgument('result', $result);
}
/**
* Gets the installer override plugin extension id.
*
* @return integer The installer override plugin extension id.
*
* @since 4.0.0
*/
private function getOverridePluginId()
{
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' = ' . $db->quote('installer'))
->where($db->quoteName('element') . ' = ' . $db->quote('override'));
$db->setQuery($query);
try {
$result = (int) $db->loadResult();
} catch (\RuntimeException $e) {
$this->getApplication()->enqueueMessage($e->getMessage(), 'error');
}
return $result;
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_phpversioncheck</name>
<author>Joomla! Project</author>
<creationDate>2016-08</creationDate>
<copyright>(C) 2016 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.7.0</version>
<description>PLG_QUICKICON_PHPVERSIONCHECK_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\PhpVersionCheck</namespace>
<files>
<folder plugin="phpversioncheck">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_phpversioncheck.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_phpversioncheck.sys.ini</language>
</languages>
</extension>

View File

@@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.phpversioncheck
*
* @copyright (C) 2022 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\PhpVersionCheck\Extension\PhpVersionCheck;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new PhpVersionCheck(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'phpversioncheck')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,254 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.phpversioncheck
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\PhpVersionCheck\Extension;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Plugin to check the PHP version and display a warning about its support status
*
* @since 3.7.0
*/
final class PhpVersionCheck extends CMSPlugin implements SubscriberInterface
{
/**
* Constant representing the active PHP version being fully supported
*
* @var integer
* @since 3.7.0
*/
public const PHP_SUPPORTED = 0;
/**
* Constant representing the active PHP version receiving security support only
*
* @var integer
* @since 3.7.0
*/
public const PHP_SECURITY_ONLY = 1;
/**
* Constant representing the active PHP version being unsupported
*
* @var integer
* @since 3.7.0
*/
public const PHP_UNSUPPORTED = 2;
/**
* Load plugin language files automatically
*
* @var boolean
* @since 3.7.0
*/
protected $autoloadLanguage = true;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.3.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'onGetIcons',
];
}
/**
* Check the PHP version after the admin component has been dispatched.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 3.7.0
*/
public function onGetIcons(QuickIconsEvent $event): void
{
if (!$this->shouldDisplayMessage()) {
return;
}
$supportStatus = $this->getPhpSupport();
if ($supportStatus['status'] !== self::PHP_SUPPORTED) {
// Enqueue the notification message; set a warning if receiving security support or "error" if unsupported
switch ($supportStatus['status']) {
case self::PHP_SECURITY_ONLY:
$this->getApplication()->enqueueMessage($supportStatus['message'], 'warning');
break;
case self::PHP_UNSUPPORTED:
$this->getApplication()->enqueueMessage($supportStatus['message'], 'danger');
break;
}
}
}
/**
* Gets PHP support status.
*
* @return array Array of PHP support data
*
* @since 3.7.0
* @note The dates used in this method should correspond to the dates given on PHP.net
* @link https://www.php.net/supported-versions.php
* @link https://www.php.net/eol.php
*/
private function getPhpSupport()
{
$phpSupportData = [
'7.2' => [
'security' => '2019-11-30',
'eos' => '2020-11-30',
],
'7.3' => [
'security' => '2020-12-06',
'eos' => '2021-12-06',
],
'7.4' => [
'security' => '2021-11-28',
'eos' => '2022-11-28',
],
'8.0' => [
'security' => '2022-11-26',
'eos' => '2023-11-26',
],
'8.1' => [
'security' => '2023-11-25',
'eos' => '2025-12-31',
],
'8.2' => [
'security' => '2024-12-31',
'eos' => '2026-12-31',
],
'8.3' => [
'security' => '2025-12-31',
'eos' => '2027-12-31',
],
];
// Fill our return array with default values
$supportStatus = [
'status' => self::PHP_SUPPORTED,
'message' => null,
];
// Check the PHP version's support status using the minor version
$activePhpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
// Handle non standard strings like PHP 7.2.34-8+ubuntu18.04.1+deb.sury.org+1
$phpVersion = preg_split('/-/', PHP_VERSION)[0];
// Do we have the PHP version's data?
if (isset($phpSupportData[$activePhpVersion])) {
// First check if the version has reached end of support
$today = new Date();
$phpEndOfSupport = new Date($phpSupportData[$activePhpVersion]['eos']);
if ($phpNotSupported = $today > $phpEndOfSupport) {
/*
* Find the oldest PHP version still supported that is newer than the current version,
* this is our recommendation for users on unsupported platforms
*/
foreach ($phpSupportData as $version => $versionData) {
$versionEndOfSupport = new Date($versionData['eos']);
if (version_compare($version, $activePhpVersion, 'ge') && ($today < $versionEndOfSupport)) {
$supportStatus['status'] = self::PHP_UNSUPPORTED;
$supportStatus['message'] = Text::sprintf(
'PLG_QUICKICON_PHPVERSIONCHECK_UNSUPPORTED',
$phpVersion,
$version,
$versionEndOfSupport->format(Text::_('DATE_FORMAT_LC4'))
);
return $supportStatus;
}
}
// PHP version is not supported and we don't know of any supported versions.
$supportStatus['status'] = self::PHP_UNSUPPORTED;
$supportStatus['message'] = Text::sprintf(
'PLG_QUICKICON_PHPVERSIONCHECK_UNSUPPORTED_JOOMLA_OUTDATED',
$phpVersion
);
return $supportStatus;
}
// If the version is still supported, check if it has reached eol minus 3 month
$securityWarningDate = clone $phpEndOfSupport;
$securityWarningDate->sub(new \DateInterval('P3M'));
if (!$phpNotSupported && $today > $securityWarningDate) {
$supportStatus['status'] = self::PHP_SECURITY_ONLY;
$supportStatus['message'] = Text::sprintf(
'PLG_QUICKICON_PHPVERSIONCHECK_SECURITY_ONLY',
$phpVersion,
$phpEndOfSupport->format(Text::_('DATE_FORMAT_LC4'))
);
}
}
return $supportStatus;
}
/**
* Determines if the message should be displayed
*
* @return boolean
*
* @since 3.7.0
*/
private function shouldDisplayMessage()
{
// Only on admin app
if (!$this->getApplication()->isClient('administrator')) {
return false;
}
// Only if authenticated
if ($this->getApplication()->getIdentity()->guest) {
return false;
}
// Only on HTML documents
if ($this->getApplication()->getDocument()->getType() !== 'html') {
return false;
}
// Only on full page requests
if ($this->getApplication()->getInput()->getCmd('tmpl', 'index') === 'component') {
return false;
}
// Only to com_cpanel
if ($this->getApplication()->getInput()->get('option') !== 'com_cpanel') {
return false;
}
return true;
}
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_privacycheck</name>
<author>Joomla! Project</author>
<creationDate>2018-06</creationDate>
<copyright>(C) 2018 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.9.0</version>
<description>PLG_QUICKICON_PRIVACYCHECK_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\PrivacyCheck</namespace>
<files>
<folder plugin="privacycheck">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_privacycheck.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_privacycheck.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="context"
type="text"
label="PLG_QUICKICON_PRIVACYCHECK_GROUP_LABEL"
description="PLG_QUICKICON_PRIVACYCHECK_GROUP_DESC"
default="update_quickicon"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.privacycheck
*
* @copyright (C) 2022 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\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Quickicon\PrivacyCheck\Extension\PrivacyCheck;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.3.0
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new PrivacyCheck(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'privacycheck')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@@ -0,0 +1,110 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Quickicon.privacycheck
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Quickicon\PrivacyCheck\Extension;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\Event\SubscriberInterface;
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Plugin to check privacy requests older than 14 days
*
* @since 3.9.0
*/
final class PrivacyCheck extends CMSPlugin implements SubscriberInterface
{
/**
* Load plugin language files automatically
*
* @var boolean
* @since 3.9.0
*/
protected $autoloadLanguage = true;
/**
* Returns an array of events this subscriber will listen to.
*
* @return array
*
* @since 4.3.0
*/
public static function getSubscribedEvents(): array
{
return [
'onGetIcons' => 'onGetIcons',
];
}
/**
* Check privacy requests older than 14 days.
*
* @param QuickIconsEvent $event The event object
*
* @return void
*
* @since 3.9.0
*/
public function onGetIcons(QuickIconsEvent $event): void
{
$context = $event->getContext();
if (
$context !== $this->params->get('context', 'update_quickicon')
|| !$this->getApplication()->getIdentity()->authorise('core.admin', 'com_privacy')
|| !ComponentHelper::isEnabled('com_privacy')
) {
return;
}
$token = Session::getFormToken() . '=' . 1;
$privacy = 'index.php?option=com_privacy';
$options = [
'plg_quickicon_privacycheck_url' => Uri::base() . $privacy . '&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC',
'plg_quickicon_privacycheck_ajax_url' => Uri::base() . $privacy . '&task=getNumberUrgentRequests&format=json&' . $token,
'plg_quickicon_privacycheck_text' => [
"NOREQUEST" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_NOREQUEST'),
"REQUESTFOUND" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND'),
"ERROR" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_ERROR'),
"REQUESTFOUND_MESSAGE" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND_MESSAGE'),
"REQUESTFOUND_BUTTON" => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_REQUESTFOUND_BUTTON'),
],
];
$this->getApplication()->getDocument()->addScriptOptions('js-privacy-check', $options);
$this->getApplication()->getDocument()->getWebAssetManager()
->registerAndUseScript('plg_quickicon_privacycheck', 'plg_quickicon_privacycheck/privacycheck.js', [], ['defer' => true], ['core']);
// Add the icon to the result array
$result = $event->getArgument('result', []);
$result[] = [
[
'link' => $privacy . '&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC',
'image' => 'icon-users',
'icon' => '',
'text' => $this->getApplication()->getLanguage()->_('PLG_QUICKICON_PRIVACYCHECK_CHECKING'),
'id' => 'plg_quickicon_privacycheck',
'group' => 'MOD_QUICKICON_USERS',
],
];
$event->setArgument('result', $result);
}
}

View File

@@ -0,0 +1,2 @@
PLG_QUANTUMMANAGERICON="Icon - Quantum Manager Icon for Quick Launch"
PLG_QUANTUMMANAGERICON_XML_DESCRIPTION="Quantum Manager Icon for Quick Launch"

View File

@@ -0,0 +1,2 @@
PLG_QUANTUMMANAGERICON="Icon - Quantum Manager Icon for Quick Launch"
PLG_QUANTUMMANAGERICON_XML_DESCRIPTION="Quantum Manager Icon for Quick Launch"

View File

@@ -0,0 +1,2 @@
PLG_QUANTUMMANAGERICON="Иконка - Quantum Manager"
PLG_QUANTUMMANAGERICON_XML_DESCRIPTION="Иконка Quantum Manager для быстрого запуска"

View File

@@ -0,0 +1,2 @@
PLG_QUANTUMMANAGERICON="Иконка - Quantum Manager"
PLG_QUANTUMMANAGERICON_XML_DESCRIPTION="Иконка Quantum Manager для быстрого запуска"

View File

@@ -0,0 +1,51 @@
<?php
/**
* @package quantummanagericon
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
* @license GNU General Public License version 3 or later; see license.txt
* @link https://www.norrnext.com
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
/**
* Class plgQuickiconQuantummanagericon
*/
class plgQuickiconQuantummanagericon extends JPlugin
{
public function onGetIcons($context)
{
if (
$context !== $this->params->get('context', 'mod_quickicon') ||
!Factory::getUser()->authorise('core.manage', 'com_quantummanager')
)
{
return;
}
JLoader::register('QuantummanagerHelper', JPATH_ROOT . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
$icon = 'folder-open';
if (QuantummanagerHelper::isJoomla4())
{
$icon = 'icon-folder-open';
}
return [
[
'link' => 'index.php?option=com_quantummanager',
'image' => $icon,
'text' => 'Quantum Manager',
'id' => 'plg_quickicon_quantummanageicon',
]
];
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8" type="plugin" group="quickicon" method="upgrade">
<name>PLG_QUANTUMMANAGERICON</name>
<creationDate>30.06.2019</creationDate>
<version>1.3.2</version>
<author>Tsymbal</author>
<authorEmail>cymbal@delo-design.ru</authorEmail>
<authorUrl>https://www.norrnext.com</authorUrl>
<copyright>Copyright © 2019 Delo Design &amp; NorrNext. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see license.txt</license>
<description>PLG_QUANTUMMANAGERICON_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_quickicon_quantummanagericon.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_quickicon_quantummanagericon.sys.ini</language>
<language tag="ru-RU">ru-RU/ru-RU.plg_quickicon_quantummanagericon.ini</language>
<language tag="ru-RU">ru-RU/ru-RU.plg_quickicon_quantummanagericon.sys.ini</language>
</languages>
<files>
<filename plugin="quantummanagericon">quantummanagericon.php</filename>
<folder>language</folder>
</files>
<config>
<fields name="params">
<fieldset name="basic">
<field name="context" type="text" default="mod_quickicon" description="QUICKICON_GROUP" label="GROUP" />
</fieldset>
</fields>
</config>
</extension>

View File

@@ -0,0 +1,36 @@
<?php
/**
* @package quantummanagermedia
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
* @license GNU General Public License version 3 or later; see license.txt
* @link https://www.norrnext.com
*/
defined('_JEXEC') or die;
/**
* Quantummanagermedia script file.
*
* @package A package name
* @since 1.0
*/
class plgQuickiconQuantummanagericonInstallerScript
{
/**
* Called after any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function postflight($route, $adapter) {
$db = JFactory::getDbo();
$query = $db->getQuery( true );
$query->update( '#__extensions' )->set( 'enabled=1' )->where( 'type=' . $db->q( 'plugin' ) )->where( 'element=' . $db->q( 'quantummanagericon' ) );
$db->setQuery( $query )->execute();
}
}