<?php
class main extends MySQL{
    //var $db; // Здесь объект для работы с MySQL
    var $id;
    private $settings;
/* ------------------------------------------------------------------------------------------------------------------------- */
    function __construct($smarty, $settings){
        @mkdir (MYDIR . '/img/avatars', 0700);
        /* Создаем каталог под файлы раздела и определяемся с кэшем */
        if( $settings['cachePage'] > 0 ){
            if( !@$_SESSION['user_id'] ) { /* если не авторизован - кешируем на часок */
                $smarty -> caching = true;
                $smarty -> cache_lifetime = $settings['cachePage'];
            }
        }
        $this -> settings = $settings;
    }
/* ------------------------------------------------------------------------------------------------------------------------- */
    function user_info($id) { /* Получаем инормацию об авторе */
        //$db=$this->db;
        $a['id']=$id;
        return $this -> get_massiv('users', $a, '', 1);
    }
/* ------------------------------------------------------------------------------------------------------------------------- */
    function get_albums($id){/* Берем альбомы пользователя */
        $a['user_id']=$id;
        $a['public']=1;
        return $this -> get_massiv('foto_albums', $a);
    }

/* ------------------------------------------------------------------------------------------------------------------------- */
function get_best_foto($id, $limit){/* Берем самые лайкнутые фото пользователя */
    $a['user_id']=$id;
    $a['public']=1;
    $this -> or_by_desc = 1;
    return $this -> get_massiv('foto_img', $a, 'reyt', $limit);
    unset($this -> or_by_desc);
}
/* ------------------------------------------------------------------------------------------------------------------------- */

/* ------------------------------------------------------------------------------------------------------------------------- */
}
/*
$('#myModal').modal('toggle');
$('#myModal').modal('show');
$('#myModal').modal('hide');
*/
?>