<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.0.9h
  @date  06/06/10, 15:45
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/

$info=tep_get_system_information();

// Get the database system version
$database_query = tep_db_query("SELECT VERSION()");
$database_version = tep_db_fetch_array($database_query);

// Calculate total db size/row count
//$result = tep_db_query("SHOW TABLE STATUS FROM ".DB_DATABASE);
$result = tep_db_query("SHOW TABLE STATUS");

$total_records = $total_size = 0;
  while ($status = tep_db_fetch_array($result))	{
    $total_records += $status['Rows'];
    $total_size += $status['Data_length'] + $status['Index_length'];
  }

$total_size = $total_size / 1024;
if ( $total_size > 1024 )  $total_size = round($total_size / 1024, 2).' MB';
else  $total_size = round($total_size, 2).' KB';

// See if MMCache or PHPA is loaded
if ( function_exists('mmcache') ) {
  $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';
} else if ( isset($_PHPA) ) {
  $php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>';
} else {
  $php_accelerator = 'N/A';
}
?>
<div id="homeStats" class="<?php echo $widg['class'] ?>">
 <h3><?php echo __('main info') ;?></h3>
  <dl>
    <dt><?php echo __('text oscss version') ;?></dt>
    <dd><?php echo PROJECT_VERSION ;?> - <a href="<?php echo tep_href_link(FILENAME_ACA,'action_type=generic&amp;action_class=SvnUpdate&amp;action_method=draw_form') ?>"><?php echo __('Check for upgrade') ?></a></dd>

    <dt><?php echo __('environment') ;?></dt>
    <dd>
	<ul>
	  <li><?php echo PHP_OS ?></li>
	  <li><?php echo 'PHP :'. $info['php'].' <a href="'.tep_href_link(FILENAME_CONFIGURATION,'gID=36').'">'.__('Show info').'</a>' ?></li>
	  <li><?php echo __('zend : ').$info['zend'] ?></li>
	  <li><?php echo __('Accelerator : ').$php_accelerator ?></li>
	</ul>
    </dd>

    <dt><?php echo  __('base de donnee') ;?></dt>
    <dd>
	<ul>
	  <li><?php echo __('SQL ') ?></li>
	  <li><?php echo __('Version : ').$database_version['VERSION()'] ?></li>
	  <li><?php echo __('Rows : ').$total_records ?></li>
	  <li><?php echo __('Size : ').$total_size ?></li>
	</ul>
    </dd>
  </dl>

 <div class="separator"></div>
</div>