OSDN Git Service

embrj
[embrj/master.git] / retweets.php
1 <?php
2         include_once('lib/twitese.php');
3         $title = "Retweets";
4         include_once('inc/header.php');
5         include_once('lib/timeline_format.php');
6         if (!loginStatus()) header('location: login.php');
7
8         $count = isset($_GET['count']) ? $_GET['count'] : 20;
9         $since_id = isset($_GET['since_id']) ? $_GET['since_id'] : false;
10         $max_id = isset($_GET['max_id']) ? $_GET['max_id'] : false;
11
12         $t = getTwitter();
13
14         $retweets = $t->retweets_of_me($count, $since_id, $max_id);
15
16         echo '<div id="statuses" class="column round-left">';
17         include_once('inc/sentForm.php');
18         $html = '<script src="js/btns.js"></script>
19         <style>
20         .big-retweet-icon{display:none}
21         </style>';
22         $html .='<div class="clear"></div>';
23         $empty = count($retweets) == 0? true: false;
24         if ($empty) {
25                 $html .= "<div id=\"empty\">No retweet to display.</div>";
26         } else if ($t->http_code == 429) {
27                 $html .= "<div id=\"empty\">API quota is used out, please wait for a moment before next refresh.</div>";
28         } else {
29                 $html .= '<ol class="timeline" id="allTimeline">';
30                 $firstid = false;
31                 $lastid = false;
32                 foreach($retweets as $retweet){
33                         if (!$firstid) $firstid = $retweet->id_str;
34                         $lastid = $retweet->id_str;
35                         $html .= format_retweet_of_me($retweet);
36                 }
37                 $lastid = bcsub($lastid, "1");
38                 $html .= '</ol><div id="pagination">';
39                         $html .= "<a id=\"less\" class=\"round more\" style=\"float: left;\" href=\"retweets.php?since_id={$firstid}\">Back</a>";
40                         $html .= "<a id=\"more\" class=\"round more\" style=\"float: right;\" href=\"retweets.php?max_id={$lastid}\">Next</a>";
41                 $html .= "</div>";
42         }
43         echo $html;
44         include_once('inc/sidebar.php');
45         include_once('inc/footer.php');
46 ?>