<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

function block_directory_stat() {
  global $dbConn;
  
  if (!$params['template']) {
    $params['template'] = 'block.directory_stat.html';
  }

  $tpl = new Template;

  $query = "select count(*) as tl, sum(hits) as  h from idx_link";
  $result = $dbConn->Execute($query);
  $total_link = $result->Fields("tl");
  $total_hits = $result->Fields("h");

  $query = "select count(*) as tc from idx_category";
  $result = $dbConn->Execute($query);
  $total_category = $result->Fields("tc");

  $query = "select count(*) as tu from idx_users where status = 1";
  $result = $dbConn->Execute($query);
  $total_member = $result->Fields("tu");

  $query = "select count(*) as tm from idx_mailing_list where status = 1";
  $result = $dbConn->Execute($query);
  $total_milis = $result->Fields("tm");

  $tpl->assign("total_link", $total_link);
  $tpl->assign("total_hits", $total_hits);
  $tpl->assign("total_category", $total_category);
  $tpl->assign("total_member", $total_member);
  $tpl->assign("total_milis", $total_milis);
  $tpl->display("blocks/" . $params['template']);
}

?>