Skip to content

Commit

Permalink
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into f…
Browse files Browse the repository at this point in the history
…ix#24235
  • Loading branch information
bahl24 committed Apr 14, 2019
2 parents 6ab7de7 + 34def69 commit b300d01
Show file tree
Hide file tree
Showing 680 changed files with 18,217 additions and 4,750 deletions.
3 changes: 1 addition & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ There are other branches available which serve specific purposes.

| Branch | Purpose |
| ------ | ------- |
| staging | Current codebase. Branch for the next minor Joomla version. New backward compatible features go into this branch. |
| 3.9-dev | Branch for the next minor Joomla version. The 3.9.0 release will include the Privacy Tools Suite features. Commits to staging will be applied to this branch as well. |
| staging | Current codebase. Branch for the next minor Joomla version. New backward compatible features go into this branch. The 3.9.0 release will include the Privacy Tools Suite features. |
| 3.10-dev | Branch for the next minor Joomla version. The 3.10.0 release will only include compatibility features for 4.0. Commits to staging will be applied to this branch as well. |
| 4.0-dev | Branch for the next major Joomla version. New features go into this branch. Commits to staging will be applied to this branch as well. |
10 changes: 5 additions & 5 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Where can you get support and help?
====================
* [The Joomla! Documentation](https://docs.joomla.org/Special:MyLanguage/Main_Page);
* [Frequently Asked Questions](https://docs.joomla.org/Special:MyLanguage/Category:FAQ) (FAQ);
* Find the [information you need](https://docs.joomla.org/Special:MyLanguage/Start_here);
* Find [help and other users](https://www.joomla.org/about-joomla/create-and-share.html);
* Post questions at [our forums](https://forum.joomla.org);
* [The Joomla! Documentation](https://docs.joomla.org/Special:MyLanguage/Main_Page).
* [Frequently Asked Questions](https://docs.joomla.org/Special:MyLanguage/Category:FAQ) (FAQ).
* Find the [information you need](https://docs.joomla.org/Special:MyLanguage/Start_here).
* Find [help and other users](https://www.joomla.org/about-joomla/create-and-share.html).
* Post questions at [our forums](https://forum.joomla.org).
* [Joomla Resources Directory](https://resources.joomla.org) (JRD).
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_userlogs
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

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

$controller = JControllerLegacy::getInstance('Userlogs');
$controller = JControllerLegacy::getInstance('Actionlogs');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension version="3.9" type="component" method="upgrade">
<name>com_userlogs</name>
<name>com_actionlogs</name>
<author>Joomla! Project</author>
<creationDate>May 2018</creationDate>
<copyright>Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.</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>__DEPLOY_VERSION__</version>
<description>COM_USERLOGS_XML_DESCRIPTION</description>
<version>3.9.0</version>
<description>COM_ACTIONLOGS_XML_DESCRIPTION</description>
<administration>
<menu>COM_USERLOGS</menu>
<menu>COM_ACTIONLOGS</menu>
<files folder="admin">
<file>userlogs.php</file>
<file>actionlogs.php</file>
<file>config.xml</file>
<file>access.xml</file>
<file>controller.php</file>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_userlogs.ini</language>
<language tag="en-GB">language/en-GB.com_userlogs.sys.ini</language>
<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>
35 changes: 35 additions & 0 deletions administrator/components/com_actionlogs/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="actionlogs" label="COM_ACTIONLOGS_OPTIONS" addfieldpath="/administrator/components/com_actionlogs/models/fields">
<field
name="ip_logging"
type="radio"
label="COM_ACTIONLOGS_IP_LOGGING_LABEL"
description="COM_ACTIONLOGS_IP_LOGGING_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="csv_delimiter"
type="list"
label="COM_ACTIONLOGS_CSV_DELIMITER_LABEL"
description="COM_ACTIONLOGS_CSV_DELIMITER_DESC"
default=","
>
<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"
description="COM_ACTIONLOGS_LOG_EXTENSIONS_DESC"
multiple="true"
default="com_banners,com_cache,com_categories,com_config,com_contact,com_content,com_installer,com_media,com_menus,com_messages,com_modules,com_newsfeeds,com_plugins,com_redirect,com_tags,com_templates,com_users"
/>
</fieldset>
</config>
19 changes: 19 additions & 0 deletions administrator/components/com_actionlogs/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/**
* Actionlogs Controller
*
* @since 3.9.0
*/
class ActionlogsController extends JControllerLegacy
{
}
155 changes: 155 additions & 0 deletions administrator/components/com_actionlogs/controllers/actionlogs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\Utilities\ArrayHelper;

JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');

/**
* Actionlogs list controller class.
*
* @since 3.9.0
*/
class ActionlogsControllerActionlogs extends JControllerAdmin
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @since 3.9.0
*/
public function __construct(array $config = array())
{
parent::__construct($config);

$this->registerTask('exportSelectedLogs', 'exportLogs');
}

/**
* 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 = 'ActionlogsModel', $config = array('ignore_request' => true))
{
// Return the model
return parent::getModel($name, $prefix, $config);
}

/**
* Method to export logs
*
* @return void
*
* @since 3.9.0
*/
public function exportLogs()
{
// Check for request forgeries.
$this->checkToken();

$task = $this->getTask();

$pks = array();

if ($task == 'exportSelectedLogs')
{
// Get selected logs
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
}

/** @var ActionlogsModelActionlogs $model */
$model = $this->getModel();

// Get the logs data
$data = $model->getLogDataAsIterator($pks);

if (count($data))
{

try
{
$rows = ActionlogsHelper::getCsvData($data);
}
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));

return;
}

// Destroy the iterator now
unset($data);

$date = new JDate('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->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);
}

fclose($output);

$app->close();
}
else
{
$this->setMessage(JText::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false));
}
}

/**
* 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 = JText::_('COM_ACTIONLOGS_PURGE_SUCCESS');
}
else
{
$message = JText::_('COM_ACTIONLOGS_PURGE_FAIL');
}

$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
}
}

0 comments on commit b300d01

Please sign in to comment.