<?php
include_once("postget.php");
include_once("common.php");
$pagetitle = lang('_DOWNLOADS');
moduleaccess(69);

if ($_SESSION['hd_accesslvl']>0) {
	include("head_template.php");
}else{
	include("head_template_guest.php");
}

echo '
<div class="container">
<div class="row">
';

if (!$_SESSION['hd_accesslvl']) {$w = " WHERE onlyclients = '0' ";}else{$w = " ";}

$aclientservices[] = '';

$data = query("SELECT * FROM hd_downloads ".$w."ORDER by position",0);
$now=time()+$config[31][1]*3600;

echo '<table width="98%" class="table table-striped table-hover">';
print("<thead><tr>
	<th>".ucfirst(_TYPE)."</th> 
	<th>".ucfirst(_NAME)."</th> 
	<th>".ucfirst(_DESCRIPTION)."</th> 
	<th>".ucfirst(_DATE)."</th> 
	<th>".ucfirst(_SIZE)."</th> 
	<th>".ucfirst(_DOWNLOAD)."</th>
	</tr>
	</thead><tbody>");

while($row=mysql_fetch_array($data)) {

	$tamanioarchivo = @byteConvert(filesize($config[75][1].'/'.$row[file])) ;
	if ($tamanioarchivo<>'0,00 B' AND $tamanioarchivo<>'0 B') {
		print("<tr><td width='50'>");
		$extension = explode('.',$row[file]) ;
		$extension = array_pop($extension) ;
		if (file_exists("images/fileformats/".$extension.".png")){
			$imagen =  "images/fileformats/".$extension.".png" ;
		}else{
			$imagen =  "images/fileformats/other.png" ;
		}
		print("<img src='".$imagen."' width='50' border='0' title=''>");
		print("</td>");

		print("<td class=sizeplus align='left'><b>".$row[name]."</b></td>");
		print("<td align='left' width='50%'>".$row[description]."</td>");
		print("<td align='center'>".date($df,$row[date])."<br>(");
		print(TimeAgo($row[date],$now));
		print(")</td>");

		print("<td align='center' nowrap>");
		print($tamanioarchivo);
		print("&nbsp;</td>");

		print("<td align='center'>");
		print("<a href='".$serverurl."/dl.php?f=".$row[file]."' class='btn btn-primary'>".strtoupper(_DOWNLOAD)."</a></td>");
		print("</td>");

		print("</tr>");
	}
}


print("</tbody></table>");

echo '
</div>
</div>
';

include("foot_template.php");

?>