<?php 
/**
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: index.php 14 2011-09-27 09:16:19Z along $
#
#	Copyright (C) 2008-2011 PHPDisk Team. All Rights Reserved.
#
*/

include "includes/commons.inc.php";

$in_front = true;

lang('index');

$title = $settings['site_title'];
include PHPDISK_ROOT."./includes/header.inc.php";

function index_last(){
	global $db,$tpf;
	$rs = $db->fetch_one_array("select userid,username from {$tpf}users order by userid desc limit 1");
	$rs['username_all'] = $rs['username'];
	$arr['username'] = cutstr($rs['username'],18);
	$arr['a_last_user'] = urr("space","username=".rawurlencode($rs['username_all']));
	return $arr;
}
function index_stats($pd_uid){
	global $db,$tpf;
	$stats['total_folders'] = (int)@$db->result_first("select count(*) from {$tpf}folders where userid='$pd_uid' and in_recycle=0");
	$stats['total_share_files'] = @$db->result_first("select count(*) from {$tpf}files where userid='$pd_uid' and in_share=1 and in_recycle=0");
	$stats['total_files'] = (int)@$db->result_first("select count(*) from {$tpf}files where userid='$pd_uid' and in_recycle=0");
	$stats['file_size_total'] = get_size(@$db->result_first("select sum(file_size) from {$tpf}files where userid='$pd_uid' and in_recycle=0"));
	$stats['last_login_ip'] = @$db->result_first("select last_login_ip from {$tpf}users where userid='$pd_uid'");
	return $stats;
}

if($pd_uid){
	$mystats = super_cache('user','index_stats|'.$pd_uid,1,0,$pd_uid,$settings['cache_time']);
	$myinfo = super_cache('user','my_disk_info|'.$pd_uid,1,0,$pd_uid,$settings['cache_time']);
}
$last = super_cache('user','index_last',1,0);


require_once template_echo('phpdisk',$user_tpl_dir);

include PHPDISK_ROOT."./includes/footer.inc.php";

?>