diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index a474229d00c1f..4051d1c5bc5bb 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -45,8 +45,6 @@ RoboFile.php @rdeutz @hackwar
# CSP Tooling
plugins/system/httpheaders/* @zero-24
-administrator/components/com_csp/* @zero-24
-components/com_csp/* @zero-24
# Web Authentication (WebAuthn)
plugins/system/webauthn/* @nikosdion
diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php
index ed1e93c4f64e4..531e3ca0263e1 100644
--- a/administrator/components/com_admin/script.php
+++ b/administrator/components/com_admin/script.php
@@ -5248,14 +5248,31 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/administrator/components/com_admin/src/Controller/ProfileController.php',
'/administrator/components/com_admin/src/Model/ProfileModel.php',
'/administrator/components/com_admin/src/View/Profile/HtmlView.php',
+ '/administrator/components/com_csp/access.xml',
+ '/administrator/components/com_csp/config.xml',
+ '/administrator/components/com_csp/csp.xml',
+ '/administrator/components/com_csp/forms/filter_reports.xml',
+ '/administrator/components/com_csp/services/provider.php',
+ '/administrator/components/com_csp/src/Controller/DisplayController.php',
+ '/administrator/components/com_csp/src/Controller/ReportsController.php',
+ '/administrator/components/com_csp/src/Helper/ReporterHelper.php',
+ '/administrator/components/com_csp/src/Model/ReportModel.php',
+ '/administrator/components/com_csp/src/Model/ReportsModel.php',
+ '/administrator/components/com_csp/src/Table/ReportTable.php',
+ '/administrator/components/com_csp/src/View/Reports/HtmlView.php',
+ '/administrator/components/com_csp/tmpl/reports/default.php',
+ '/administrator/components/com_csp/tmpl/reports/default.xml',
'/administrator/components/com_admin/tmpl/profile/edit.php',
'/administrator/components/com_config/tmpl/application/default_ftp.php',
'/administrator/components/com_config/tmpl/application/default_ftplogin.php',
'/administrator/components/com_fields/src/Field/SubfieldstypeField.php',
'/administrator/components/com_installer/tmpl/installer/default_ftp.php',
+ '/administrator/language/en-GB/com_csp.ini',
+ '/administrator/language/en-GB/com_csp.sys.ini',
'/administrator/language/en-GB/plg_fields_subfields.ini',
'/administrator/language/en-GB/plg_fields_subfields.sys.ini',
'/administrator/templates/atum/Service/HTML/Atum.php',
+ '/components/com_csp/src/Controller/ReportController.php',
'/components/com_menus/src/Controller/DisplayController.php',
'/libraries/vendor/beberlei/assert/phpstan-code.neon',
'/libraries/vendor/beberlei/assert/phpstan-tests.neon',
@@ -6905,8 +6922,23 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false)
'/libraries/vendor/ozdemirburak/iris',
'/libraries/vendor/ozdemirburak',
'/components/com_menus/src/Controller',
+ '/components/com_csp/src/Controller',
+ '/components/com_csp/src',
+ '/components/com_csp',
'/administrator/templates/atum/Service/HTML',
'/administrator/templates/atum/Service',
+ '/administrator/components/com_csp/tmpl/reports',
+ '/administrator/components/com_csp/tmpl',
+ '/administrator/components/com_csp/src/View/Reports',
+ '/administrator/components/com_csp/src/View',
+ '/administrator/components/com_csp/src/Table',
+ '/administrator/components/com_csp/src/Model',
+ '/administrator/components/com_csp/src/Helper',
+ '/administrator/components/com_csp/src/Controller',
+ '/administrator/components/com_csp/src',
+ '/administrator/components/com_csp/services',
+ '/administrator/components/com_csp/forms',
+ '/administrator/components/com_csp',
'/administrator/components/com_admin/tmpl/profile',
'/administrator/components/com_admin/src/View/Profile',
'/administrator/components/com_admin/forms',
@@ -6983,7 +7015,7 @@ public function updateAssets($installer)
{
// List all components added since 4.0
$newComponents = array(
- 'com_csp',
+ // Components to be added here
);
foreach ($newComponents as $component)
diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-06-03.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-06-03.sql
index a25eb4c8be0fb..65a7046e3392c 100644
--- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-06-03.sql
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2018-06-03.sql
@@ -1,18 +1 @@
---
--- Table structure for table `#__csp`
---
-
-CREATE TABLE IF NOT EXISTS `#__csp` (
- `id` int NOT NULL AUTO_INCREMENT,
- `document_uri` varchar(500) NOT NULL DEFAULT '',
- `blocked_uri` varchar(500) NOT NULL DEFAULT '',
- `directive` varchar(500) NOT NULL DEFAULT '',
- `client` varchar(500) NOT NULL DEFAULT '',
- `created` datetime NOT NULL,
- `modified` datetime NOT NULL,
- `published` tinyint NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
-
-INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
-(0, 'com_csp', 'component', 'com_csp', '', 1, 1, 1, 0, '', '{}', '', 0, '0000-00-00 00:00:00', 0, 0);
+-- This has been removed as com_csp has been removed from the final build
diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-07-16.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-07-16.sql
index 2899b721b7700..65a7046e3392c 100644
--- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-07-16.sql
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-07-16.sql
@@ -1 +1 @@
-DELETE FROM `#__menu` WHERE `link` = 'index.php?option=com_csp' AND `menutype` = 'main';
+-- This has been removed as com_csp has been removed from the final build
diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-03-25.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-03-25.sql
index 50649a1ec8452..5f72531aef0a6 100644
--- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-03-25.sql
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-03-25.sql
@@ -39,7 +39,6 @@ WHERE (`type` = 'component' AND `element` IN (
'com_privacy',
'com_actionlogs',
'com_workflow',
- 'com_csp',
'com_mails'
))
OR (`type` = 'module' AND `client_id` = 0 AND `element` IN (
diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2021-05-04.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2021-05-04.sql
new file mode 100644
index 0000000000000..5c0fa009f5215
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2021-05-04.sql
@@ -0,0 +1,2 @@
+DELETE FROM `#__extensions` WHERE `name` = 'com_csp' and `type` = 'component' and `element` = 'com_csp';
+DROP TABLE `#__csp`;
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-06-03.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-06-03.sql
index aa8383b195e60..65a7046e3392c 100644
--- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-06-03.sql
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-06-03.sql
@@ -1,18 +1 @@
---
--- Table structure for table `#__csp`
---
-
-CREATE TABLE IF NOT EXISTS "#__csp" (
- "id" serial NOT NULL,
- "document_uri" varchar(500) NOT NULL DEFAULT '',
- "blocked_uri" varchar(500) NOT NULL DEFAULT '',
- "directive" varchar(500) NOT NULL DEFAULT '',
- "client" varchar(500) NOT NULL DEFAULT '',
- "created" timestamp without time zone NOT NULL,
- "modified" timestamp without time zone NOT NULL,
- "published" smallint DEFAULT 0 NOT NULL,
- PRIMARY KEY ("id")
-);
-
-INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "checked_out", "checked_out_time", "ordering", "state") VALUES
-(0, 'com_csp', 'component', 'com_csp', '', 1, 1, 1, 0, '', '{}', '', 0, '1970-01-01 00:00:00', 0, 0);
+-- This has been removed as com_csp has been removed from the final build
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-07-16.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-07-16.sql
index 2259b9e932770..65a7046e3392c 100644
--- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-07-16.sql
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-07-16.sql
@@ -1 +1 @@
-DELETE FROM "#__menu" WHERE "link" = 'index.php?option=com_csp' AND "menutype" = 'main';
+-- This has been removed as com_csp has been removed from the final build
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2020-03-25.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2020-03-25.sql
index 3586f07edac94..0d45c2156d656 100644
--- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2020-03-25.sql
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2020-03-25.sql
@@ -41,7 +41,6 @@ WHERE ("type" = 'component' AND "element" IN (
'com_privacy',
'com_actionlogs',
'com_workflow',
- 'com_csp',
'com_mails'
))
OR ("type" = 'module' AND "client_id" = 0 AND "element" IN (
diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2021-05-04.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2021-05-04.sql
new file mode 100644
index 0000000000000..5c0fa009f5215
--- /dev/null
+++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2021-05-04.sql
@@ -0,0 +1,2 @@
+DELETE FROM `#__extensions` WHERE `name` = 'com_csp' and `type` = 'component' and `element` = 'com_csp';
+DROP TABLE `#__csp`;
diff --git a/administrator/components/com_csp/access.xml b/administrator/components/com_csp/access.xml
deleted file mode 100644
index 5582ccc729ee1..0000000000000
--- a/administrator/components/com_csp/access.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/administrator/components/com_csp/config.xml b/administrator/components/com_csp/config.xml
deleted file mode 100644
index b49f60aafb6d0..0000000000000
--- a/administrator/components/com_csp/config.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-
-
-
-
-
diff --git a/administrator/components/com_csp/csp.xml b/administrator/components/com_csp/csp.xml
deleted file mode 100644
index 7771f2f5ecedf..0000000000000
--- a/administrator/components/com_csp/csp.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- com_csp
- Joomla! Project
- May 2018
- (C) 2018 Open Source Matters, Inc.
- GNU General Public License version 2 or later; see LICENSE.txt
- admin@joomla.org
- www.joomla.org
- 4.0.0
- COM_CSP_XML_DESCRIPTION
- Joomla\Component\Csp
-
- src
-
-
-
-
- access.xml
- config.xml
- csp.xml
- forms
- services
- src
- tmpl
-
-
- language/en-GB/com_csp.ini
- language/en-GB/com_csp.sys.ini
-
-
-
diff --git a/administrator/components/com_csp/forms/filter_reports.xml b/administrator/components/com_csp/forms/filter_reports.xml
deleted file mode 100644
index 72d1722e0e194..0000000000000
--- a/administrator/components/com_csp/forms/filter_reports.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
diff --git a/administrator/components/com_csp/services/provider.php b/administrator/components/com_csp/services/provider.php
deleted file mode 100644
index 96b65a9d4940b..0000000000000
--- a/administrator/components/com_csp/services/provider.php
+++ /dev/null
@@ -1,52 +0,0 @@
-
- * @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\MVCComponent;
-use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
-use Joomla\CMS\Extension\Service\Provider\MVCFactory;
-use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
-use Joomla\DI\Container;
-use Joomla\DI\ServiceProviderInterface;
-
-/**
- * The com_csp 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\\Csp'));
- $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Csp'));
- $container->set(
- ComponentInterface::class,
- function (Container $container)
- {
- $component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
- $component->setMVCFactory($container->get(MVCFactoryInterface::class));
-
- return $component;
- }
- );
- }
-};
diff --git a/administrator/components/com_csp/src/Controller/DisplayController.php b/administrator/components/com_csp/src/Controller/DisplayController.php
deleted file mode 100644
index 67648620437ac..0000000000000
--- a/administrator/components/com_csp/src/Controller/DisplayController.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Controller;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\HTML\HTMLHelper;
-use Joomla\CMS\Language\Text;
-use Joomla\CMS\MVC\Controller\BaseController;
-use Joomla\CMS\Plugin\PluginHelper;
-use Joomla\Component\Csp\Administrator\Helper\ReporterHelper;
-
-/**
- * Csp display controller.
- *
- * @since 4.0.0
- */
-class DisplayController extends BaseController
-{
- /**
- * The default view.
- *
- * @var string
- * @since 4.0.0
- */
- protected $default_view = 'reports';
-
- /**
- * Method to display a view.
- *
- * @param boolean $cachable If true, the view output will be cached.
- * @param mixed $urlparams An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
- *
- * @return static This object to support chaining.
- *
- * @since 4.0.0
- */
- public function display($cachable = false, $urlparams = false)
- {
- // Show messages about the plugin when it is disabled
- if (!PluginHelper::isEnabled('system', 'httpheaders'))
- {
- $httpHeadersId = ReporterHelper::getHttpHeadersPluginId();
- $link = HTMLHelper::_(
- 'link',
- '#plugin' . $httpHeadersId . 'Modal',
- Text::_('COM_CSP_SYSTEM_PLUGIN'),
- 'class="alert-link" data-bs-toggle="modal" id="title-' . $httpHeadersId . '"'
- );
-
- $this->app->enqueueMessage(Text::sprintf('COM_CSP_PLUGIN_MODAL_DISABLED', $link), 'error');
- }
-
- return parent::display();
- }
-}
diff --git a/administrator/components/com_csp/src/Controller/ReportsController.php b/administrator/components/com_csp/src/Controller/ReportsController.php
deleted file mode 100644
index d293e1ec6eba9..0000000000000
--- a/administrator/components/com_csp/src/Controller/ReportsController.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Controller;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\MVC\Controller\AdminController;
-
-/**
- * Reports list controller class.
- *
- * @since 4.0.0
- */
-class ReportsController extends AdminController
-{
- /**
- * Proxy for getModel
- *
- * @param string $name The model name. Optional.
- * @param string $prefix The class prefix. Optional.
- * @param array $config The array of possible config values. Optional.
- *
- * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model.
- *
- * @since 4.0.0
- */
- public function getModel($name = 'Report', $prefix = 'Administrator', $config = array('ignore_request' => true))
- {
- return parent::getModel($name, $prefix, $config);
- }
-}
diff --git a/administrator/components/com_csp/src/Helper/ReporterHelper.php b/administrator/components/com_csp/src/Helper/ReporterHelper.php
deleted file mode 100644
index 5cb9c95a06761..0000000000000
--- a/administrator/components/com_csp/src/Helper/ReporterHelper.php
+++ /dev/null
@@ -1,145 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Helper;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\Factory;
-
-/**
- * Reporter component helper.
- *
- * @since 4.0.0
- */
-class ReporterHelper
-{
- /**
- * Gets the httpheaders system plugin extension id.
- *
- * @return mixed The httpheaders system plugin extension id or false in case of an error.
- *
- * @since 4.0.0
- */
- public static function getHttpHeadersPluginId()
- {
- $db = Factory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->quoteName('extension_id'))
- ->from($db->quoteName('#__extensions'))
- ->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
- ->where($db->quoteName('element') . ' = ' . $db->quote('httpheaders'));
- $db->setQuery($query);
-
- try
- {
- $result = (int) $db->loadResult();
- }
- catch (\RuntimeException $e)
- {
- Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
-
- return false;
- }
-
- return $result;
- }
-
- /**
- * Check the com_csp trash to show a warning in this case
- *
- * @return boolean The status of the trash; Do items exists in the trash
- *
- * @since 4.0.0
- */
- public static function getCspTrashStatus()
- {
- $db = Factory::getDbo();
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from($db->quoteName('#__csp'))
- ->where($db->quoteName('published') . ' = ' . $db->quote('-2'));
- $db->setQuery($query);
-
- try
- {
- $result = (int) $db->loadResult();
- }
- catch (\RuntimeException $e)
- {
- Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
-
- return false;
- }
-
- return boolval($result);
- }
-
- /**
- * Check whether there are unsafe-inline rules published
- *
- * @return boolean Whether there are unsafe-inline rules published
- *
- * @since 4.0.0
- */
- public static function getCspUnsafeInlineStatus()
- {
- $db = Factory::getDbo();
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from($db->quoteName('#__csp'))
- ->where($db->quoteName('blocked_uri') . ' = ' . $db->quote("'unsafe-inline'"))
- ->where($db->quoteName('published') . ' = 1');
- $db->setQuery($query);
-
- try
- {
- $result = (int) $db->loadResult();
- }
- catch (\RuntimeException $e)
- {
- Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
-
- return false;
- }
-
- return boolval($result);
- }
-
- /**
- * Check whether there are unsafe-eval rules published
- *
- * @return boolean Whether there are unsafe-eval rules published
- *
- * @since 4.0.0
- */
- public static function getCspUnsafeEvalStatus()
- {
- $db = Factory::getDbo();
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from($db->quoteName('#__csp'))
- ->where($db->quoteName('blocked_uri') . ' = ' . $db->quote("'unsafe-eval'"))
- ->where($db->quoteName('published') . ' = 1');
- $db->setQuery($query);
-
- try
- {
- $result = (int) $db->loadResult();
- }
- catch (\RuntimeException $e)
- {
- Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
-
- return false;
- }
-
- return boolval($result);
- }
-}
diff --git a/administrator/components/com_csp/src/Model/ReportModel.php b/administrator/components/com_csp/src/Model/ReportModel.php
deleted file mode 100644
index 8bde470c00f0d..0000000000000
--- a/administrator/components/com_csp/src/Model/ReportModel.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Model;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\MVC\Model\AdminModel;
-
-/**
- * Report Model
- *
- * @since 4.0.0
- */
-class ReportModel extends AdminModel
-{
- /**
- * The prefix to use with controller messages.
- *
- * @var string
- * @since 4.0.0
- */
- protected $text_prefix = 'COM_CSP';
-
- /**
- * Method to get the row form.
- *
- * @param array $data Data for the form.
- * @param boolean $loadData True if the form is to load its own data (default case), false if not.
- *
- * @return \JForm|boolean A JForm object on success, false on failure
- *
- * @since 4.0.0
- */
- public function getForm($data = array(), $loadData = true)
- {
- return false;
- }
-}
diff --git a/administrator/components/com_csp/src/Model/ReportsModel.php b/administrator/components/com_csp/src/Model/ReportsModel.php
deleted file mode 100644
index 7dcc7d26efcef..0000000000000
--- a/administrator/components/com_csp/src/Model/ReportsModel.php
+++ /dev/null
@@ -1,174 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Model;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
-use Joomla\CMS\MVC\Model\ListModel;
-use Joomla\Database\ParameterType;
-
-/**
- * CSP Component Reports Model
- *
- * @since 4.0.0
- */
-class ReportsModel extends ListModel
-{
- /**
- * Constructor
- *
- * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
- * @param MVCFactoryInterface $factory The factory.
- *
- * @since 4.0.0
- * @throws \Exception
- */
- public function __construct($config = array(), MVCFactoryInterface $factory = null)
- {
- if (empty($config['filter_fields']))
- {
- $config['filter_fields'] = array(
- 'id', 'a.id',
- 'document_uri', 'a.document_uri',
- 'blocked_uri', 'a.blocked_uri',
- 'directive', 'a.directive',
- 'client', 'a.client',
- 'published', 'a.published',
- 'created', 'a.created',
- );
- }
-
- parent::__construct($config, $factory);
- }
-
- /**
- * Method to auto-populate the model state.
- *
- * Note. Calling getState in this method will result in recursion.
- *
- * @param string $ordering An optional ordering field.
- * @param string $direction An optional direction (asc|desc).
- *
- * @return void
- *
- * @since 4.0.0
- */
- protected function populateState($ordering = 'a.id', $direction = 'asc')
- {
- // List state information.
- parent::populateState($ordering, $direction);
- }
-
- /**
- * Method to get a store id based on model configuration state.
- *
- * This is necessary because the model is used by the component and
- * different modules that might need different sets of data or different
- * ordering requirements.
- *
- * @param string $id A prefix for the store id.
- *
- * @return string A store id.
- *
- * @since 4.0.0
- */
- protected function getStoreId($id = '')
- {
- // Compile the store id.
- $id .= ':' . $this->getState('filter.search');
- $id .= ':' . $this->getState('filter.published');
-
- return parent::getStoreId($id);
- }
-
- /**
- * Method to create a query for a list of items.
- *
- * @return string
- *
- * @since 4.0.0
- */
- protected function getListQuery()
- {
- $db = $this->getDbo();
- $query = $db->getQuery(true);
-
- // Select the required fields from the table.
- $query
- ->select('*')
- ->from($db->quoteName('#__csp', 'a'));
-
- // Filter by client
- $client = (string) $this->getState('filter.client');
-
- if (!empty($client))
- {
- $query->where($db->quoteName('a.client') . ' = :client')
- ->bind(':client', $client);
- }
-
- // Filter by published state
- $published = (string) $this->getState('filter.published');
-
- if (is_numeric($published))
- {
- $published = (int) $published;
- $query->where($db->quoteName('a.published') . ' = :published')
- ->bind(':published', $published, ParameterType::INTEGER);
- }
- elseif ($published === '')
- {
- $query->whereIn($db->quoteName('a.published'), [0, 1]);
- }
-
- // Filter by directive
- $directive = (string) $this->getState('filter.directive');
-
- if (!empty($directive))
- {
- $query->where($db->quoteName('a.directive') . ' = :directive')
- ->bind(':directive', $directive);
- }
-
- // Filter by search in title
- $search = $this->getState('filter.search');
-
- if (!empty($search))
- {
- if (stripos($search, 'id:') === 0)
- {
- $ids = (int) substr($search, 3);
- $query->where($db->quoteName('a.id') . ' = :id');
- $query->bind(':id', $ids, ParameterType::INTEGER);
- }
- else
- {
- $search = '%' . trim($search) . '%';
- $query->where(
- '(' . $db->quoteName('a.document_uri') . ' LIKE :documenturi'
- . ' OR ' . $db->quoteName('a.blocked_uri') . ' LIKE :blockeduri'
- . ' OR ' . $db->quoteName('a.directive') . ' LIKE :directive)'
- )
- ->bind(':documenturi', $search)
- ->bind(':blockeduri', $search)
- ->bind(':directive', $search);
- }
- }
-
- // Add the list ordering clause
- $listOrdering = $this->getState('list.ordering', 'a.id');
- $listDirn = $db->escape($this->getState('list.direction', 'ASC'));
-
- $query->order($db->escape($listOrdering) . ' ' . $listDirn);
-
- return $query;
- }
-}
diff --git a/administrator/components/com_csp/src/Table/ReportTable.php b/administrator/components/com_csp/src/Table/ReportTable.php
deleted file mode 100644
index aa8a806b0ed2d..0000000000000
--- a/administrator/components/com_csp/src/Table/ReportTable.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\Table;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\Table\Table;
-use Joomla\Database\DatabaseInterface;
-
-/**
- * Report table
- *
- * @since 4.0.0
- */
-class ReportTable extends Table
-{
- /**
- * Constructor
- *
- * @param DatabaseInterface $db Database driver object.
- *
- * @since 4.0.0
- */
- public function __construct(DatabaseInterface $db)
- {
- parent::__construct('#__csp', 'id', $db);
- }
-}
diff --git a/administrator/components/com_csp/src/View/Reports/HtmlView.php b/administrator/components/com_csp/src/View/Reports/HtmlView.php
deleted file mode 100644
index e2e217df15432..0000000000000
--- a/administrator/components/com_csp/src/View/Reports/HtmlView.php
+++ /dev/null
@@ -1,183 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-namespace Joomla\Component\Csp\Administrator\View\Reports;
-
-\defined('_JEXEC') or die;
-
-use Joomla\CMS\Component\ComponentHelper;
-use Joomla\CMS\Helper\ContentHelper;
-use Joomla\CMS\Language\Text;
-use Joomla\CMS\MVC\View\GenericDataException;
-use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
-use Joomla\CMS\Plugin\PluginHelper;
-use Joomla\CMS\Toolbar\ToolbarHelper;
-use Joomla\Component\Csp\Administrator\Helper\ReporterHelper;
-
-/**
- * Reports view class for the Csp package.
- *
- * @since 4.0.0
- */
-class HtmlView extends BaseHtmlView
-{
- /**
- * An array of items
- *
- * @var array
- * @since 4.0.0
- */
- protected $items;
-
- /**
- * The pagination object
- *
- * @var \Joomla\CMS\Pagination\Pagination
- * @since 4.0.0
- */
- protected $pagination;
-
- /**
- * The model state
- *
- * @var \JObject
- * @since 4.0.0
- */
- protected $state;
-
- /**
- * Form object for search filters
- *
- * @var \JForm
- * @since 4.0.0
- */
- public $filterForm;
-
- /**
- * The active search filters
- *
- * @var array
- * @since 4.0.0
- */
- public $activeFilters;
-
- /**
- * The id of the httpheaders plugin in mysql
- *
- * @var integer
- * @since 4.0.0
- */
- protected $httpHeadersId = 0;
-
- /**
- * Is this view an Empty State
- *
- * @var boolean
- * @since __DEPLOY_VERSION__
- */
- private $isEmptyState = false;
-
- /**
- * Execute and display a template script.
- *
- * @param string $tpl The name of the template file to parse; automatically searches through the template paths.
- *
- * @return mixed A string if successful, otherwise an Error object.
- *
- * @since 4.0.0
- */
- public function display($tpl = null)
- {
- $this->items = $this->get('Items');
- $this->pagination = $this->get('Pagination');
- $this->state = $this->get('State');
- $this->activeFilters = $this->get('ActiveFilters');
- $this->filterForm = $this->get('FilterForm');
-
- if (!count($this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
- {
- $this->setLayout('emptystate');
- }
-
- // Check for errors.
- if (count($errors = $this->get('Errors')))
- {
- throw new GenericDataException(implode("\n", $errors), 500);
- }
-
- if (!(PluginHelper::isEnabled('system', 'httpheaders')))
- {
- $this->httpHeadersId = ReporterHelper::getHttpHeadersPluginId();
- }
-
- if (ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy_mode', 'detect') === 'detect'
- && ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy', 0)
- && ReporterHelper::getCspTrashStatus())
- {
- $this->trashWarningMessage = Text::_('COM_CSP_COLLECTING_TRASH_WARNING');
- }
-
- if (ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy_mode', 'detect') === 'auto'
- && ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy', 0)
- && ReporterHelper::getCspUnsafeInlineStatus())
- {
- $this->unsafeInlineWarningMessage = Text::_('COM_CSP_AUTO_UNSAFE_INLINE_WARNING');
- }
-
- if (ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy_mode', 'detect') === 'auto'
- && ComponentHelper::getParams('com_csp')->get('contentsecuritypolicy', 0)
- && ReporterHelper::getCspUnsafeEvalStatus())
- {
- $this->unsafeEvalWarningMessage = Text::_('COM_CSP_AUTO_UNSAFE_EVAL_WARNING');
- }
-
- $this->addToolbar();
-
- return parent::display($tpl);
- }
-
- /**
- * Add the page title and toolbar.
- *
- * @return void
- *
- * @since 4.0.0
- */
- protected function addToolbar()
- {
- $canDo = ContentHelper::getActions('com_csp');
-
- ToolbarHelper::title(Text::_('COM_CSP_REPORTS'), 'shield-alt');
-
- if (!$this->isEmptyState)
- {
- if ($canDo->get('core.edit.state'))
- {
- ToolbarHelper::publish('reports.publish', 'JTOOLBAR_ENABLE', true);
- ToolbarHelper::unpublish('reports.unpublish', 'JTOOLBAR_DISABLE', true);
- }
-
- if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
- {
- ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'reports.delete', 'JTOOLBAR_EMPTY_TRASH');
- }
- elseif ($canDo->get('core.edit.state'))
- {
- ToolbarHelper::trash('reports.trash');
- }
- }
-
- if ($canDo->get('core.admin') || $canDo->get('core.options'))
- {
- ToolbarHelper::preferences('com_csp');
- }
-
- ToolbarHelper::help('JHELP_COMPONENTS_CSP_REPORTS');
- }
-}
diff --git a/administrator/components/com_csp/tmpl/reports/default.php b/administrator/components/com_csp/tmpl/reports/default.php
deleted file mode 100644
index eb46660f8230e..0000000000000
--- a/administrator/components/com_csp/tmpl/reports/default.php
+++ /dev/null
@@ -1,149 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-defined('_JEXEC') or die;
-
-use Joomla\CMS\Factory;
-use Joomla\CMS\HTML\HTMLHelper;
-use Joomla\CMS\Language\Text;
-use Joomla\CMS\Layout\LayoutHelper;
-use Joomla\CMS\Router\Route;
-
-HTMLHelper::_('behavior.multiselect');
-
-$user = Factory::getUser();
-$userId = $user->get('id');
-$listOrder = $this->escape($this->state->get('list.ordering'));
-$listDirn = $this->escape($this->state->get('list.direction'));
-$saveOrder = $listOrder == 'a.id';
-
-?>
-
diff --git a/administrator/components/com_csp/tmpl/reports/default.xml b/administrator/components/com_csp/tmpl/reports/default.xml
deleted file mode 100644
index b9e433d38f42e..0000000000000
--- a/administrator/components/com_csp/tmpl/reports/default.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/administrator/components/com_csp/tmpl/reports/emptystate.php b/administrator/components/com_csp/tmpl/reports/emptystate.php
deleted file mode 100644
index 2f2484fee9f7e..0000000000000
--- a/administrator/components/com_csp/tmpl/reports/emptystate.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
-
-defined('_JEXEC') or die;
-
-use Joomla\CMS\Layout\LayoutHelper;
-
-$displayData = [
- 'textPrefix' => 'COM_CSP',
- 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Help4.x:Content_Security_Policy_Reports',
- 'icon' => 'icon-shield-alt',
-];
-
-echo LayoutHelper::render('joomla.content.emptystate', $displayData);
diff --git a/administrator/components/com_menus/presets/alternate.xml b/administrator/components/com_menus/presets/alternate.xml
index 1fb555fe9aee6..761677398d0c4 100644
--- a/administrator/components/com_menus/presets/alternate.xml
+++ b/administrator/components/com_menus/presets/alternate.xml
@@ -511,14 +511,6 @@
link="index.php?option=com_languages&view=overrides"
/>
-
-
-
-