Spade
Mini Shell
helper.php000064400000010427151166752560006556 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_stats_admin
*
* @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;
/**
* Helper class for admin stats module
*
* @since 3.0
*/
class ModStatsHelper
{
/**
* Method to retrieve information about the site
*
* @param JObject &$params Params object
*
* @return array Array containing site information
*
* @since 3.0
*/
public static function getStats(&$params)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$rows = array();
$query = $db->getQuery(true);
$serverinfo = $params->get('serverinfo', 0);
$siteinfo = $params->get('siteinfo', 0);
$counter = $params->get('counter', 0);
$increase = $params->get('increase', 0);
$i = 0;
if ($serverinfo)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_OS');
$rows[$i]->icon = 'screen';
$rows[$i]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->icon = 'cogs';
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_($db->name);
$rows[$i]->icon = 'database';
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_TIME');
$rows[$i]->icon = 'clock';
$rows[$i]->data = JHtml::_('date', 'now',
'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->icon = 'dashboard';
$rows[$i]->data = $app->get('caching') ?
JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$rows[$i]->icon = 'lightning';
$rows[$i]->data = $app->get('gzip') ?
JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
}
if ($siteinfo)
{
$query->select('COUNT(id) AS count_users')
->from('#__users');
$db->setQuery($query);
try
{
$users = $db->loadResult();
}
catch (RuntimeException $e)
{
$users = false;
}
$query->clear()
->select('COUNT(id) AS count_items')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$items = $db->loadResult();
}
catch (RuntimeException $e)
{
$items = false;
}
if ($users)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_USERS');
$rows[$i]->icon = 'users';
$rows[$i]->data = $users;
$rows[$i]->link =
JRoute::_('index.php?option=com_users');
$i++;
}
if ($items)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->icon = 'file';
$rows[$i]->data = $items;
$rows[$i]->link =
JRoute::_('index.php?option=com_content&view=articles&filter[published]=1');
$i++;
}
}
if ($counter)
{
$query->clear()
->select('SUM(hits) AS count_hits')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$hits = $db->loadResult();
}
catch (RuntimeException $e)
{
$hits = false;
}
if ($hits)
{
$rows[$i] = new stdClass;
$rows[$i]->title =
JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->icon = 'eye';
$rows[$i]->data = number_format($hits + $increase, 0,
JText::_('DECIMALS_SEPARATOR'),
JText::_('THOUSANDS_SEPARATOR'));
$i++;
}
}
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');
$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetStats',
array('mod_stats_admin'));
foreach ($arrays as $response)
{
foreach ($response as $row)
{
// We only add a row if the title and data are given
if (isset($row['title']) &&
isset($row['data']))
{
$rows[$i] = new stdClass;
$rows[$i]->title = $row['title'];
$rows[$i]->icon = isset($row['icon']) ?
$row['icon'] : 'info';
$rows[$i]->data = $row['data'];
$rows[$i]->link = isset($row['link']) ?
$row['link'] : null;
$i++;
}
}
}
return $rows;
}
}
language/en-GB.mod_stats_admin.ini000064400000002170151166752560013102
0ustar00; Joomla! Project
; Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_STATS_ADMIN="Statistics"
MOD_STATS_ARTICLES="Articles"
MOD_STATS_ARTICLES_VIEW_HITS="Articles View Hits"
MOD_STATS_CACHING="Caching"
MOD_STATS_FIELD_COUNTER_DESC="Display hit counter."
MOD_STATS_FIELD_COUNTER_LABEL="Hit Counter"
MOD_STATS_FIELD_INCREASECOUNTER_DESC="Enter the number of hits to
increase the counter by."
MOD_STATS_FIELD_INCREASECOUNTER_LABEL="Increase Counter"
MOD_STATS_FIELD_SERVERINFO_DESC="Display server information."
MOD_STATS_FIELD_SERVERINFO_LABEL="Server Information"
MOD_STATS_FIELD_SITEINFO_DESC="Display site information."
MOD_STATS_FIELD_SITEINFO_LABEL="Site Information"
MOD_STATS_GZIP="Gzip"
MOD_STATS_OS="OS"
MOD_STATS_PHP="PHP"
MOD_STATS_TIME="Time"
MOD_STATS_USERS="Users"
MOD_STATS_WEBLINKS="Web Links"
MOD_STATS_XML_DESCRIPTION="The Statistics Module shows information
about your server installation together with statistics on the website
users and the number of Articles in your database."
language/en-GB.mod_stats_admin.sys.ini000064400000000722151166752560013720
0ustar00; Joomla! Project
; Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_STATS_ADMIN="Statistics"
MOD_STATS_XML_DESCRIPTION="The Statistics Module shows information
about your server installation together with statistics on the website
users and the number of Articles in your database."
MOD_STATS_LAYOUT_DEFAULT="Default"
mod_stats_admin.php000064400000001320151166752560010434 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_stats_admin
*
* @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;
// Include the mod_stats functions only once
JLoader::register('ModStatsHelper', __DIR__ .
'/helper.php');
$serverinfo = $params->get('serverinfo');
$siteinfo = $params->get('siteinfo');
$list = ModStatsHelper::getStats($params);
$moduleclass_sfx =
htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT,
'UTF-8');
require JModuleHelper::getLayoutPath('mod_stats_admin',
$params->get('layout', 'default'));
mod_stats_admin.xml000064400000006251151166752560010455 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1"
client="administrator" method="upgrade">
<name>mod_stats_admin</name>
<author>Joomla! Project</author>
<creationDate>July 2004</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.0.0</version>
<description>MOD_STATS_XML_DESCRIPTION</description>
<files>
<filename
module="mod_stats_admin">mod_stats_admin.php</filename>
<folder>tmpl</folder>
<folder>language</folder>
<filename>helper.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.mod_stats.ini</language>
<language
tag="en-GB">en-GB.mod_stats.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_STATISTICS" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="serverinfo"
type="radio"
label="MOD_STATS_FIELD_SERVERINFO_LABEL"
description="MOD_STATS_FIELD_SERVERINFO_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="siteinfo"
type="radio"
label="MOD_STATS_FIELD_SITEINFO_LABEL"
description="MOD_STATS_FIELD_SITEINFO_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="counter"
type="radio"
label="MOD_STATS_FIELD_COUNTER_LABEL"
description="MOD_STATS_FIELD_COUNTER_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="increase"
type="number"
label="MOD_STATS_FIELD_INCREASECOUNTER_LABEL"
description="MOD_STATS_FIELD_INCREASECOUNTER_DESC"
default="0"
filter="integer"
/>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
default="1"
filter="integer"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>
tmpl/default.php000064400000002634151166752560007700 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_stats_admin
*
* @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;
JHtml::_('jquery.framework');
JFactory::getDocument()->addScriptDeclaration('
jQuery(document).ready(function($) {
$("a.js-revert").on("click", function(e) {
e.preventDefault();
e.stopPropagation();
var activeTab = [];
activeTab.push("#" + e.target.href.split("#")[1]);
var path = window.location.pathname;
localStorage.removeItem(e.target.href.replace(/&return=[a-zA-Z0-9%]+/,
"").replace(/&[a-zA-Z-_]+=[0-9]+/, ""));
localStorage.setItem(path +
e.target.href.split("index.php")[1].split("#")[0],
JSON.stringify(activeTab));
return window.location.href = e.target.href.split("#")[0];
});
});
');
?>
<div class="row-striped">
<?php foreach ($list as $item) : ?>
<div class="row-fluid">
<div class="span4">
<span class="icon-<?php echo $item->icon; ?>"
aria-hidden="true"></span> <?php echo
$item->title; ?>
</div>
<div class="span8">
<?php if (isset($item->link)) : ?>
<a class="btn btn-info btn-small js-revert"
href="<?php echo $item->link; ?>"><?php echo
$item->data; ?></a>
<?php else : ?>
<?php echo $item->data; ?>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>