Ignore:
Timestamp:
07/02/10 10:31:36 (23 months ago)
Author:
fuze
Message:

Ticket #104

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/fuze/core/classes/user.class.php

    r181 r218  
    404404        } 
    405405 
    406         $sql = "SELECT DISTINCT c.id, c.content, c.target as target, c.target_id as target_id, c.user_id, c.target_link, u.id as user_id, u.nickname as nickname, u.login as login, 
    407                        IF(DATE_FORMAT(c.pubdate, '%d-%m-%Y')=DATE_FORMAT(NOW(), '%d-%m-%Y'), DATE_FORMAT(c.pubdate, '<strong>Cåãîäíÿ</strong> â %H:%i'), 
    408                        IF(DATEDIFF(NOW(), c.pubdate)=1, DATE_FORMAT(c.pubdate, 'Â÷åðà â %H:%i'),DATE_FORMAT(c.pubdate, '%d, %M') ))  as pubdate 
     406        $sql = "SELECT DISTINCT c.id, c.content, c.target as target, c.target_id as target_id, c.user_id, c.target_link, u.id as user_id, u.nickname as nickname, u.login as login, c.pubdate as pubdate 
    409407                FROM cms_comments c, cms_users u 
    410408                WHERE c.user_id = u.id AND ({$friends_sql}) 
     
    421419 
    422420        while ($comment = $inDB->fetch_assoc($result)){ 
    423             $comment['pubdate'] = $inCore->getRusDate($comment['pubdate']); 
     421            $comment['pubdate'] = $inCore->dateFormat($comment['pubdate']); 
    424422            if (sizeof($comment['content'])>50){ 
    425423                $comment['content'] = substr($comment['content'], 0, 50) . '...'; 
     
    466464                                u.nickname as nickname, 
    467465                                u.login as login, 
    468                        IF(DATE_FORMAT(p.pubdate, '%d-%m-%Y')=DATE_FORMAT(NOW(), '%d-%m-%Y'), DATE_FORMAT(p.pubdate, '<strong>Cåãîäíÿ</strong> â %H:%i'), 
    469                        IF(DATEDIFF(NOW(), p.pubdate)=1, DATE_FORMAT(p.pubdate, 'Â÷åðà â %H:%i'),DATE_FORMAT(p.pubdate, '%d, %M') ))  as pubdate 
     466                                        p.pubdate as pubdate 
    470467                FROM cms_blog_posts p, cms_users u, cms_blogs b 
    471468                WHERE p.blog_id = b.id AND p.user_id = u.id AND ({$friends_sql}) 
     
    485482 
    486483        while ($post = $inDB->fetch_assoc($result)){ 
    487             $post['pubdate']    = $inCore->getRusDate($post['pubdate']); 
     484            $post['pubdate']    = $inCore->dateFormat($post['pubdate']); 
    488485            $post['url']        = $model->getPostURL(0, $post['bloglink'], $post['seolink']); 
    489486            $posts[]            = $post; 
     
    518515            if ($id < sizeof($friends)-1){ $friends_sql .= ' OR '; } 
    519516        } 
    520  
    521         $sql = "SELECT DISTINCT p.id, p.title, p.user_id, u.id as user_id, u.nickname as nickname, u.login as login,  
    522                        IF(DATE_FORMAT(p.pubdate, '%d-%m-%Y')=DATE_FORMAT(NOW(), '%d-%m-%Y'), DATE_FORMAT(p.pubdate, '<strong>Cåãîäíÿ</strong> â %H:%i'), 
    523                        IF(DATEDIFF(NOW(), p.pubdate)=1, DATE_FORMAT(p.pubdate, 'Â÷åðà â %H:%i'),DATE_FORMAT(p.pubdate, '%d, %M') ))  as pubdate 
     517                // Ïîëó÷àåì ôîòî èç îáùåé ãàëåðåè 
     518        $sql = "SELECT p.id, p.title, u.nickname as nickname, u.login as login, p.pubdate as pubdate 
    524519                FROM cms_photo_files p, cms_users u 
    525520                WHERE p.user_id = u.id AND ({$friends_sql}) 
     
    530525         
    531526        $result = $inDB->query($sql); 
    532  
    533         $photos = array(); 
    534  
    535         if (!$inDB->num_rows($result)){ return false; } 
     527                //Ïîëó÷àåì ëè÷íûå ôîòîãðàôèè 
     528                $private_sql = "SELECT p.id, p.title, p.user_id, u.nickname as nickname, u.login as login, p.pubdate as pubdate 
     529                                                FROM cms_user_photos p, cms_users u 
     530                                                WHERE p.user_id = u.id AND ({$friends_sql}) 
     531                                                ORDER BY p.pubdate DESC 
     532                                                "; 
     533                if ($limit) { $private_sql .= 'LIMIT '.$limit; } 
     534                $private_res = $inDB->query($private_sql); 
     535                 
     536                $photos = array(); 
     537 
     538        if (!$inDB->num_rows($result) && !$inDB->num_rows($private_res)){ return false; } 
     539                 
     540                if ($inDB->num_rows($private_res)) { 
     541                        while($photo = $inDB->fetch_assoc($private_res)){ 
     542                                $photo['pubdate'] = $inCore->dateFormat($photo['pubdate']); 
     543                                $photos[]       = $photo; 
     544                        } 
     545                } 
    536546 
    537547        while ($photo = $inDB->fetch_assoc($result)){ 
    538             $photo['pubdate'] = $inCore->getRusDate($photo['pubdate']); 
     548            $photo['pubdate'] = $inCore->dateFormat($photo['pubdate']); 
    539549            $photos[] = $photo; 
    540550        } 
    541  
     551                //Âûáèðàåì ïîñëåäíèå $limit ôîòî èç îáùåãî ìàññèâà 
     552                $total      = sizeof($photos); 
     553         
     554                if ($total){ 
     555                        $page_photos    = array(); 
     556                        for($p=0; $p<$limit; $p++){ 
     557                                if ($photos[$p]){ 
     558                                        $page_photos[] = $photos[$p]; 
     559                                } 
     560                        } 
     561                        $photos = $page_photos; unset($page_photos); 
     562                } 
    542563        return $photos; 
    543564         
Note: See TracChangeset for help on using the changeset viewer.