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,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" method="upgrade">
<name>com_admin</name>
<author>Joomla! Project</author>
<creationDate>2006-04</creationDate>
<copyright>(C) 2006 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>COM_ADMIN_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Component\Admin</namespace>
<media />
<administration>
<files folder="admin">
<filename>admin.xml</filename>
<filename>script.php</filename>
<folder>forms</folder>
<folder>postinstall</folder>
<folder>services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/com_admin.ini</language>
<language tag="en-GB">language/en-GB/com_admin.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for notifying users of a change
* in the default .htaccess and web.config files.
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Notifies users of the add the nosniff headers by applying the changes from the default .htaccess or web.config file
*
* This check returns true regardless of condition.
*
* @return boolean
*
* @since 3.4
*/
function admin_postinstall_addnosniff_condition()
{
return true;
}

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Path;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Notifies users of the new Behind Load Balancer option in Global Config, if we detect they might be behind a proxy
*
* @return boolean
*
* @since 3.9.26
*/
function admin_postinstall_behindproxy_condition()
{
$app = Factory::getApplication();
if ($app->get('behind_loadbalancer', '0')) {
return false;
}
if (\array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return true;
}
if (\array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) {
return true;
}
return false;
}
/**
* Enables the Behind Load Balancer setting in Global Configuration
*
* @return void
*
* @since 3.9.26
*/
function behindproxy_postinstall_action()
{
$prev = ArrayHelper::fromObject(new JConfig());
$data = array_merge($prev, ['behind_loadbalancer' => '1']);
$config = new Registry($data);
// Set the configuration file path.
$file = JPATH_CONFIGURATION . '/configuration.php';
// Attempt to make the file writeable
if (Path::isOwner($file) && !Path::setPermissions($file, '0644')) {
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'error');
return;
}
// Attempt to write the configuration file as a PHP class named JConfig.
$configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]);
if (!File::write($file, $configuration)) {
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
return;
}
// Attempt to make the file unwriteable
if (Path::isOwner($file) && !Path::setPermissions($file, '0444')) {
Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'), 'error');
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for notifying users of a change
* in the default .htaccess file regarding setting the Content-Encoding header.
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Notifies users of a change in the default .htaccess file regarding setting the Content-Encoding header
*
* This check returns true regardless of condition.
*
* @return boolean
*
* @since 4.2.9
*/
function admin_postinstall_htaccesssetce_condition()
{
return true;
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for notifying users of a change
* in the default .htaccess file regarding hardening against XSS in SVG's
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Notifies users of a change in the default .htaccess file regarding hardening against XSS in SVG's
*
* This check returns true regardless of condition.
*
* @return boolean
*
* @since 3.9.21
*/
function admin_postinstall_htaccesssvg_condition()
{
return true;
}

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for the checks if the installation is
* affected by the issue with content languages access in 3.4.0
*/
use Joomla\CMS\Factory;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Checks if the installation is affected by the issue with content languages access in 3.4.0
*
* @link https://github.com/joomla/joomla-cms/pull/6172
* @link https://github.com/joomla/joomla-cms/pull/6194
*
* @return boolean
*
* @since 3.4.1
*/
function admin_postinstall_languageaccess340_condition()
{
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('access'))
->from($db->quoteName('#__languages'))
->where($db->quoteName('access') . ' = ' . $db->quote('0'));
$db->setQuery($query);
$db->execute();
$numRows = $db->getNumRows();
if (isset($numRows) && $numRows != 0) {
// We have rows here so we have at minimum one row with access set to 0
return true;
}
// All good the query return nothing.
return false;
}

View File

@ -0,0 +1,27 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for the checking minimum PHP version support
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Alerts the user we are collecting anonymous data as of Joomla 3.5.0.
*
* @return boolean
*
* @since 3.5
*/
function admin_postinstall_statscollection_condition()
{
return true;
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This file contains post-installation message handling for notifying users of a change
* in the default textfilter settings
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Notifies users the changes from the default textfilter.
*
* This check returns true regardless of condition.
*
* @return boolean
*
* @since 3.9.19
*/
function admin_postinstall_textfilter3919_condition()
{
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2018 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\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
use Joomla\CMS\HTML\Registry;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Component\Admin\Administrator\Extension\AdminComponent;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The admin service provider.
*
* @since 4.0.0
*/
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->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Admin'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Admin'));
$container->set(
ComponentInterface::class,
function (Container $container) {
$component = new AdminComponent($container->get(ComponentDispatcherFactoryInterface::class));
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
$component->setRegistry($container->get(Registry::class));
return $component;
}
);
}
};

View File

@ -0,0 +1 @@
DROP TABLE IF EXISTS `#__utf8_conversion`;

View File

@ -0,0 +1 @@
DELETE FROM `#__scheduler_tasks` WHERE `type` = 'demoTask_r1.sleep';

View File

@ -0,0 +1,2 @@
ALTER TABLE `#__menu_types` ADD COLUMN `ordering` int NOT NULL DEFAULT 0 AFTER `client_id` /** CAN FAIL **/;
UPDATE `#__menu_types` SET `ordering` = `id` WHERE `client_id` = 0;

View File

@ -0,0 +1,23 @@
--
-- Table structure for table `#__schemaorg`
--
CREATE TABLE IF NOT EXISTS `#__schemaorg` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`itemId` int unsigned,
`context` varchar(100),
`schemaType` varchar(100),
`schema` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
-- Add plugins to `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_schemaorg_blogposting', 'plugin', 'blogposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 1, 0),
(0, 'plg_schemaorg_book', 'plugin', 'book', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 2, 0),
(0, 'plg_schemaorg_event', 'plugin', 'event', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 3, 0),
(0, 'plg_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 4, 0),
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 5, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);

View File

@ -0,0 +1,3 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`)
SELECT 0, 'plg_behaviour_compat', 'plugin', 'compat', 'behaviour', 0, 1, 1, 0, 1, '', '{"classes_aliases":"1","es5_assets":"1"}', '', -1, 0
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'compat' AND e.`folder` = 'behaviour' AND e.`client_id` = 0);

View File

@ -0,0 +1,17 @@
--
-- Attention: In the below SQL statements, the value of the filter is unescaped, i.e. uses "\\", while
-- in base.sql the same value is using "\\\\". This is expected because of how JSON_REPLACE works.
--
UPDATE `#__extensions`
SET `params` = JSON_REPLACE(`params`, '$.filter' , '\\Joomla\\CMS\\Component\\ComponentHelper::filterText')
WHERE `type` = 'plugin'
AND `folder` = 'fields'
AND `element` IN ('editor', 'text', 'textarea')
AND `params` <> ''
AND JSON_EXTRACT(`params`, '$.filter') = 'JComponentHelper::filterText';
UPDATE `#__fields`
SET `fieldparams` = JSON_REPLACE(`fieldparams`, '$.filter' , '\\Joomla\\CMS\\Component\\ComponentHelper::filterText')
WHERE `type` IN ('editor', 'text', 'textarea')
AND `fieldparams` <> ''
AND JSON_EXTRACT(`fieldparams`, '$.filter') = 'JComponentHelper::filterText';

View File

@ -0,0 +1,3 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_task_globalcheckin', 'plugin', 'globalcheckin', 'task', 0, 1, 1, 0, 0, '', '{}', '', 5, 0);

View File

@ -0,0 +1,13 @@
UPDATE `#__guidedtours` SET `extensions` = '["com_content","com_categories"]' WHERE `url` LIKE '%option=com_content%';
UPDATE `#__guidedtours` SET `extensions` = '["com_content","com_categories"]' WHERE `url` LIKE '%option=com_categories%';
UPDATE `#__guidedtours` SET `extensions` = '["com_menus"]' WHERE `url` LIKE '%com_menus%';
UPDATE `#__guidedtours` SET `extensions` = '["com_tags"]' WHERE `url` LIKE '%com_tags%';
UPDATE `#__guidedtours` SET `extensions` = '["com_banners"]' WHERE `url` LIKE '%com_banners%';
UPDATE `#__guidedtours` SET `extensions` = '["com_contact"]' WHERE `url` LIKE '%com_contact%';
UPDATE `#__guidedtours` SET `extensions` = '["com_newsfeeds"]' WHERE `url` LIKE '%com_newsfeeds%';
UPDATE `#__guidedtours` SET `extensions` = '["com_finder"]' WHERE `url` LIKE '%com_finder%';
UPDATE `#__guidedtours` SET `extensions` = '["com_users"]' WHERE `url` LIKE '%com_users%';
UPDATE `#__update_sites`
SET `location` = 'https://update.joomla.org/language/translationlist_5.xml'
WHERE `location` = 'https://update.joomla.org/language/translationlist_4.xml';

View File

@ -0,0 +1,14 @@
ALTER TABLE `#__guidedtours` ADD COLUMN `uid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL AFTER `title`/** CAN FAIL **/;
ALTER TABLE `#__guidedtours` ADD INDEX `idx_uid` (`uid`(191)) /** CAN FAIL **/;
UPDATE `#__guidedtours` SET `uid` = 'joomla-guidedtours' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_GUIDEDTOURS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-guidedtoursteps' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_GUIDEDTOURSTEPS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-articles' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_ARTICLES_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-categories' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_CATEGORIES_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-menus' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_MENUS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-tags' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_TAGS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-banners' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_BANNERS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-contacts' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_CONTACTS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-newsfeeds' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_NEWSFEEDS_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-smartsearch' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_SMARTSEARCH_TITLE';
UPDATE `#__guidedtours` SET `uid` = 'joomla-users' WHERE `title` = 'COM_GUIDEDTOURS_TOUR_USERS_TITLE';

View File

@ -0,0 +1,3 @@
UPDATE `#__extensions`
SET `locked` = 0
WHERE `type` = 'plugin' AND `element` = 'recaptcha_invisible' AND `folder` = 'captcha';

View File

@ -0,0 +1,14 @@
INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
('plg_task_deleteactionlogs', 'plugin', 'deleteactionlogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_privacyconsent', 'plugin', 'privacyconsent', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_rotatelogs', 'plugin', 'rotatelogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_sessiongc', 'plugin', 'sessiongc', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0);
INSERT INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES
('plg_task_privacyconsent.request.reminder', 'plg_task_privacyconsent', '', 'PLG_TASK_PRIVACYCONSENT_EMAIL_REMIND_SUBJECT', 'PLG_TASK_PRIVACYCONSENT_EMAIL_REMIND_BODY', '', '', '{"tags":["sitename","url","tokenurl","formurl","token"]}'),
('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}');
DELETE FROM `#__mail_templates` WHERE `template_id` IN ('plg_system_privacyconsent.request.reminder', 'plg_system_updatenotification.mail');
DELETE FROM `#__postinstall_messages` WHERE `condition_file` = 'site://plugins/system/updatenotification/postinstall/updatecachetime.php';

View File

@ -0,0 +1,5 @@
UPDATE `#__scheduler_tasks` SET `title` = 'Delete Action Logs' WHERE `type` = 'delete.actionlogs' AND `title` = 'DeleteActionLogs';
UPDATE `#__scheduler_tasks` SET `title` = 'Privacy Consent' WHERE `type` = 'privacy.consent' AND `title` = 'PrivacyConsent';
UPDATE `#__scheduler_tasks` SET `title` = 'Rotate Logs' WHERE `type` = 'rotation.logs' AND `title` = 'RotateLogs';
UPDATE `#__scheduler_tasks` SET `title` = 'Session GC' WHERE `type` = 'session.gc' AND `title` = 'SessionGC';
UPDATE `#__scheduler_tasks` SET `title` = 'Update Notification' WHERE `type` = 'update.notification' AND `title` = 'UpdateNotification';

View File

@ -0,0 +1,5 @@
-- Add com_fields to action logs
INSERT INTO `#__action_logs_extensions` (`extension`) VALUES ('com_fields');
INSERT INTO `#__action_log_config` (`type_title`, `type_alias`, `id_holder`, `title_holder`, `table_name`, `text_prefix`) VALUES
('field', 'com_fields.field', 'id', 'title', '#__fields', 'PLG_ACTIONLOG_JOOMLA');

View File

@ -0,0 +1 @@
UPDATE `#__extensions` SET `enabled` = 1 WHERE `type` = 'plugin' AND `element` = 'schedulerunner' AND `folder` = 'system';

View File

@ -0,0 +1 @@
DROP TABLE IF EXISTS "#__utf8_conversion";

View File

@ -0,0 +1 @@
DELETE FROM "#__scheduler_tasks" WHERE "type" = 'demoTask_r1.sleep';

View File

@ -0,0 +1,2 @@
ALTER TABLE "#__menu_types" ADD COLUMN "ordering" int NOT NULL DEFAULT 0 /** CAN FAIL **/;
UPDATE "#__menu_types" SET "ordering" = "id" WHERE "client_id" = 0;

View File

@ -0,0 +1,23 @@
--
-- Table structure for table "#__schemaorg"
--
CREATE TABLE IF NOT EXISTS "#__schemaorg" (
"id" serial NOT NULL,
"itemId" bigint,
"context" varchar(100),
"schemaType" varchar(100),
"schema" text,
PRIMARY KEY ("id")
);
-- Add plugins to "#__extensions"
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_schemaorg_blogposting', 'plugin', 'blogposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 1, 0),
(0, 'plg_schemaorg_book', 'plugin', 'book', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 2, 0),
(0, 'plg_schemaorg_event', 'plugin', 'event', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 3, 0),
(0, 'plg_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 4, 0),
(0, 'plg_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 5, 0),
(0, 'plg_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 6, 0),
(0, 'plg_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 1, 1, 0, 0, '', '{}', '', 7, 0),
(0, 'plg_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 1, 1, 0, 0, '', '{}', '', 0, 0);

View File

@ -0,0 +1,3 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state")
SELECT 0, 'plg_behaviour_compat', 'plugin', 'compat', 'behaviour', 0, 1, 1, 0, 1, '', '{"classes_aliases":"1","es5_assets":"1"}', '', -1, 0
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'compat' AND e."folder" = 'behaviour' AND e."client_id" = 0);

View File

@ -0,0 +1,13 @@
UPDATE "#__extensions"
SET "params" = jsonb_set("params"::jsonb, '{filter}' , '"\\\\Joomla\\\\CMS\\\\Component\\\\ComponentHelper::filterText"')
WHERE "type" = 'plugin'
AND "folder" = 'fields'
AND "element" IN ('editor', 'text', 'textarea')
AND "params" <> ''
AND "params"::jsonb->>'filter' = 'JComponentHelper::filterText';
UPDATE "#__fields"
SET "fieldparams" = jsonb_set("fieldparams"::jsonb, '{filter}' , '"\\\\Joomla\\\\CMS\\\\Component\\\\ComponentHelper::filterText"')
WHERE "type" IN ('editor', 'text', 'textarea')
AND "fieldparams" <> ''
AND "fieldparams"::jsonb->>'filter' = 'JComponentHelper::filterText';

View File

@ -0,0 +1,3 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_task_globalcheckin', 'plugin', 'globalcheckin', 'task', 0, 1, 1, 0, 0, '', '{}', '', 5, 0);

View File

@ -0,0 +1,14 @@
UPDATE "#__guidedtours" SET "extensions" = '["com_content","com_categories"]' WHERE "url" LIKE '%option=com_content%';
UPDATE "#__guidedtours" SET "extensions" = '["com_content","com_categories"]' WHERE "url" LIKE '%option=com_categories%';
UPDATE "#__guidedtours" SET "extensions" = '["com_menus"]' WHERE "url" LIKE '%com_menus%';
UPDATE "#__guidedtours" SET "extensions" = '["com_tags"]' WHERE "url" LIKE '%com_tags%';
UPDATE "#__guidedtours" SET "extensions" = '["com_banners"]' WHERE "url" LIKE '%com_banners%';
UPDATE "#__guidedtours" SET "extensions" = '["com_contact"]' WHERE "url" LIKE '%com_contact%';
UPDATE "#__guidedtours" SET "extensions" = '["com_newsfeeds"]' WHERE "url" LIKE '%com_newsfeeds%';
UPDATE "#__guidedtours" SET "extensions" = '["com_finder"]' WHERE "url" LIKE '%com_finder%';
UPDATE "#__guidedtours" SET "extensions" = '["com_users"]' WHERE "url" LIKE '%com_users%';
UPDATE "#__update_sites"
SET "location" = 'https://update.joomla.org/language/translationlist_5.xml'
WHERE "location" = 'https://update.joomla.org/language/translationlist_4.xml';

View File

@ -0,0 +1,14 @@
ALTER TABLE "#__guidedtours" ADD COLUMN "uid" varchar(255) DEFAULT '' NOT NULL /** CAN FAIL **/;
CREATE INDEX "#__guidedtours_idx_uid" ON "#__guidedtours" ("uid") /** CAN FAIL **/;
UPDATE "#__guidedtours" SET "uid" = 'joomla-guidedtours' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_GUIDEDTOURS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-guidedtoursteps' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_GUIDEDTOURSTEPS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-articles' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_ARTICLES_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-categories' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_CATEGORIES_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-menus' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_MENUS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-tags' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_TAGS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-banners' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_BANNERS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-contacts' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_CONTACTS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-newsfeeds' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_NEWSFEEDS_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-smartsearch' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_SMARTSEARCH_TITLE';
UPDATE "#__guidedtours" SET "uid" = 'joomla-users' WHERE "title" = 'COM_GUIDEDTOURS_TOUR_USERS_TITLE';

View File

@ -0,0 +1,3 @@
UPDATE "#__extensions"
SET "locked" = 0
WHERE "type" = 'plugin' AND "element" = 'recaptcha_invisible' AND "folder" = 'captcha';

View File

@ -0,0 +1,14 @@
INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "checked_out", "checked_out_time", "ordering", "state") VALUES
('plg_task_deleteactionlogs', 'plugin', 'deleteactionlogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_privacyconsent', 'plugin', 'privacyconsent', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_rotatelogs', 'plugin', 'rotatelogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_sessiongc', 'plugin', 'sessiongc', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0),
('plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0);
INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES
('plg_task_privacyconsent.request.reminder', 'plg_task_privacyconsent', '', 'PLG_TASK_PRIVACYCONSENT_EMAIL_REMIND_SUBJECT', 'PLG_TASK_PRIVACYCONSENT_EMAIL_REMIND_BODY', '', '', '{"tags":["sitename","url","tokenurl","formurl","token"]}'),
('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}');
DELETE FROM "#__mail_templates" WHERE "template_id" IN ('plg_system_privacyconsent.request.reminder', 'plg_system_updatenotification.mail');
DELETE FROM "#__postinstall_messages" WHERE "condition_file" = 'site://plugins/system/updatenotification/postinstall/updatecachetime.php';

View File

@ -0,0 +1,5 @@
UPDATE "#__scheduler_tasks" SET "title" = 'Delete Action Logs' WHERE "type" = 'delete.actionlogs' AND "title" = 'DeleteActionLogs';
UPDATE "#__scheduler_tasks" SET "title" = 'Privacy Consent' WHERE "type" = 'privacy.consent' AND "title" = 'PrivacyConsent';
UPDATE "#__scheduler_tasks" SET "title" = 'Rotate Logs' WHERE "type" = 'rotation.logs' AND "title" = 'RotateLogs';
UPDATE "#__scheduler_tasks" SET "title" = 'Session GC' WHERE "type" = 'session.gc' AND "title" = 'SessionGC';
UPDATE "#__scheduler_tasks" SET "title" = 'Update Notification' WHERE "type" = 'update.notification' AND "title" = 'UpdateNotification';

View File

@ -0,0 +1,5 @@
-- Add com_fields to action logs extensions
INSERT INTO "#__action_logs_extensions" ("extension") VALUES ('com_fields');
INSERT INTO "#__action_log_config" ("type_title", "type_alias", "id_holder", "title_holder", "table_name", "text_prefix") VALUES
('field', 'com_fields.field', 'id', 'title', '#__fields', 'PLG_ACTIONLOG_JOOMLA');

View File

@ -0,0 +1 @@
UPDATE "#__extensions" SET "enabled" = 1 WHERE "type" = 'plugin' AND "element" = 'schedulerunner' AND "folder" = 'system';

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\Controller;
use Joomla\CMS\MVC\Controller\BaseController;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Admin Controller
*
* @since 1.6
*/
class DisplayController extends BaseController
{
/**
* View method
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types.
* @see \Joomla\CMS\Filter\InputFilter::clean() for valid values.
*
* @return static Supports chaining.
*
* @since 3.9
*/
public function display($cachable = false, $urlparams = [])
{
$viewName = $this->input->get('view', $this->default_view);
$format = $this->input->get('format', 'html');
// Check CSRF token for sysinfo export views
if ($viewName === 'sysinfo' && ($format === 'text' || $format === 'json')) {
// Check for request forgeries.
$this->checkToken('GET');
}
return parent::display($cachable, $urlparams);
}
}

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\Dispatcher;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* ComponentDispatcher class for com_admin
*
* @since 4.0.0
*/
class Dispatcher extends ComponentDispatcher
{
/**
* com_admin does not require check permission, so we override checkAccess method and have it empty
*
* @return void
*/
protected function checkAccess()
{
}
}

View File

@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Extension;
use Joomla\CMS\Extension\BootableExtensionInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
use Joomla\Component\Admin\Administrator\Service\HTML\Configuration;
use Joomla\Component\Admin\Administrator\Service\HTML\Directory;
use Joomla\Component\Admin\Administrator\Service\HTML\PhpSetting;
use Joomla\Component\Admin\Administrator\Service\HTML\System;
use Psr\Container\ContainerInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Component class for com_admin
*
* @since 4.0.0
*/
class AdminComponent extends MVCComponent implements BootableExtensionInterface
{
use HTMLRegistryAwareTrait;
/**
* Booting the extension. This is the function to set up the environment of the extension like
* registering new class loaders, etc.
*
* If required, some initial set up can be done from services of the container, eg.
* registering HTML services.
*
* @param ContainerInterface $container The container
*
* @return void
*
* @since 4.0.0
*/
public function boot(ContainerInterface $container)
{
$this->getRegistry()->register('system', new System());
$this->getRegistry()->register('phpsetting', new PhpSetting());
$this->getRegistry()->register('directory', new Directory());
$this->getRegistry()->register('configuration', new Configuration());
}
}

View File

@ -0,0 +1,189 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Model;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Help\Help;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\String\StringHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Admin Component Help Model
*
* @since 1.6
*/
class HelpModel extends BaseDatabaseModel
{
/**
* The search string
*
* @var string
* @since 1.6
*/
protected $help_search = null;
/**
* The page to be viewed
*
* @var string
* @since 1.6
*/
protected $page = null;
/**
* The ISO language tag
*
* @var string
* @since 1.6
*/
protected $lang_tag = null;
/**
* Table of contents
*
* @var array
* @since 1.6
*/
protected $toc = [];
/**
* URL for the latest version check
*
* @var string
* @since 1.6
*/
protected $latest_version_check = null;
/**
* Method to get the help search string
*
* @return string Help search string
*
* @since 1.6
*/
public function &getHelpSearch()
{
if (\is_null($this->help_search)) {
$this->help_search = Factory::getApplication()->getInput()->getString('helpsearch');
}
return $this->help_search;
}
/**
* Method to get the page
*
* @return string The page
*
* @since 1.6
*/
public function &getPage()
{
if (\is_null($this->page)) {
$this->page = Help::createUrl(Factory::getApplication()->getInput()->get('page', 'Start_Here'));
}
return $this->page;
}
/**
* Method to get the lang tag
*
* @return string lang iso tag
*
* @since 1.6
*/
public function getLangTag()
{
if (\is_null($this->lang_tag)) {
$this->lang_tag = Factory::getLanguage()->getTag();
if (!is_dir(JPATH_BASE . '/help/' . $this->lang_tag)) {
// Use English as fallback
$this->lang_tag = 'en-GB';
}
}
return $this->lang_tag;
}
/**
* Method to get the table of contents
*
* @return array Table of contents
*/
public function &getToc()
{
if (\count($this->toc)) {
return $this->toc;
}
// Get vars
$lang_tag = $this->getLangTag();
$help_search = $this->getHelpSearch();
// New style - Check for a TOC \JSON file
if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')) {
$data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'));
// Loop through the data array
foreach ($data as $key => $value) {
$this->toc[$key] = Text::_('COM_ADMIN_HELP_' . $value);
}
// Sort the Table of Contents
asort($this->toc);
return $this->toc;
}
// Get Help files
$files = Folder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$');
foreach ($files as $file) {
$buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file);
if (!preg_match('#<title>(.*?)</title>#', $buffer, $m)) {
continue;
}
$title = trim($m[1]);
if (!$title) {
continue;
}
// Translate the page title
$title = Text::_($title);
// Strip the extension
$file = preg_replace('#\.xml$|\.html$#', '', $file);
if ($help_search && StringHelper::strpos(StringHelper::strtolower(strip_tags($buffer)), StringHelper::strtolower($help_search)) === false) {
continue;
}
// Add an item in the Table of Contents
$this->toc[$file] = $title;
}
// Sort the Table of Contents
asort($this->toc);
return $this->toc;
}
}

View File

@ -0,0 +1,732 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Model;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Extension\ExtensionHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Version;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Model for the display of system information.
*
* @since 1.6
*/
class SysinfoModel extends BaseDatabaseModel
{
/**
* Some PHP settings
*
* @var array
* @since 1.6
*/
protected $php_settings = [];
/**
* Config values
*
* @var array
* @since 1.6
*/
protected $config = [];
/**
* Some system values
*
* @var array
* @since 1.6
*/
protected $info = [];
/**
* PHP info
*
* @var string
* @since 1.6
*/
protected $php_info = null;
/**
* Array containing the phpinfo() data.
*
* @var array
*
* @since 3.5
*/
protected $phpInfoArray;
/**
* Private/critical data that we don't want to share
*
* @var array
*
* @since 3.5
*/
protected $privateSettings = [
'phpInfoArray' => [
'CONTEXT_DOCUMENT_ROOT',
'Cookie',
'DOCUMENT_ROOT',
'extension_dir',
'error_log',
'Host',
'HTTP_COOKIE',
'HTTP_HOST',
'HTTP_ORIGIN',
'HTTP_REFERER',
'HTTP Request',
'include_path',
'mysql.default_socket',
'MYSQL_SOCKET',
'MYSQL_INCLUDE',
'MYSQL_LIBS',
'mysqli.default_socket',
'MYSQLI_SOCKET',
'PATH',
'Path to sendmail',
'pdo_mysql.default_socket',
'Referer',
'REMOTE_ADDR',
'SCRIPT_FILENAME',
'sendmail_path',
'SERVER_ADDR',
'SERVER_ADMIN',
'Server Administrator',
'SERVER_NAME',
'Server Root',
'session.name',
'session.save_path',
'upload_tmp_dir',
'User/Group',
'open_basedir',
],
'other' => [
'db',
'dbprefix',
'fromname',
'live_site',
'log_path',
'mailfrom',
'memcached_server_host',
'open_basedir',
'Origin',
'proxy_host',
'proxy_user',
'proxy_pass',
'redis_server_host',
'redis_server_auth',
'secret',
'sendmail',
'session.save_path',
'session_memcached_server_host',
'session_redis_server_host',
'session_redis_server_auth',
'sitename',
'smtphost',
'tmp_path',
'open_basedir',
],
];
/**
* System values that can be "safely" shared
*
* @var array
*
* @since 3.5
*/
protected $safeData;
/**
* Information about writable state of directories
*
* @var array
* @since 1.6
*/
protected $directories = [];
/**
* The current editor.
*
* @var string
* @since 1.6
*/
protected $editor = null;
/**
* Remove sections of data marked as private in the privateSettings
*
* @param array $dataArray Array with data that may contain private information
* @param string $dataType Type of data to search for a specific section in the privateSettings array
*
* @return array
*
* @since 3.5
*/
protected function cleanPrivateData(array $dataArray, string $dataType = 'other'): array
{
$dataType = isset($this->privateSettings[$dataType]) ? $dataType : 'other';
$privateSettings = $this->privateSettings[$dataType];
if (!$privateSettings) {
return $dataArray;
}
foreach ($dataArray as $section => $values) {
if (\is_array($values)) {
$dataArray[$section] = $this->cleanPrivateData($values, $dataType);
}
if (\in_array($section, $privateSettings, true)) {
$dataArray[$section] = $this->cleanSectionPrivateData($values);
}
}
return $dataArray;
}
/**
* Obfuscate section values
*
* @param mixed $sectionValues Section data
*
* @return string|array
*
* @since 3.5
*/
protected function cleanSectionPrivateData($sectionValues)
{
if (!\is_array($sectionValues)) {
if (strstr($sectionValues, JPATH_ROOT)) {
$sectionValues = 'xxxxxx';
}
return \strlen($sectionValues) ? 'xxxxxx' : '';
}
foreach ($sectionValues as $setting => $value) {
$sectionValues[$setting] = \strlen($value) ? 'xxxxxx' : '';
}
return $sectionValues;
}
/**
* Method to get the PHP settings
*
* @return array Some PHP settings
*
* @since 1.6
*/
public function &getPhpSettings(): array
{
if (!empty($this->php_settings)) {
return $this->php_settings;
}
$this->php_settings = [
'memory_limit' => ini_get('memory_limit'),
'upload_max_filesize' => ini_get('upload_max_filesize'),
'post_max_size' => ini_get('post_max_size'),
'display_errors' => ini_get('display_errors') == '1',
'short_open_tag' => ini_get('short_open_tag') == '1',
'file_uploads' => ini_get('file_uploads') == '1',
'output_buffering' => (int) ini_get('output_buffering') !== 0,
'open_basedir' => ini_get('open_basedir'),
'session.save_path' => ini_get('session.save_path'),
'session.auto_start' => ini_get('session.auto_start'),
'disable_functions' => ini_get('disable_functions'),
'xml' => \extension_loaded('xml'),
'zlib' => \extension_loaded('zlib'),
'zip' => \function_exists('zip_open') && \function_exists('zip_read'),
'mbstring' => \extension_loaded('mbstring'),
'fileinfo' => \extension_loaded('fileinfo'),
'gd' => \extension_loaded('gd'),
'iconv' => \function_exists('iconv'),
'intl' => \function_exists('transliterator_transliterate'),
'max_input_vars' => ini_get('max_input_vars'),
];
return $this->php_settings;
}
/**
* Method to get the config
*
* @return array config values
*
* @since 1.6
*/
public function &getConfig(): array
{
if (!empty($this->config)) {
return $this->config;
}
$registry = new Registry(new \JConfig());
$this->config = $registry->toArray();
$hidden = [
'host', 'user', 'password', 'ftp_user', 'ftp_pass',
'smtpuser', 'smtppass', 'redis_server_auth', 'session_redis_server_auth',
'proxy_user', 'proxy_pass', 'secret',
];
foreach ($hidden as $key) {
$this->config[$key] = 'xxxxxx';
}
return $this->config;
}
/**
* Method to get the system information
*
* @return array System information values
*
* @since 1.6
*/
public function &getInfo(): array
{
if (!empty($this->info)) {
return $this->info;
}
$db = $this->getDatabase();
$this->info = [
'php' => php_uname(),
'dbserver' => $db->getServerType(),
'dbversion' => $db->getVersion(),
'dbcollation' => $db->getCollation(),
'dbconnectioncollation' => $db->getConnectionCollation(),
'dbconnectionencryption' => $db->getConnectionEncryption(),
'dbconnencryptsupported' => $db->isConnectionEncryptionSupported(),
'phpversion' => PHP_VERSION,
'server' => $_SERVER['SERVER_SOFTWARE'] ?? getenv('SERVER_SOFTWARE'),
'sapi_name' => PHP_SAPI,
'version' => (new Version())->getLongVersion(),
'compatpluginenabled' => PluginHelper::isEnabled('behaviour', 'compat'),
'compatpluginparameters' => $this->getCompatPluginParameters(),
'useragent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
];
return $this->info;
}
private function getCompatPluginParameters()
{
$record = ExtensionHelper::getExtensionRecord('compat', 'plugin', 0, 'behaviour');
if ($record) {
$params = new Registry($record->params);
return ArrayHelper::toString($params->toArray(), ':', ', ');
}
return '';
}
/**
* Check if the phpinfo function is enabled
*
* @return boolean True if enabled
*
* @since 3.4.1
*/
public function phpinfoEnabled(): bool
{
// remove any spaces from the ini value before exploding it
$disabledFunctions = str_replace(' ', '', ini_get('disable_functions'));
return !\in_array('phpinfo', explode(',', $disabledFunctions));
}
/**
* Method to get filter data from the model
*
* @param string $dataType Type of data to get safely
* @param bool $public If true no sensitive information will be removed
*
* @return array
*
* @since 3.5
*/
public function getSafeData(string $dataType, bool $public = true): array
{
if (isset($this->safeData[$dataType])) {
return $this->safeData[$dataType];
}
$methodName = 'get' . ucfirst($dataType);
if (!method_exists($this, $methodName)) {
return [];
}
$data = $this->$methodName($public);
$this->safeData[$dataType] = $this->cleanPrivateData($data, $dataType);
return $this->safeData[$dataType];
}
/**
* Method to get the PHP info
*
* @return string PHP info
*
* @since 1.6
*/
public function &getPHPInfo(): string
{
if (!$this->phpinfoEnabled()) {
$this->php_info = Text::_('COM_ADMIN_PHPINFO_DISABLED');
return $this->php_info;
}
if (!\is_null($this->php_info)) {
return $this->php_info;
}
ob_start();
date_default_timezone_set('UTC');
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES);
$phpInfo = ob_get_clean();
preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpInfo, $output);
$output = preg_replace('#<table[^>]*>#', '<table class="table">', $output[1][0]);
$output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
$output = str_replace('<hr />', '', $output);
$output = str_replace('<div class="text-center">', '', $output);
$output = preg_replace('#<tr class="h">(.*)</tr>#', '<thead><tr class="h">$1</tr></thead><tbody>', $output);
$output = str_replace('</table>', '</tbody></table>', $output);
$output = str_replace('</div>', '', $output);
$this->php_info = $output;
return $this->php_info;
}
/**
* Get phpinfo() output as array
*
* @return array
*
* @since 3.5
*/
public function getPhpInfoArray(): array
{
// Already cached
if (null !== $this->phpInfoArray) {
return $this->phpInfoArray;
}
$phpInfo = $this->getPHPInfo();
$this->phpInfoArray = $this->parsePhpInfo($phpInfo);
return $this->phpInfoArray;
}
/**
* Method to get a list of installed extensions
*
* @return array installed extensions
*
* @since 3.5
*/
public function getExtensions(): array
{
$installed = [];
$db = $this->getDatabase();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__extensions'));
$db->setQuery($query);
try {
$extensions = $db->loadObjectList();
} catch (\Exception $e) {
try {
Log::add(Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), Log::WARNING, 'jerror');
} catch (\RuntimeException $exception) {
Factory::getApplication()->enqueueMessage(
Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()),
'warning'
);
}
return $installed;
}
if (empty($extensions)) {
return $installed;
}
foreach ($extensions as $extension) {
if (\strlen($extension->name) == 0) {
continue;
}
$installed[$extension->name] = [
'name' => $extension->name,
'type' => $extension->type,
'state' => $extension->enabled ? Text::_('JENABLED') : Text::_('JDISABLED'),
'author' => 'unknown',
'version' => 'unknown',
'creationDate' => 'unknown',
'authorUrl' => 'unknown',
];
$manifest = new Registry($extension->manifest_cache);
$extraData = [
'author' => $manifest->get('author', ''),
'version' => $manifest->get('version', ''),
'creationDate' => $manifest->get('creationDate', ''),
'authorUrl' => $manifest->get('authorUrl', ''),
];
$installed[$extension->name] = array_merge($installed[$extension->name], $extraData);
}
return $installed;
}
/**
* Method to get the directory states
*
* @param bool $public If true no information is going to be removed
*
* @return array States of directories
*
* @throws \Exception
* @since 1.6
*/
public function getDirectory(bool $public = false): array
{
if (!empty($this->directories)) {
return $this->directories;
}
$this->directories = [];
$registry = Factory::getApplication()->getConfig();
$cparams = ComponentHelper::getParams('com_media');
$this->addDirectory('administrator/components', JPATH_ADMINISTRATOR . '/components');
$this->addDirectory('administrator/components/com_joomlaupdate', JPATH_ADMINISTRATOR . '/components/com_joomlaupdate');
$this->addDirectory('administrator/language', JPATH_ADMINISTRATOR . '/language');
// List all admin languages
$admin_langs = new \DirectoryIterator(JPATH_ADMINISTRATOR . '/language');
foreach ($admin_langs as $folder) {
if ($folder->isDot() || !$folder->isDir()) {
continue;
}
$this->addDirectory(
'administrator/language/' . $folder->getFilename(),
JPATH_ADMINISTRATOR . '/language/' . $folder->getFilename()
);
}
// List all manifests folders
$manifests = new \DirectoryIterator(JPATH_ADMINISTRATOR . '/manifests');
foreach ($manifests as $folder) {
if ($folder->isDot() || !$folder->isDir()) {
continue;
}
$this->addDirectory(
'administrator/manifests/' . $folder->getFilename(),
JPATH_ADMINISTRATOR . '/manifests/' . $folder->getFilename()
);
}
$this->addDirectory('administrator/modules', JPATH_ADMINISTRATOR . '/modules');
$this->addDirectory('administrator/templates', JPATH_THEMES);
$this->addDirectory('components', JPATH_SITE . '/components');
$this->addDirectory($cparams->get('image_path'), JPATH_SITE . '/' . $cparams->get('image_path'));
// List all images folders
$image_folders = new \DirectoryIterator(JPATH_SITE . '/' . $cparams->get('image_path'));
foreach ($image_folders as $folder) {
if ($folder->isDot() || !$folder->isDir()) {
continue;
}
$this->addDirectory(
'images/' . $folder->getFilename(),
JPATH_SITE . '/' . $cparams->get('image_path') . '/' . $folder->getFilename()
);
}
$this->addDirectory('language', JPATH_SITE . '/language');
// List all site languages
$site_langs = new \DirectoryIterator(JPATH_SITE . '/language');
foreach ($site_langs as $folder) {
if ($folder->isDot() || !$folder->isDir()) {
continue;
}
$this->addDirectory('language/' . $folder->getFilename(), JPATH_SITE . '/language/' . $folder->getFilename());
}
$this->addDirectory('libraries', JPATH_LIBRARIES);
$this->addDirectory('media', JPATH_SITE . '/media');
$this->addDirectory('modules', JPATH_SITE . '/modules');
$this->addDirectory('plugins', JPATH_PLUGINS);
$plugin_groups = new \DirectoryIterator(JPATH_SITE . '/plugins');
foreach ($plugin_groups as $folder) {
if ($folder->isDot() || !$folder->isDir()) {
continue;
}
$this->addDirectory('plugins/' . $folder->getFilename(), JPATH_PLUGINS . '/' . $folder->getFilename());
}
$this->addDirectory('templates', JPATH_SITE . '/templates');
$this->addDirectory('configuration.php', JPATH_CONFIGURATION . '/configuration.php');
// Is there a cache path in configuration.php?
if ($cache_path = trim($registry->get('cache_path', ''))) {
// Frontend and backend use same directory for caching.
$this->addDirectory($cache_path, $cache_path, 'COM_ADMIN_CACHE_DIRECTORY');
} else {
$this->addDirectory('administrator/cache', JPATH_CACHE, 'COM_ADMIN_CACHE_DIRECTORY');
}
$this->addDirectory('media/cache', JPATH_ROOT . '/media/cache', 'COM_ADMIN_MEDIA_CACHE_DIRECTORY');
if ($public) {
$this->addDirectory(
'log',
$registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'),
'COM_ADMIN_LOG_DIRECTORY'
);
$this->addDirectory(
'tmp',
$registry->get('tmp_path', JPATH_ROOT . '/tmp'),
'COM_ADMIN_TEMP_DIRECTORY'
);
} else {
$this->addDirectory(
$registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'),
$registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'),
'COM_ADMIN_LOG_DIRECTORY'
);
$this->addDirectory(
$registry->get('tmp_path', JPATH_ROOT . '/tmp'),
$registry->get('tmp_path', JPATH_ROOT . '/tmp'),
'COM_ADMIN_TEMP_DIRECTORY'
);
}
return $this->directories;
}
/**
* Method to add a directory
*
* @param string $name Directory Name
* @param string $path Directory path
* @param string $message Message
*
* @return void
*
* @since 1.6
*/
private function addDirectory(string $name, string $path, string $message = ''): void
{
$this->directories[$name] = ['writable' => is_writable($path), 'message' => $message,];
}
/**
* Method to get the editor
*
* @return string The default editor
*
* @note Has to be removed (it is present in the config...)
* @since 1.6
*/
public function &getEditor(): string
{
if (!\is_null($this->editor)) {
return $this->editor;
}
$this->editor = Factory::getApplication()->get('editor');
return $this->editor;
}
/**
* Parse phpinfo output into an array
* Source https://gist.github.com/sbmzhcn/6255314
*
* @param string $html Output of phpinfo()
*
* @return array
*
* @since 3.5
*/
protected function parsePhpInfo(string $html): array
{
$html = strip_tags($html, '<h2><th><td>');
$html = preg_replace('/<th[^>]*>([^<]+)<\/th>/', '<info>\1</info>', $html);
$html = preg_replace('/<td[^>]*>([^<]+)<\/td>/', '<info>\1</info>', $html);
$t = preg_split('/(<h2[^>]*>[^<]+<\/h2>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
$r = [];
$count = \count($t);
$p1 = '<info>([^<]+)<\/info>';
$p2 = '/' . $p1 . '\s*' . $p1 . '\s*' . $p1 . '/';
$p3 = '/' . $p1 . '\s*' . $p1 . '/';
for ($i = 1; $i < $count; $i++) {
if (preg_match('/<h2[^>]*>([^<]+)<\/h2>/', $t[$i], $matches)) {
$name = trim($matches[1]);
$vals = explode("\n", $t[$i + 1]);
foreach ($vals as $val) {
// 3cols
if (preg_match($p2, $val, $matches)) {
$r[$name][trim($matches[1])] = [trim($matches[2]), trim($matches[3]),];
} elseif (preg_match($p3, $val, $matches)) {
// 2cols
$r[$name][trim($matches[1])] = trim($matches[2]);
}
}
}
}
return $r;
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\Service\HTML;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Class for rendering configuration values
*
* @since 4.0.0
*/
class Configuration
{
/**
* Method to generate a string for a value
*
* @param mixed $value The configuration value
*
* @return string Formatted and escaped string
*
* @since 4.0.0
*/
public function value($value): string
{
if (\is_bool($value)) {
return $value ? 'true' : 'false';
}
if (\is_array($value)) {
$value = implode(', ', $value);
}
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
}

View File

@ -0,0 +1,61 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Service\HTML;
use Joomla\CMS\Language\Text;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Utility class working with directory
*
* @since 1.6
*/
class Directory
{
/**
* Method to generate a (un)writable message for directory
*
* @param boolean $writable is the directory writable?
*
* @return string html code
*/
public function writable($writable)
{
if ($writable) {
return '<span class="badge bg-success">' . Text::_('COM_ADMIN_WRITABLE') . '</span>';
}
return '<span class="badge bg-danger">' . Text::_('COM_ADMIN_UNWRITABLE') . '</span>';
}
/**
* Method to generate a message for a directory
*
* @param string $dir the directory
* @param boolean $message the message
* @param boolean $visible is the $dir visible?
*
* @return string html code
*/
public function message($dir, $message, $visible = true)
{
$output = $visible ? $dir : '';
if (empty($message)) {
return $output;
}
return $output . ' <strong>' . Text::_($message) . '</strong>';
}
}

View File

@ -0,0 +1,61 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Service\HTML;
use Joomla\CMS\Language\Text;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Utility class working with phpsetting
*
* @since 1.6
*/
class PhpSetting
{
/**
* Method to generate a boolean message for a value
*
* @param boolean $val is the value set?
*
* @return string html code
*/
public function boolean($val)
{
return Text::_($val ? 'JON' : 'JOFF');
}
/**
* Method to generate a boolean message for a value
*
* @param boolean $val is the value set?
*
* @return string html code
*/
public function set($val)
{
return Text::_($val ? 'JYES' : 'JNO');
}
/**
* Method to generate a string message for a value
*
* @param string $val a php ini value
*
* @return string html code
*/
public function string($val)
{
return !empty($val) ? $val : Text::_('JNONE');
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @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\Component\Admin\Administrator\Service\HTML;
use Joomla\CMS\Language\Text;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Utility class working with system
*
* @since 1.6
*/
class System
{
/**
* Method to generate a string message for a value
*
* @param string $val a php ini value
*
* @return string html code
*/
public function server($val)
{
return !empty($val) ? $val : Text::_('COM_ADMIN_NA');
}
}

View File

@ -0,0 +1,97 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\View\Help;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Admin\Administrator\Model\HelpModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* HTML View class for the Admin component
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* The search string
*
* @var string
* @since 1.6
*/
protected $helpSearch = null;
/**
* The page to be viewed
*
* @var string
* @since 1.6
*/
protected $page = null;
/**
* The iso language tag
*
* @var string
* @since 1.6
*/
protected $languageTag = null;
/**
* Table of contents
*
* @var array
* @since 1.6
*/
protected $toc = [];
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*
* @throws \Exception
*/
public function display($tpl = null): void
{
/** @var HelpModel $model */
$model = $this->getModel();
$this->helpSearch = $model->getHelpSearch();
$this->page = $model->getPage();
$this->toc = $model->getToc();
$this->languageTag = $model->getLangTag();
$this->addToolbar();
parent::display($tpl);
}
/**
* Setup the Toolbar
*
* @return void
*
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_ADMIN_HELP'), 'support help_header');
}
}

View File

@ -0,0 +1,123 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\View\Sysinfo;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Admin\Administrator\Model\SysinfoModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Sysinfo View class for the Admin component
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Some PHP settings
*
* @var array
* @since 1.6
*/
protected $phpSettings = [];
/**
* Config values
*
* @var array
* @since 1.6
*/
protected $config = [];
/**
* Some system values
*
* @var array
* @since 1.6
*/
protected $info = [];
/**
* PHP info
*
* @var string
* @since 1.6
*/
protected $phpInfo = null;
/**
* Information about writable state of directories
*
* @var array
* @since 1.6
*/
protected $directory = [];
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 1.6
*
* @throws \Exception
*/
public function display($tpl = null): void
{
// Access check.
if (!$this->getCurrentUser()->authorise('core.admin')) {
throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
/** @var SysinfoModel $model */
$model = $this->getModel();
$this->phpSettings = $model->getPhpSettings();
$this->config = $model->getConfig();
$this->info = $model->getInfo();
$this->phpInfo = $model->getPHPInfo();
$this->directory = $model->getDirectory();
$this->addToolbar();
parent::display($tpl);
}
/**
* Setup the Toolbar
*
* @return void
*
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-circle systeminfo');
$toolbar = Toolbar::getInstance();
$toolbar->linkButton('download', 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT')
->url(Route::_('index.php?option=com_admin&view=sysinfo&format=text&' . Session::getFormToken() . '=1'));
$toolbar->linkButton('download', 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON')
->url(Route::_('index.php?option=com_admin&view=sysinfo&format=json&' . Session::getFormToken() . '=1'));
$toolbar->help('Site_System_Information');
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\View\Sysinfo;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\AbstractView;
use Joomla\CMS\User\CurrentUserInterface;
use Joomla\CMS\User\CurrentUserTrait;
use Joomla\Component\Admin\Administrator\Model\SysinfoModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Sysinfo View class for the Admin component
*
* @since 3.5
*/
class JsonView extends AbstractView implements CurrentUserInterface
{
use CurrentUserTrait;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 3.5
*
* @throws \Exception
*/
public function display($tpl = null): void
{
// Access check.
if (!$this->getCurrentUser()->authorise('core.admin')) {
throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
header('MIME-Version: 1.0');
header('Content-Disposition: attachment; filename="systeminfo-' . date('c') . '.json"');
header('Content-Transfer-Encoding: binary');
$data = $this->getLayoutData();
echo json_encode($data, JSON_PRETTY_PRINT);
Factory::getApplication()->close();
}
/**
* Get the data for the view
*
* @return array
*
* @since 3.5
*/
protected function getLayoutData(): array
{
/** @var SysinfoModel $model */
$model = $this->getModel();
return [
'info' => $model->getSafeData('info'),
'phpSettings' => $model->getSafeData('phpSettings'),
'config' => $model->getSafeData('config'),
'directories' => $model->getSafeData('directory', true),
'phpInfo' => $model->getSafeData('phpInfoArray'),
'extensions' => $model->getSafeData('extensions'),
];
}
}

View File

@ -0,0 +1,182 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Admin\Administrator\View\Sysinfo;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\AbstractView;
use Joomla\CMS\User\CurrentUserInterface;
use Joomla\CMS\User\CurrentUserTrait;
use Joomla\Component\Admin\Administrator\Model\SysinfoModel;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Sysinfo View class for the Admin component
*
* @since 3.5
*/
class TextView extends AbstractView implements CurrentUserInterface
{
use CurrentUserTrait;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*
* @since 3.5
*
* @throws \Exception
*/
public function display($tpl = null): void
{
// Access check.
if (!$this->getCurrentUser()->authorise('core.admin')) {
throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
header('Content-Type: text/plain; charset=utf-8');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="systeminfo-' . date('c') . '.txt"');
header('Cache-Control: must-revalidate');
$data = $this->getLayoutData();
$lines = [];
foreach ($data as $sectionName => $section) {
$customRenderingMethod = 'render' . ucfirst($sectionName);
if (method_exists($this, $customRenderingMethod)) {
$lines[] = $this->$customRenderingMethod($section['title'], $section['data']);
} else {
$lines[] = $this->renderSection($section['title'], $section['data']);
}
}
echo str_replace(JPATH_ROOT, 'xxxxxx', implode("\n\n", $lines));
Factory::getApplication()->close();
}
/**
* Get the data for the view
*
* @return array
*
* @since 3.5
*/
protected function getLayoutData(): array
{
/** @var SysinfoModel $model */
$model = $this->getModel();
return [
'info' => [
'title' => Text::_('COM_ADMIN_SYSTEM_INFORMATION', true),
'data' => $model->getSafeData('info'),
],
'phpSettings' => [
'title' => Text::_('COM_ADMIN_PHP_SETTINGS', true),
'data' => $model->getSafeData('phpSettings'),
],
'config' => [
'title' => Text::_('COM_ADMIN_CONFIGURATION_FILE', true),
'data' => $model->getSafeData('config'),
],
'directories' => [
'title' => Text::_('COM_ADMIN_DIRECTORY_PERMISSIONS', true),
'data' => $model->getSafeData('directory', true),
],
'phpInfo' => [
'title' => Text::_('COM_ADMIN_PHP_INFORMATION', true),
'data' => $model->getSafeData('phpInfoArray'),
],
'extensions' => [
'title' => Text::_('COM_ADMIN_EXTENSIONS', true),
'data' => $model->getSafeData('extensions'),
],
];
}
/**
* Render a section
*
* @param string $sectionName Name of the section to render
* @param array $sectionData Data of the section to render
* @param integer $level Depth level for indentation
*
* @return string
*
* @since 3.5
*/
protected function renderSection(string $sectionName, array $sectionData, int $level = 0): string
{
$lines = [];
$margin = ($level > 0) ? str_repeat("\t", $level) : null;
$lines[] = $margin . '=============';
$lines[] = $margin . $sectionName;
$lines[] = $margin . '=============';
$level++;
foreach ($sectionData as $name => $value) {
if (\is_array($value)) {
if ($name == 'Directive') {
continue;
}
$lines[] = '';
$lines[] = $this->renderSection($name, $value, $level);
} else {
if (\is_bool($value)) {
$value = $value ? 'true' : 'false';
}
if (\is_int($name) && ($name == 0 || $name == 1)) {
// The term "Master" is used because it is the term used in phpinfo() and this is a text representation of that.
$name = ($name == 0 ? 'Local Value' : 'Master Value');
}
$lines[] = $margin . $name . ': ' . $value;
}
}
return implode("\n", $lines);
}
/**
* Specific rendering for directories
*
* @param string $sectionName Name of the section
* @param array $sectionData Directories information
* @param integer $level Starting level
*
* @return string
*
* @since 3.5
*/
protected function renderDirectories(string $sectionName, array $sectionData, int $level = -1): string
{
foreach ($sectionData as $directory => $data) {
$sectionData[$directory] = $data['writable'] ? ' writable' : ' NOT writable';
}
return $this->renderSection($sectionName, $sectionData, $level);
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 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\Help\Help;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \Joomla\Component\Admin\Administrator\View\Help\HtmlView $this */
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('com_admin.admin-help');
?>
<form action="<?php echo Route::_('index.php?option=com_admin&amp;view=help'); ?>" method="post" name="adminForm" id="adminForm" class="main-card">
<div class="row mt-sm-3">
<div id="sidebar" class="col-md-3">
<button class="btn btn-sm btn-secondary my-2 options-menu d-md-none" type="button" data-bs-toggle="collapse" data-bs-target=".sidebar-nav" aria-controls="help-index" aria-expanded="false">
<span class="icon-align-justify" aria-hidden="true"></span>
<?php echo Text::_('JTOGGLE_SIDEBAR_MENU'); ?>
</button>
<div class="sidebar-nav" id="help-index">
<ul class="nav flex-column">
<li class="item"><?php echo HTMLHelper::_('link', Help::createUrl('Start_Here'), Text::_('COM_ADMIN_START_HERE'), ['target' => 'helpFrame']); ?></li>
<li class="item"><?php echo HTMLHelper::_('link', 'https://help.joomla.org/proxy?keyref=Help4.x:License', Text::_('COM_ADMIN_LICENSE'), ['target' => 'helpFrame']); ?></li>
<li class="item"><?php echo HTMLHelper::_('link', Help::createUrl('Glossary'), Text::_('COM_ADMIN_GLOSSARY'), ['target' => 'helpFrame']); ?></li>
<li class="divider"></li>
<li class="nav-header"><?php echo Text::_('COM_ADMIN_ALPHABETICAL_INDEX'); ?></li>
<?php foreach ($this->toc as $k => $v) : ?>
<li class="item">
<?php $url = Help::createUrl($k); ?>
<?php echo HTMLHelper::_('link', $url, $v, ['target' => 'helpFrame']); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="col-md-9">
<iframe onLoad="var x = getElementById('help-index'); x.classList.remove('show');" name="helpFrame" title="helpFrame" height="2100px" src="<?php echo $this->page; ?>" class="helpFrame table table-bordered"></iframe>
</div>
</div>
<input class="textarea" type="hidden" name="option" value="com_admin">
</form>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<layout title="COM_ADMIN_HELP_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_ADMIN_HELP_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>

View File

@ -0,0 +1,26 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2017 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\Factory;
use Joomla\CMS\Language\Text;
$this->getLanguage()->load('mod_menu', JPATH_ADMINISTRATOR);
$forumId = (int) Text::_('MOD_MENU_HELP_SUPPORT_OFFICIAL_LANGUAGE_FORUM_VALUE');
if (empty($forumId)) {
$forumId = 511;
}
$forumUrl = 'https://forum.joomla.org/viewforum.php?f=' . $forumId;
Factory::getApplication()->redirect($forumUrl);

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="main-card">
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'site', 'recall' => true, 'breakpoint' => 768]); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'site', Text::_('COM_ADMIN_SYSTEM_INFORMATION')); ?>
<?php echo $this->loadTemplate('system'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'phpsettings', Text::_('COM_ADMIN_PHP_SETTINGS')); ?>
<?php echo $this->loadTemplate('phpsettings'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'config', Text::_('COM_ADMIN_CONFIGURATION_FILE')); ?>
<?php echo $this->loadTemplate('config'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'directory', Text::_('COM_ADMIN_DIRECTORY_PERMISSIONS')); ?>
<?php echo $this->loadTemplate('directory'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'phpinfo', Text::_('COM_ADMIN_PHP_INFORMATION')); ?>
<?php echo $this->loadTemplate('phpinfo'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
</div>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<layout title="COM_ADMIN_SYSINFO_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_ADMIN_SYSINFO_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2006 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="sysinfo">
<table class="table">
<caption class="visually-hidden">
<?php echo Text::_('COM_ADMIN_CONFIGURATION_FILE'); ?>
</caption>
<thead>
<tr>
<th scope="col" class="w-30">
<?php echo Text::_('COM_ADMIN_SETTING'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_ADMIN_VALUE'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->config as $key => $value) : ?>
<tr>
<th scope="row">
<?php echo $key; ?>
</th>
<td>
<?php echo HTMLHelper::_('configuration.value', $value); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="sysinfo">
<table class="table">
<caption class="visually-hidden">
<?php echo Text::_('COM_ADMIN_DIRECTORY_PERMISSIONS'); ?>
</caption>
<thead>
<tr>
<th scope="col" class="w-60">
<?php echo Text::_('COM_ADMIN_DIRECTORY'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_ADMIN_STATUS'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->directory as $dir => $info) : ?>
<tr>
<th scope="row">
<?php echo '&#x200E;' . HTMLHelper::_('directory.message', $dir, $info['message']); ?>
</th>
<td>
<?php echo HTMLHelper::_('directory.writable', $info['writable']); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="sysinfo">
<?php echo $this->phpInfo; ?>
</div>

View File

@ -0,0 +1,197 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2008 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="sysinfo">
<table class="table">
<caption class="visually-hidden">
<?php echo Text::_('COM_ADMIN_PHP_SETTINGS'); ?>
</caption>
<thead>
<tr>
<th scope="col" class="w-30">
<?php echo Text::_('COM_ADMIN_SETTING'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_ADMIN_VALUE'); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_UPLOAD_MAX_FILESIZE'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['upload_max_filesize']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_POST_MAX_SIZE'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['post_max_size']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_MEMORY_LIMIT'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['memory_limit']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_OPEN_BASEDIR'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['open_basedir']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DISPLAY_ERRORS'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.boolean', $this->phpSettings['display_errors']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_SHORT_OPEN_TAGS'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.boolean', $this->phpSettings['short_open_tag']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_FILE_UPLOADS'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.boolean', $this->phpSettings['file_uploads']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_OUTPUT_BUFFERING'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.boolean', $this->phpSettings['output_buffering']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_SESSION_SAVE_PATH'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['session.save_path']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_SESSION_AUTO_START'); ?>
</th>
<td>
<?php echo (int) $this->phpSettings['session.auto_start']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_XML_ENABLED'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['xml']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_ZLIB_ENABLED'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['zlib']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_ZIP_ENABLED'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['zip']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DISABLED_FUNCTIONS'); ?>
</th>
<td class="break-word">
<?php echo HTMLHelper::_('phpsetting.string', $this->phpSettings['disable_functions']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::sprintf('COM_ADMIN_EXTENSION_AVAILABLE', 'Fileinfo'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['fileinfo']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_MBSTRING_ENABLED'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['mbstring']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::sprintf('COM_ADMIN_EXTENSION_AVAILABLE', 'GD'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['gd']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::sprintf('COM_ADMIN_EXTENSION_AVAILABLE', 'iconv'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['iconv']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::sprintf('COM_ADMIN_EXTENSION_AVAILABLE', 'intl'); ?>
</th>
<td>
<?php echo HTMLHelper::_('phpsetting.set', $this->phpSettings['intl']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_MAX_INPUT_VARS'); ?>
</th>
<td>
<?php echo (int) $this->phpSettings['max_input_vars']; ?>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,141 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
*
* @copyright (C) 2006 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\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \Joomla\Component\Admin\Administrator\View\Sysinfo\HtmlView $this */
?>
<div class="sysinfo">
<table class="table">
<caption class="visually-hidden">
<?php echo Text::_('COM_ADMIN_SYSTEM_INFORMATION'); ?>
</caption>
<thead>
<tr>
<th scope="col" class="w-30">
<?php echo Text::_('COM_ADMIN_SETTING'); ?>
</th>
<th scope="col">
<?php echo Text::_('COM_ADMIN_VALUE'); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_PHP_BUILT_ON'); ?>
</th>
<td>
<?php echo $this->info['php']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_TYPE'); ?>
</th>
<td>
<?php echo $this->info['dbserver']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_VERSION'); ?>
</th>
<td>
<?php echo $this->info['dbversion']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_COLLATION'); ?>
</th>
<td>
<?php echo $this->info['dbcollation']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_CONNECTION_COLLATION'); ?>
</th>
<td>
<?php echo $this->info['dbconnectioncollation']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_CONNECTION_ENCRYPTION'); ?>
</th>
<td>
<?php echo $this->info['dbconnectionencryption'] ?: Text::_('JNONE'); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_DATABASE_CONNECTION_ENCRYPTION_SUPPORTED'); ?>
</th>
<td>
<?php echo $this->info['dbconnencryptsupported'] ? Text::_('JYES') : Text::_('JNO'); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_PHP_VERSION'); ?>
</th>
<td>
<?php echo $this->info['phpversion']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_WEB_SERVER'); ?>
</th>
<td>
<?php echo HTMLHelper::_('system.server', $this->info['server']); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_WEBSERVER_TO_PHP_INTERFACE'); ?>
</th>
<td>
<?php echo $this->info['sapi_name']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_JOOMLA_VERSION'); ?>
</th>
<td>
<?php echo $this->info['version']; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_JOOMLA_COMPAT_PLUGIN'); ?>
</th>
<td>
<?php echo $this->info['compatpluginenabled'] ? Text::_('JENABLED') . ' (' . $this->info['compatpluginparameters'] . ')' : Text::_('JDISABLED'); ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_ADMIN_USER_AGENT'); ?>
</th>
<td>
<?php echo htmlspecialchars($this->info['useragent'], ENT_COMPAT, 'UTF-8'); ?>
</td>
</tr>
</tbody>
</table>
</div>