Просмотр файла modules/share/new_files.php

Размер файла: 1.64Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate	= 'in_share';
$title = $lang->word('new_files').' | '.$lang->word('share');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('new_files').' | '.$lang->word('share'));
$files_r = $db->query("SELECT * FROM `share_files` WHERE `time` > '". (time()-60*60*24) ."'")->rowCount();
$pages = new Paginator($files_r, $ames);
if($files_r == 0) {
	echo $tpl->div('menu', $lang->word('no_files'));
} 
else {
		$files_q = $db->query("SELECT * FROM `share_files` WHERE `time` > '". (time()-60*60*24) ."' ORDER BY time DESC LIMIT $start, $ames");
		while($files = $files_q->fetch()) {
			echo '<div class="menu">
				'.(preg_match('/jpeg|jpg|gif|png|bmp/i', $files['ext']) ? img('image.png') : NULL).'
				'.(preg_match('/jar|sis|sisx|jad|apk/i', $files['ext']) ? img('application.png') : NULL).'
				'.(preg_match('/mp4|3gp|avi|flv/i', $files['ext']) ? img('video.png') : NULL).'
				'.(preg_match('/mp3|aac|amr|wav|midi|mid/i', $files['ext']) ? img('music.png') : NULL).'
				'.(preg_match('/zip|rar|tar.gz|7z/i', $files['ext']) ? img('box.png') : NULL).'
				 <a href="/share/file/'. $files['id'] .'/">'. $files['name'] .'</a> ('.strtoupper($files['ext']).')<br/>
				 '. mb_substr($files['text'], 0, 60).'...
				</div>';
		}
	$pages->view('/share/new_files/?');
}
$tpl->div('block', NAV . ' <a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>