Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-password-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpit-24 committed Mar 29, 2019
2 parents 7f13e48 + 81ed3dd commit e793829
Show file tree
Hide file tree
Showing 301 changed files with 13,243 additions and 3,021 deletions.
@@ -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.
* @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.manage', 'com_actionlogs'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

$controller = JControllerLegacy::getInstance('Userlogs');
$controller = JControllerLegacy::getInstance('Actionlogs');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
$controller->redirect();
@@ -1,18 +1,18 @@
<?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>
<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>
Expand All @@ -22,8 +22,8 @@
<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>
34 changes: 34 additions & 0 deletions administrator/components/com_actionlogs/config.xml
@@ -0,0 +1,34 @@
<?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"
description="COM_ACTIONLOGS_IP_LOGGING_DESC"
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="csv_delimiter"
type="list"
label="COM_ACTIONLOGS_CSV_DELIMITER"
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"
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>
@@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_userlogs
* @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
Expand All @@ -10,36 +10,24 @@
defined('_JEXEC') or die;

/**
* Userlogs Controller
* Actionlogs Controller
*
* @since __DEPLOY_VERSION__
*/
class UserlogsController extends JControllerLegacy
class ActionlogsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return UserlogsController This object to support chaining.
* @return ActionlogsController This object to support chaining.
*
* @since __DEPLOY_VERSION__
*/
public function display($cachable = false, $urlparams = array())
{
$view = $this->input->get('view', 'userlogs');

switch ($view)
{
case 'userlogs':
if (!JFactory::getUser()->authorise('core.viewlogs', 'com_userlogs'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
break;
}

return parent::display();
}
}
@@ -1,23 +1,24 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_userlogs
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;
JLoader::register('UserlogsHelper', JPATH_COMPONENT . '/helpers/userlogs.php');
JLoader::register('ActionlogsHelper', JPATH_COMPONENT . '/helpers/actionlogs.php');

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

/**
* Userlogs list controller class.
* Actionlogs list controller class.
*
* @since __DEPLOY_VERSION__
*/
class UserlogsControllerUserlogs extends JControllerAdmin
class ActionlogsControllerActionlogs extends JControllerAdmin
{
/**
* Constructor.
Expand All @@ -44,7 +45,7 @@ public function __construct(array $config = array())
*
* @since __DEPLOY_VERSION__
*/
public function getModel($name = 'Userlogs', $prefix = 'UserlogsModel',
public function getModel($name = 'Actionlogs', $prefix = 'ActionlogsModel',
$config = array('ignore_request' => true))
{

Expand All @@ -68,17 +69,35 @@ public function exportLogs()
$pks = ArrayHelper::toInteger($this->input->post->get('cid', array(), 'array'));

// Get the logs data
$data = $this->getModel('userlogs')->getLogsData($pks);
$data = $this->getModel()->getLogsData($pks);

if (count($data))
{
// Export data to CSV file
UserlogsHelper::dataToCsv($data);
$rows = ActionlogsHelper::getCsvData($data);
$filename = "logs_" . JFactory::getDate();
$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_USERLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(JRoute::_('index.php?option=com_userlogs&view=userlogs'));
$this->setMessage(JText::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(JRoute::_('index.php?option=com_actionlogs&view=actionlogs', false));
}
}

Expand All @@ -91,13 +110,6 @@ public function exportLogs()
*/
public function delete()
{
if (!JFactory::getUser()->authorise('core.delete', $this->option))
{
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));

return;
}

parent::delete();
}

Expand All @@ -114,13 +126,13 @@ public function purge()

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

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

0 comments on commit e793829

Please sign in to comment.