[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/modules/ -> mod_stats.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  global $mosConfig_offset, $mosConfig_caching, $mosConfig_enable_stats;
  20  global $mosConfig_gzip;
  21  $serverinfo = $params->get( 'serverinfo' );
  22  $siteinfo = $params->get( 'siteinfo' );
  23  $moduleclass_sfx = $params->get( 'moduleclass_sfx' );
  24  
  25  $content = "";
  26  
  27  if ($serverinfo) {
  28      echo "<strong>OS:</strong> "  . substr(php_uname(),0,7) . "<br />\n";
  29      echo "<strong>PHP:</strong> " .phpversion() . "<br />\n";
  30      echo "<strong>MySQL:</strong> " .mysql_get_server_info() . "<br />\n";
  31      echo "<strong>".T_('Time').": </strong> " .date("H:i",time()+($mosConfig_offset*60*60)) . "<br />\n";
  32      $c = $mosConfig_caching ? T_('Enabled'):T_('Disabled');
  33      echo "<strong>Caching:</strong> " . $c . "<br />\n";
  34      $z = $mosConfig_gzip ? T_('Enabled'):T_('Disabled');
  35      echo "<strong>GZIP:</strong> " . $z . "<br />\n";
  36  }
  37  
  38  if ($siteinfo) {
  39      $query="SELECT count(id) AS count_users FROM #__users";
  40      $database->setQuery($query);
  41      echo "<strong>".T_('Members').":</strong> " .$database->loadResult() . "<br />\n";
  42  
  43      $query="SELECT count(id) as count_items from #__content";
  44      $database->setQuery($query);
  45      echo "<strong>".T_('News').":</strong> ".$database->loadResult() . "<br />\n";
  46  
  47      $query="SELECT count(id) as count_links FROM #__weblinks WHERE published='1'";
  48      $database->setQuery($query);
  49      echo "<strong>".T_('Web Links').":</strong> ".$database->loadResult() . "<br />\n";
  50  }
  51  
  52  if ($mosConfig_enable_stats) {
  53      $counter = $params->get( 'counter' );
  54      $increase = $params->get( 'increase' );
  55      if ($counter) {
  56          $query = "SELECT sum(hits) AS count FROM #__stats_agents WHERE type='1'";
  57          $database->setQuery( $query );
  58          $hits = $database->loadResult();
  59  
  60          $hits = $hits + $increase;
  61  
  62          if ($hits == NULL) {
  63              $content .= "<strong>" . T_('Visitors') . ":</strong> 0\n";
  64          } else {
  65              $content .= "<strong>" .  T_('Visitors') . ":</strong> " . $hits . "\n";
  66          }
  67      }
  68  }
  69  ?>