File manager - Edit - /home/ferretapmx/public_html/webinstaller.tar
Back
webinstaller.script.php 0000644 00000011454 15231065043 0011257 0 ustar 00 <?php /** * @package Joomla.Plugin * @subpackage Installer.webinstaller * * @copyright Copyright (C) 2013 - 2019 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; // If the minimum PHP version constant hasn't been defined (really old Joomla version), set it now if (!defined('JOOMLA_MINIMUM_PHP')) { // Minimum as of Joomla! 3.3 define('JOOMLA_MINIMUM_PHP', '5.3.10'); } // Stub the JInstallerScript class for older versions to perform the minimum required checks if (!class_exists('JInstallerScript')) { /** * Base install script for use by extensions providing helper methods for common behaviours. * * @since 3.6 */ class JInstallerScript { /** * Minimum PHP version required to install the extension * * @var string * @since 3.6 */ protected $minimumPhp; /** * Minimum Joomla! version required to install the extension * * @var string * @since 3.6 */ protected $minimumJoomla; /** * Function called before extension installation/update/removal procedure commences * * @param string $type The type of change (install, update or discover_install, not uninstall) * @param JInstallerAdapter $parent The class calling this method * * @return boolean True on success * * @since 3.6 */ public function preflight($type, $parent) { // Check for the minimum PHP version before continuing if (!empty($this->minimumPhp) && version_compare(PHP_VERSION, $this->minimumPhp, '<')) { JLog::add(JText::sprintf('JLIB_INSTALLER_MINIMUM_PHP', $this->minimumPhp), JLog::WARNING, 'jerror'); return false; } // Check for the minimum Joomla version before continuing if (!empty($this->minimumJoomla) && version_compare(JVERSION, $this->minimumJoomla, '<')) { JLog::add(JText::sprintf('JLIB_INSTALLER_MINIMUM_JOOMLA', $this->minimumJoomla), JLog::WARNING, 'jerror'); return false; } // Theoretically we should not reach this line in this stub because triggering it means we aren't matching the minimum Joomla version return true; } } } /** * Support for the "Install from Web" tab * * @since 1.0 */ class plginstallerwebinstallerInstallerScript extends JInstallerScript { /** * A list of files to be deleted * * @var array * @since 2.0 */ protected $deleteFiles = array( '/plugins/installer/webinstaller/css/client.css', '/plugins/installer/webinstaller/css/client.min.css', '/plugins/installer/webinstaller/css/index.html', '/plugins/installer/webinstaller/index.html', '/plugins/installer/webinstaller/js/client.js', '/plugins/installer/webinstaller/js/client.min.js', ); /** * A list of folders to be deleted * * @var array * @since 2.0 */ protected $deleteFolders = array( '/plugins/installer/webinstaller/css', '/plugins/installer/webinstaller/js', ); /** * Minimum PHP version required to install the extension * * @var string * @since 2.0 */ protected $minimumPhp = JOOMLA_MINIMUM_PHP; /** * Minimum Joomla! version required to install the extension * * @var string * @since 2.0 */ protected $minimumJoomla = '3.9'; /** * Function called before extension installation/update/removal procedure commences * * @param string $type The type of change (install, update or discover_install, not uninstall) * @param JInstallerAdapter $parent The class calling this method * * @return boolean True on success * * @since 3.6 */ public function preflight($type, $parent) { if (!parent::preflight($type, $parent)) { return false; } // Disallow installs on 4.0 as the plugin is part of core if (version_compare(JVERSION, '4.0', '>=')) { JLog::add(JText::_('PLG_INSTALLER_WEBINSTALLER_ERROR_PLUGIN_INCLUDED_IN_CORE'), JLog::WARNING, 'jerror'); return false; } return true; } /** * Function called after extension installation/update/removal procedure commences * * @param string $route The action being performed * @param JInstallerPlugin $adapter The class calling this method * * @return void * * @since 1.0 */ public function postflight($route, $adapter) { // When initially installing the plugin, enable it as well if ($route === 'install') { try { $db = JFactory::getDbo(); $db->setQuery( $db->getQuery(true) ->update($db->quoteName('#__extensions')) ->set($db->quoteName('enabled') . ' = 1') ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) ->where($db->quoteName('element') . ' = ' . $db->quote('webinstaller')) )->execute(); } catch (RuntimeException $e) { // Don't let this fatal out the install process, proceed as normal from here } } } } src/Extension/WebInstaller.php 0000644 00000012777 15231065043 0012430 0 ustar 00 <?php /** * @package Joomla.Plugin * @subpackage Installer.webinstaller * * @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\Installer\Web\Extension; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Event\Installer\AddInstallationTabEvent; use Joomla\CMS\Form\Rule\UrlRule; use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Updater\Update; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Version; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Support for the "Install from Web" tab * * @since 3.2 */ final class WebInstaller extends CMSPlugin implements SubscriberInterface { /** * The URL for the remote server. * * @var string * @since 4.0.0 */ public const REMOTE_URL = 'https://appscdn.joomla.org/webapps/'; /** * The application object. * * @var CMSApplication * @since 4.0.0 * @deprecated 6.0 Is needed for template overrides, use getApplication instead */ protected $app; /** * The URL to install from * * @var string|null * @since 4.0.0 */ private $installfrom = null; /** * Flag if the document is in a RTL direction * * @var integer|null * @since 4.0.0 */ private $rtl = null; /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.0.0 */ public static function getSubscribedEvents(): array { return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab']; } /** * Event listener for the `onInstallerAddInstallationTab` event. * * @param AddInstallationTabEvent $event The event instance * * @return void * * @since 4.0.0 */ public function onInstallerAddInstallationTab(AddInstallationTabEvent $event) { // Load language files $this->loadLanguage(); $installfrom = $this->getInstallFrom(); $doc = $this->getApplication()->getDocument(); $lang = $this->getApplication()->getLanguage(); // Push language strings to the JavaScript store Text::script('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN'); Text::script('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL'); $doc->getWebAssetManager() ->registerAndUseStyle('plg_installer_webinstaller.client', 'plg_installer_webinstaller/client.min.css') ->registerAndUseScript( 'plg_installer_webinstaller.client', 'plg_installer_webinstaller/client.min.js', [], ['type' => 'module'], ['core'] ); $devLevel = Version::PATCH_VERSION; if (!empty(Version::EXTRA_VERSION)) { $devLevel .= '-' . Version::EXTRA_VERSION; } $doc->addScriptOptions( 'plg_installer_webinstaller', [ 'base_url' => addslashes(self::REMOTE_URL), 'installat_url' => base64_encode(Uri::current() . '?option=com_installer&view=install'), 'installfrom_url' => addslashes($installfrom), 'product' => base64_encode(Version::PRODUCT), 'release' => base64_encode(Version::MAJOR_VERSION . '.' . Version::MINOR_VERSION), 'dev_level' => base64_encode($devLevel), 'installfromon' => $installfrom ? 1 : 0, 'language' => base64_encode($lang->getTag()), 'installFrom' => $installfrom != '' ? 4 : 5, ] ); $tab = [ 'name' => 'web', 'label' => $lang->_('PLG_INSTALLER_WEBINSTALLER_TAB_LABEL'), ]; // Render the input ob_start(); include PluginHelper::getLayoutPath('installer', 'webinstaller'); $tab['content'] = ob_get_clean(); $tab['content'] = '<legend>' . $tab['label'] . '</legend>' . $tab['content']; $event->addResult($tab); } /** * Internal check to determine if the output is in a RTL direction * * @return integer * * @since 3.2 */ private function isRTL() { if ($this->rtl === null) { $this->rtl = strtolower($this->getApplication()->getDocument()->getDirection()) === 'rtl' ? 1 : 0; } return $this->rtl; } /** * Get the install from URL * * @return string * * @since 3.2 */ private function getInstallFrom() { if ($this->installfrom === null) { $installfrom = base64_decode($this->getApplication()->getInput()->getBase64('installfrom', '')); $field = new \SimpleXMLElement('<field></field>'); if ((new UrlRule())->test($field, $installfrom) && preg_match('/\.xml\s*$/', $installfrom)) { $update = new Update(); $update->loadFromXml($installfrom); $package_url = trim($update->get('downloadurl', false)->_data); if ($package_url) { $installfrom = $package_url; } } $this->installfrom = $installfrom; } return $this->installfrom; } } src/Extension/.htaccess 0000555 00000000355 15231065043 0011110 0 ustar 00 <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>