<?php
defined('_IN_JOHNCMS') or die('Restricted access');
class DownFile
{
    public static function getById($id)
    {
        if(is_int($id)) {
            $return_array = array();
            $res = mysql_query("SELECT * FROM `downfiles` WHERE `id` = '".$id."'");
            if($file_array = mysql_fetch_array($res)) {
                $name = explode('||||', $file_array['name']);
                $file_name = DownUtil::translit($name['0']);
                $return_array['FILE_PAGE_URL'] = '/download/'.$file_name.'_'.$id.'.html';
                return array_merge($return_array, $file_array);
            }
        }
        return false;
    }
}