Вход Регистрация
Файл: incfiles/classes/DownFile.php
Строк: 41
<?php defined('_IN_JOHNCMS') or die('Restricted access');
/**
 * @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
 */

/**
 * Class DownFile
 *
 * @package JohnCMS
 * @author  Maxim (Simba) Masalov <max@symbos.su>
 */
class DownFile
{

    
/**
     * This method returns file data array by ID
     *
     * @param $id - File id in table downfiles
     * @return array|bool - Array or false if not exists
     */
    
public static function getById($id)
    {
        if(
is_int($id)) {

            
$return_array = array();
            
$res db::query("SELECT * FROM `downfiles` WHERE `id` = '".$id."'");

            if(
$file_array mysqli_fetch_array($res)) {

                
$name explode('||||'$file_array['name']);
                
$file_name DownUtil::translit($name['0']);
                
$return_array['db_name'] = $file_array['name'];
                
$return_array['name'] = $name['0'];
                
$return_array['FILE_PAGE_URL'] = '/download/'.$file_name.'_'.$id.'.html';
                return 
array_merge($file_array$return_array);
            }
        }

        return 
false;
    }

}
Онлайн: 2
Реклама