Вход Регистрация
Файл: adultscript-2.0.3-pro/files/mobile/components/photo_browse.php
Строк: 73
<?php
defined
('_VALID') or die('Restricted Access!');
class 
VComponent_mobile_photo_browse extends VComponent_mobile_photo
{
    public function 
__construct()
    {
        
parent::__construct();
    }
    
    public function 
render()
    {
        
$args       $this->get_query(false1);
        
$order      $args['order'];
        
$timeline   $args['timeline'];
        
$page       $args['page'];

        if (
$order == 'recent' && VUri::request(1) == '') {
            
VF::redirect(MOBILE_URL.'/photo/recent/''301');
        }

        
$url 'photo/'.$order.'/';
        if (
$timeline) {
            
$url .= $timeline.'/';
        }

        if (
$page 1) {
            
$url .= $page.'/';
        }

        if (!
VUri::match($url)) {
              
$this->notfound();
        }

        
$sql        "SELECT a.album_id, a.title, a.slug, a.rating, a.rated_by, a.total_views,
                              a.total_photos, a.add_time, a.type, u.username
                       FROM #__photo_albums AS a
                       LEFT JOIN #__user AS u ON (u.user_id = a.user_id)
                       WHERE a.status = '1'"
;
        
$sql_count  "SELECT COUNT(*) AS total_albums
                       FROM #__photo_albums AS a
                       WHERE a.status = '1'"
;

        
$time_name  '';
        if (
$timeline) {
            switch (
$timeline) {
                case 
'today':
                    
$sql        .= " AND DATE_FORMAT(a.add_date, '%y-%m-%d') = DATE_FORMAT(NOW(), '%y-%m-%d')";
                    
$sql_count  .= " AND DATE_FORMAT(a.add_date, '%y-%m-%d') = DATE_FORMAT(NOW(), '%y-%m-%d')";
                    
$time_name   __('todays').' ';
                    break;
                case 
'yesterday':
                    
$sql        .= " AND DATE_FORMAT(a.add_date, '%y-%m-%d') = DATE_ADD(CURDATE(), INTERVAL -1 DAY)";
                    
$sql_count  .= " AND DATE_FORMAT(a.add_date, '%y-%m-%d') = DATE_ADD(CURDATE(), INTERVAL -1 DAY)";
                    
$time_name   __('yesterdays').' ';
                    break;
                case 
'week':
                    
$time_name   __('this-weeks').' ';
                    break;
                case 
'month':
                    
$sql        .= " AND DATE_FORMAT(a.add_date, '%y-%m') = DATE_FORMAT(NOW(), '%y-%m')";
                    
$sql_count  .= " AND DATE_FORMAT(a.add_date, '%y-%m') = DATE_FORMAT(NOW(), '%y-%m')";
                    
$time_name   __('this-months').' ';
                    break;
                case 
'year':
                    
$sql        .= " AND DATE_FORMAT(a.add_date, '%y') = DATE_FORMAT(NOW(), '%y')";
                    
$sql_count  .= " AND DATE_FORMAT(a.add_date, '%y') = DATE_FORMAT(NOW(), '%y')";
                    
$time_name   __('this-years').' ';
                    break;
            }
        }

        switch (
$order) {
            case 
'recent':
                
$sql        .= ' ORDER BY a.album_id DESC';
                
$order_name  ' '.__('most-recent');
                break;
            case 
'popular':
                
$sql       .= ' ORDER BY a.total_views DESC';
                
$order_name ' '.__('popular');
                break;
            case 
'discussed':
                
$sql        .= ' ORDER BY a.total_comments DESC';
                
$order_name  ' '.__('most-discussed');
                break;
            case 
'rated':
                
$sql       .= ' ORDER BY (a.rating+a.rated_by) DESC';
                
$order_name ' '.__('top-rated');
                break;
            case 
'favorited':
                
$sql       .= ' ORDER BY a.total_favorites DESC';
                
$order_name ' '.__('most-favorites');
                break;
            default:
                
VModule::load('404'TRUE);
        }
        
        
$total_albums   $this->db->get_field($sql_count'total_albums');
        
$pagination     VPagination::get($page$total_albumsVF::cfg_item('module.mobile.albums_per_page'));
        
$sql            $sql' LIMIT '.$pagination['limit'];
        if (!
$albums $this->cache->get($sql3600)) {
            
$albums     $this->db->get_rows($sql);
            
$this->cache->store($sql$albums3600);
        }
        
        
$page_add    = ($page 1) ? ' - '.__('page').' '.$page '';

        
$this->tpl->menu        'photo';

        
$this->tpl->title        __('photos-title', array($time_name.$order_name$page_add));
        
$this->tpl->meta_title    __('photos-meta-title', array($time_name.$order_name$page_add$this->mcfg['site_name']));
        
$this->tpl->meta_desc    __('photos-meta-desc', array($time_name.$order_name$page_add$this->mcfg['meta_desc']));
        
$this->tpl->meta_keys    __('photos-meta-keys', array($this->mcfg['meta_keys']));

        
$this->tpl->canonical    BASE_URL.'/'.$url;

        
$this->tpl->order        $order;
        
$this->tpl->timeline    $timeline;
        
$this->tpl->slug        null;
        
$this->tpl->albums        $albums;
        
$this->tpl->pagination    $pagination;
        
$this->tpl->load(array('header''photo_browse''footer'));
        
$this->tpl->display();
    }
}
Онлайн: 1
Реклама