OSDN Git Service

embrj
[embrj/master.git] / profile.php
1 <?php
2         include ('lib/twitese.php');
3         $title = "Profile";
4         include ('inc/header.php');
5         
6         if (!loginStatus()) header('location: login.php');
7 ?>
8
9 <script src="js/btns.js"></script>
10
11 <div id="statuses" class="column round-left">
12
13         <?php include('inc/sentForm.php');
14                 $t = getTwitter();
15                 $since_id = isset($_GET['since_id']) ? $_GET['since_id'] : false;
16                 $max_id = isset($_GET['max_id']) ? $_GET['max_id'] : false;
17         
18                 $statuses = $t->userTimeline(false, $since_id, $max_id);
19                 if ($statuses === false) {
20                         header('location: error.php');exit();
21                 } 
22                 $empty = count($statuses) == 0? true: false;
23                 if ($empty) {
24                         echo "<div id=\"empty\">No tweet to display.</div>";
25                 } else if ($t->http_code == 429) {
26                         echo "<div id=\"empty\">API quota is used out, please wait for a moment before next refresh.</div>";
27                 } else {
28                         include_once('lib/timeline_format.php');
29                         $output = '<ol class="timeline" id="allTimeline">';
30
31                         $firstid = false;
32                         $lastid = false;
33                         foreach ($statuses as $status) {
34                                 if (isset($status->retweeted_status)) {
35                                         $output .= format_retweet($status,true);
36                                 } else { 
37                                         $output .= format_timeline($status,$t->username);
38                                 }
39                                 if(!$firstid)
40                                         $firstid = $status->id_str;
41                                 $lastid = $status->id_str;
42                         }
43                         $lastid = bcsub($lastid, "1");
44
45                         $output .= "</ol><div id=\"pagination\">";
46
47                         $output .= "<a id=\"less\" class=\"round more\" style=\"float: left;\" href=\"profile.php?since_id={$firstid}\">Back</a>";
48                         $output .= "<a id=\"more\" class=\"round more\" style=\"float: right;\" href=\"profile.php?max_id={$lastid}\">Next</a>";
49
50                         $output .= "</div>";
51
52                         echo $output;
53                 }
54
55
56
57 ?>
58 </div>
59
60 <?php 
61                 include ('inc/sidebar.php');
62                 include ('inc/footer.php');
63 ?>