File manager - Edit - /home/ferretapmx/public_html/akwarn.zip
Back
PK ��\�{� src/Extension/AKWarn.phpnu �[��� <?php /** * @package akeebabackup * @copyright Copyright 2006-2026 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ namespace Akeeba\Plugin\System\AKWarn\Extension; defined('_JEXEC') || die; use Joomla\CMS\Application\AdministratorApplication; use Joomla\CMS\Document\HtmlDocument; use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Uri\Uri; use Joomla\Event\Event; use Joomla\Event\SubscriberInterface; use Joomla\Filesystem\Folder; use Throwable; class AKWarn extends CMSPlugin implements SubscriberInterface { private const SAFE_FOLDERS = [ 'administrator', 'api', 'cli', 'components', 'files', 'images', 'includes', 'language', 'layouts', 'libraries', 'media', 'modules', 'plugins', 'templates', ]; /** * @inheritDoc * @since 10.2.0 */ public static function getSubscribedEvents(): array { return [ 'onAfterInitialise' => 'onAfterInitialise', 'onAfterDispatch' => 'showMessage', ]; } /** * Handles the onAfterInitialise event. Implements the file deletion action handler. * * @param Event $event The Joomla! event we are handling. * * @return void * @since 10.2.0 */ public function onAfterInitialise(Event $event): void { if (!$this->isAdminPanel()) { return; } $jInput = $this->getApplication()->getInput(); $toggleParam = $jInput->getCmd('_akeeba_backup_delete_leftovers', null); if ($toggleParam && ($toggleParam === $this->getApplication()->getSession()->getToken())) { $this->deleteFiles(); $uri = Uri::getInstance(); $uri->delVar('_akeeba_backup_delete_leftovers'); $this->getApplication()->redirect($uri->toString()); } } /** * Handles the onAfterDispatch event. Displays a message if leftover files are found. * * @param Event $event The Joomla! event we are handling. * * @return void * @since 10.2.0 */ public function showMessage(Event $event): void { if (!$this->isAdminPanel()) { return; } $dash = $this->getApplication()->getInput()->get('dashboard'); if (!empty($dash)) { return; } try { $leftoverFiles = $this->getLeftoverFiles(); } catch (\Throwable $e) { $leftoverFiles = []; } if (empty($leftoverFiles)) { return; } $this->loadLanguage(); asort($leftoverFiles); $path = PluginHelper::getLayoutPath('system', 'akwarn', 'leftovers'); @ob_start(); include $path; $text = @ob_get_clean(); $document = $this->getApplication()->getDocument(); if (!$document instanceof HtmlDocument) { return; } $buffer = $document->getBuffer('component'); $document->setBuffer( $text . $buffer, ['type' => 'component'] ); } /** * Are we a Super User logged into Joomla's administrator, accessing the Control Panel page? * * @return bool * @since 10.2.0 */ private function isAdminPanel(): bool { // Make sure this is the back-end try { $app = $this->getApplication(); } catch (Throwable $e) { return false; } if (!$app->isClient('administrator')) { return false; } // Make sure a user is logged in $user = $this->getApplication()->getIdentity(); if (!is_object($user) || $user->guest) { return false; } // Make sure the user is a Super User if (!$user->authorise('core.admin')) { return false; } // Make sure this is the Joomla control panel (com_cpanel) $option = $app->input->get('option', 'com_cpanel'); if ($option !== 'com_cpanel' && $option !== '') { return false; } return true; } /** * Return the detected leftover files. * * @return array * @since 10.2.0 */ private function getLeftoverFiles(): array { $files = []; try { $di = new \DirectoryIterator(JPATH_PUBLIC); } catch (Throwable $e) { return []; } /** @var \DirectoryIterator $file */ foreach ($di as $file) { try { $isDot = $file->isDot(); $isDir = $file->isDir(); $isFile = $file->isFile(); $pathname = $file->getPathname(); $basename = $file->getBasename(); $ext = $file->getExtension(); } catch (\Throwable $e) { continue; } if ($isDot) { continue; } if ($isDir) { if ($this->isInstallationFolder($pathname)) { $files[] = $basename; } continue; } if (!$isFile) { continue; } $isArchive = in_array($ext, ['zip', 'jpa', 'jps']); $isArchivePart = (str_starts_with($ext, 'z') || str_starts_with($ext, 'p')) && preg_match('/[pz][\d]]{2,}/', $ext); $isKickstart = $basename === 'kickstart.php' || ($ext === 'php' && str_contains($basename, 'kickstart')); if ($isArchive || $isArchivePart || $isKickstart) { $files[] = $basename; } } return $files; } /** * Delete leftover files. * * @return void * @since 10.2.0 */ private function deleteFiles(): void { $leftoverFiles = $this->getLeftoverFiles(); $fails = 0; $deleted = 0; if (empty($leftoverFiles)) { return; } foreach ($leftoverFiles as $file) { $filePath = JPATH_PUBLIC . '/' . $file; if (!file_exists($filePath)) { continue; } if (is_dir($filePath)) { if (!Folder::delete($filePath)) { $fails++; } else { $deleted++; } continue; } if (!@unlink($filePath)) { $fails++; } else { $deleted++; } } if ($deleted > 0) { $this->loadLanguage(); $this->getApplication()->enqueueMessage( Text::plural('PLG_SYSTEM_AKWARN_SUCCESS_DELETING_N_FILES', $deleted), 'success' ); } if ($fails > 0) { $this->loadLanguage(); $this->getApplication()->enqueueMessage( Text::plural('PLG_SYSTEM_AKWARN_ERR_DELETING_N_FILES', $fails), AdministratorApplication::MSG_ERROR ); } } /** * Does this look like a leftover installation folder? * * @param string $folder * * @return bool * @since 10.2.0 */ private function isInstallationFolder(string $folder): bool { /** * Check for the existence of the following files and folders (covers ANGIE and BRS): * index.php * version.php * src/Controller/AbstractSetup.php OR angie/controllers/base/main.php */ if (!@is_file($folder . '/index.php')) { return false; } if (!@is_file($folder . '/version.php')) { return false; } if (!@is_file($folder . '/src/Controller/AbstractSetup.php') && !@is_file($folder . '/angie/controllers/base/main.php')) { return false; } return true; } }PK ��\�Sʉ� � src/Extension/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\X� � � akwarn.xmlnu �[��� <?xml version="1.0" encoding="utf-8"?> <!--~ ~ @package akeebabackup ~ @copyright Copyright 2006-2026 Nicholas K. Dionysopoulos / Akeeba Ltd ~ @license GNU General Public License version 3, or later --> <extension type="plugin" group="system" method="upgrade"> <name>PLG_SYSTEM_AKWARN</name> <version>10.3.6</version> <creationDate>2026-06-22</creationDate> <author>Nicholas K. Dionysopoulos</author> <authorEmail>nicholas@dionysopoulos.me</authorEmail> <authorUrl>https://www.akeeba.com</authorUrl> <copyright>Copyright (c)2006-2025 Akeeba Ltd / Nicholas K. Dionysopoulos</copyright> <license>GNU General Public License version 3, or later</license> <description>PLG_SYSTEM_AKWARN_XML_DESCRIPTION</description> <namespace path="src">Akeeba\Plugin\System\AKWarn</namespace> <files> <folder plugin="akwarn">services</folder> <folder>src</folder> <folder>tmpl</folder> <filename>.htaccess</filename> <filename>web.config</filename> </files> <languages folder="language"> <language tag="en-GB">en-GB/plg_system_akwarn.ini</language> <language tag="en-GB">en-GB/plg_system_akwarn.sys.ini</language> <language tag="el-GR">el-GR/plg_system_akwarn.ini</language> <language tag="el-GR">el-GR/plg_system_akwarn.sys.ini</language> <language tag="fr-FR">fr-FR/plg_system_akwarn.ini</language> <language tag="fr-FR">fr-FR/plg_system_akwarn.sys.ini</language> <language tag="de-DE">de-DE/plg_system_akwarn.ini</language> <language tag="de-DE">de-DE/plg_system_akwarn.sys.ini</language> <language tag="es-ES">es-ES/plg_system_akwarn.ini</language> <language tag="es-ES">es-ES/plg_system_akwarn.sys.ini</language> <language tag="pt-PT">pt-PT/plg_system_akwarn.ini</language> <language tag="pt-PT">pt-PT/plg_system_akwarn.sys.ini</language> <language tag="it-IT">it-IT/plg_system_akwarn.ini</language> <language tag="it-IT">it-IT/plg_system_akwarn.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> </fieldset> </fields> </config> </extension>PK ��\0��t t tmpl/leftovers.phpnu �[��� <?php /** * @package akeebabackup * @copyright Copyright 2006-2026 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') || die; use Joomla\CMS\Factory; use Joomla\CMS\Uri\Uri; /** * @var array $leftoverFiles * @var \Akeeba\Plugin\System\AKWarn\Extension\AKWarn $this */ $l = Factory::getApplication()->getLanguage(); $hasKickstart = array_reduce($leftoverFiles, fn(bool $carry, string $x) => $carry || str_ends_with($x, '.php'), false); $hasArchives = array_reduce($leftoverFiles, fn(bool $carry, string $x) => $carry || str_ends_with($x, '.jpa') || str_ends_with($x, '.jps') || str_ends_with($x, '.zip'), false); $actionUri = clone Uri::getInstance(); $actionUri->setVar('_akeeba_backup_delete_leftovers', $this->getApplication()->getSession()->getToken()); ?> <div class="card border border-warning mb-3"> <h3 class="card-header bg-warning text-dark"> <span class="fa fa-fw fa-circle-exclamation me-2" aria-hidden="true"></span> <?= $l->_('PLG_SYSTEM_AKWARN_CARD_HEAD') ?> </h3> <div class="card-body p-3"> <p class="card-text"> <?= $l->_('PLG_SYSTEM_AKWARN_INFO') ?> </p> <p class="card-text"> <?= $l->_('PLG_SYSTEM_AKWARN_RECOMMEND_DELETE') ?> </p> <details> <summary> <?= $l->_('PLG_SYSTEM_AKWARN_DETECTED_FILES') ?> </summary> <ul> <?php foreach($leftoverFiles as $file): ?> <li><code><?php echo htmlentities($file) ?></code></li> <?php endforeach; ?> </ul> </details> <hr> <div class="d-flex flex-row flex-wrap align-items-baseline gap-3 justify-content-between" id="plg_system_akwarn_delete"> <a href="<?= $actionUri->toString() ?>" class="btn btn-primary"> <span class="fa fa-fw fa-trash-can" aria-hidden="true"></span> <?= $l->_('PLG_SYSTEM_AKWARN_DELETE_FILES') ?> </a> </div> </div> </div> PK ��\�Sʉ� � tmpl/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\eڮ�� � services/provider.phpnu �[��� <?php /** * @package akeebabackup * @copyright Copyright 2006-2026 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') or die; use Akeeba\Plugin\System\AKWarn\Extension\AKWarn; 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; return new class implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 10.2.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $config = (array) PluginHelper::getPlugin('system', 'akwarn'); $dispatcher = $container->get(DispatcherInterface::class); $plugin = version_compare(JVERSION, '5.4.0', 'ge') ? new AKWarn($config) : new AKWarn( $dispatcher, $config ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; PK ��\�Sʉ� � services/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\|��N web.confignu �[��� <?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>PK ��\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�{� src/Extension/AKWarn.phpnu �[��� PK ��\�Sʉ� � d src/Extension/.htaccessnu �7��m PK ��\�Sʉ� � � src/.htaccessnu �7��m PK ��\X� � � � akwarn.xmlnu �[��� PK ��\0��t t �% tmpl/leftovers.phpnu �[��� PK ��\�Sʉ� � o- tmpl/.htaccessnu �7��m PK ��\eڮ�� � �. services/provider.phpnu �[��� PK ��\�Sʉ� � ~3 services/.htaccessnu �7��m PK ��\|��N �4 web.confignu �[��� PK ��\�Sʉ� � �6 .htaccessnu �7��m PK "8
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.07 |
proxy
|
phpinfo
|
Settings