init
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="component" method="upgrade">
|
||||
<name>com_actionlogs</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2018-05</creationDate>
|
||||
<copyright>(C) 2018 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>3.9.0</version>
|
||||
<description>COM_ACTIONLOGS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Component\Actionlogs</namespace>
|
||||
<administration>
|
||||
<menu>COM_ACTIONLOGS</menu>
|
||||
<files folder="admin">
|
||||
<file>actionlogs.xml</file>
|
||||
<file>config.xml</file>
|
||||
<folder>forms</folder>
|
||||
<folder>services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/com_actionlogs.ini</language>
|
||||
<language tag="en-GB">language/en-GB/com_actionlogs.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config addfieldprefix="Joomla\Component\Actionlogs\Administrator\Field">
|
||||
<help key="User_Actions_Log:_Options"/>
|
||||
<inlinehelp button="show"/>
|
||||
<fieldset name="actionlogs" label="COM_ACTIONLOGS_OPTIONS">
|
||||
<field
|
||||
name="ip_logging"
|
||||
type="radio"
|
||||
label="COM_ACTIONLOGS_IP_LOGGING_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="csv_delimiter"
|
||||
type="list"
|
||||
label="COM_ACTIONLOGS_CSV_DELIMITER_LABEL"
|
||||
default=","
|
||||
validate="options"
|
||||
>
|
||||
<option value=",">COM_ACTIONLOGS_COMMA</option>
|
||||
<option value=";">COM_ACTIONLOGS_SEMICOLON</option>
|
||||
</field>
|
||||
<field
|
||||
name="loggable_extensions"
|
||||
type="logtype"
|
||||
label="COM_ACTIONLOGS_LOG_EXTENSIONS_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
default="com_banners,com_cache,com_categories,com_checkin,com_config,com_contact,com_content,com_fields,com_guidedtours,com_installer,com_media,com_menus,com_messages,com_modules,com_newsfeeds,com_plugins,com_redirect,com_scheduler,com_tags,com_templates,com_users"
|
||||
/>
|
||||
<field
|
||||
name="loggable_api"
|
||||
type="radio"
|
||||
label="COM_ACTIONLOGS_API_LOGGING_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="loggable_verbs"
|
||||
type="list"
|
||||
label="COM_ACTIONLOGS_LOG_VERBS_LABEL"
|
||||
multiple="true"
|
||||
showon="loggable_api:1"
|
||||
default="GET"
|
||||
validate="options"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
>
|
||||
<option value="GET">COM_ACTIONLOGS_FIELD_VALUE_GET</option>
|
||||
<option value="POST">COM_ACTIONLOGS_FIELD_VALUE_POST</option>
|
||||
<option value="DELETE">COM_ACTIONLOGS_FIELD_VALUE_DELETE</option>
|
||||
<option value="PUT">COM_ACTIONLOGS_FIELD_VALUE_PUT</option>
|
||||
<option value="PATCH">COM_ACTIONLOGS_FIELD_VALUE_PATCH</option>
|
||||
</field>
|
||||
<field
|
||||
name="date_relative"
|
||||
type="radio"
|
||||
label="COM_ACTIONLOGS_DATE_RELATIVE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</config>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form addfieldprefix="Joomla\Component\Actionlogs\Administrator\Field">
|
||||
<fields name="filter">
|
||||
<field
|
||||
name="search"
|
||||
type="text"
|
||||
inputmode="search"
|
||||
label="COM_ACTIONLOGS_FILTER_SEARCH_LABEL"
|
||||
description="COM_ACTIONLOGS_FILTER_SEARCH_DESC"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
name="extension"
|
||||
type="extension"
|
||||
label="COM_ACTIONLOGS_EXTENSION"
|
||||
class="js-select-submit-on-change"
|
||||
>
|
||||
<option value="">COM_ACTIONLOGS_SELECT_EXTENSION</option>
|
||||
</field>
|
||||
<field
|
||||
name="dateRange"
|
||||
type="logsdaterange"
|
||||
label="COM_ACTIONLOGS_DATE"
|
||||
class="js-select-submit-on-change"
|
||||
>
|
||||
<option value="">COM_ACTIONLOGS_OPTION_FILTER_DATE</option>
|
||||
</field>
|
||||
<field
|
||||
name="user"
|
||||
type="user"
|
||||
label="COM_ACTIONLOGS_NAME"
|
||||
class="js-select-submit-on-change"
|
||||
>
|
||||
<option value="">COM_ACTIONLOGS_SELECT_USER</option>
|
||||
</field>
|
||||
</fields>
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="JGLOBAL_SORT_BY"
|
||||
class="js-select-submit-on-change"
|
||||
default="a.id DESC"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.message ASC">COM_ACTIONLOGS_ACTION_ASC</option>
|
||||
<option value="a.message DESC">COM_ACTIONLOGS_ACTION_DESC</option>
|
||||
<option value="a.extension ASC">COM_ACTIONLOGS_EXTENSION_ASC</option>
|
||||
<option value="a.extension DESC">COM_ACTIONLOGS_EXTENSION_DESC</option>
|
||||
<option value="a.log_date ASC">JDATE_ASC</option>
|
||||
<option value="a.log_date DESC">JDATE_DESC</option>
|
||||
<option value="a.user_id ASC">JGLOBAL_NAME_ASC</option>
|
||||
<option value="a.user_id DESC">JGLOBAL_NAME_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
</fields>
|
||||
<fields name="list">
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="JGLOBAL_LIST_LIMIT"
|
||||
class="input-mini js-select-submit-on-change"
|
||||
default="25"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @copyright (C) 2019 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\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 actionlogs 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\\Actionlogs'));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Actionlogs'));
|
||||
|
||||
$container->set(
|
||||
ComponentInterface::class,
|
||||
function (Container $container) {
|
||||
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
|
||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
|
||||
return $component;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Event\ActionLog\AfterLogExportEvent;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Actionlogs list controller class.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class ActionlogsController extends AdminController
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* Recognized key values include 'name', 'default_task', 'model_path', and
|
||||
* 'view_path' (this list is not meant to be comprehensive).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
* @param ?CMSApplication $app The Application for the dispatcher
|
||||
* @param ?Input $input Input
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], ?MVCFactoryInterface $factory = null, $app = null, $input = null)
|
||||
{
|
||||
parent::__construct($config, $factory, $app, $input);
|
||||
|
||||
$this->registerTask('exportSelectedLogs', 'exportLogs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to export logs
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function exportLogs()
|
||||
{
|
||||
// Check for request forgeries.
|
||||
$this->checkToken();
|
||||
|
||||
$task = $this->getTask();
|
||||
|
||||
$pks = [];
|
||||
|
||||
if ($task == 'exportSelectedLogs') {
|
||||
// Get selected logs
|
||||
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
|
||||
}
|
||||
|
||||
/** @var ActionlogsModel $model */
|
||||
$model = $this->getModel();
|
||||
|
||||
// Get the logs data
|
||||
$data = $model->getLogDataAsIterator($pks);
|
||||
|
||||
if (\count($data)) {
|
||||
try {
|
||||
$rows = ActionlogsHelper::getCsvData($data);
|
||||
} catch (\InvalidArgumentException) {
|
||||
$this->setMessage(Text::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
|
||||
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Destroy the iterator now
|
||||
unset($data);
|
||||
|
||||
$date = new Date('now', new \DateTimeZone('UTC'));
|
||||
$filename = 'logs_' . $date->format('Y-m-d_His_T');
|
||||
|
||||
$csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ',');
|
||||
|
||||
$this->app->setHeader('Content-Type', 'application/csv', true)
|
||||
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
|
||||
->setHeader('Cache-Control', 'must-revalidate', true)
|
||||
->sendHeaders();
|
||||
|
||||
$output = fopen("php://output", "w");
|
||||
|
||||
foreach ($rows as $row) {
|
||||
fputcsv($output, $row, $csvDelimiter, escape: "");
|
||||
}
|
||||
|
||||
fclose($output);
|
||||
$this->getDispatcher()->dispatch('onAfterLogExport', new AfterLogExportEvent('onAfterLogExport'));
|
||||
$this->app->close();
|
||||
} else {
|
||||
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
|
||||
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return object The model.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
// Return the model
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean out the logs
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
// Check for request forgeries.
|
||||
$this->checkToken();
|
||||
|
||||
$model = $this->getModel();
|
||||
|
||||
if ($model->purge()) {
|
||||
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
|
||||
} else {
|
||||
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
|
||||
}
|
||||
|
||||
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Actionlogs\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Actionlogs display controller.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* The default view.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $default_view = 'actionlogs';
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Actionlogs\Administrator\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Access\Exception\NotAllowed;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcher;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* ComponentDispatcher class for com_actionlogs
|
||||
*
|
||||
* @since 4.2.7
|
||||
*/
|
||||
class Dispatcher extends ComponentDispatcher
|
||||
{
|
||||
/**
|
||||
* Method to check component access permission
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.2.7
|
||||
*/
|
||||
protected function checkAccess()
|
||||
{
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// Access check
|
||||
if (!$user->authorise('core.admin')) {
|
||||
throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Field to load a list of all extensions that have logged actions
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class ExtensionField extends ListField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $type = 'extension';
|
||||
|
||||
/**
|
||||
* Method to get the options to populate list
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select('DISTINCT ' . $db->quoteName('extension'))
|
||||
->from($db->quoteName('#__action_logs'))
|
||||
->order($db->quoteName('extension'));
|
||||
|
||||
$db->setQuery($query);
|
||||
$context = $db->loadColumn();
|
||||
|
||||
$options = [];
|
||||
|
||||
if (\count($context) > 0) {
|
||||
foreach ($context as $item) {
|
||||
$extensions[] = strtok($item, '.');
|
||||
}
|
||||
|
||||
$extensions = array_unique($extensions);
|
||||
|
||||
foreach ($extensions as $extension) {
|
||||
ActionlogsHelper::loadTranslationFiles($extension);
|
||||
$options[] = HTMLHelper::_('select.option', $extension, Text::_($extension));
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge(parent::getOptions(), $options);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Field to load a list of all users that have logged actions
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @deprecated 5.3 will be removed in 7.0 without replacement
|
||||
*/
|
||||
class LogcreatorField extends ListField
|
||||
{
|
||||
/**
|
||||
* Cached array of the category items.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected static $options = [];
|
||||
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $type = 'LogCreator';
|
||||
|
||||
/**
|
||||
* Method to get the options to populate list
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
// Accepted modifiers
|
||||
$hash = md5($this->element);
|
||||
|
||||
if (!isset(static::$options[$hash])) {
|
||||
static::$options[$hash] = parent::getOptions();
|
||||
|
||||
$db = $this->getDatabase();
|
||||
|
||||
// Construct the query
|
||||
$query = $db->createQuery()
|
||||
->select($db->quoteName('u.id', 'value'))
|
||||
->select($db->quoteName('u.username', 'text'))
|
||||
->from($db->quoteName('#__users', 'u'))
|
||||
->join('INNER', $db->quoteName('#__action_logs', 'c') . ' ON ' . $db->quoteName('c.user_id') . ' = ' . $db->quoteName('u.id'))
|
||||
->group($db->quoteName('u.id'))
|
||||
->group($db->quoteName('u.username'))
|
||||
->order($db->quoteName('u.username'));
|
||||
|
||||
// Setup the query
|
||||
$db->setQuery($query);
|
||||
|
||||
// Return the result
|
||||
if ($options = $db->loadObjectList()) {
|
||||
static::$options[$hash] = array_merge(static::$options[$hash], $options);
|
||||
}
|
||||
}
|
||||
|
||||
return static::$options[$hash];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\PredefinedlistField;
|
||||
use Joomla\CMS\Form\Form;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Field to show a list of range dates to sort with
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class LogsdaterangeField extends PredefinedlistField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $type = 'logsdaterange';
|
||||
|
||||
/**
|
||||
* Available options
|
||||
*
|
||||
* @var array
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $predefinedOptions = [
|
||||
'today' => 'COM_ACTIONLOGS_OPTION_RANGE_TODAY',
|
||||
'past_week' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_WEEK',
|
||||
'past_1month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_1MONTH',
|
||||
'past_3month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_3MONTH',
|
||||
'past_6month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_6MONTH',
|
||||
'past_year' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_YEAR',
|
||||
];
|
||||
|
||||
/**
|
||||
* Method to instantiate the form field object.
|
||||
*
|
||||
* @param Form $form The form to attach to the form field object.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function __construct($form = null)
|
||||
{
|
||||
parent::__construct($form);
|
||||
|
||||
// Load the required language
|
||||
$lang = Factory::getLanguage();
|
||||
$lang->load('com_actionlogs', JPATH_ADMINISTRATOR);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Application\ApplicationHelper;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Field to load a list of all extensions that have logged actions
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class LogtypeField extends ListField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $type = 'LogType';
|
||||
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select($db->quoteName('extension'))
|
||||
->from($db->quoteName('#__action_logs_extensions'));
|
||||
|
||||
$extensions = $db->setQuery($query)->loadColumn();
|
||||
|
||||
$options = [];
|
||||
|
||||
foreach ($extensions as $extension) {
|
||||
ActionlogsHelper::loadTranslationFiles($extension);
|
||||
$extensionName = Text::_($extension);
|
||||
$options[ApplicationHelper::stringURLSafe($extensionName) . '_' . $extension] = HTMLHelper::_('select.option', $extension, $extensionName);
|
||||
}
|
||||
|
||||
ksort($options);
|
||||
|
||||
return array_merge(parent::getOptions(), array_values($options));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Information field.
|
||||
*
|
||||
* @since 3.9.2
|
||||
*/
|
||||
class PlugininfoField extends FormField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.9.2
|
||||
*/
|
||||
protected $type = 'PluginInfo';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.9.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select($db->quoteName('extension_id'))
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog'))
|
||||
->where($db->quoteName('element') . ' = ' . $db->quote('joomla'));
|
||||
$db->setQuery($query);
|
||||
|
||||
$result = (int) $db->loadResult();
|
||||
|
||||
$link = HTMLHelper::_(
|
||||
'link',
|
||||
Route::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $result),
|
||||
Text::_('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED'),
|
||||
['class' => 'alert-link']
|
||||
);
|
||||
|
||||
return '<div class="alert alert-info">'
|
||||
. '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">'
|
||||
. Text::_('INFO')
|
||||
. '</span>'
|
||||
. Text::sprintf('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED_REDIRECT', $link)
|
||||
. '</div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Actionlogs\Administrator\Field;
|
||||
|
||||
use Joomla\CMS\Application\ApplicationHelper;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Field\ListField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
use Joomla\Database\ParameterType;
|
||||
|
||||
/**
|
||||
* Field to load a list of all users that have logged actions
|
||||
*
|
||||
* @since 5.1.0
|
||||
*/
|
||||
class UserlogtypeField extends ListField
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.1.0
|
||||
*/
|
||||
protected $type = 'UserLogType';
|
||||
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$query = $db->createQuery()
|
||||
->select($db->quoteName('extensions'))
|
||||
->from($db->quoteName('#__action_logs_users'))
|
||||
->where($db->quoteName('user_id') . ' = :userid')
|
||||
->bind(':userid', $user->id, ParameterType::INTEGER);
|
||||
|
||||
$extensions = $db->setQuery($query)->loadColumn();
|
||||
$userExt = [];
|
||||
$params = ComponentHelper::getParams('com_actionlogs');
|
||||
$globalExt = $params->get('loggable_extensions', []);
|
||||
|
||||
if (!empty($extensions)) {
|
||||
$userExt = substr($extensions[0], 2);
|
||||
$userExt = substr($userExt, 0, -2);
|
||||
$userExt = explode('","', $userExt);
|
||||
}
|
||||
|
||||
$common = array_merge($globalExt, array_intersect($globalExt, $userExt));
|
||||
$options = [];
|
||||
|
||||
foreach ($common as $extension) {
|
||||
ActionlogsHelper::loadTranslationFiles($extension);
|
||||
$extensionName = Text::_($extension);
|
||||
$options[ApplicationHelper::stringURLSafe($extensionName) . '_' . $extension] = HTMLHelper::_('select.option', $extension, $extensionName);
|
||||
}
|
||||
|
||||
ksort($options);
|
||||
|
||||
return array_merge(parent::getOptions(), array_values($options));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Filesystem\Path;
|
||||
use Joomla\String\StringHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Actionlogs component helper.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class ActionlogsHelper
|
||||
{
|
||||
/**
|
||||
* Array of characters starting a formula
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @since 3.9.7
|
||||
*/
|
||||
private static $characters = ['=', '+', '-', '@'];
|
||||
|
||||
/**
|
||||
* Method to convert logs objects array to an iterable type for use with a CSV export
|
||||
*
|
||||
* @param array|\Traversable $data The logs data objects to be exported
|
||||
*
|
||||
* @return \Generator
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function getCsvData($data): \Generator
|
||||
{
|
||||
if (!is_iterable($data)) {
|
||||
throw new \InvalidArgumentException(
|
||||
\sprintf(
|
||||
'%s() requires an array or object implementing the Traversable interface, a %s was given.',
|
||||
__METHOD__,
|
||||
\is_object($data) ? \get_class($data) : \gettype($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$disabledText = Text::_('COM_ACTIONLOGS_DISABLED');
|
||||
|
||||
// Header row
|
||||
yield ['Id', 'Action', 'Extension', 'Date', 'Name', 'IP Address'];
|
||||
|
||||
foreach ($data as $log) {
|
||||
$extension = strtok($log->extension, '.');
|
||||
|
||||
static::loadTranslationFiles($extension);
|
||||
|
||||
yield [
|
||||
'id' => $log->id,
|
||||
'message' => self::escapeCsvFormula(strip_tags(static::getHumanReadableLogMessage($log, false))),
|
||||
'extension' => self::escapeCsvFormula(Text::_($extension)),
|
||||
'date' => (new Date($log->log_date, new \DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
|
||||
'name' => self::escapeCsvFormula($log->name),
|
||||
'ip_address' => self::escapeCsvFormula($log->ip_address === 'COM_ACTIONLOGS_DISABLED' ? $disabledText : $log->ip_address),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the translation files for an extension
|
||||
*
|
||||
* @param string $extension Extension name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function loadTranslationFiles($extension)
|
||||
{
|
||||
static $cache = [];
|
||||
$extension = strtolower($extension);
|
||||
|
||||
if (isset($cache[$extension])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lang = Factory::getLanguage();
|
||||
$source = '';
|
||||
|
||||
switch (substr($extension, 0, 3)) {
|
||||
case 'com':
|
||||
default:
|
||||
$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
|
||||
break;
|
||||
|
||||
case 'lib':
|
||||
$source = JPATH_LIBRARIES . '/' . substr($extension, 4);
|
||||
break;
|
||||
|
||||
case 'mod':
|
||||
$source = JPATH_SITE . '/modules/' . $extension;
|
||||
break;
|
||||
|
||||
case 'plg':
|
||||
$parts = explode('_', $extension, 3);
|
||||
|
||||
if (\count($parts) > 2) {
|
||||
$source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'pkg':
|
||||
$source = JPATH_SITE;
|
||||
break;
|
||||
|
||||
case 'tpl':
|
||||
$source = JPATH_BASE . '/templates/' . substr($extension, 4);
|
||||
break;
|
||||
}
|
||||
|
||||
$lang->load($extension, JPATH_ADMINISTRATOR)
|
||||
|| $lang->load($extension, $source);
|
||||
|
||||
if (!$lang->hasKey(strtoupper($extension))) {
|
||||
$lang->load($extension . '.sys', JPATH_ADMINISTRATOR)
|
||||
|| $lang->load($extension . '.sys', $source);
|
||||
}
|
||||
|
||||
$cache[$extension] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get human readable log message for a User Action Log
|
||||
*
|
||||
* @param \stdClass $log A User Action log message record
|
||||
* @param boolean $generateLinks Flag to disable link generation when creating a message
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function getHumanReadableLogMessage($log, $generateLinks = true)
|
||||
{
|
||||
static::loadActionLogPluginsLanguage();
|
||||
static $links = [];
|
||||
$message = Text::_($log->message_language_key);
|
||||
$messageData = json_decode($log->message, true);
|
||||
|
||||
// Special handling for translation extension name
|
||||
if (isset($messageData['extension_name'])) {
|
||||
static::loadTranslationFiles($messageData['extension_name']);
|
||||
$messageData['extension_name'] = Text::_($messageData['extension_name']);
|
||||
}
|
||||
|
||||
// Translating application
|
||||
if (isset($messageData['app'])) {
|
||||
$messageData['app'] = Text::_($messageData['app']);
|
||||
}
|
||||
|
||||
// Translating type
|
||||
if (isset($messageData['type'])) {
|
||||
$messageData['type'] = Text::_($messageData['type']);
|
||||
}
|
||||
|
||||
// Remove links from the message template, if we should not generate links.
|
||||
if (!$generateLinks) {
|
||||
$message = preg_replace('/<a href=["\'].+?["\']>/', '', $message);
|
||||
$message = str_replace('</a>', '', $message);
|
||||
}
|
||||
|
||||
$linkMode = Factory::getApplication()->get('force_ssl', 0) >= 1 ? Route::TLS_FORCE : Route::TLS_IGNORE;
|
||||
|
||||
foreach ($messageData as $key => $value) {
|
||||
// Escape any markup in the values to prevent XSS attacks
|
||||
$value = $value !== null ? htmlspecialchars($value, ENT_QUOTES, 'UTF-8') : '';
|
||||
|
||||
// Convert relative url to absolute url so that it is clickable in action logs notification email
|
||||
if ($generateLinks && StringHelper::strpos($value, 'index.php?') === 0) {
|
||||
if (!isset($links[$value])) {
|
||||
$links[$value] = Route::link('administrator', $value, false, $linkMode, true);
|
||||
}
|
||||
|
||||
$value = $links[$value];
|
||||
}
|
||||
|
||||
$message = str_replace('{' . $key . '}', $value, $message);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to an item of given content type
|
||||
*
|
||||
* @param string $component
|
||||
* @param string $contentType
|
||||
* @param integer $id
|
||||
* @param string $urlVar
|
||||
* @param \stdClass $object
|
||||
*
|
||||
* @return string Link to the content item
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function getContentTypeLink($component, $contentType, $id, $urlVar = 'id', $object = null)
|
||||
{
|
||||
// Try to find the component helper.
|
||||
$eName = str_replace('com_', '', $component);
|
||||
$file = Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');
|
||||
|
||||
if (file_exists($file)) {
|
||||
$prefix = ucfirst(str_replace('com_', '', $component));
|
||||
$cName = $prefix . 'Helper';
|
||||
|
||||
\JLoader::register($cName, $file);
|
||||
|
||||
if (class_exists($cName) && \is_callable([$cName, 'getContentTypeLink'])) {
|
||||
return $cName::getContentTypeLink($contentType, $id, $object);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($urlVar)) {
|
||||
$urlVar = 'id';
|
||||
}
|
||||
|
||||
// Return default link to avoid having to implement getContentTypeLink in most of our components
|
||||
return 'index.php?option=' . $component . '&task=' . $contentType . '.edit&' . $urlVar . '=' . $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load both enabled and disabled actionlog plugins language file.
|
||||
*
|
||||
* It is used to make sure actions log is displayed properly instead of only language items displayed when a plugin is disabled.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function loadActionLogPluginsLanguage()
|
||||
{
|
||||
static $loaded;
|
||||
if ($loaded) {
|
||||
return;
|
||||
}
|
||||
$loaded = true;
|
||||
|
||||
$lang = Factory::getLanguage();
|
||||
$db = Factory::getDbo();
|
||||
|
||||
// Get all (both enabled and disabled) actionlog plugins
|
||||
$query = $db->createQuery()
|
||||
->select(
|
||||
$db->quoteName(
|
||||
[
|
||||
'folder',
|
||||
'element',
|
||||
'params',
|
||||
'extension_id',
|
||||
],
|
||||
[
|
||||
'type',
|
||||
'name',
|
||||
'params',
|
||||
'id',
|
||||
]
|
||||
)
|
||||
)
|
||||
->from($db->quoteName('#__extensions'))
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
|
||||
->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog'))
|
||||
->whereIn($db->quoteName('state'), [0, 1])
|
||||
->order($db->quoteName('ordering'));
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$rows = $db->loadObjectList();
|
||||
} catch (\RuntimeException) {
|
||||
$rows = [];
|
||||
}
|
||||
|
||||
if (empty($rows)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$name = $row->name;
|
||||
$type = $row->type;
|
||||
$extension = 'Plg_' . $type . '_' . $name;
|
||||
$extension = strtolower($extension);
|
||||
|
||||
// If language already loaded, don't load it again.
|
||||
if ($lang->getPaths($extension)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lang->load($extension, JPATH_ADMINISTRATOR)
|
||||
|| $lang->load($extension, JPATH_PLUGINS . '/' . $type . '/' . $name);
|
||||
}
|
||||
|
||||
// Load plg_system_actionlogs too
|
||||
$lang->load('plg_system_actionlogs', JPATH_ADMINISTRATOR);
|
||||
|
||||
// Load plg_system_privacyconsent too
|
||||
$lang->load('plg_system_privacyconsent', JPATH_ADMINISTRATOR);
|
||||
|
||||
// Load plg_user_terms too
|
||||
$lang->load('plg_user_terms', JPATH_ADMINISTRATOR);
|
||||
|
||||
// Load com_privacy too.
|
||||
$lang->load('com_privacy', JPATH_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes potential characters that start a formula in a CSV value to prevent injection attacks
|
||||
*
|
||||
* @param mixed $value csv field value
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.9.7
|
||||
*/
|
||||
protected static function escapeCsvFormula($value)
|
||||
{
|
||||
if ($value == '') {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (\in_array($value[0], self::$characters, true)) {
|
||||
$value = ' ' . $value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Actionlogs\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Model to interact with the action log configuration.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
class ActionlogConfigModel extends BaseDatabaseModel
|
||||
{
|
||||
/**
|
||||
* Returns the action logs config for the given context.
|
||||
*
|
||||
* @param string $context The context of the content
|
||||
*
|
||||
* @return \stdClass|null An object contains content type parameters, or null if not found
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function getLogContentTypeParams(string $context): ?\stdClass
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select('a.*')
|
||||
->from($db->quoteName('#__action_log_config', 'a'))
|
||||
->where($db->quoteName('a.type_alias') . ' = :context')
|
||||
->bind(':context', $context);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Mail\Exception\MailDisabledException;
|
||||
use Joomla\CMS\Mail\MailTemplate;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
use Joomla\CMS\User\UserFactoryAwareInterface;
|
||||
use Joomla\CMS\User\UserFactoryAwareTrait;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
use Joomla\Utilities\IpHelper;
|
||||
use PHPMailer\PHPMailer\Exception as phpMailerException;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Methods supporting a list of Actionlog records.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class ActionlogModel extends BaseDatabaseModel implements UserFactoryAwareInterface
|
||||
{
|
||||
use UserFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Function to add logs to the database
|
||||
* This method adds a record to #__action_logs contains (message_language_key, message, date, context, user)
|
||||
*
|
||||
* @param array $messages The contents of the messages to be logged
|
||||
* @param string $messageLanguageKey The language key of the message
|
||||
* @param string $context The context of the content passed to the plugin
|
||||
* @param integer $userId ID of user perform the action, usually ID of current logged in user
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function addLog($messages, $messageLanguageKey, $context, $userId = 0)
|
||||
{
|
||||
if (!is_numeric($userId)) {
|
||||
@trigger_error(\sprintf('User ID must be an integer in %s.', __METHOD__), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
try {
|
||||
$user = $userId ? $this->getUserFactory()->loadUserById($userId) : $this->getCurrentUser();
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
@trigger_error('UserFactory must be set, this will not be caught anymore in 7.0.', E_USER_DEPRECATED);
|
||||
$user = Factory::getUser($userId);
|
||||
}
|
||||
|
||||
$db = $this->getDatabase();
|
||||
$date = Factory::getDate();
|
||||
$params = ComponentHelper::getComponent('com_actionlogs')->getParams();
|
||||
|
||||
if ($params->get('ip_logging', 0)) {
|
||||
$ip = IpHelper::getIp();
|
||||
|
||||
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
|
||||
$ip = 'COM_ACTIONLOGS_IP_INVALID';
|
||||
}
|
||||
} else {
|
||||
$ip = 'COM_ACTIONLOGS_DISABLED';
|
||||
}
|
||||
|
||||
$loggedMessages = [];
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$logMessage = new \stdClass();
|
||||
$logMessage->message_language_key = $messageLanguageKey;
|
||||
$logMessage->message = json_encode($message);
|
||||
$logMessage->log_date = (string) $date;
|
||||
$logMessage->extension = $context;
|
||||
$logMessage->user_id = $user->id;
|
||||
$logMessage->ip_address = $ip;
|
||||
$logMessage->item_id = isset($message['id']) ? (int) $message['id'] : 0;
|
||||
|
||||
try {
|
||||
$db->insertObject('#__action_logs', $logMessage);
|
||||
$loggedMessages[] = $logMessage;
|
||||
} catch (\RuntimeException) {
|
||||
// Ignore it
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Send notification email to users who choose to be notified about the action logs
|
||||
$this->sendNotificationEmails($loggedMessages, $user->name, $context);
|
||||
} catch (MailDisabledException | phpMailerException) {
|
||||
// Ignore it
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification emails about the action log
|
||||
*
|
||||
* @param array $messages The logged messages
|
||||
* @param string $username The username
|
||||
* @param string $context The Context
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws MailDisabledException if mail is disabled
|
||||
* @throws phpmailerException if sending mail failed
|
||||
*/
|
||||
protected function sendNotificationEmails($messages, $username, $context)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$lang = $app->getLanguage();
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery();
|
||||
|
||||
$query
|
||||
->select($db->quoteName(['u.email', 'l.extensions']))
|
||||
->from($db->quoteName('#__users', 'u'))
|
||||
->where($db->quoteName('u.block') . ' = 0')
|
||||
->join(
|
||||
'INNER',
|
||||
$db->quoteName('#__action_logs_users', 'l') . ' ON ( ' . $db->quoteName('l.notify') . ' = 1 AND '
|
||||
. $db->quoteName('l.user_id') . ' = ' . $db->quoteName('u.id') . ')'
|
||||
);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$users = $db->loadObjectList();
|
||||
|
||||
$recipients = [];
|
||||
|
||||
foreach ($users as $user) {
|
||||
$extensions = json_decode($user->extensions, true);
|
||||
|
||||
if ($extensions && \in_array(strtok($context, '.'), $extensions)) {
|
||||
$recipients[] = $user->email;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($recipients)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$extension = strtok($context, '.');
|
||||
$lang->load('com_actionlogs', JPATH_ADMINISTRATOR);
|
||||
ActionlogsHelper::loadTranslationFiles($extension);
|
||||
$temp = [];
|
||||
$tempPlain = [];
|
||||
|
||||
foreach ($messages as $message) {
|
||||
$m = [];
|
||||
$m['extension'] = Text::_($extension);
|
||||
$m['message'] = ActionlogsHelper::getHumanReadableLogMessage($message);
|
||||
$tzOffset = Factory::getApplication()->get('offset');
|
||||
$m['date'] = HTMLHelper::_('date', $message->log_date, 'Y-m-d H:i:s T', $tzOffset);
|
||||
$m['ip_address'] = Text::_($message->ip_address);
|
||||
$m['username'] = $username;
|
||||
$temp[] = $m;
|
||||
|
||||
// copy replacement tags array and set non-HTML message.
|
||||
$mPlain = array_merge([], $m);
|
||||
$mPlain['message'] = ActionlogsHelper::getHumanReadableLogMessage($message, false);
|
||||
$tempPlain[] = $mPlain;
|
||||
}
|
||||
|
||||
$templateData = [
|
||||
'messages' => $temp,
|
||||
];
|
||||
$templateDataPlain = [
|
||||
'messages' => $tempPlain,
|
||||
];
|
||||
|
||||
$mailer = new MailTemplate('com_actionlogs.notification', $app->getLanguage()->getTag());
|
||||
$mailer->addTemplateData($templateData);
|
||||
$mailer->addTemplateData($templateDataPlain, true);
|
||||
|
||||
foreach ($recipients as $recipient) {
|
||||
$mailer->addRecipient($recipient);
|
||||
}
|
||||
|
||||
$mailer->send();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Event\ActionLog\AfterLogPurgeEvent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Database\DatabaseIterator;
|
||||
use Joomla\Database\ParameterType;
|
||||
use Joomla\Database\QueryInterface;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Methods supporting a list of article records.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class ActionlogsModel extends ListModel
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], ?MVCFactoryInterface $factory = null)
|
||||
{
|
||||
if (empty($config['filter_fields'])) {
|
||||
$config['filter_fields'] = [
|
||||
'a.id', 'id',
|
||||
'a.extension', 'extension',
|
||||
'a.user_id', 'user',
|
||||
'a.message', 'message',
|
||||
'a.log_date', 'log_date',
|
||||
'a.ip_address', 'ip_address',
|
||||
'dateRange',
|
||||
];
|
||||
}
|
||||
|
||||
parent::__construct($config, $factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function populateState($ordering = 'a.id', $direction = 'desc')
|
||||
{
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to load the list data.
|
||||
*
|
||||
* @return QueryInterface
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select('a.*')
|
||||
->select($db->quoteName('u.name'))
|
||||
->from($db->quoteName('#__action_logs', 'a'))
|
||||
->join('LEFT', $db->quoteName('#__users', 'u') . ' ON ' . $db->quoteName('a.user_id') . ' = ' . $db->quoteName('u.id'));
|
||||
|
||||
// Get ordering
|
||||
$fullorderCol = $this->state->get('list.fullordering', 'a.id DESC');
|
||||
|
||||
// Apply ordering
|
||||
if (!empty($fullorderCol)) {
|
||||
$query->order($db->escape($fullorderCol));
|
||||
}
|
||||
|
||||
// Get filter by user
|
||||
$user = $this->getState('filter.user');
|
||||
|
||||
// Apply filter by user
|
||||
if (!empty($user)) {
|
||||
$user = (int) $user;
|
||||
$query->where($db->quoteName('a.user_id') . ' = :userid')
|
||||
->bind(':userid', $user, ParameterType::INTEGER);
|
||||
}
|
||||
|
||||
// Get filter by extension
|
||||
$extension = $this->getState('filter.extension');
|
||||
|
||||
// Apply filter by extension
|
||||
if (!empty($extension)) {
|
||||
$extension .= '%';
|
||||
$query->where($db->quoteName('a.extension') . ' LIKE :extension')
|
||||
->bind(':extension', $extension);
|
||||
}
|
||||
|
||||
// Get filter by date range
|
||||
$dateRange = $this->getState('filter.dateRange');
|
||||
|
||||
// Apply filter by date range
|
||||
if (!empty($dateRange)) {
|
||||
$date = $this->buildDateRange($dateRange);
|
||||
|
||||
// If the chosen range is not more than a year ago
|
||||
if ($date['dNow'] !== false && $date['dStart'] !== false) {
|
||||
$dStart = $date['dStart']->format('Y-m-d H:i:s');
|
||||
$dNow = $date['dNow']->format('Y-m-d H:i:s');
|
||||
$query->where(
|
||||
$db->quoteName('a.log_date') . ' BETWEEN :dstart AND :dnow'
|
||||
);
|
||||
$query->bind(':dstart', $dStart);
|
||||
$query->bind(':dnow', $dNow);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the items over the search string if set.
|
||||
$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')
|
||||
->bind(':id', $ids, ParameterType::INTEGER);
|
||||
} elseif (stripos($search, 'item_id:') === 0) {
|
||||
$ids = (int) substr($search, 8);
|
||||
$query->where($db->quoteName('a.item_id') . ' = :itemid')
|
||||
->bind(':itemid', $ids, ParameterType::INTEGER);
|
||||
} else {
|
||||
$search = '%' . $search . '%';
|
||||
$query->where($db->quoteName('a.message') . ' LIKE :message')
|
||||
->bind(':message', $search);
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the date range to filter on.
|
||||
*
|
||||
* @param string $range The textual range to construct the filter for.
|
||||
*
|
||||
* @return array The date range to filter on.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function buildDateRange($range)
|
||||
{
|
||||
// Get UTC for now.
|
||||
$dNow = new Date();
|
||||
$dStart = clone $dNow;
|
||||
|
||||
switch ($range) {
|
||||
case 'past_week':
|
||||
$dStart->modify('-7 day');
|
||||
break;
|
||||
|
||||
case 'past_1month':
|
||||
$dStart->modify('-1 month');
|
||||
break;
|
||||
|
||||
case 'past_3month':
|
||||
$dStart->modify('-3 month');
|
||||
break;
|
||||
|
||||
case 'past_6month':
|
||||
$dStart->modify('-6 month');
|
||||
break;
|
||||
|
||||
case 'past_year':
|
||||
$dStart->modify('-1 year');
|
||||
break;
|
||||
|
||||
case 'today':
|
||||
// Ranges that need to align with local 'days' need special treatment.
|
||||
$offset = Factory::getApplication()->get('offset');
|
||||
|
||||
// Reset the start time to be the beginning of today, local time.
|
||||
$dStart = new Date('now', $offset);
|
||||
$dStart->setTime(0, 0, 0);
|
||||
|
||||
// Now change the timezone back to UTC.
|
||||
$tz = new \DateTimeZone('UTC');
|
||||
$dStart->setTimezone($tz);
|
||||
break;
|
||||
}
|
||||
|
||||
return ['dNow' => $dNow, 'dStart' => $dStart];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all log entries for an item
|
||||
*
|
||||
* @param string $extension The extension the item belongs to
|
||||
* @param integer $itemId The item ID
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getLogsForItem($extension, $itemId)
|
||||
{
|
||||
$itemId = (int) $itemId;
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select('a.*')
|
||||
->select($db->quoteName('u.name'))
|
||||
->from($db->quoteName('#__action_logs', 'a'))
|
||||
->join('INNER', $db->quoteName('#__users', 'u') . ' ON ' . $db->quoteName('a.user_id') . ' = ' . $db->quoteName('u.id'))
|
||||
->where($db->quoteName('a.extension') . ' = :extension')
|
||||
->where($db->quoteName('a.item_id') . ' = :itemid')
|
||||
->bind(':extension', $extension)
|
||||
->bind(':itemid', $itemId, ParameterType::INTEGER);
|
||||
|
||||
// Get ordering
|
||||
$fullorderCol = $this->getState('list.fullordering', 'a.id DESC');
|
||||
|
||||
// Apply ordering
|
||||
if (!empty($fullorderCol)) {
|
||||
$query->order($db->escape($fullorderCol));
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logs data into Table object
|
||||
*
|
||||
* @param integer[]|null $pks An optional array of log record IDs to load
|
||||
*
|
||||
* @return array All logs in the table
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getLogsData($pks = null)
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $this->getLogDataQuery($pks);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logs data as a database iterator
|
||||
*
|
||||
* @param integer[]|null $pks An optional array of log record IDs to load
|
||||
*
|
||||
* @return DatabaseIterator
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getLogDataAsIterator($pks = null)
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $this->getLogDataQuery($pks);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->getIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query for loading logs data
|
||||
*
|
||||
* @param integer[]|null $pks An optional array of log record IDs to load
|
||||
*
|
||||
* @return QueryInterface
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
private function getLogDataQuery($pks = null)
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->select('a.*')
|
||||
->select($db->quoteName('u.name'))
|
||||
->from($db->quoteName('#__action_logs', 'a'))
|
||||
->join('INNER', $db->quoteName('#__users', 'u') . ' ON ' . $db->quoteName('a.user_id') . ' = ' . $db->quoteName('u.id'));
|
||||
|
||||
if (\is_array($pks) && \count($pks) > 0) {
|
||||
$pks = ArrayHelper::toInteger($pks);
|
||||
$query->whereIn($db->quoteName('a.id'), $pks);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete logs
|
||||
*
|
||||
* @param array $pks Primary keys of logs
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
$keys = ArrayHelper::toInteger($pks);
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->createQuery()
|
||||
->delete($db->quoteName('#__action_logs'))
|
||||
->whereIn($db->quoteName('id'), $keys);
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$db->execute();
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->setError($e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->getDispatcher()->dispatch('onAfterLogPurge', new AfterLogPurgeEvent('onAfterLogPurge'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all of logs from the table.
|
||||
*
|
||||
* @return boolean result of operation
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
try {
|
||||
$this->getDatabase()->truncateTable('#__action_logs');
|
||||
} catch (\Exception) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->getDispatcher()->dispatch('onAfterLogPurge', new AfterLogPurgeEvent('onAfterLogPurge'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter form
|
||||
*
|
||||
* @param array $data data
|
||||
* @param boolean $loadData load current data
|
||||
*
|
||||
* @return Form|boolean The Form object or false on error
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public function getFilterForm($data = [], $loadData = true)
|
||||
{
|
||||
$form = parent::getFilterForm($data, $loadData);
|
||||
$params = ComponentHelper::getParams('com_actionlogs');
|
||||
$ipLogging = (bool) $params->get('ip_logging', 0);
|
||||
|
||||
// Add ip sort options to sort dropdown
|
||||
if ($form && $ipLogging) {
|
||||
/* @var \Joomla\CMS\Form\Field\ListField $field */
|
||||
$field = $form->getField('fullordering', 'list');
|
||||
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_ASC'), ['value' => 'a.ip_address ASC']);
|
||||
$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_DESC'), ['value' => 'a.ip_address DESC']);
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\Plugin;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Abstract Action Log Plugin
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
abstract class ActionLogPlugin extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Application object.
|
||||
*
|
||||
* @var \Joomla\CMS\Application\CMSApplication
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @deprecated 5.1.0 will be removed in 7.0 use $this->getApplication() instead
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Database object.
|
||||
*
|
||||
* @var \Joomla\Database\DatabaseDriver
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @deprecated 5.1.0 will be removed in 7.0 use $this->getDatabase() instead
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Load plugin language file automatically so that it can be used inside component
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Proxy for ActionlogsModelUserlog addLog method
|
||||
*
|
||||
* This method adds a record to #__action_logs contains (message_language_key, message, date, context, user)
|
||||
*
|
||||
* @param array $messages The contents of the messages to be logged
|
||||
* @param string $messageLanguageKey The language key of the message
|
||||
* @param string $context The context of the content passed to the plugin
|
||||
* @param int $userId ID of user perform the action, usually ID of current logged in user
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addLog($messages, $messageLanguageKey, $context, $userId = null)
|
||||
{
|
||||
$app = $this->getApplication() ?: $this->app;
|
||||
$user = $app->getIdentity();
|
||||
|
||||
foreach ($messages as $index => $message) {
|
||||
if (!\array_key_exists('userid', $message) && $user) {
|
||||
$message['userid'] = $user->id;
|
||||
}
|
||||
|
||||
if (!\array_key_exists('username', $message) && $user) {
|
||||
$message['username'] = $user->username;
|
||||
}
|
||||
|
||||
if (!\array_key_exists('accountlink', $message) && $user) {
|
||||
$message['accountlink'] = 'index.php?option=com_users&task=user.edit&id=' . $user->id;
|
||||
}
|
||||
|
||||
if (\array_key_exists('type', $message)) {
|
||||
$message['type'] = strtoupper($message['type']);
|
||||
}
|
||||
|
||||
if (\array_key_exists('app', $message)) {
|
||||
$message['app'] = strtoupper($message['app']);
|
||||
}
|
||||
|
||||
$messages[$index] = $message;
|
||||
}
|
||||
|
||||
/** @var \Joomla\Component\Actionlogs\Administrator\Model\ActionlogModel $model */
|
||||
$model = $app->bootComponent('com_actionlogs')
|
||||
->getMVCFactory()->createModel('Actionlog', 'Administrator', ['ignore_request' => true]);
|
||||
|
||||
$model->addLog($messages, strtoupper($messageLanguageKey), $context, $userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\Actionlogs\Administrator\View\Actionlogs;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\ListView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* View class for a list of logs.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class HtmlView extends ListView
|
||||
{
|
||||
/**
|
||||
* Setting if the IP column should be shown
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected $showIpColumn = false;
|
||||
|
||||
/**
|
||||
* Setting if the date should be displayed relative to the current date.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 4.1.0
|
||||
*/
|
||||
protected $dateRelative = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
if (empty($config['option'])) {
|
||||
$config['option'] = 'com_actionlogs';
|
||||
}
|
||||
|
||||
$config['toolbar_title'] = 'COM_ACTIONLOGS_MANAGER_USERLOGS';
|
||||
$config['toolbar_icon'] = 'list-2 actionlog';
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare view data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 6.0.0
|
||||
*/
|
||||
protected function initializeView()
|
||||
{
|
||||
parent::initializeView();
|
||||
|
||||
$params = ComponentHelper::getParams('com_actionlogs');
|
||||
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
|
||||
$this->dateRelative = (bool) $params->get('date_relative', 1);
|
||||
|
||||
// Load all actionlog plugins language files
|
||||
ActionlogsHelper::loadActionLogPluginsLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'), 'icon-list-2');
|
||||
|
||||
$toolbar = $this->getDocument()->getToolbar();
|
||||
|
||||
$toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_CSV', 'actionlogs.exportSelectedLogs')
|
||||
->icon('icon-download')
|
||||
->listCheck(true);
|
||||
|
||||
$toolbar->standardButton('download', 'COM_ACTIONLOGS_EXPORT_ALL_CSV', 'actionlogs.exportLogs')
|
||||
->icon('icon-download')
|
||||
->listCheck(false);
|
||||
|
||||
$toolbar->delete('actionlogs.delete')
|
||||
->message('JGLOBAL_CONFIRM_DELETE');
|
||||
|
||||
$toolbar->confirmButton('delete', 'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge')
|
||||
->message('COM_ACTIONLOGS_PURGE_CONFIRM')
|
||||
->listCheck(false);
|
||||
|
||||
$toolbar->preferences('com_actionlogs');
|
||||
$toolbar->help('User_Actions_Log');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_actionlogs
|
||||
*
|
||||
* @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\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
|
||||
/** @var \Joomla\Component\Actionlogs\Administrator\View\Actionlogs\HtmlView $this */
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('table.columns')
|
||||
->useScript('multiselect')
|
||||
->useScript('com_actionlogs.admin-actionlogs');
|
||||
|
||||
?>
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_actionlogs&view=actionlogs'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<div id="j-main-container" class="j-main-container">
|
||||
<?php // Search tools bar ?>
|
||||
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-info">
|
||||
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table" id="logsList">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('COM_ACTIONLOGS_TABLE_CAPTION'); ?>,
|
||||
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="w-1 text-center">
|
||||
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||
</td>
|
||||
<th scope="col" class="d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_ACTION', 'a.message', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-15 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_EXTENSION', 'a.extension', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-15 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_DATE', 'a.log_date', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th scope="col" class="w-10 d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_NAME', 'a.user_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->showIpColumn) : ?>
|
||||
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_IP_ADDRESS', 'a.ip_address', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-1 d-none d-md-table-cell">
|
||||
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$extension = strtok($item->extension, '.');
|
||||
ActionlogsHelper::loadTranslationFiles($extension); ?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="text-center">
|
||||
<?php echo HTMLHelper::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<th scope="row" class="d-md-table-cell">
|
||||
<?php echo ActionlogsHelper::getHumanReadableLogMessage($item); ?>
|
||||
</th>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo $this->escape(Text::_($extension)); ?>
|
||||
</td>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php if ($this->dateRelative) : ?>
|
||||
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
|
||||
<div class="small">
|
||||
<?php endif; ?>
|
||||
<?php echo HTMLHelper::_('date', $item->log_date, Text::_('DATE_FORMAT_LC6')); ?>
|
||||
<?php if ($this->dateRelative) : ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="d-md-table-cell">
|
||||
<?php echo $this->escape($item->name); ?>
|
||||
</td>
|
||||
<?php if ($this->showIpColumn) : ?>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo Text::_($this->escape($item->ip_address)); ?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<?php echo (int) $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php // Load the pagination. ?>
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
|
||||
<?php endif;?>
|
||||
|
||||
<?php echo $this->filterForm->renderControlFields(); ?>
|
||||
</div>
|
||||
</form>
|
||||
<form action="<?php echo Route::_('index.php?option=com_actionlogs&view=actionlogs'); ?>" method="post" name="exportForm" id="exportForm">
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="cids" value="" />
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</form>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_ACTIONLOGS_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_ACTIONLOGS_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
</metadata>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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>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>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_admin
|
||||
*
|
||||
* @copyright (C) 2024 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 Brotli compression.
|
||||
*/
|
||||
|
||||
// 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 for brotli to prevent double compression
|
||||
*
|
||||
* This check returns true regardless of condition.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 4.4.4
|
||||
*/
|
||||
function admin_postinstall_htaccessbrotli_condition()
|
||||
{
|
||||
$htaccessContent = '';
|
||||
|
||||
if (is_file(JPATH_ROOT . '/.htaccess') || is_file(JPATH_ROOT . '/htaccess.txt')) {
|
||||
$htaccessContent = file_get_contents(is_file(JPATH_ROOT . '/.htaccess') ? JPATH_ROOT . '/.htaccess' : JPATH_ROOT . '/htaccess.txt');
|
||||
}
|
||||
|
||||
return !str_contains($htaccessContent, 'E=no-brotli:1');
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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->createQuery()
|
||||
->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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Update link to featured
|
||||
|
||||
UPDATE `#__menu`
|
||||
SET `link` = 'index.php?option=com_content&view=articles&filter[featured]=1'
|
||||
WHERE `link` = 'index.php?option=com_content&view=featured'
|
||||
AND `client_id` = 1;
|
||||
@@ -0,0 +1,2 @@
|
||||
INSERT IGNORE INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES
|
||||
('plg_content_joomla.newarticle', 'plg_content_joomla', '', 'PLG_CONTENT_JOOMLA_NEW_ARTICLE_SUBJECT', 'PLG_CONTENT_JOOMLA_NEW_ARTICLE_BODY', '', '', '{"tags":["sitename","name","email","title","url"]}');
|
||||
@@ -0,0 +1,3 @@
|
||||
UPDATE `#__extensions`
|
||||
SET `params` = ''
|
||||
WHERE `type` = 'plugin' AND `element` = 'stats' AND `folder` = 'system';
|
||||
@@ -0,0 +1,62 @@
|
||||
--
|
||||
-- Insert back previously unlocked schemaorg and task core plugins if they have been uninstalled
|
||||
--
|
||||
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_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'article' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_blogposting', 'plugin', 'blogposting', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'blogposting' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_book', 'plugin', 'book', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'book' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_event', 'plugin', 'event', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'event' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'jobposting' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'organization' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'person' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'recipe' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'custom' AND e.`folder` = 'schemaorg' AND e.`client_id` = 0);
|
||||
|
||||
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_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'schemaorg' AND e.`folder` = 'system' AND e.`client_id` = 0);
|
||||
|
||||
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_task_globalcheckin', 'plugin', 'globalcheckin', 'task', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'globalcheckin' AND e.`folder` = 'task' AND e.`client_id` = 0);
|
||||
|
||||
--
|
||||
-- Update present unlocked schemaorg and task core plugins
|
||||
--
|
||||
UPDATE `#__extensions` SET `locked` = 1
|
||||
WHERE `type` = 'plugin' AND `folder` = 'schemaorg'
|
||||
AND `element` IN ('article', 'blogposting', 'book', 'event', 'jobposting', 'organization', 'person', 'recipe', 'custom')
|
||||
AND `locked` <> 1;
|
||||
|
||||
UPDATE `#__extensions` SET `locked` = 1
|
||||
WHERE `type` = 'plugin' AND `element` = 'schemaorg' AND `folder` = 'system'
|
||||
AND `locked` <> 1;
|
||||
|
||||
UPDATE `#__extensions` SET `locked` = 1
|
||||
WHERE `type` = 'plugin' AND `element` = 'globalcheckin' AND `folder` = 'task'
|
||||
AND `locked` <> 1;
|
||||
@@ -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_fields_note', 'plugin', 'note', 'fields', 0, 1, 1, 0, 1, '', '{"class":"alert alert-info","heading":"h4"}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'note' AND e.`folder` = 'fields' AND e.`client_id` = 0);
|
||||
@@ -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_fields_number', 'plugin', 'number', 'fields', 0, 1, 1, 0, 1, '', '{"min":"1.0","max":"100.0","step":"0.1","currency":"0","position":"0","decimals":"2"}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'number' AND e.`folder` = 'fields' AND e.`client_id` = 0);
|
||||
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`)
|
||||
SELECT 0, 'cassiopeia_extended', 'template', 'cassiopeia_extended', '', 0, 1, 1, 0, 1, '', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","systemFontBody":"","systemFontHeading":"","colorName":"colors_standard","fluidContainer":"0","stickyHeader":"0","backTop":"0","colorSettings":"0","headerbg":"rgb(193, 205, 207)","headercolor":"rgb(23, 23, 23)","bodybg":"rgb(254, 254, 254)","bodycolor":"rgb(23, 23, 23)","linkcolor":"rgb(29, 121, 137)","linkcolorh":"rgb(14, 59, 67)","btnbg":"rgb(206, 60, 55)","btnbgh":"rgb(131, 35, 32)","btncolor":"rgb(254, 254, 254)","btncolorh":"rgb(254, 254, 254)","footerbg":"rgb(29, 121, 137)","footercolor":"rgb(254, 254, 254)","fontSettings":"0","bodysize":"1","h1size":"2","h2size":"1.7","h3size":"1.5"}', '', 0, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'template' AND e.`element` = 'cassiopeia_extended' AND e.`client_id` = 0);
|
||||
|
||||
INSERT INTO `#__template_styles` (`template`, `client_id`, `home`, `title`, `inheritable`, `parent`, `params`)
|
||||
SELECT 'cassiopeia_extended', 0, '0', 'Cassiopeia Extended - Default', 0, 'cassiopeia', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","systemFontBody":"","systemFontHeading":"","colorName":"colors_standard","fluidContainer":"0","stickyHeader":"0","backTop":"0","colorSettings":"0","headerbg":"rgb(193, 205, 207)","headercolor":"rgb(23, 23, 23)","bodybg":"rgb(254, 254, 254)","bodycolor":"rgb(23, 23, 23)","linkcolor":"rgb(29, 121, 137)","linkcolorh":"rgb(14, 59, 67)","btnbg":"rgb(206, 60, 55)","btnbgh":"rgb(131, 35, 32)","btncolor":"rgb(254, 254, 254)","btncolorh":"rgb(254, 254, 254)","footerbg":"rgb(29, 121, 137)","footercolor":"rgb(254, 254, 254)","fontSettings":"0","bodysize":"1","h1size":"2","h2size":"1.7","h3size":"1.5"}'
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__template_styles` t WHERE t.`template` = 'cassiopeia_extended' AND t.`client_id` = 0 AND t.`inheritable` = 0 AND t.`parent` = 'cassiopeia');
|
||||
@@ -0,0 +1,6 @@
|
||||
-- uninstall previous what's new tours
|
||||
DELETE FROM `#__guidedtour_steps`
|
||||
WHERE `tour_id` IN (SELECT `id` FROM `#__guidedtours` WHERE `uid` IN ('joomla-whatsnew-5-2', 'joomla-whatsnew-5-3', 'joomla-whatsnew-5-4'));
|
||||
|
||||
DELETE FROM `#__guidedtours`
|
||||
WHERE `uid` IN ('joomla-whatsnew-5-2', 'joomla-whatsnew-5-3', 'joomla-whatsnew-5-4');
|
||||
@@ -0,0 +1,13 @@
|
||||
INSERT INTO `#__guidedtours` (`title`, `description`, `extensions`, `url`, `published`, `language`, `note`, `access`, `uid`, `autostart`, `created`, `created_by`, `modified`, `modified_by`)
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_DESCRIPTION', '["com_cpanel"]', 'administrator/index.php', 1, '*', '', 1, 'joomla-whatsnew-6-0', 1, CURRENT_TIMESTAMP(), 0, CURRENT_TIMESTAMP(), 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__guidedtours` g WHERE g.`uid` = 'joomla-whatsnew-6-0');
|
||||
|
||||
INSERT INTO `#__guidedtour_steps` (`title`, `description`, `position`, `target`, `type`, `interactive_type`, `url`, `published`, `language`, `note`, `params`, `created`, `created_by`, `modified`, `modified_by`, `tour_id`)
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_0_DESCRIPTION', 'center', '', 0, 1, '', 1, '*', '', '{"required":1,"requiredvalue":""}', CURRENT_TIMESTAMP(), 0, CURRENT_TIMESTAMP(), 0, MAX(`id`)
|
||||
FROM `#__guidedtours`
|
||||
WHERE `uid` = 'joomla-whatsnew-6-0';
|
||||
|
||||
INSERT INTO `#__guidedtour_steps` (`title`, `description`, `position`, `target`, `type`, `interactive_type`, `url`, `published`, `language`, `note`, `params`, `created`, `created_by`, `modified`, `modified_by`, `tour_id`)
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_1_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_1_DESCRIPTION', 'right', '#sidebarmenu nav > ul:first-of-type > li:last-child', 0, 1, '', 1, '*', '', '"{\"required\":1,\"requiredvalue\":\"\"}"', CURRENT_TIMESTAMP(), 0, CURRENT_TIMESTAMP(), 0, MAX(`id`)
|
||||
FROM `#__guidedtours`
|
||||
WHERE `uid` = 'joomla-whatsnew-6-0';
|
||||
@@ -0,0 +1,3 @@
|
||||
UPDATE `#__update_sites`
|
||||
SET `location` = 'https://update.joomla.org/language/translationlist_6.xml'
|
||||
WHERE `location` = 'https://update.joomla.org/language/translationlist_5.xml';
|
||||
@@ -0,0 +1,32 @@
|
||||
-- Update content types for lookup tags
|
||||
|
||||
UPDATE `#__content_types`
|
||||
SET `content_history_options` = JSON_ARRAY_APPEND(
|
||||
`content_history_options`,
|
||||
'$.displayLookup',
|
||||
JSON_OBJECT(
|
||||
'sourceColumn', 'tags',
|
||||
'targetTable', '#__tags',
|
||||
'targetColumn', 'id',
|
||||
'displayColumn', 'title'
|
||||
)
|
||||
)
|
||||
WHERE `type_alias` IN (
|
||||
'com_content.article',
|
||||
'com_contact.contact',
|
||||
'com_newsfeeds.newsfeed',
|
||||
'com_content.category',
|
||||
'com_contact.category',
|
||||
'com_newsfeeds.category',
|
||||
'com_banners.category',
|
||||
'com_users.category'
|
||||
)
|
||||
AND NOT JSON_CONTAINS(
|
||||
JSON_EXTRACT(`content_history_options`, '$.displayLookup'),
|
||||
JSON_OBJECT(
|
||||
'sourceColumn', 'tags',
|
||||
'targetTable', '#__tags',
|
||||
'targetColumn', 'id',
|
||||
'displayColumn', 'title'
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE `#__history`
|
||||
ADD COLUMN `is_current` TINYINT NOT NULL DEFAULT 0 /** CAN FAIL **/;
|
||||
ALTER TABLE `#__history`
|
||||
ADD COLUMN `is_legacy` TINYINT NOT NULL DEFAULT 0 /** CAN FAIL **/;
|
||||
UPDATE `#__history` SET `is_legacy` = 1;
|
||||
@@ -0,0 +1,14 @@
|
||||
UPDATE `#__menu`
|
||||
SET `params` = JSON_SET(`params`,
|
||||
JSON_UNQUOTE(JSON_SEARCH(`params`, 'one', ' ', NULL, '$.featured_categories[*]')),
|
||||
''
|
||||
)
|
||||
WHERE JSON_VALID(`params`) = 1
|
||||
AND JSON_SEARCH(`params`, 'one', ' ', NULL, '$.featured_categories[*]') IS NOT NULL
|
||||
AND `type` = 'component'
|
||||
AND `link` = 'index.php?option=com_content&view=featured';
|
||||
|
||||
UPDATE `#__menu`
|
||||
SET `link` = REPLACE(`link`, '&catid[0]= ', '&catid[0]=')
|
||||
WHERE `type` = 'component'
|
||||
AND `link` LIKE 'index.php?option=com_content&view=archive&catid[0]= %';
|
||||
@@ -0,0 +1,8 @@
|
||||
--
|
||||
-- Add a template tag for ip_address on Joomla update.
|
||||
-- New installs will have the default value set in the installation support sql.
|
||||
--
|
||||
|
||||
UPDATE `#__mail_templates`
|
||||
SET `params` = '{"tags":["messages","message","date","extension","username","ip_address"]}'
|
||||
WHERE `template_id` = 'com_actionlogs.notification';
|
||||
@@ -0,0 +1,3 @@
|
||||
INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`)
|
||||
SELECT 'plg_captcha_powcaptcha', 'plugin', 'powcaptcha', 'captcha', 0, 1, 1, 0, 1, '', '{}', '', 0, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'powcaptcha' AND e.`folder` = 'captcha' AND e.`client_id` = 0);
|
||||
@@ -0,0 +1,7 @@
|
||||
-- --------------------------------------------------------
|
||||
-- The following statement which was introduced with 6.1.0-beta1
|
||||
-- has been disabled as it was replaced in 6.1.0-beta3 with
|
||||
-- a new statement in file "6.1.0-2026-03-10.sql".
|
||||
-- See https://github.com/joomla/joomla-cms/pull/47361 for details.
|
||||
--
|
||||
-- INSERT INTO `#__content_types` (`type_id`, `type_title`, `type_alias`, `table`, `rules`, `field_mappings`, `router`, `content_history_options`) VALUES (14, 'Module', 'com_modules.module', '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}', '', '{}', '', '{"formFile":"administrator\\/components\\/com_modules\\/forms\\/module.xml", "hideFields":["checked_out", "checked_out_time", "publish_up", "publish_down"], "ignoreChanges":["checked_out", "checked_out_time"], "convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"checked_out", "targetTable":"#__users", "targetColumn":"id", "displayColumn":"name"}]}');
|
||||
@@ -0,0 +1,5 @@
|
||||
--
|
||||
-- Add position column to workflow stages table
|
||||
--
|
||||
|
||||
ALTER TABLE `#__workflow_stages` ADD COLUMN `position` text NULL AFTER `default` /** CAN FAIL **/;
|
||||
@@ -0,0 +1,15 @@
|
||||
UPDATE `#__extensions`
|
||||
SET `params` = JSON_REPLACE(`params`, '$.html_height' , '550px')
|
||||
WHERE `type` = 'plugin'
|
||||
AND `folder` = 'editors'
|
||||
AND `element` = 'tinymce'
|
||||
AND `params` <> ''
|
||||
AND JSON_EXTRACT(`params`, '$.html_height') = '550';
|
||||
|
||||
UPDATE `#__extensions`
|
||||
SET `params` = JSON_REPLACE(`params`, '$.html_width' , '100%')
|
||||
WHERE `type` = 'plugin'
|
||||
AND `folder` = 'editors'
|
||||
AND `element` = 'tinymce'
|
||||
AND `params` <> ''
|
||||
AND JSON_EXTRACT(`params`, '$.html_width') = '750';
|
||||
@@ -0,0 +1,13 @@
|
||||
-- --------------------------------------------------------
|
||||
-- The following statement replaces the statement which has been disabled
|
||||
-- in file "6.1.0-2026-01-29.sql" with 6.1.0-beta3.
|
||||
-- See https://github.com/joomla/joomla-cms/pull/47361 for details.
|
||||
--
|
||||
INSERT INTO `#__content_types` (`type_title`, `type_alias`, `table`, `rules`, `field_mappings`, `router`, `content_history_options`)
|
||||
SELECT 'Module', 'com_modules.module', '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}', '', '{}', ''
|
||||
, '{"formFile":"administrator\\/components\\/com_modules\\/forms\\/module.xml", "hideFields":["checked_out", "checked_out_time", "publish_up", "publish_down"], "ignoreChanges":["checked_out", "checked_out_time"], "convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"checked_out", "targetTable":"#__users", "targetColumn":"id", "displayColumn":"name"}]}'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT * FROM `#__content_types` c
|
||||
WHERE c.`type_title` = 'Module' AND c.`type_alias` = 'com_modules.module'
|
||||
AND c.`table` = '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}'
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
-- disable autostart for the previous tour
|
||||
UPDATE `#__guidedtours` SET `autostart` = 0 WHERE `uid` = 'joomla-whatsnew-6-0';
|
||||
|
||||
INSERT INTO `#__guidedtours` (`title`, `description`, `extensions`, `url`, `published`, `language`, `note`, `access`, `uid`, `autostart`, `created`, `created_by`, `modified`, `modified_by`)
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_DESCRIPTION', '["com_cpanel"]', 'administrator/index.php', 1, '*', '', 1, 'joomla-whatsnew-6-1', 1, CURRENT_TIMESTAMP(), 0, CURRENT_TIMESTAMP(), 0
|
||||
WHERE NOT EXISTS (SELECT * FROM `#__guidedtours` g WHERE g.`uid` = 'joomla-whatsnew-6-1');
|
||||
|
||||
INSERT INTO `#__guidedtour_steps` (`title`, `description`, `position`, `target`, `type`, `interactive_type`, `url`, `published`, `language`, `note`, `params`, `created`, `created_by`, `modified`, `modified_by`, `tour_id`)
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_STEP_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_STEP_0_DESCRIPTION', 'right', '#sidebarmenu nav > ul:first-of-type > li:last-child', 0, 1, '', 1, '*', '', '{"required":1,"requiredvalue":""}', CURRENT_TIMESTAMP(), 0, CURRENT_TIMESTAMP(), 0, MAX(`id`)
|
||||
FROM `#__guidedtours`
|
||||
WHERE `uid` = 'joomla-whatsnew-6-1';
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
-- Update link to featured
|
||||
|
||||
UPDATE "#__menu"
|
||||
SET "link" = 'index.php?option=com_content&view=articles&filter[featured]=1'
|
||||
WHERE "link" = 'index.php?option=com_content&view=featured'
|
||||
AND "client_id" = 1;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES
|
||||
('plg_content_joomla.newarticle', 'plg_content_joomla', '', 'PLG_CONTENT_JOOMLA_NEW_ARTICLE_SUBJECT', 'PLG_CONTENT_JOOMLA_NEW_ARTICLE_BODY', '', '', '{"tags":["sitename","name","email","title","url"]}')
|
||||
ON CONFLICT DO NOTHING;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
UPDATE "#__extensions"
|
||||
SET "params" = ''
|
||||
WHERE "type" = 'plugin' AND "element" = 'stats' AND "folder" = 'system';
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
--
|
||||
-- Insert back previously unlocked schemaorg and task core plugins if they have been uninstalled
|
||||
--
|
||||
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_schemaorg_article', 'plugin', 'article', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'article' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_blogposting', 'plugin', 'blogposting', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'blogposting' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_book', 'plugin', 'book', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'book' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_event', 'plugin', 'event', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'event' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_jobposting', 'plugin', 'jobposting', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'jobposting' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_organization', 'plugin', 'organization', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'organization' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_person', 'plugin', 'person', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'person' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_recipe', 'plugin', 'recipe', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'recipe' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_schemaorg_custom', 'plugin', 'custom', 'schemaorg', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'custom' AND e."folder" = 'schemaorg' AND e."client_id" = 0);
|
||||
|
||||
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_system_schemaorg', 'plugin', 'schemaorg', 'system', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'schemaorg' AND e."folder" = 'system' AND e."client_id" = 0);
|
||||
|
||||
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_task_globalcheckin', 'plugin', 'globalcheckin', 'task', 0, 0, 1, 0, 1, '', '{}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'globalcheckin' AND e."folder" = 'task' AND e."client_id" = 0);
|
||||
|
||||
--
|
||||
-- Update present unlocked schemaorg and task core plugins
|
||||
--
|
||||
UPDATE "#__extensions" SET "locked" = 1
|
||||
WHERE "type" = 'plugin' AND "folder" = 'schemaorg'
|
||||
AND "element" IN ('article', 'blogposting', 'book', 'event', 'jobposting', 'organization', 'person', 'recipe', 'custom')
|
||||
AND "locked" <> 1;
|
||||
|
||||
UPDATE "#__extensions" SET "locked" = 1
|
||||
WHERE "type" = 'plugin' AND "element" = 'schemaorg' AND "folder" = 'system'
|
||||
AND "locked" <> 1;
|
||||
|
||||
UPDATE "#__extensions" SET "locked" = 1
|
||||
WHERE "type" = 'plugin' AND "element" = 'globalcheckin' AND "folder" = 'task'
|
||||
AND "locked" <> 1;
|
||||
+3
@@ -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_fields_note', 'plugin', 'note', 'fields', 0, 1, 1, 0, 1, '', '{"class":"alert alert-info","heading":"h4"}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'note' AND e."folder" = 'fields' AND e."client_id" = 0);
|
||||
+3
@@ -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_fields_number', 'plugin', 'number', 'fields', 0, 1, 1, 0, 1, '', '{"min":"1.0","max":"100.0","step":"0.1","currency":"0","position":"0","decimals":"2"}', '', -1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'number' AND e."folder" = 'fields' AND e."client_id" = 0);
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state")
|
||||
SELECT 0, 'cassiopeia_extended', 'template', 'cassiopeia_extended', '', 0, 1, 1, 0, 1, '', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","systemFontBody":"","systemFontHeading":"","colorName":"colors_standard","fluidContainer":"0","stickyHeader":"0","backTop":"0","colorSettings":"0","headerbg":"rgb(193, 205, 207)","headercolor":"rgb(23, 23, 23)","bodybg":"rgb(254, 254, 254)","bodycolor":"rgb(23, 23, 23)","linkcolor":"rgb(29, 121, 137)","linkcolorh":"rgb(14, 59, 67)","btnbg":"rgb(206, 60, 55)","btnbgh":"rgb(131, 35, 32)","btncolor":"rgb(254, 254, 254)","btncolorh":"rgb(254, 254, 254)","footerbg":"rgb(29, 121, 137)","footercolor":"rgb(254, 254, 254)","fontSettings":"0","bodysize":"1","h1size":"2","h2size":"1.7","h3size":"1.5"}', '', 1, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'template' AND e."element" = 'cassiopeia_extended' AND e."client_id" = 0);
|
||||
|
||||
|
||||
INSERT INTO "#__template_styles" ("template", "client_id", "home", "title", "inheritable", "parent", "params")
|
||||
SELECT 'cassiopeia_extended', 0, '0', 'Cassiopeia Extended - Default', 0, 'cassiopeia', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","systemFontBody":"","systemFontHeading":"","colorName":"colors_standard","fluidContainer":"0","stickyHeader":"0","backTop":"0","colorSettings":"0","headerbg":"rgb(193, 205, 207)","headercolor":"rgb(23, 23, 23)","bodybg":"rgb(254, 254, 254)","bodycolor":"rgb(23, 23, 23)","linkcolor":"rgb(29, 121, 137)","linkcolorh":"rgb(14, 59, 67)","btnbg":"rgb(206, 60, 55)","btnbgh":"rgb(131, 35, 32)","btncolor":"rgb(254, 254, 254)","btncolorh":"rgb(254, 254, 254)","footerbg":"rgb(29, 121, 137)","footercolor":"rgb(254, 254, 254)","fontSettings":"0","bodysize":"1","h1size":"2","h2size":"1.7","h3size":"1.5"}'
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__template_styles" t WHERE t."template" = 'cassiopeia_extended' AND t."client_id" = 0 AND t."inheritable" = 0 AND t."parent" = 'cassiopeia');
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
-- uninstall previous What's New tours
|
||||
DELETE FROM "#__guidedtour_steps"
|
||||
WHERE "tour_id" IN (SELECT "id" FROM "#__guidedtours" WHERE "uid" IN ('joomla-whatsnew-5-2', 'joomla-whatsnew-5-3', 'joomla-whatsnew-5-4'));
|
||||
|
||||
DELETE FROM "#__guidedtours"
|
||||
WHERE "uid" IN ('joomla-whatsnew-5-2', 'joomla-whatsnew-5-3', 'joomla-whatsnew-5-4');
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
INSERT INTO "#__guidedtours" ("title", "description", "extensions", "url", "published", "language", "note", "access", "uid", "autostart", "created", "created_by", "modified", "modified_by")
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_DESCRIPTION', '["com_cpanel"]', 'administrator/index.php', 1, '*', '', 1, 'joomla-whatsnew-6-0', 1, CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__guidedtours" g WHERE g."uid" = 'joomla-whatsnew-6-0');
|
||||
|
||||
INSERT INTO "#__guidedtour_steps" ("title", "description", "position", "target", "type", "interactive_type", "url", "published", "language", "note", "params", "created", "created_by", "modified", "modified_by", "tour_id")
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_0_DESCRIPTION', 'center', '', 0, 1, '', 1, '*', '', '{"required":1,"requiredvalue":""}', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0, MAX("id")
|
||||
FROM "#__guidedtours"
|
||||
WHERE "uid" = 'joomla-whatsnew-6-0';
|
||||
|
||||
INSERT INTO "#__guidedtour_steps" ("title", "description", "position", "target", "type", "interactive_type", "url", "published", "language", "note", "params", "created", "created_by", "modified", "modified_by", "tour_id")
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_1_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_0_STEP_1_DESCRIPTION', 'right', '#sidebarmenu nav > ul:first-of-type > li:last-child', 0, 1, '', 1, '*', '', '"{\"required\":1,\"requiredvalue\":\"\"}"', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0, MAX("id")
|
||||
FROM "#__guidedtours"
|
||||
WHERE "uid" = 'joomla-whatsnew-6-0';
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
UPDATE "#__update_sites"
|
||||
SET "location" = 'https://update.joomla.org/language/translationlist_6.xml'
|
||||
WHERE "location" = 'https://update.joomla.org/language/translationlist_5.xml';
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
-- Update content types for lookup tags
|
||||
|
||||
UPDATE "#__content_types"
|
||||
SET "content_history_options" = jsonb_set(
|
||||
"content_history_options"::jsonb,
|
||||
'{displayLookup}',
|
||||
"content_history_options"::jsonb->'displayLookup' ||
|
||||
jsonb_build_object(
|
||||
'sourceColumn', 'tags',
|
||||
'targetTable', '#__tags',
|
||||
'targetColumn', 'id',
|
||||
'displayColumn', 'title'
|
||||
)
|
||||
)
|
||||
WHERE "type_alias" IN (
|
||||
'com_content.article',
|
||||
'com_contact.contact',
|
||||
'com_newsfeeds.newsfeed',
|
||||
'com_content.category',
|
||||
'com_contact.category',
|
||||
'com_newsfeeds.category',
|
||||
'com_banners.category',
|
||||
'com_users.category'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT * FROM jsonb_array_elements("content_history_options"::jsonb->'displayLookup')
|
||||
WHERE value = jsonb_build_object(
|
||||
'sourceColumn', 'tags',
|
||||
'targetTable', '#__tags',
|
||||
'targetColumn', 'id',
|
||||
'displayColumn', 'title'
|
||||
)
|
||||
);
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
-- Remove wrong unique constraint from "#__ucm_content" table
|
||||
ALTER TABLE "#__ucm_content" DROP CONSTRAINT "#__ucm_content_idx_type_alias_item_id" /** CAN FAIL **/;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE "#__history"
|
||||
ADD COLUMN "is_current" SMALLINT NOT NULL DEFAULT 0 /** CAN FAIL **/;
|
||||
ALTER TABLE "#__history"
|
||||
ADD COLUMN "is_legacy" SMALLINT NOT NULL DEFAULT 0 /** CAN FAIL **/;
|
||||
UPDATE "#__history" SET "is_legacy" = 1;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
UPDATE "#__menu"
|
||||
SET "params" = jsonb_set(
|
||||
"params"::jsonb,
|
||||
'{featured_categories}',
|
||||
COALESCE(
|
||||
(
|
||||
SELECT jsonb_agg(to_jsonb(CASE WHEN elem = ' ' THEN '' ELSE elem END))
|
||||
FROM jsonb_array_elements_text("params"::jsonb->'featured_categories') AS t(elem)
|
||||
),
|
||||
'[]'::jsonb
|
||||
),
|
||||
false
|
||||
)
|
||||
WHERE ("params"::jsonb->'featured_categories') @> '[" "]'::jsonb
|
||||
AND "type" = 'component'
|
||||
AND "link" = 'index.php?option=com_content&view=featured';
|
||||
|
||||
UPDATE "#__menu"
|
||||
SET "link" = REPLACE("link", '&catid[0]= ', '&catid[0]=')
|
||||
WHERE "type" = 'component'
|
||||
AND "link" LIKE 'index.php?option=com_content&view=archive&catid[0]= %';
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
--
|
||||
-- Add a template tag for ip_address on Joomla update.
|
||||
-- New installs will have the default value set in the installation support sql.
|
||||
--
|
||||
|
||||
UPDATE "#__mail_templates"
|
||||
SET "params" = '{"tags":["messages","message","date","extension","username","ip_address"]}'
|
||||
WHERE "template_id" = 'com_actionlogs.notification';
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state")
|
||||
SELECT 'plg_captcha_powcaptcha', 'plugin', 'powcaptcha', 'captcha', 0, 1, 1, 0, 1, '', '{}', '', 0, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'powcaptcha' AND e."folder" = 'captcha' AND e."client_id" = 0);
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
-- --------------------------------------------------------
|
||||
-- The following statement which was introduced with 6.1.0-beta1
|
||||
-- has been disabled as it was replaced in 6.1.0-beta3 with
|
||||
-- a new statement in file "6.1.0-2026-03-10.sql".
|
||||
-- See https://github.com/joomla/joomla-cms/pull/47361 for details.
|
||||
--
|
||||
-- INSERT INTO "#__content_types" ("type_id", "type_title", "type_alias", "table", "rules", "field_mappings", "router", "content_history_options") VALUES (14, 'Module', 'com_modules.module', '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}', '', '{}', '', '{"formFile":"administrator\\/components\\/com_modules\\/forms\\/module.xml", "hideFields":["checked_out", "checked_out_time", "publish_up", "publish_down"], "ignoreChanges":["checked_out", "checked_out_time"], "convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"checked_out", "targetTable":"#__users", "targetColumn":"id", "displayColumn":"name"}]}');
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
--
|
||||
-- Add position column to workflow stages table
|
||||
--
|
||||
|
||||
ALTER TABLE "#__workflow_stages" ADD COLUMN "position" text NULL /** CAN FAIL **/;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
UPDATE "#__extensions"
|
||||
SET "params" = jsonb_set("params"::jsonb, '{html_height}' , '"550px"')
|
||||
WHERE "type" = 'plugin'
|
||||
AND "folder" = 'editors'
|
||||
AND "element" = 'tinymce'
|
||||
AND "params" <> ''
|
||||
AND "params"::jsonb->>'html_height' = '550';
|
||||
|
||||
UPDATE "#__extensions"
|
||||
SET "params" = jsonb_set("params"::jsonb, '{html_width}' , '"100%"')
|
||||
WHERE "type" = 'plugin'
|
||||
AND "folder" = 'editors'
|
||||
AND "element" = 'tinymce'
|
||||
AND "params" <> ''
|
||||
AND "params"::jsonb->>'html_width' = '750';
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
-- --------------------------------------------------------
|
||||
-- The following statement replaces the statement which has been disabled
|
||||
-- in file "6.1.0-2026-01-29.sql" with 6.1.0-beta3.
|
||||
-- See https://github.com/joomla/joomla-cms/pull/47361 for details.
|
||||
--
|
||||
INSERT INTO "#__content_types" ("type_title", "type_alias", "table", "rules", "field_mappings", "router", "content_history_options")
|
||||
SELECT 'Module', 'com_modules.module', '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}', '', '{}', ''
|
||||
, '{"formFile":"administrator\\/components\\/com_modules\\/forms\\/module.xml", "hideFields":["checked_out", "checked_out_time", "publish_up", "publish_down"], "ignoreChanges":["checked_out", "checked_out_time"], "convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"checked_out", "targetTable":"#__users", "targetColumn":"id", "displayColumn":"name"}]}'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT * FROM "#__content_types" c
|
||||
WHERE c."type_title" = 'Module' AND c."type_alias" = 'com_modules.module'
|
||||
AND c."table" = '{"special":{"dbtable":"#__modules","key":"id","type":"Module","prefix":"Joomla\\\\CMS\\\\Table\\\\"}}'
|
||||
);
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
-- disable autostart for the previous tour
|
||||
UPDATE "#__guidedtours" SET "autostart" = 0 WHERE "uid" = 'joomla-whatsnew-6-0';
|
||||
|
||||
INSERT INTO "#__guidedtours" ("title", "description", "extensions", "url", "published", "language", "note", "access", "uid", "autostart", "created", "created_by", "modified", "modified_by")
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_DESCRIPTION', '["com_cpanel"]', 'administrator/index.php', 1, '*', '', 1, 'joomla-whatsnew-6-1', 1, CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0
|
||||
WHERE NOT EXISTS (SELECT * FROM "#__guidedtours" g WHERE g."uid" = 'joomla-whatsnew-6-1');
|
||||
|
||||
INSERT INTO "#__guidedtour_steps" ("title", "description", "position", "target", "type", "interactive_type", "url", "published", "language", "note", "params", "created", "created_by", "modified", "modified_by", "tour_id")
|
||||
SELECT 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_STEP_0_TITLE', 'COM_GUIDEDTOURS_TOUR_WHATSNEW_6_1_STEP_0_DESCRIPTION', 'right', '#sidebarmenu nav > ul:first-of-type > li:last-child', 0, 1, '', 1, '*', '', '{"required":1,"requiredvalue":""}', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0, MAX("id")
|
||||
FROM "#__guidedtours"
|
||||
WHERE "uid" = 'joomla-whatsnew-6-1';
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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\Help\Help;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
use Joomla\Filesystem\Folder;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,751 @@
|
||||
<?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 = [
|
||||
'version' => (new Version())->getLongVersion(),
|
||||
'compatpluginenabled' => PluginHelper::isEnabled('behaviour', 'compat6'),
|
||||
'compatpluginparameters' => $this->getCompatPluginParameters(),
|
||||
'phpversion' => PHP_VERSION,
|
||||
'php' => php_uname(),
|
||||
'dbserver' => $db->getServerType(),
|
||||
'dbversion' => $db->getVersion(),
|
||||
'dbcollation' => $db->getCollation(),
|
||||
'dbconnectioncollation' => $db->getConnectionCollation(),
|
||||
'dbconnectionencryption' => $db->getConnectionEncryption(),
|
||||
'dbconnencryptsupported' => $db->isConnectionEncryptionSupported(),
|
||||
'server' => $_SERVER['SERVER_SOFTWARE'] ?? getenv('SERVER_SOFTWARE'),
|
||||
'sapi_name' => PHP_SAPI,
|
||||
'useragent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
|
||||
];
|
||||
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
private function getCompatPluginParameters()
|
||||
{
|
||||
$record = ExtensionHelper::getExtensionRecord('compat6', '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->createQuery()
|
||||
->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) {
|
||||
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');
|
||||
|
||||
$imagesDir = $cparams->get('image_path', 'images');
|
||||
$filesDir = $cparams->get('file_path', 'files');
|
||||
|
||||
$this->addDirectory($imagesDir, JPATH_SITE . '/' . $imagesDir);
|
||||
|
||||
// List all images folders
|
||||
$image_folders = new \DirectoryIterator(JPATH_SITE . '/' . $imagesDir);
|
||||
|
||||
|
||||
foreach ($image_folders as $folder) {
|
||||
if ($folder->isDot() || !$folder->isDir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->addDirectory(
|
||||
$imagesDir . '/' . $folder->getFilename(),
|
||||
JPATH_SITE . '/' . $imagesDir . '/' . $folder->getFilename()
|
||||
);
|
||||
}
|
||||
|
||||
$this->addDirectory($filesDir, JPATH_SITE . '/' . $filesDir);
|
||||
|
||||
$files_folders = new \DirectoryIterator(JPATH_SITE . '/' . $filesDir);
|
||||
|
||||
foreach ($files_folders as $folder) {
|
||||
if ($folder->isDot() || !$folder->isDir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->addDirectory(
|
||||
$filesDir . '/' . $folder->getFilename(),
|
||||
JPATH_SITE . '/' . $filesDir . '/' . $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;
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -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>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?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 boolean message for a value
|
||||
*
|
||||
* @param boolean $val is the value set?
|
||||
*
|
||||
* @return string html code
|
||||
*/
|
||||
public function enabled($val)
|
||||
{
|
||||
return Text::_($val ? 'JENABLED' : 'JDISABLED');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?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\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 = $this->getDocument()->getToolbar();
|
||||
$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');
|
||||
}
|
||||
}
|
||||
@@ -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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('com_admin.admin-help');
|
||||
|
||||
?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_admin&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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
|
||||
/** @var \Joomla\Component\Admin\Administrator\View\Help\HtmlView $this */
|
||||
|
||||
$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);
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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 '‎' . HTMLHelper::_('directory.message', $dir, $info['message']); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('directory.writable', $info['writable']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -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>
|
||||
@@ -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 HTMLHelper::_('phpsetting.enabled', $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>
|
||||
@@ -0,0 +1,142 @@
|
||||
<?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_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_PHP_VERSION'); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo $this->info['phpversion']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<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_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_USER_AGENT'); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo htmlspecialchars($this->info['useragent'], ENT_COMPAT, 'UTF-8'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_ajax
|
||||
*
|
||||
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
require_once JPATH_SITE . '/components/com_ajax/ajax.php';
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="component" method="upgrade">
|
||||
<name>com_ajax</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2013-08</creationDate>
|
||||
<copyright>(C) 2013 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_AJAX_XML_DESCRIPTION</description>
|
||||
<files folder="site">
|
||||
<filename>ajax.php</filename>
|
||||
</files>
|
||||
<languages folder="site">
|
||||
<language tag="en-GB">language/en-GB/com_ajax.ini</language>
|
||||
</languages>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>ajax.php</filename>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/com_ajax.ini</language>
|
||||
<language tag="en-GB">language/en-GB/com_ajax.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<access component="com_associations">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JACTION_ADMIN" />
|
||||
<action name="core.options" title="JACTION_OPTIONS" />
|
||||
<action name="core.manage" title="JACTION_MANAGE" />
|
||||
</section>
|
||||
</access>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="component" method="upgrade">
|
||||
<name>com_associations</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2017-01</creationDate>
|
||||
<copyright>(C) 2017 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_ASSOCIATIONS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Component\Associations</namespace>
|
||||
<media destination="com_associations" folder="media">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
<administration>
|
||||
<menu img="class:language">COM_ASSOCIATIONS</menu>
|
||||
<files folder="admin">
|
||||
<filename>access.xml</filename>
|
||||
<filename>associations.xml</filename>
|
||||
<filename>config.xml</filename>
|
||||
<folder>forms</folder>
|
||||
<folder>layouts</folder>
|
||||
<folder>services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/com_associations.ini</language>
|
||||
<language tag="en-GB">language/en-GB/com_associations.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user