<?php
/**************************************************************************************************
|
| iDocScript - Document Sharing Script
| http://www.idocscript.com
| webmaster@idocscript.com
|
|**************************************************************************************************
|
| By using this software you agree that you have read and acknowledged our End-User License 
| Agreement available at http://www.idocscript.com/eula.html and to be bound by it.
|
| Copyright (c) 2011 iDocScript.com. All rights reserved.
|**************************************************************************************************/
include("include/config.php");
include("include/functions/import.php");
$mainmenu = "0";
STemplate::assign('mainmenu',$mainmenu);

//POPULAR DOCS
$max_pop_home = $config['max_pop_home'];
$query="SELECT DID,title FROM docs WHERE public='1' AND active='1' ORDER BY viewcount desc limit $max_pop_home";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$pdocs = $executequery->getrows();
STemplate::assign('pdocs',$pdocs);
//POPULAR DOCS

//NEW DOCS
$max_nd_home = $config['max_nd_home'];
$query="SELECT DID,title FROM docs WHERE public='1' AND active='1' ORDER BY DID desc limit $max_nd_home";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$ndocs = $executequery->getrows();
STemplate::assign('ndocs',$ndocs);
//NEW DOCS

//FEATURED CATS
$max_feat_home = $config['max_feat_home'];
$query="SELECT * FROM categories_docs WHERE featured='1' ORDER BY rand() limit $max_feat_home";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$fcats = $executequery->getrows();
STemplate::assign('fcats',$fcats);
//FEATURED CATS

//COMMENTS
$max_rc = $config['max_rc'];
$query="SELECT A.*,B.username,B.USERID,C.title FROM docs_comments A, members B, docs C WHERE B.status='1' AND A.USERID=B.USERID AND C.public='1' AND C.active='1' AND C.DID=A.DID ORDER BY A.CID desc limit $max_rc";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$c = $executequery->getrows();
STemplate::assign('c',$c);
//COMMENTS

$pagetitle = $lang['173'];
STemplate::assign('pagetitle',$pagetitle);

//TEMPLATES BEGIN
STemplate::display('header.tpl');
STemplate::display('home.tpl');
STemplate::display('footer.tpl');
//TEMPLATES END
?>