Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/com_actionlogs.zip

PK*�[�:H���actionlogs.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\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 NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}

$controller = BaseController::getInstance('Actionlogs');
$controller->execute(Factory::getApplication()->input->get('task'));
$controller->redirect();
PK*�[��66actionlogs.xmlnu�[���<?xml
version="1.0" encoding="UTF-8"?>
<extension version="3.9" type="component"
method="upgrade">
	<name>com_actionlogs</name>
	<author>Joomla! Project</author>
	<creationDate>May 2018</creationDate>
	<copyright>Copyright (C) 2005 - 2020 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>3.9.0</version>
	<description>COM_ACTIONLOGS_XML_DESCRIPTION</description>
	<administration>
		<menu>COM_ACTIONLOGS</menu>
		<files folder="admin">
			<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>
		</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>
PK*�[�p��
config.xmlnu�[���<?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_checkin,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>
PK*�[�v��controller.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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
{
}
PK*�[���-��controllers/actionlogs.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\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');

/**
 * 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(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',
',');

			$app = Factory::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->triggerEvent('onAfterLogExport', array());
			$app->close();
		}
		else
		{
			$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
			$this->setRedirect(Route::_('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 = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
		}
		else
		{
			$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
		}

		$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs',
false), $message);
	}
}
PK*�[�$8$8$helpers/actionlogs.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\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;

/**
 * Actionlogs component helper.
 *
 * @since  3.9.0
 */
class ActionlogsHelper
{
	/**
	 * Array of characters starting a formula
	 *
	 * @var    array
	 * @since  3.9.7
	 */
	private static $characters = array('=', '+',
'-', '@');

	/**
	 * 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  array|Generator  For PHP 5.5 and newer, a Generator is
returned; PHP 5.4 and earlier use an array
	 *
	 * @since   3.9.0
	 * @throws  InvalidArgumentException
	 */
	public static function getCsvData($data)
	{
		if (!is_iterable($data))
		{
			throw new InvalidArgumentException(
				sprintf(
					'%s() requires an array or object implementing the Traversable
interface, a %s was given.',
					__METHOD__,
					gettype($data) === 'object' ? get_class($data) :
gettype($data)
				)
			);
		}

		if (version_compare(PHP_VERSION, '5.5', '>='))
		{
			// Only include the PHP 5.5 helper in this conditional to prevent the
potential of parse errors for PHP 5.4 or earlier
			JLoader::register('ActionlogsHelperPhp55', __DIR__ .
'/actionlogsphp55.php');

			return ActionlogsHelperPhp55::getCsvAsGenerator($data);
		}

		$disabledText = Text::_('COM_ACTIONLOGS_DISABLED');

		$rows = array();

		// Header row
		$rows[] = array('Id', 'Message', 'Date',
'Extension', 'User', 'Ip');

		foreach ($data as $log)
		{
			$date      = new Date($log->log_date, new
DateTimeZone('UTC'));
			$extension = strtok($log->extension, '.');

			static::loadTranslationFiles($extension);

			$rows[] = array(
				'id'         => $log->id,
				'message'    =>
self::escapeCsvFormula(strip_tags(static::getHumanReadableLogMessage($log,
false))),
				'date'       => $date->format('Y-m-d H:i:s
T'),
				'extension'  =>
self::escapeCsvFormula(Text::_($extension)),
				'name'       => self::escapeCsvFormula($log->name),
				'ip_address' => self::escapeCsvFormula($log->ip_address
=== 'COM_ACTIONLOGS_DISABLED' ? $disabledText :
$log->ip_address)
			);
		}

		return $rows;
	}

	/**
	 * 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 = array();
		$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, null, false, true)
			|| $lang->load($extension, $source, null, false, true);

		if (!$lang->hasKey(strtoupper($extension)))
		{
			$lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null,
false, true)
				|| $lang->load($extension . '.sys', $source, null, false,
true);
		}

		$cache[$extension] = true;
	}

	/**
	 * Get parameters to be
	 *
	 * @param   string  $context  The context of the content
	 *
	 * @return  mixed  An object contains content type parameters, or null if
not found
	 *
	 * @since   3.9.0
	 */
	public static function getLogContentTypeParams($context)
	{
		$db = Factory::getDbo();
		$query = $db->getQuery(true)
			->select('a.*')
			->from($db->quoteName('#__action_log_config',
'a'))
			->where($db->quoteName('a.type_alias') . ' = '
. $db->quote($context));

		$db->setQuery($query);

		return $db->loadObject();
	}

	/**
	 * 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 $links = array();

		$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']);
		}

		$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 = 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
	 *
	 * @return  string  Link to the content item
	 *
	 * @since   3.9.0
	 */
	public static function getContentTypeLink($component, $contentType, $id,
$urlVar = 'id')
	{
		// 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(array($cName,
'getContentTypeLink')))
			{
				return $cName::getContentTypeLink($contentType, $id);
			}
		}

		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()
	{
		$lang = Factory::getLanguage();
		$db   = Factory::getDbo();

		// Get all (both enabled and disabled) actionlog plugins
		$query = $db->getQuery(true)
			->select(
				$db->quoteName(
					array(
						'folder',
						'element',
						'params',
						'extension_id'
					),
					array(
						'type',
						'name',
						'params',
						'id'
					)
				)
			)
			->from('#__extensions')
			->where('type = ' . $db->quote('plugin'))
			->where('folder = ' . $db->quote('actionlog'))
			->where('state IN (0,1)')
			->order('ordering');
		$db->setQuery($query);

		try
		{
			$rows = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			$rows = array();
		}

		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, null, false, true)
			|| $lang->load($extension, JPATH_PLUGINS . '/' . $type .
'/' . $name, null, false, true);
		}

		// Load com_privacy too.
		$lang->load('com_privacy', JPATH_ADMINISTRATOR, null, false,
true);
	}

	/**
	 * 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;
	}
}
PK*�[�%.4v
v
helpers/actionlogsphp55.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Date\Date;
use Joomla\CMS\Language\Text;

/**
 * Actionlogs component helper for newer PHP versions.
 *
 * This file should only be included in environments running PHP 5.5 or
newer and may potentially cause a parse error on older versions.
 *
 * @since       3.9.0
 * @deprecated  Will be inlined back into ActionlogsHelper when PHP 5.5 or
newer is the minimum supported PHP version
 * @internal
 */
class ActionlogsHelperPhp55
{
	/**
	 * Array of characters starting a formula
	 *
	 * @var    array
	 * @since  3.9.7
	 */
	private static $characters = array('=', '+',
'-', '@');

	/**
	 * Method to convert logs objects array to a Generator 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 getCsvAsGenerator($data)
	{
		if (!is_iterable($data))
		{
			throw new InvalidArgumentException(
				sprintf(
					'%s() requires an array or object implementing the Traversable
interface, a %s was given.',
					__METHOD__,
					gettype($data) === 'object' ? get_class($data) :
gettype($data)
				)
			);
		}

		$disabledText = Text::_('COM_ACTIONLOGS_DISABLED');

		// Header row
		yield array('Id', 'Message', 'Date',
'Extension', 'User', 'Ip');

		foreach ($data as $log)
		{
			$extension = strtok($log->extension, '.');

			ActionlogsHelper::loadTranslationFiles($extension);

			yield array(
				'id'         => $log->id,
				'message'    =>
self::escapeCsvFormula(strip_tags(ActionlogsHelper::getHumanReadableLogMessage($log,
false))),
				'date'       => (new Date($log->log_date, new
DateTimeZone('UTC')))->format('Y-m-d H:i:s T'),
				'extension'  =>
self::escapeCsvFormula(Text::_($extension)),
				'name'       => self::escapeCsvFormula($log->name),
				'ip_address' => self::escapeCsvFormula($log->ip_address
=== 'COM_ACTIONLOGS_DISABLED' ? $disabledText :
$log->ip_address)
			);
		}
	}

	/**
	 * 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;
	}
}
PK*�[ɮ����layouts/logstable.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\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 Text::_('COM_ACTIONLOGS_EMAIL_SUBJECT'); ?>
</h1>
<h2>
	<?php echo Text::_('COM_ACTIONLOGS_EMAIL_DESC'); ?>
</h2>
<table>
	<thead>
		<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 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 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 Text::_($message->ip_address);
?></td>
				<?php endif; ?>
			</tr>
		<?php endforeach; ?>
	</tbody>
</table>
PK*�[E����	�	libraries/actionlogplugin.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;

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

/**
 * Abstract Action Log Plugin
 *
 * @since  3.9.0
 */
abstract class ActionLogPlugin extends JPlugin
{
	/**
	 * Application object.
	 *
	 * @var    JApplicationCms
	 * @since  3.9.0
	 */
	protected $app;

	/**
	 * Database object.
	 *
	 * @var    JDatabaseDriver
	 * @since  3.9.0
	 */
	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)
	{
		$user = Factory::getUser();

		foreach ($messages as $index => $message)
		{
			if (!array_key_exists('userid', $message))
			{
				$message['userid'] = $user->id;
			}

			if (!array_key_exists('username', $message))
			{
				$message['username'] = $user->username;
			}

			if (!array_key_exists('accountlink', $message))
			{
				$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 ActionlogsModelActionlog $model **/
		$model = BaseDatabaseModel::getInstance('Actionlog',
'ActionlogsModel');
		$model->addLog($messages, strtoupper($messageLanguageKey), $context,
$userId);
	}
}
PK*�[����models/actionlog.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\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');

/**
 * Methods supporting a list of Actionlog records.
 *
 * @since  3.9.0
 */
class ActionlogsModelActionlog extends JModelLegacy
{
	/**
	 * 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 =
null)
	{
		$user   = Factory::getUser($userId);
		$db     = $this->getDbo();
		$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 = array();

		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 $e)
			{
				// Ignore it
			}
		}

		// Send notification email to users who choose to be notified about the
action logs
		$this->sendNotificationEmails($loggedMessages, $user->name,
$context);
	}

	/**
	 * 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
	 */
	protected function sendNotificationEmails($messages, $username, $context)
	{
		$db           = $this->getDbo();
		$query        = $db->getQuery(true);
		$params       = ComponentHelper::getParams('com_actionlogs');
		$showIpColumn = (bool) $params->get('ip_logging', 0);

		$query
			->select($db->quoteName(array('u.email',
'l.extensions')))
			->from($db->quoteName('#__users', 'u'))
			->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);

		try
		{
			$users = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());

			return;
		}

		$recipients = array();

		foreach ($users as $user)
		{
			$extensions = json_decode($user->extensions, true);

			if ($extensions && in_array(strtok($context, '.'),
$extensions))
			{
				$recipients[] = $user->email;
			}
		}

		if (empty($recipients))
		{
			return;
		}

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

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

		$displayData = array(
			'messages'     => $messages,
			'username'     => $username,
			'showIpColumn' => $showIpColumn,
		);

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

		if (!$mailer->Send())
		{
			JError::raiseWarning(500, Text::_('JERROR_SENDING_EMAIL'));
		}
	}
}
PK*�[7i�b$b$models/actionlogs.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;

/**
 * Methods supporting a list of article records.
 *
 * @since  3.9.0
 */
class ActionlogsModelActionlogs extends JModelList
{
	/**
	 * Constructor.
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @since   3.9.0
	 */
	public function __construct($config = array())
	{
		if (empty($config['filter_fields']))
		{
			$config['filter_fields'] = array(
				'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);
	}

	/**
	 * Method to auto-populate the model state.
	 *
	 * @return  void
	 *
	 * @since   3.9.0
	 */
	protected function populateState($ordering = 'a.id', $direction
= 'desc')
	{
		$app = Factory::getApplication();

		$search = $app->getUserStateFromRequest($this->context .
'filter.search', 'filter_search', '',
'string');
		$this->setState('filter.search', $search);

		$user = $app->getUserStateFromRequest($this->context .
'filter.user', 'filter_user', '',
'string');
		$this->setState('filter.user', $user);

		$extension = $app->getUserStateFromRequest($this->context .
'filter.extension', 'filter_extension', '',
'string');
		$this->setState('filter.extension', $extension);

		$ip_address = $app->getUserStateFromRequest($this->context .
'filter.ip_address', 'filter_ip_address', '',
'string');
		$this->setState('filter.ip_address', $ip_address);

		$dateRange = $app->getUserStateFromRequest($this->context .
'filter.dateRange', 'filter_dateRange', '',
'string');
		$this->setState('filter.dateRange', $dateRange);

		parent::populateState($ordering, $direction);
	}

	/**
	 * Build an SQL query to load the list data.
	 *
	 * @return  JDatabaseQuery
	 *
	 * @since   3.9.0
	 */
	protected function getListQuery()
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true)
			->select('a.*, u.name')
			->from('#__action_logs AS a')
			->leftJoin('#__users AS u ON a.user_id = 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))
		{
			$query->where($db->quoteName('a.user_id') . ' =
' . (int) $user);
		}

		// Get filter by extension
		$extension = $this->getState('filter.extension');

		// Apply filter by extension
		if (!empty($extension))
		{
			$query->where($db->quoteName('a.extension') . '
LIKE ' . $db->quote($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)
			{
				$query->where(
					$db->qn('a.log_date') . ' >= ' .
$db->quote($date['dStart']->format('Y-m-d
H:i:s')) .
					' AND ' . $db->qn('a.log_date') . ' <=
' . $db->quote($date['dNow']->format('Y-m-d
H:i:s'))
				);
			}
		}

		// Filter the items over the search string if set.
		$search = $this->getState('filter.search');

		if (!empty($search))
		{
			if (stripos($search, 'id:') === 0)
			{
				$query->where($db->quoteName('a.id') . ' = '
. (int) substr($search, 3));
			}
			elseif (stripos($search, 'item_id:') === 0)
			{
				$query->where($db->quoteName('a.item_id') . ' =
' . (int) substr($search, 8));
			}
			else
			{
				$search = $db->quote('%' . $db->escape($search, true) .
'%');
				$query->where('(' .
$db->quoteName('u.username') . ' LIKE ' . $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
	 */
	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('GMT');
				$dStart->setTimezone($tz);
				break;
		}

		return array('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)
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true)
			->select('a.*, u.name')
			->from('#__action_logs AS a')
			->innerJoin('#__users AS u ON a.user_id = u.id')
			->where($db->quoteName('a.extension') . ' = '
. $db->quote($extension))
			->where($db->quoteName('a.item_id') . ' = ' .
(int) $itemId);

		// 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 JTable 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->getDbo();
		$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  JDatabaseIterator
	 *
	 * @since   3.9.0
	 */
	public function getLogDataAsIterator($pks = null)
	{
		$db    = $this->getDbo();
		$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  JDatabaseQuery
	 *
	 * @since   3.9.0
	 */
	private function getLogDataQuery($pks = null)
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true)
			->select('a.*, u.name')
			->from('#__action_logs AS a')
			->innerJoin('#__users AS u ON a.user_id = u.id');

		if (is_array($pks) && count($pks) > 0)
		{
			$query->where($db->quoteName('a.id') . ' IN ('
. implode(',', ArrayHelper::toInteger($pks)) . ')');
		}

		return $query;
	}

	/**
	 * Delete logs
	 *
	 * @param   array  $pks  Primary keys of logs
	 *
	 * @return  boolean
	 *
	 * @since   3.9.0
	 */
	public function delete(&$pks)
	{
		$db    = $this->getDbo();
		$query = $db->getQuery(true)
			->delete($db->quoteName('#__action_logs'))
			->where($db->quoteName('id') . ' IN (' .
implode(',', ArrayHelper::toInteger($pks)) . ')');
		$db->setQuery($query);

		try
		{
			$db->execute();
		}
		catch (RuntimeException $e)
		{
			$this->setError($e->getMessage());

			return false;
		}

		Factory::getApplication()->triggerEvent('onAfterLogPurge',
array());

		return true;
	}

	/**
	 * Removes all of logs from the table.
	 *
	 * @return  boolean result of operation
	 *
	 * @since   3.9.0
	 */
	public function purge()
	{
		try
		{
			$this->getDbo()->truncateTable('#__action_logs');
		}
		catch (Exception $e)
		{
			return false;
		}

		Factory::getApplication()->triggerEvent('onAfterLogPurge',
array());

		return true;
	}

	/**
	 * Get the filter form
	 *
	 * @param   array    $data      data
	 * @param   boolean  $loadData  load current data
	 *
	 * @return  \JForm|boolean  The \JForm object or false on error
	 *
	 * @since  3.9.0
	 */
	public function getFilterForm($data = array(), $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 JFormFieldList $field */
			$field = $form->getField('fullordering', 'list');
			$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_ASC'),
array('value' => 'a.ip_address ASC'));
			$field->addOption(Text::_('COM_ACTIONLOGS_IP_ADDRESS_DESC'),
array('value' => 'a.ip_address DESC'));
		}

		return $form;
	}
}
PK*�[JƸ�zzmodels/fields/extension.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

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

/**
 * Field to load a list of all extensions that have logged actions
 *
 * @since  3.9.0
 */
class JFormFieldExtension extends JFormFieldList
{
	/**
	 * 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 = Factory::getDbo();
		$query = $db->getQuery(true)
			->select('DISTINCT ' .
$db->quoteName('extension'))
			->from($db->quoteName('#__action_logs'))
			->order($db->quoteName('extension'));

		$db->setQuery($query);
		$context = $db->loadColumn();

		$options = array();

		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);
	}
}
PK*�[�(l6 
models/fields/logcreator.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Factory;
use Joomla\CMS\Form\FormHelper;

FormHelper::loadFieldClass('list');

/**
 * Field to load a list of all users that have logged actions
 *
 * @since  3.9.0
 */
class JFormFieldLogCreator extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	protected $type = 'LogCreator';

	/**
	 * Cached array of the category items.
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected static $options = array();

	/**
	 * 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();

			$options = array();

			$db = Factory::getDbo();

			// Construct the query
			$query = $db->getQuery(true)
				->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];
	}
}
PK*�[#ɬ���models/fields/logsdaterange.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Factory;
use Joomla\CMS\Form\FormHelper;

FormHelper::loadFieldClass('predefinedlist');

/**
 * Field to show a list of range dates to sort with
 *
 * @since  3.9.0
 */
class JFormFieldLogsDateRange extends JFormFieldPredefinedList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.9.0
	 */
	protected $type = 'logsdaterange';

	/**
	 * Available options
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $predefinedOptions = array(
		'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   JForm  $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);
	}
}
PK*�[��
��models/fields/logtype.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  System.actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

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

/**
 * Field to load a list of all users that have logged actions
 *
 * @since 3.9.0
 */
class JFormFieldLogType extends JFormFieldCheckboxes
{
	/**
	 * 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 = Factory::getDbo();
		$query = $db->getQuery(true)
			->select($db->quoteName('extension'))
			->from($db->quoteName('#__action_logs_extensions'));

		$extensions = $db->setQuery($query)->loadColumn();

		$options = array();
		$tmp     = array('checked' => true);

		foreach ($extensions as $extension)
		{
			ActionlogsHelper::loadTranslationFiles($extension);
			$option = HTMLHelper::_('select.option', $extension,
Text::_($extension));
			$options[ApplicationHelper::stringURLSafe(Text::_($extension)) .
'_' . $extension] = (object) array_merge($tmp, (array) $option);
		}

		ksort($options);

		return array_merge(parent::getOptions(), array_values($options));
	}
}
PK*�[����models/fields/plugininfo.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Information field.
 *
 * @since  3.9.2
 */
class JFormFieldPluginInfo extends JFormField
{
	/**
	 * 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 = JFactory::getDbo();
		$result = null;
		$query = $db->getQuery(true)
			->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);

		try
		{
			$result = (int) $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		$link = JHtml::_(
			'link',
			JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id='
. $result),
			JText::_('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED'),
			array('class' => 'alert-link')
		);

		return '<div class="alert alert-info">'
			.
JText::sprintf('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED_REDIRECT',
$link)
			. '</div>';
	}
}
PK*�[�"��55"models/forms/filter_actionlogs.xmlnu�[���<?xml
version="1.0" encoding="UTF-8"?>
<form>
	<fields name="filter">
		<field
			name="search"
			type="text"
			inputmode="search"
			description="COM_ACTIONLOGS_FILTER_SEARCH_DESC"
			hint="JSEARCH_FILTER"
		/>
		<field
			name="extension"
			type="extension"
			label="COM_ACTIONLOGS_EXTENSION"
			description="COM_ACTIONLOGS_EXTENSION_FILTER_DESC"
			onchange="this.form.submit()"
			>
			<option
value="">COM_ACTIONLOGS_SELECT_EXTENSION</option>
		</field>
		<field
			name="dateRange"
			type="logsdaterange"
			label="COM_ACTIONLOGS_OPTION_FILTER_DATE"
			description="COM_ACTIONLOGS_OPTION_FILTER_DATE"
			onchange="this.form.submit();"
			>
			<option
value="">COM_ACTIONLOGS_OPTION_FILTER_DATE</option>
		</field>
		<field
			name="user"
			type="logcreator"
			onchange="this.form.submit();"
			>
			<option
value="">COM_ACTIONLOGS_SELECT_USER</option>
		</field>
	</fields>
	<fields name="list">
		<field
			name="fullordering"
			type="list"
			label="COM_ACTIONLOGS_LIST_FULL_ORDERING"
			description="COM_ACTIONLOGS_LIST_FULL_ORDERING_DESC"
			onchange="this.form.submit();"
			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">COM_ACTIONLOGS_NAME_ASC</option>
			<option value="a.user_id
DESC">COM_ACTIONLOGS_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="COM_ACTIONLOGS_LIST_LIMIT"
			description="COM_ACTIONLOGS_LIST_LIMIT_DESC"
			class="input-mini"
			onchange="this.form.submit();"
			default="25"
		/>
	</fields>
</form>
PK*�[�}�%��!views/actionlogs/tmpl/default.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;

/** @var ActionlogsViewActionlogs $this */

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

HTMLHelper::_('bootstrap.tooltip');
HTMLHelper::_('behavior.multiselect');
HTMLHelper::_('formbehavior.chosen', 'select');

$listOrder  =
$this->escape($this->state->get('list.ordering'));
$listDirn   =
$this->escape($this->state->get('list.direction'));

Factory::getDocument()->addScriptDeclaration('
	Joomla.submitbutton = function(task)
	{
		if (task == "actionlogs.exportLogs")
		{
			Joomla.submitform(task,
document.getElementById("exportForm"));
			
			return;
		}

		if (task == "actionlogs.exportSelectedLogs")
		{
			// Get id of selected action logs item and pass it to export form hidden
input
			var cids = [];

			jQuery("input[name=\'cid[]\']:checked").each(function()
{
					cids.push(jQuery(this).val());
			});

			document.exportForm.cids.value = cids.join(",");
			Joomla.submitform(task,
document.getElementById("exportForm"));

			return;
		}

		Joomla.submitform(task);
	};
');
?>
<form action="<?php echo
Route::_('index.php?option=com_actionlogs&view=actionlogs');
?>" method="post" name="adminForm"
id="adminForm">
	<div id="j-main-container">
		<?php echo
LayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped table-hover"
id="logsList">
				<thead>
					<th width="1%" class="center">
						<?php echo HTMLHelper::_('grid.checkall'); ?>
					</th>
					<th>
						<?php echo HTMLHelper::_('searchtools.sort',
'COM_ACTIONLOGS_ACTION', 'a.message', $listDirn,
$listOrder); ?>
					</th>
					<th width="15%" class="nowrap">
						<?php echo HTMLHelper::_('searchtools.sort',
'COM_ACTIONLOGS_EXTENSION', 'a.extension', $listDirn,
$listOrder); ?>
					</th>
					<th width="15%" class="nowrap">
						<?php echo HTMLHelper::_('searchtools.sort',
'COM_ACTIONLOGS_DATE', 'a.log_date', $listDirn,
$listOrder); ?>
					</th>
					<th width="10%" class="nowrap">
						<?php echo HTMLHelper::_('searchtools.sort',
'COM_ACTIONLOGS_NAME', 'a.user_id', $listDirn,
$listOrder); ?>
					</th>
					<?php if ($this->showIpColumn) : ?>
						<th width="10%" class="nowrap">
							<?php echo HTMLHelper::_('searchtools.sort',
'COM_ACTIONLOGS_IP_ADDRESS', 'a.ip_address', $listDirn,
$listOrder); ?>
						</th>
					<?php endif; ?>
					<th width="1%" class="nowrap hidden-phone">
						<?php echo HTMLHelper::_('searchtools.sort',
'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder);
?>
					</th>
				</thead>
				<tfoot>
					<tr>
						<td colspan="7">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
					<?php foreach ($this->items as $i => $item) :
						$extension = strtok($item->extension, '.');
						ActionlogsHelper::loadTranslationFiles($extension); ?>
						<tr class="row<?php echo $i % 2; ?>">
							<td class="center">
								<?php echo HTMLHelper::_('grid.id', $i, $item->id);
?>
							</td>
							<td>
								<?php echo ActionlogsHelper::getHumanReadableLogMessage($item);
?>
							</td>
							<td>
								<?php echo $this->escape(Text::_($extension)); ?>
							</td>
							<td>
								<span class="hasTooltip" title="<?php echo
HTMLHelper::_('date', $item->log_date,
Text::_('DATE_FORMAT_LC6')); ?>">
									<?php echo HTMLHelper::_('date.relative',
$item->log_date); ?>
								</span>
							</td>
							<td>
								<?php echo $this->escape($item->name); ?>
							</td>
							<?php if ($this->showIpColumn) : ?>
								<td>
									<?php echo Text::_($this->escape($item->ip_address));
?>
								</td>
							<?php endif;?>
							<td class="hidden-phone">
								<?php echo (int) $item->id; ?>
							</td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		<?php endif;?>
		<input type="hidden" name="task"
value="" />
		<input type="hidden" name="boxchecked"
value="0" />
		<?php echo HTMLHelper::_('form.token'); ?>
	</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>
PK*�[XME��!views/actionlogs/tmpl/default.xmlnu�[���<?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>

PK*�[3���
�
views/actionlogs/view.html.phpnu�[���<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   Copyright (C) 2005 - 2020 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\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;

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

/**
 * View class for a list of logs.
 *
 * @since  3.9.0
 */
class ActionlogsViewActionlogs extends JViewLegacy
{
	/**
	 * An array of items.
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $items;

	/**
	 * The model state
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $state;

	/**
	 * The pagination object
	 *
	 * @var    JPagination
	 * @since  3.9.0
	 */
	protected $pagination;

	/**
	 * The active search filters
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	public $activeFilters;

	/**
	 * Method to display the view.
	 *
	 * @param   string  $tpl  A template file to load. [optional]
	 *
	 * @return  mixed  A string if successful, otherwise an Error object.
	 *
	 * @since   3.9.0
	 */
	public function display($tpl = null)
	{
		$params = ComponentHelper::getParams('com_actionlogs');

		$this->items         = $this->get('Items');
		$this->state         = $this->get('State');
		$this->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');
		$this->pagination    = $this->get('Pagination');
		$this->showIpColumn  = (bool) $params->get('ip_logging',
0);

		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		$this->addToolBar();

		// Load all actionlog plugins language files
		ActionlogsHelper::loadActionLogPluginsLanguage();

		return parent::display($tpl);
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since   3.9.0
	 */
	protected function addToolbar()
	{
		ToolbarHelper::title(Text::_('COM_ACTIONLOGS_MANAGER_USERLOGS'),
'list-2');

		ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE',
'actionlogs.delete');
		$bar = Toolbar::getInstance('toolbar');
		$bar->appendButton('Confirm',
'COM_ACTIONLOGS_PURGE_CONFIRM', 'delete',
'COM_ACTIONLOGS_TOOLBAR_PURGE', 'actionlogs.purge',
false);
		ToolbarHelper::preferences('com_actionlogs');
		ToolbarHelper::help('JHELP_COMPONENTS_ACTIONLOGS');
		ToolBarHelper::custom('actionlogs.exportSelectedLogs',
'download', '', 'COM_ACTIONLOGS_EXPORT_CSV',
true);
		ToolBarHelper::custom('actionlogs.exportLogs',
'download', '',
'COM_ACTIONLOGS_EXPORT_ALL_CSV', false);
	}
}
PK*�[�:H���actionlogs.phpnu�[���PK*�[��66�actionlogs.xmlnu�[���PK*�[�p��
gconfig.xmlnu�[���PK*�[�v��Ccontroller.phpnu�[���PK*�[���-��controllers/actionlogs.phpnu�[���PK*�[�$8$8$helpers/actionlogs.phpnu�[���PK*�[�%.4v
v
�Ahelpers/actionlogsphp55.phpnu�[���PK*�[ɮ����QLlayouts/logstable.phpnu�[���PK*�[E����	�	�Rlibraries/actionlogplugin.phpnu�[���PK*�[�����\models/actionlog.phpnu�[���PK*�[7i�b$b$nomodels/actionlogs.phpnu�[���PK*�[JƸ�zz�models/fields/extension.phpnu�[���PK*�[�(l6

ښmodels/fields/logcreator.phpnu�[���PK*�[#ɬ���F�models/fields/logsdaterange.phpnu�[���PK*�[��
��_�models/fields/logtype.phpnu�[���PK*�[����@�models/fields/plugininfo.phpnu�[���PK*�[�"��55"[�models/forms/filter_actionlogs.xmlnu�[���PK*�[�}�%��!�views/actionlogs/tmpl/default.phpnu�[���PK*�[XME��!0�views/actionlogs/tmpl/default.xmlnu�[���PK*�[3���
�
H�views/actionlogs/view.html.phpnu�[���PK�B�