Spade
Mini Shell
PKX��[#�,�
�
helper.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage mod_stats
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_stats
*
* @since 1.5
*/
class ModStatsHelper
{
/**
* Get list of stats
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function &getList(&$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]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_($db->name);
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_TIME');
$rows[$i]->data = JHtml::_('date', 'now',
'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->data = $app->get('caching') ?
JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$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]->data = $users;
$i++;
}
if ($items)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->data = $items;
$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]->data = $hits + $increase;
$i++;
}
}
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');
$arrays = (array) $app->triggerEvent('onGetStats',
array('mod_stats'));
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'];
$i++;
}
}
}
return $rows;
}
}
PKX��[�
��
mod_stats.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage mod_stats
*
* @copyright (C) 2005 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the statistics functions only once
JLoader::register('ModStatsHelper', __DIR__ .
'/helper.php');
$serverinfo = $params->get('serverinfo', 0);
$siteinfo = $params->get('siteinfo', 0);
$list = ModStatsHelper::getList($params);
$moduleclass_sfx =
htmlspecialchars($params->get('moduleclass_sfx',
''), ENT_COMPAT, 'UTF-8');
require JModuleHelper::getLayoutPath('mod_stats',
$params->get('layout', 'default'));
PKX��[�Bmm
mod_stats.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1"
client="site" method="upgrade">
<name>mod_stats</name>
<author>Joomla! Project</author>
<creationDate>July 2004</creationDate>
<copyright>(C) 2005 Open Source Matters, Inc.</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">mod_stats.php</filename>
<folder>tmpl</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"
validate="moduleLayout"
/>
<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>
PKX��[�&E��tmpl/default.phpnu�[���<?php
/**
* @package Joomla.Site
* @subpackage mod_stats
*
* @copyright (C) 2006 Open Source Matters, Inc.
<https://www.joomla.org>
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<dl class="stats-module<?php echo $moduleclass_sfx;
?>">
<?php foreach ($list as $item) : ?>
<dt><?php echo $item->title; ?></dt>
<dd><?php echo $item->data; ?></dd>
<?php endforeach; ?>
</dl>
PKX��[#�,�
�
helper.phpnu�[���PKX��[�
��
2mod_stats.phpnu�[���PKX��[�Bmm
'mod_stats.xmlnu�[���PKX��[�&E���tmpl/default.phpnu�[���PK4�