OSDN Git Service

embrj
[embrj/master.git] / ajax / updateMessage.php
1 <?php
2         if(!isset($_SESSION)){
3                 session_start();
4         }
5         include ('../lib/twitese.php');
6         include_once('../lib/timeline_format.php');
7         $t = getTwitter();
8         if ( isset($_GET['since_id']) ) {
9
10                 $messages = $t->directMessages($_GET['since_id']);
11                 $count = count($messages);
12                 if ($count == 0) {
13                         echo "empty";
14                 } else {
15                         $output = '';
16                         foreach ($messages as $message) {
17                                 $output .= format_message($message);
18                         }
19                         $tweetCounter = "<span class=\"tweetcount\">$count</span> unread message(s)";
20                         $output .= '<div class="new">'.$tweetCounter.'</div>';
21                         echo $output;
22                 }
23         } else {
24                 echo 'error';
25         }
26
27 ?>