Skip to content

Commit

Permalink
V1.3 Quickstart Code Added
Browse files Browse the repository at this point in the history
  • Loading branch information
itxchandan committed Feb 19, 2019
1 parent b2db9f1 commit 381a98c
Show file tree
Hide file tree
Showing 7,621 changed files with 612,481 additions and 92,759 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion quickstart/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* Documentation for Web designers: https://docs.joomla.org/Special:MyLanguage/Web_designers

Copyright:
* Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.
* Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
* Special Thanks: https://docs.joomla.org/Special:MyLanguage/Joomla!_Credits_and_Thanks
* Distributed under the GNU General Public License version 2 or later
* See Licenses details at https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses
15 changes: 10 additions & 5 deletions quickstart/administrator/components/com_actionlogs/actionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 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.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();
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>com_actionlogs</name>
<author>Joomla! Project</author>
<creationDate>May 2018</creationDate>
<copyright>Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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"
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>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 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');
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 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;

/**
Expand Down Expand Up @@ -57,7 +61,7 @@ public static function getCsvData($data)

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

static::loadTranslationFiles($extension);
Expand All @@ -66,9 +70,9 @@ public static function getCsvData($data)
'id' => $log->id,
'message' => strip_tags(static::getHumanReadableLogMessage($log, false)),
'date' => $date->format('Y-m-d H:i:s T'),
'extension' => JText::_($extension),
'extension' => Text::_($extension),
'name' => $log->name,
'ip_address' => JText::_($log->ip_address),
'ip_address' => Text::_($log->ip_address),
);
}

Expand All @@ -94,7 +98,8 @@ public static function loadTranslationFiles($extension)
return;
}

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

switch (substr($extension, 0, 3))
{
Expand All @@ -113,7 +118,15 @@ public static function loadTranslationFiles($extension)

case 'plg':
$parts = explode('_', $extension, 3);
$source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2];

if (count($parts) > 2)
{
$source = JPATH_PLUGINS . '/' . $parts[1] . '/' . $parts[2];
}
break;

case 'pkg':
$source = JPATH_SITE;
break;

case 'tpl':
Expand Down Expand Up @@ -145,7 +158,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 @@ -170,17 +183,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 @@ -189,13 +202,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 @@ -252,8 +265,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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 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.
*
Expand Down Expand Up @@ -55,10 +58,10 @@ public static function getCsvAsGenerator($data)
yield array(
'id' => $log->id,
'message' => strip_tags(ActionlogsHelper::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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,46 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

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 @@ -3,12 +3,15 @@
* @package Joomla.Administrator
* @subpackage com_actionlogs
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;

JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;

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

/**
* Abstract Action Log Plugin
Expand Down Expand Up @@ -57,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 Expand Up @@ -90,7 +93,7 @@ protected function addLog($messages, $messageLanguageKey, $context, $userId = nu
}

/** @var ActionlogsModelActionlog $model **/
$model = JModelLegacy::getInstance('Actionlog', 'ActionlogsModel');
$model = BaseDatabaseModel::getInstance('Actionlog', 'ActionlogsModel');
$model->addLog($messages, strtoupper($messageLanguageKey), $context, $userId);
}
}
Loading

0 comments on commit 381a98c

Please sign in to comment.