Show
Ignore:
Timestamp:
10/01/08 07:41:06 (3 months ago)
Author:
anatoo
Message:

メール周り追加

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/plain_php/trunk/model/phwittr/TimelineService.php

    r20036 r20338  
    33class TimelineService 
    44{ 
    5     protected $pdo, $context; 
    6     function __construct(PDO $pdo, ApplicationContext $context) 
     5    protected $pdo, $baseUrl; 
     6    function __construct(PDO $pdo, $base_url) 
    77    { 
    88        $this->pdo = $pdo; 
    9         $this->context = $context; 
     9        $this->baseUrl = $base_url; 
    1010    } 
    1111    function fetchPublicTimeline($offset, $limit) 
     
    5555    { 
    5656        $smt = $this->pdo->prepare(' 
    57             select statuses.* from statuses  
     57            select statuses.*, users.user_name, users.image from statuses  
    5858            left join users on users.id = statuses.user_id where users.id = :user_id  
    5959            order by statuses.created_at desc  
     
    9292            select count(users.id)  
    9393                from statuses left join users on users.id = statuses.user_id 
    94                      left join followers f1 on f1.user_id = users.id 
    95                        
    96                 where users.delete_flag = 0 and f1.follow_id = :user_id 
    97                       or users.id = :user_id'); 
     94                              left join (select * from followers where user_id = :user_id) f1 on f1.follow_id = users.id 
     95                           
     96                where users.delete_flag = 0 and f1.user_id = :user_id 
     97                      or users.id = :user_id '); 
    9898         
    9999        $smt->bindValue(':user_id', $user_id, PDO::PARAM_INT); 
     
    105105            select users.user_name, users.image, statuses.*  
    106106                from statuses left join users on users.id = statuses.user_id 
    107                               left join followers f1 on f1.user_id = users.id 
     107                              left join (select * from followers where user_id = :user_id) f1 on f1.follow_id = users.id 
    108108                           
    109                 where users.delete_flag = 0 and f1.follow_id = :user_id 
     109                where users.delete_flag = 0 and f1.user_id = :user_id 
    110110                      or users.id = :user_id  
    111111                        
     
    138138        $status['comment'] = preg_replace('#(https?://[[:alnum:]+$;?.%,!\#~*/:@&=_-]+)#', '<a href="$1">$1</a>' , h($status['comment'])); 
    139139        $status['comment'] = preg_replace('#@([[:word:]]{1,30})#',  
    140                                 '@<a href="' . $this->context->baseUrl . '/$1">$1</a>',  
     140                                '@<a href="' . $this->baseUrl . '/$1">$1</a>',  
    141141                                $status['comment']); 
    142142        return $status;