<?php
/**
 * @package     JohnCMS
 * @link        http://johncms.com
 * @copyright   Copyright (C) 2008-2011 JohnCMS Community
 * @license     LICENSE.txt (see attached file)
 * @version     VERSION.txt (see attached file)
 * @author      http://johncms.com/about
 */

$lng_dl = core::load_lng('downloads');

defined('_IN_JOHNCMS') or die('Error:restricted access');
$textl = $lng_dl['downloads'].' / '.$lng_dl['last_100_files'];
require_once '../incfiles/head.php';
echo '<div class="phdr">
<b>Bo\'limdagi Fayllar</b></div>';
$cat = intval($_GET['cat']);

$cat_inf = mysql_query("SELECT * FROM `downpath` WHERE `id` = '" . $cat . "' LIMIT 1");

if(mysql_num_rows($cat_inf)){
    $cat_inf = mysql_fetch_assoc($cat_inf);
}else{
    $cat_inf = array('way' => '');
}

$totalfile = mysql_result(mysql_query("SELECT COUNT(*) FROM `downfiles`  WHERE `type` != 1 AND `status` = 1 && `way` LIKE '" . $cat_inf['way'] ."%'"), 0);
if($totalfile > 10000){ $totalfile = 10000; }
$zap = mysql_query("SELECT * FROM `downfiles` WHERE `type` != 1 AND `status` = 1 && `way` LIKE '" . $cat_inf['way'] ."%' ORDER BY `time` DESC LIMIT " . $start . "," . $kmess);
while ($zap2 = mysql_fetch_array($zap)) {
echo ($i % 2) ? '<div class="menu">' : '<div class="menu">';
    ++$i;
        $tf = pathinfo($zap2['way'], PATHINFO_EXTENSION); // Тип файла
    	if($tf == 'mp3'){
$set_view = array('variant' => 1);
        }elseif((($tf == 'thm' or $tf == 'nth') && $down_setting['tmini']) || (($tf == '3gp' or $tf == 'mp4' or $tf == 'avi') && $down_setting['vmini']) || ($tf == 'jpg' or $tf == 'png' or $tf == 'jpeg' or $tf == 'gif')){
$set_view = array('link_download' => 1, 'div' => 1);
}else{
$set_view = array('variant' => 1);

        }
        echo f_preview($zap2, $set_view, $tf);
echo '<hr color="#DCDCDC">';
        echo '</div>';
    }


if ($totalfile > $kmess){
    	echo '<div class = "phdr">' . functions::display_pagination('index.php?act=new&amp;cat='.$cat.'&amp;', $start, $totalfile, $kmess) . '';
    	echo '</div><div class="menu"><form action="index.php" method="get"><input type="hidden" name="act" value="new"/><input type="hidden" name="cat" value="'.$cat.'"/><input type="text" name="page" size="2"/><input type="submit" value="'.$lng_dl['to_page'].' &gt;&gt;"/></form></div>';}


