[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/modules/mod_stats/ -> helper.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: helper.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   6  * @license        GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_JEXEC' ) or die( 'Restricted access' );
  16  
  17  class modStatsHelper
  18  {
  19      function &getList( &$params )
  20      {
  21          global $mainframe;
  22  
  23          $db =& JFactory::getDBO();
  24          $rows = array();
  25  
  26          $serverinfo         = $params->get( 'serverinfo' );
  27          $siteinfo             = $params->get( 'siteinfo' );
  28          $counter             = $params->get( 'counter' );
  29          $increase             = $params->get( 'increase' );
  30  
  31          $i = 0;
  32          if ( $serverinfo )
  33          {
  34              $rows[$i]->title     = JText::_( 'OS' );
  35              $rows[$i]->data     = substr( php_uname(), 0, 7 );
  36              $i++;
  37              $rows[$i]->title     = JText::_( 'PHP' );
  38              $rows[$i]->data     = phpversion();
  39              $i++;
  40              $rows[$i]->title     = JText::_( 'MySQL' );
  41              $rows[$i]->data     = $db->getVersion();
  42              $i++;
  43              $rows[$i]->title     = JText::_( 'Time' );
  44              $rows[$i]->data     = JHTML::_('date', 'now', '%H:%M');
  45              $i++;
  46              $rows[$i]->title     = JText::_( 'Caching' );
  47              $rows[$i]->data     =  $mainframe->getCfg('caching') ? JText::_( 'Enabled' ):JText::_( 'Disabled' );
  48              $i++;
  49              $rows[$i]->title     = JText::_( 'GZip' );
  50              $rows[$i]->data     = $mainframe->getCfg('gzip') ? JText::_( 'Enabled' ):JText::_( 'Disabled' );
  51              $i++;
  52          }
  53  
  54          if ( $siteinfo )
  55          {
  56              $query = 'SELECT COUNT( id ) AS count_users'
  57              . ' FROM #__users'
  58              ;
  59              $db->setQuery( $query );
  60              $members = $db->loadResult();
  61  
  62              $query = 'SELECT COUNT( id ) AS count_items'
  63              . ' FROM #__content'
  64              . ' WHERE state = "1"'
  65              ;
  66              $db->setQuery( $query );
  67              $items = $db->loadResult();
  68  
  69              $query = 'SELECT COUNT( id ) AS count_links'
  70              . ' FROM #__weblinks'
  71              . ' WHERE published = "1"'
  72              ;
  73              $db->setQuery( $query );
  74              $links = $db->loadResult();
  75  
  76              if ( $members ) {
  77                  $rows[$i]->title     = JText::_( 'Members' );
  78                  $rows[$i]->data     = $members;
  79                  $i++;
  80              }
  81  
  82              if ( $items ) {
  83                  $rows[$i]->title     = JText::_( 'Content' );
  84                  $rows[$i]->data     = $items;
  85                  $i++;
  86              }
  87  
  88              if ( $links ) {
  89                  $rows[$i]->title     = JText::_( 'Web Links' );
  90                  $rows[$i]->data     = $links;
  91                  $i++;
  92              }
  93  
  94          }
  95  
  96          if( $counter )
  97          {
  98              $query = 'SELECT SUM( hits ) AS count_hits'
  99              . ' FROM #__content'
 100              . ' WHERE state = "1"'
 101              ;
 102              $db->setQuery( $query );
 103              $hits = $db->loadResult();
 104  
 105              if ( $hits ) {
 106                  $rows[$i]->title     = JText::_( 'Content View Hits' );
 107                  $rows[$i]->data     = $hits + $increase;
 108                  $i++;
 109              }
 110          }
 111  
 112          return $rows;
 113      }
 114  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1