Skip to content

Commit

Permalink
Merge pull request #2 from zero-24/cspj4
Browse files Browse the repository at this point in the history
update com_csp
  • Loading branch information
yvesh authored Jun 6, 2018
2 parents 5ffdf84 + 6381608 commit e71cfa6
Show file tree
Hide file tree
Showing 303 changed files with 5,115 additions and 4,258 deletions.
9 changes: 5 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# A list of files to ignore from linting
*.js
!*.es6.js
!build/**/*.js
# A list of files to ignore from linting
*.js
!*.es6.js
!build/**/*.js
*.vue
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,7 @@ composer.phar

# Build related
RoboFile.ini

# Media Manager
/media/com_media/js/mediamanager.min.js.map
/media/com_media/css/mediamanager.min.css.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,23 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;
namespace Joomla\Component\Admin\Administrator\Dispatcher;

use Joomla\CMS\Dispatcher\Dispatcher;
defined('_JEXEC') or die;

/**
* Dispatcher class for com_admin
*
* @since 4.0.0
*/
class AdminDispatcher extends Dispatcher
class Dispatcher extends \Joomla\CMS\Dispatcher\Dispatcher
{
/**
* The extension namespace
*
* @var string
*
* @since 4.0.0
*/
protected $namespace = 'Joomla\\Component\\Admin';

/**
* com_admin does not require check permission, so we override checkAccess method and have it empty
*
* @return void
*/
protected function checkAccess()
{

}
}
50 changes: 50 additions & 0 deletions administrator/components/com_admin/Extension/AdminComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Admin\Administrator\Extension;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Extension\BootableExtensionInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
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;

/**
* 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Admin\Administrator\Service\HTML;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

/**
* Utility class working with directory
*
* @since 1.6
*/
abstract class JHtmlDirectory
class Directory
{
/**
* Method to generate a (un)writable message for directory
Expand All @@ -23,14 +27,14 @@ abstract class JHtmlDirectory
*
* @return string html code
*/
public static function writable($writable)
public function writable($writable)
{
if ($writable)
{
return '<span class="badge badge-success">' . JText::_('COM_ADMIN_WRITABLE') . '</span>';
return '<span class="badge badge-success">' . Text::_('COM_ADMIN_WRITABLE') . '</span>';
}

return '<span class="badge badge-danger">' . JText::_('COM_ADMIN_UNWRITABLE') . '</span>';
return '<span class="badge badge-danger">' . Text::_('COM_ADMIN_UNWRITABLE') . '</span>';
}

/**
Expand All @@ -42,7 +46,7 @@ public static function writable($writable)
*
* @return string html code
*/
public static function message($dir, $message, $visible = true)
public function message($dir, $message, $visible = true)
{
$output = $visible ? $dir : '';

Expand All @@ -51,6 +55,6 @@ public static function message($dir, $message, $visible = true)
return $output;
}

return $output . ' <strong>' . JText::_($message) . '</strong>';
return $output . ' <strong>' . Text::_($message) . '</strong>';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Admin\Administrator\Service\HTML;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;

/**
* Utility class working with phpsetting
*
* @since 1.6
*/
abstract class JHtmlPhpSetting
class PhpSetting
{
/**
* Method to generate a boolean message for a value
Expand All @@ -23,9 +28,9 @@ abstract class JHtmlPhpSetting
*
* @return string html code
*/
public static function boolean($val)
public function boolean($val)
{
return JText::_($val ? 'JON' : 'JOFF');
return Text::_($val ? 'JON' : 'JOFF');
}

/**
Expand All @@ -35,9 +40,9 @@ public static function boolean($val)
*
* @return string html code
*/
public static function set($val)
public function set($val)
{
return JText::_($val ? 'JYES' : 'JNO');
return Text::_($val ? 'JYES' : 'JNO');
}

/**
Expand All @@ -47,9 +52,9 @@ public static function set($val)
*
* @return string html code
*/
public static function string($val)
public function string($val)
{
return !empty($val) ? $val : JText::_('JNONE');
return !empty($val) ? $val : Text::_('JNONE');
}

/**
Expand All @@ -61,13 +66,13 @@ public static function string($val)
*
* @deprecated 4.0 Use intval() or casting instead.
*/
public static function integer($val)
public function integer($val)
{
try
{
JLog::add(sprintf('%s() is deprecated. Use intval() or casting instead.', __METHOD__), JLog::WARNING, 'deprecated');
Log::add(sprintf('%s() is deprecated. Use intval() or casting instead.', __METHOD__), Log::WARNING, 'deprecated');
}
catch (RuntimeException $exception)
catch (\RuntimeException $exception)
{
// Informational log only
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Admin\Administrator\Service\HTML;

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

/**
* Utility class working with system
*
* @since 1.6
*/
abstract class JHtmlSystem
class System
{
/**
* Method to generate a string message for a value
Expand All @@ -23,8 +27,8 @@ abstract class JHtmlSystem
*
* @return string html code
*/
public static function server($val)
public function server($val)
{
return !empty($val) ? $val : JText::_('COM_ADMIN_NA');
return !empty($val) ? $val : Text::_('COM_ADMIN_NA');
}
}
1 change: 1 addition & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -3974,6 +3974,7 @@ public function updateAssets($installer)
{
// List all components added since 4.0
$newComponents = array(
'com_csp'
);

foreach ($newComponents as $component)
Expand Down
56 changes: 56 additions & 0 deletions administrator/components/com_admin/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Dispatcher\DispatcherFactoryInterface;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\Service\Provider\DispatcherFactory;
use Joomla\CMS\Extension\Service\Provider\MVCFactoryFactory;
use Joomla\CMS\HTML\Registry;
use Joomla\CMS\MVC\Factory\MVCFactoryFactoryInterface;
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 MVCFactoryFactory('\\Joomla\\Component\\Admin'));
$container->registerServiceProvider(new DispatcherFactory('\\Joomla\\Component\\Admin'));

$container->set(
ComponentInterface::class,
function (Container $container)
{
$component = new AdminComponent($container->get(DispatcherFactoryInterface::class));

$component->setMvcFactoryFactory($container->get(MVCFactoryFactoryInterface::class));
$component->setRegistry($container->get(Registry::class));

return $component;
}
);
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `#__modules` CHANGE `content` `content` TEXT NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ CREATE TABLE IF NOT EXISTS `#__csp` (
`published` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES
(35, 'com_csp', 'component', 'com_csp', '', 0, 0, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "#__modules" ALTER COLUMN "content" DROP NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--
-- Table structure for table `#__csp`
--

CREATE TABLE IF NOT EXISTS "#__csp" (
"id" int(11) NOT NULL AUTO_INCREMENT,
"document_uri" varchar(500) NOT NULL DEFAULT '',
"blocked_uri" varchar(500) NOT NULL DEFAULT '',
"directive" varchar(500) NOT NULL DEFAULT '',
"created" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"modified" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
"published" smallint DEFAULT 0 NOT NULL,
PRIMARY KEY ("id")
);

INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state", "namespace") VALUES
(35, 'com_csp', 'component', 'com_csp', ' ', 0, 0, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
Loading

0 comments on commit e71cfa6

Please sign in to comment.