<?php
//+-----------------------------------------------------+//
//+ Copyright Floopo.com
//+ admin.php
//+ Site Admin Loader
//+-----------------------------------------------------+//

defined('BASEPATH') or die('You can not directly access this file');//check its within this framework

//____DEFAULT TEMPLATE_____________________________
$inner_template = ADMIN_TEMPLATES.'tpl_index.htm';
$todays_date = date('Y-m-d');

//_____INCLUDES_____________________________________
include_once(BASEPATH.'/com/com_admin/functions.php');


//____Mysql: Connect to dbase______________________
$dbase = new QuickMysql(DB_NAME, DB_USER, DB_PASS, DB_HOST);


//____Login Check__________________________________
($_SESSION['admin'] != 1) ? @header("Location: ".BASEURL.'/index.php?option=com_admin_login'): NULL;


//____Let load the correct helper__________________
$type = (($_GET['type'] != '') ? $_GET['type']: $_POST['type']);
$type = sanatize($type);

switch($type){

//____members_____
case 'members':
include_once(BASEPATH.'/com/com_admin/helper.members.php');
break;

case 'stats':
include_once(BASEPATH.'/com/com_admin/helper.stats.php');
break;

case 'settings':
include_once(BASEPATH.'/com/com_admin/helper.settings.php');
break;

case 'adverts':
include_once(BASEPATH.'/com/com_admin/helper.adverts.php');
break;

case 'customize':
include_once(BASEPATH.'/com/com_admin/helper.customprofile.php');
break;

case 'themes':
include_once(BASEPATH.'/com/com_admin/helper.themes.php');
break;

case 'pages':
include_once(BASEPATH.'/com/com_admin/helper.pages.php');
break;

case 'language':
include_once(BASEPATH.'/com/com_admin/helper.language.php');
break;

case 'messages':
include_once(BASEPATH.'/com/com_admin/helper.messages.php');
break;

}


//____________Home Page Stats________________________
$today = date('Y-m-d');
$quick_stats = $dbase->SelectRecord("SELECT (

SELECT COUNT( 'content_id' ) AS messages
FROM content_text
) AS messages, (

SELECT COUNT( 'indexer' ) AS following
FROM following
) AS following, (

SELECT COUNT( 'content_id' ) AS images
FROM content_images
) AS images, (

SELECT COUNT( 'indexer' ) AS new_members
FROM member_profile
WHERE date_added_short = '$today'
) AS new_members, (

SELECT COUNT( 'content_id' ) AS new_messages
FROM content_text
WHERE date_added_short = '$today'
) AS new_messages, (

SELECT COUNT( 'content_id' ) AS new_images
FROM content_images
WHERE date_added_short = '$today'
) AS new_images, COUNT( user_id ) AS members
FROM member_profile");


//____Display any output_________________________
$TBS = new clsTinyButStrong;
$TBS->NoErr = true;
$TBS->LoadTemplate(ADMIN_WRAPPER);
$TBS->MergeBlock('blk1',$results); //helpers arrays
$TBS->MergeBlock('blk2',$results2);
$TBS->MergeField('formdata',$_POST);
$TBS->MergeField('getdata',$_GET);
$TBS->MergeField('quick_stats',$quick_stats); //basic home page stats
$TBS->MergeField('config',$config);
$TBS->MergeField('lang',$lang);
$TBS->Render = TBS_OUTPUT;
$TBS->Show();
@mysql_close();

?>