Skip to content

Commit

Permalink
Merge branch '4.0-dev' into sunday_2
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed May 10, 2019
2 parents d8c4c2d + a69da3f commit f5a417b
Show file tree
Hide file tree
Showing 81 changed files with 655 additions and 405 deletions.
26 changes: 19 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,34 @@ steps:
- name: cache
path: /cache

- name: php70-unit
- name: php72-unit
depends_on: [ rebuild-cache ]
image: joomlaprojects/docker-php70:develop
image: php:7.2
commands:
- php -v
- ./libraries/vendor/bin/phpunit

- name: php71-unit
- name: php73-unit
depends_on: [ rebuild-cache ]
image: joomlaprojects/docker-php71:develop
image: php:7.3
commands:
- php -v
- ./libraries/vendor/bin/phpunit

- name: php72-unit
- name: php74-unit
depends_on: [ rebuild-cache ]
image: phpdaily/php:7.4-dev
errignore: true
commands:
- php -v
- ./libraries/vendor/bin/phpunit

- name: php80-unit
depends_on: [ rebuild-cache ]
image: joomlaprojects/docker-php72:develop
image: phpdaily/php:8.0-dev
errignore: true
commands:
- php -v
- ./libraries/vendor/bin/phpunit

- name: javascript-cs
Expand Down Expand Up @@ -147,6 +159,6 @@ services:

---
kind: signature
hmac: 820e2021962202c01514b4ffe5eb893640c83fb5542345a70c4ca01e4ccfd43c
hmac: ccc8d591031582b24518b4f77723665fc0cae6d4b2c670f12ce13ca2e37e7e90

...
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Joomla! CMS™ [![Analytics](https://ga-beacon.appspot.com/UA-544070-3/joomla-cm

Build Status
---------------------
| Travis-CI | Drone-CI | AppVeyor |
| ------------- | ------------- | ------------- |
| [![Build Status](https://travis-ci.org/joomla/joomla-cms.svg?branch=staging)](https://travis-ci.org/joomla/joomla-cms) | [![Build Status](http://213.160.72.75/api/badges/joomla/joomla-cms/status.svg)](http://213.160.72.75/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb/branch/staging?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms) |
| Drone-CI | AppVeyor |
| ------------- | ------------- |
| [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg?branch=4.0-dev)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb/branch/staging?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms) |

What is this?
---------------------
Expand Down
13 changes: 9 additions & 4 deletions administrator/components/com_actionlogs/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@

defined('_JEXEC') or die;

if (!JFactory::getUser()->authorise('core.admin'))
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;

if (!Factory::getUser()->authorise('core.admin'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}

$controller = JControllerLegacy::getInstance('Actionlogs');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller = BaseController::getInstance('Actionlogs');
$controller->execute(Factory::getApplication()->input->get('task'));
$controller->redirect();
22 changes: 13 additions & 9 deletions administrator/components/com_actionlogs/controllers/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\Utilities\ArrayHelper;

JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');
Expand Down Expand Up @@ -89,21 +93,21 @@ public function exportLogs()
}
catch (InvalidArgumentException $exception)
{
$this->setMessage(JText::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false));
$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 JDate('now', new DateTimeZone('UTC'));
$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', ',');

$app = JFactory::getApplication();
$app = Factory::getApplication();
$app->setHeader('Content-Type', 'application/csv', true)
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
->setHeader('Cache-Control', 'must-revalidate', true)
Expand All @@ -122,8 +126,8 @@ public function exportLogs()
}
else
{
$this->setMessage(JText::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false));
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
}
}

Expand All @@ -143,13 +147,13 @@ public function purge()

if ($model->purge())
{
$message = JText::_('COM_ACTIONLOGS_PURGE_SUCCESS');
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
}
else
{
$message = JText::_('COM_ACTIONLOGS_PURGE_FAIL');
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
}

$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
}
}
28 changes: 16 additions & 12 deletions administrator/components/com_actionlogs/helpers/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

defined('_JEXEC') or die;

use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\String\StringHelper;

/**
Expand Down Expand Up @@ -54,10 +58,10 @@ public static function getCsvData($data): Generator
yield [
'id' => $log->id,
'message' => strip_tags(static::getHumanReadableLogMessage($log, false)),
'date' => (new JDate($log->log_date, new DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
'extension' => JText::_($extension),
'date' => (new Date($log->log_date, new DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
'extension' => Text::_($extension),
'name' => $log->name,
'ip_address' => JText::_($log->ip_address),
'ip_address' => Text::_($log->ip_address),
];
}
}
Expand All @@ -81,7 +85,7 @@ public static function loadTranslationFiles($extension)
return;
}

$lang = JFactory::getLanguage();
$lang = Factory::getLanguage();
$source = '';

switch (substr($extension, 0, 3))
Expand Down Expand Up @@ -141,7 +145,7 @@ public static function loadTranslationFiles($extension)
*/
public static function getLogContentTypeParams($context)
{
$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('a.*')
->from($db->quoteName('#__action_log_config', 'a'))
Expand All @@ -166,17 +170,17 @@ public static function getHumanReadableLogMessage($log, $generateLinks = true)
{
static $links = array();

$message = JText::_($log->message_language_key);
$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'] = JText::_($messageData['extension_name']);
$messageData['extension_name'] = Text::_($messageData['extension_name']);
}

$linkMode = JFactory::getApplication()->get('force_ssl', 0) >= 1 ? 1 : -1;
$linkMode = Factory::getApplication()->get('force_ssl', 0) >= 1 ? 1 : -1;

foreach ($messageData as $key => $value)
{
Expand All @@ -185,13 +189,13 @@ public static function getHumanReadableLogMessage($log, $generateLinks = true)
{
if (!isset($links[$value]))
{
$links[$value] = JRoute::link('administrator', $value, false, $linkMode);
$links[$value] = Route::link('administrator', $value, false, $linkMode);
}

$value = $links[$value];
}

$message = str_replace('{' . $key . '}', JText::_($value), $message);
$message = str_replace('{' . $key . '}', Text::_($value), $message);
}

return $message;
Expand Down Expand Up @@ -248,8 +252,8 @@ public static function getContentTypeLink($component, $contentType, $id, $urlVar
*/
public static function loadActionLogPluginsLanguage()
{
$lang = JFactory::getLanguage();
$db = JFactory::getDbo();
$lang = Factory::getLanguage();
$db = Factory::getDbo();

// Get all (both enabled and disabled) actionlog plugins
$query = $db->getQuery(true)
Expand Down
24 changes: 14 additions & 10 deletions administrator/components/com_actionlogs/layouts/logstable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,40 @@

defined('_JEXEC') or die;

JFactory::getLanguage()->load("com_actionlogs", JPATH_ADMINISTRATOR, null, false, true);
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

Factory::getLanguage()->load("com_actionlogs", JPATH_ADMINISTRATOR, null, false, true);

$messages = $displayData['messages'];
$showIpColumn = $displayData['showIpColumn'];
?>
<h1>
<?php echo JText::_('COM_ACTIONLOGS_EMAIL_SUBJECT'); ?>
<?php echo Text::_('COM_ACTIONLOGS_EMAIL_SUBJECT'); ?>
</h1>
<h2>
<?php echo JText::_('COM_ACTIONLOGS_EMAIL_DESC'); ?>
<?php echo Text::_('COM_ACTIONLOGS_EMAIL_DESC'); ?>
</h2>
<table>
<thead>
<th><?php echo JText::_('COM_ACTIONLOGS_ACTION'); ?></th>
<th><?php echo JText::_('COM_ACTIONLOGS_DATE'); ?></th>
<th><?php echo JText::_('COM_ACTIONLOGS_EXTENSION'); ?></th>
<th><?php echo JText::_('COM_ACTIONLOGS_NAME'); ?></th>
<th><?php echo Text::_('COM_ACTIONLOGS_ACTION'); ?></th>
<th><?php echo Text::_('COM_ACTIONLOGS_DATE'); ?></th>
<th><?php echo Text::_('COM_ACTIONLOGS_EXTENSION'); ?></th>
<th><?php echo Text::_('COM_ACTIONLOGS_NAME'); ?></th>
<?php if ($showIpColumn) : ?>
<th><?php echo JText::_('COM_ACTIONLOGS_IP_ADDRESS'); ?></th>
<th><?php echo Text::_('COM_ACTIONLOGS_IP_ADDRESS'); ?></th>
<?php endif; ?>
</thead>
<tbody>
<?php foreach ($messages as $message) : ?>
<tr>
<td><?php echo $message->message; ?></td>
<td><?php echo JHtml::_('date', $message->log_date, 'Y-m-d H:i:s T', 'UTC'); ?></td>
<td><?php echo HTMLHelper::_('date', $message->log_date, 'Y-m-d H:i:s T', 'UTC'); ?></td>
<td><?php echo $message->extension; ?></td>
<td><?php echo $displayData['username']; ?></td>
<?php if ($showIpColumn) : ?>
<td><?php echo JText::_($message->ip_address); ?></td>
<td><?php echo Text::_($message->ip_address); ?></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/
defined('_JEXEC') or die;

use \Joomla\CMS\MVC\Model\BaseModel;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseModel;

BaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');

Expand Down Expand Up @@ -59,7 +60,7 @@ abstract class ActionLogPlugin extends JPlugin
*/
protected function addLog($messages, $messageLanguageKey, $context, $userId = null)
{
$user = JFactory::getUser();
$user = Factory::getUser();

foreach ($messages as $index => $message)
{
Expand Down
17 changes: 10 additions & 7 deletions administrator/components/com_actionlogs/models/actionlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\Utilities\IpHelper;

JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');
Expand All @@ -36,9 +39,9 @@ class ActionlogsModelActionlog extends JModelLegacy
*/
public function addLog($messages, $messageLanguageKey, $context, $userId = null)
{
$user = JFactory::getUser($userId);
$user = Factory::getUser($userId);
$db = $this->getDbo();
$date = JFactory::getDate();
$date = Factory::getDate();
$params = ComponentHelper::getComponent('com_actionlogs')->getParams();

if ($params->get('ip_logging', 0))
Expand Down Expand Up @@ -140,13 +143,13 @@ protected function sendNotificationEmails($messages, $username, $context)
return;
}

$layout = new JLayoutFile('components.com_actionlogs.layouts.logstable', JPATH_ADMINISTRATOR);
$layout = new FileLayout('components.com_actionlogs.layouts.logstable', JPATH_ADMINISTRATOR);
$extension = strtok($context, '.');
ActionlogsHelper::loadTranslationFiles($extension);

foreach ($messages as $message)
{
$message->extension = JText::_($extension);
$message->extension = Text::_($extension);
$message->message = ActionlogsHelper::getHumanReadableLogMessage($message);
}

Expand All @@ -157,16 +160,16 @@ protected function sendNotificationEmails($messages, $username, $context)
);

$body = $layout->render($displayData);
$mailer = JFactory::getMailer();
$mailer = Factory::getMailer();
$mailer->addRecipient($recipients);
$mailer->setSubject(JText::_('COM_ACTIONLOGS_EMAIL_SUBJECT'));
$mailer->setSubject(Text::_('COM_ACTIONLOGS_EMAIL_SUBJECT'));
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setBody($body);

if (!$mailer->Send())
{
JError::raiseWarning(500, JText::_('JERROR_SENDING_EMAIL'));
JError::raiseWarning(500, Text::_('JERROR_SENDING_EMAIL'));
}
}
}

0 comments on commit f5a417b

Please sign in to comment.