Changeset 20301 for events

Show
Ignore:
Timestamp:
09/30/08 20:14:23 (2 months ago)
Author:
kenji
Message:

Add link to @username

Location:
events/phpframework/codeigniter/trunk/system/application
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/codeigniter/trunk/system/application/controllers/home.php

    r20283 r20301  
    1111                        redirect('login'); 
    1212                } 
    13                 //$this->output->enable_profiler(TRUE); 
     13                $this->output->enable_profiler(TRUE); 
    1414        } 
    1515 
  • events/phpframework/codeigniter/trunk/system/application/models/status_model.php

    r20283 r20301  
    3434                $this->db->where('username', $username); 
    3535                $query = $this->db->get('users'); 
    36                 $row = $query->row(); 
    37                 return $row->id; 
     36 
     37                if ($query->num_rows() > 0) 
     38                { 
     39                        $row = $query->row(); 
     40                        return $row->id; 
     41                } 
     42                else 
     43                { 
     44                        return FALSE; 
     45                } 
    3846        } 
    3947 
     
    111119                } 
    112120 
    113                 $this->db->select('SQL_CALC_FOUND_ROWS statuses.id, username, comment, UNIX_TIMESTAMP(statuses.created_at) AS created_at, image'); 
     121                $this->db->select('SQL_CALC_FOUND_ROWS statuses.id, u1.username AS username, comment, u2.username AS reply_username, UNIX_TIMESTAMP(statuses.created_at) AS created_at, u1.image AS image'); 
    114122                $this->db->from('statuses'); 
    115                 $this->db->join('users', 'statuses.user_id = users.id', 'left'); 
     123                $this->db->join('users AS u1', 'statuses.user_id = u1.id', 'left'); 
     124                $this->db->join('users AS u2', 'statuses.reply_user_id = u2.id', 'left'); 
    116125                $this->db->where_in('statuses.user_id', $ids); 
    117126                $this->db->order_by('created_at', 'DESC'); 
  • events/phpframework/codeigniter/trunk/system/application/views/home/main.php

    r20297 r20301  
    3434                                <p class="murmur"> 
    3535                                <?=anchor(site_url('user/index/' . $row->username), $row->username)?> 
    36                                 <?=h($row->comment)?> 
     36                                <?php  
     37                                        $row->comment = h($row->comment); 
     38                                        if ($row->reply_username) { 
     39                                                $row->comment = preg_replace('/^@(\w+)\s/', '@' . anchor(site_url('user/index/' . $row->reply_username), $row->reply_username) . ' ', $row->comment); 
     40                                        } 
     41                                ?> 
     42                                <?=$row->comment?> 
    3743                                <?=anchor(site_url('user/statuses/' . $row->username . '/' . $row->id), posted_time($row->created_at))?> 
    3844                                </p>