You've already forked joomla_test
first commit
This commit is contained in:
149
administrator/modules/mod_stats_admin/helper.php
Normal file
149
administrator/modules/mod_stats_admin/helper.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_stats_admin
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_stats_admin
|
||||
* @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');
|
||||
$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]->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->getCfg('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->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]->icon = 'users';
|
||||
$rows[$i]->data = $users;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($items)
|
||||
{
|
||||
$rows[$i] = new stdClass;
|
||||
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
|
||||
$rows[$i]->icon = 'file';
|
||||
$rows[$i]->data = $items;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($links)
|
||||
{
|
||||
$rows[$i] = new stdClass;
|
||||
$rows[$i]->title = JText::_('MOD_STATS_WEBLINKS');
|
||||
$rows[$i]->icon = 'out-2';
|
||||
$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]->icon = 'eye';
|
||||
$rows[$i]->data = $hits + $increase;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
1
administrator/modules/mod_stats_admin/index.html
Normal file
1
administrator/modules/mod_stats_admin/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,24 @@
|
||||
; Joomla! Project
|
||||
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
|
||||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
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 amount 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="Visitors"
|
||||
MOD_STATS_WEBLINKS="Web Links"
|
||||
MOD_STATS_XML_DESCRIPTION="The Statistics Module shows information about your server installation together with statistics on the Web site users, number of Articles in your database and the number of Web links you provide."
|
@ -0,0 +1,9 @@
|
||||
; Joomla! Project
|
||||
; Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.
|
||||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
MOD_STATS_ADMIN="Statistics"
|
||||
MOD_STATS_XML_DESCRIPTION="The Statistics Module shows information about your server installation together with statistics on the Web site users, number of Articles in your database and the number of Web links you provide."
|
||||
MOD_STATS_LAYOUT_DEFAULT="Default"
|
||||
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
21
administrator/modules/mod_stats_admin/mod_stats_admin.php
Normal file
21
administrator/modules/mod_stats_admin/mod_stats_admin.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::getStats($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_stats_admin', $params->get('layout', 'default'));
|
113
administrator/modules/mod_stats_admin/mod_stats_admin.xml
Normal file
113
administrator/modules/mod_stats_admin/mod_stats_admin.xml
Normal file
@ -0,0 +1,113 @@
|
||||
<?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 - 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_admin">mod_stats_admin.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_stats_admin.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>
|
16
administrator/modules/mod_stats_admin/tmpl/default.php
Normal file
16
administrator/modules/mod_stats_admin/tmpl/default.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?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;
|
||||
?>
|
||||
<ul class="list-striped list-condensed stats-module<?php echo $moduleclass_sfx ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li><i class="icon-<?php echo $item->icon;?>" title="<?php echo $item->title;?>"></i> <?php echo $item->title;?> <?php echo $item->data;?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
1
administrator/modules/mod_stats_admin/tmpl/index.html
Normal file
1
administrator/modules/mod_stats_admin/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user