<?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 64 2016-07-30 14:01:18Z along $
#
#	Copyright (C) 2008-2016 PHPDisk Team. All Rights Reserved.
#
*/
include "includes/commons.inc.php";

$in_front = true;

if($settings[index_login]==2 && $settings[open_public_file] && $auth[open_public_file]){
	redirect(urr("public",""),'',0);
	exit;
}elseif($settings[index_login]==1){
	redirect(urr("account","action=login"),'',0);
	exit;
}
$title = $settings['site_title'];
include PHPDISK_ROOT."./includes/header.inc.php";

if($settings[show_friend_link]){
	$C[links_arr] = get_friend_link();
}

require_once template_echo('phpdisk',$user_tpl_dir);

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

function get_friend_link(){
	global $db,$tpf;
	$q = $db->query("select * from {$tpf}links where is_hidden=0 order by logo desc,show_order asc,linkid desc");
	$arr = array();
	while($rs = $db->fetch_array($q)){
		$rs['has_logo'] = $rs['logo'] ? 1 : 0;
		$arr[] = $rs;
	}
	$db->free($q);
	unset($rs);
	return $arr;
}

?>