You've already forked joomla_test
first commit
This commit is contained in:
132
modules/mod_stats/helper.php
Normal file
132
modules/mod_stats/helper.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_stats
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_stats
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_stats
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModStatsHelper
|
||||
{
|
||||
public static function &getList(&$params)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$db = JFactory::getDbo();
|
||||
$rows = array();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$serverinfo = $params->get('serverinfo');
|
||||
$siteinfo = $params->get('siteinfo');
|
||||
$counter = $params->get('counter');
|
||||
$increase = $params->get('increase');
|
||||
|
||||
$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::_('MOD_STATS_MYSQL');
|
||||
$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->getCfg('caching') ? JText::_('JENABLED'):JText::_('JDISABLED');
|
||||
$i++;
|
||||
|
||||
$rows[$i] = new stdClass;
|
||||
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
|
||||
$rows[$i]->data = $app->getCfg('gzip') ? JText::_('JENABLED'):JText::_('JDISABLED');
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($siteinfo)
|
||||
{
|
||||
$query->select('COUNT(id) AS count_users')
|
||||
->from('#__users');
|
||||
$db->setQuery($query);
|
||||
$users = $db->loadResult();
|
||||
|
||||
$query->clear()
|
||||
->select('COUNT(id) AS count_items')
|
||||
->from('#__content')
|
||||
->where('state = 1');
|
||||
$db->setQuery($query);
|
||||
$items = $db->loadResult();
|
||||
|
||||
$query->clear()
|
||||
->select('COUNT(id) AS count_links ')
|
||||
->from('#__weblinks')
|
||||
->where('state = 1');
|
||||
$db->setQuery($query);
|
||||
$links = $db->loadResult();
|
||||
|
||||
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 ($links)
|
||||
{
|
||||
$rows[$i] = new stdClass;
|
||||
$rows[$i]->title = JText::_('MOD_STATS_WEBLINKS');
|
||||
$rows[$i]->data = $links;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($counter)
|
||||
{
|
||||
$query->clear()
|
||||
->select('SUM(hits) AS count_hits')
|
||||
->from('#__content')
|
||||
->where('state = 1');
|
||||
$db->setQuery($query);
|
||||
$hits = $db->loadResult();
|
||||
|
||||
if ($hits)
|
||||
{
|
||||
$rows[$i] = new stdClass;
|
||||
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
|
||||
$rows[$i]->data = $hits + $increase;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
1
modules/mod_stats/index.html
Normal file
1
modules/mod_stats/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
21
modules/mod_stats/mod_stats.php
Normal file
21
modules/mod_stats/mod_stats.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_stats
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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 syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$serverinfo = $params->get('serverinfo');
|
||||
$siteinfo = $params->get('siteinfo');
|
||||
|
||||
$list = ModStatsHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_stats', $params->get('layout', 'default'));
|
112
modules/mod_stats/mod_stats.xml
Normal file
112
modules/mod_stats/mod_stats.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?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>Copyright (C) 2005 - 2013 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">mod_stats.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename> <filename>mod_stats.xml</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"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_STATS_FIELD_SERVERINFO_LABEL"
|
||||
description="MOD_STATS_FIELD_SERVERINFO_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="siteinfo"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_STATS_FIELD_SITEINFO_LABEL"
|
||||
description="MOD_STATS_FIELD_SITEINFO_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="counter"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_STATS_FIELD_COUNTER_LABEL"
|
||||
description="MOD_STATS_FIELD_COUNTER_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="increase"
|
||||
type="text"
|
||||
default="0"
|
||||
label="MOD_STATS_FIELD_INCREASECOUNTER_LABEL"
|
||||
description="MOD_STATS_FIELD_INCREASECOUNTER_DESC" />
|
||||
</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" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
17
modules/mod_stats/tmpl/default.php
Normal file
17
modules/mod_stats/tmpl/default.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_stats
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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>
|
1
modules/mod_stats/tmpl/index.html
Normal file
1
modules/mod_stats/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user