OSDN Git Service

bfa7941437b5efdbaa9af1c04baf4c95a4dcdcc5
[embrj/master.git] / ajax / updateList.php
1 <?php
2         if(!isset($_SESSION)){
3                 session_start();
4         }
5         include ('../lib/twitese.php');
6         $t = getTwitter();
7         if ( isset($_GET['since_id']) && isset($_GET['id'])) {
8
9                 $statuses = $t->listStatus($_GET['id'], false, $_GET['since_id']);
10
11                 $empty = count($statuses) == 0? true: false;
12
13                 if ($empty) {
14                         echo "empty";
15                 } else {
16                         $count = 0;
17                         foreach ($statuses as $status) {
18                                 
19                                 $user = $status->user;
20                                 $date = $status->created_at;
21                                 $text = formatEntities($status->entities,$status->text);
22
23                                 if(strpos("@$t->username", $text) > -1) {
24                                         if (++$count == count($statuses)) 
25                                                 $output = "<li style=\"background-color:#E8FECD;border-bottom:5px solid #CCC\">";
26                                         else 
27                                                 $output = "<li style=\"background-color:#E8FECD\">";
28                                 }       else {
29                                         $output = "<li>";
30                                 }
31                                 $output .= "<span class=\"status_author\">
32                                         <a href=\"user.php?id=$user->screen_name\" target=\"_blank\"><img src=\"".getAvatar($user->profile_image_url)."\" title=\"$user->screen_name\" /></a>
33                                         </span>
34                                         <span class=\"status_body\">
35                                         <span class=\"status_id\">$status->id_str </span>
36                                         <span class=\"status_word\"><a class=\"user_name\" href=\"user.php?id=$user->screen_name\">$user->screen_name</a><span class=\"tweet\"> $text </span></span>
37                                         <span class=\"actions\">
38                                         <a class=\"replie_btn\" title=\"Reply\" href=\"a_reply.php?id=$status->id_str\">Reply</a>
39                                         <a class=\"rt_btn\" title=\"Retweet\" href=\"a_rt.php?id=$status->id_str\">RT</a>
40                                         <a class=\"favor_btn\" title=\"Favorite\" href=\"a_favor.php?id=$status->id_str\">Favor</a>";
41                                 if ($user->screen_name == $t->username) $output .= "<a class=\"delete_btn\" title=\"Delete\" href=\"a_del.php?id=$status->id_str&t=s\">删除</a>";
42                                 $output .= "</span><span class=\"status_info\">";
43                                 if ($status->in_reply_to_status_id_str) $output .= "<span class=\"in_reply_to\"> <a class=\"ajax_reply\" href=\"ajax/status.php?id=$status->in_reply_to_status_id_str&uid=$user->id \">in reply to $status->in_reply_to_screen_name</a></span>";
44                                 $output .= "<span class=\"source\">via $status->source</span>
45                                         <span class=\"date\"><a href=\"status.php?id=$status->id_str\" target=\"_blank\">$date</a></span>
46                                         </span>
47                                         </span>
48                                         </li>";
49                                 $html .= '<div class="new"></div>';
50                                 echo $output;
51                                 */
52                         }
53                 }
54
55         } else {
56                 echo 'error';
57         }
58
59 ?>