2 include ('lib/twitese.php');
\r
4 include ('inc/header.php');
\r
6 if (!loginStatus()) header('location: login.php');
\r
9 <script type="text/javascript" src="js/lists.js"></script>
\r
15 if ( isset($_POST['list_name']) ) {
\r
16 if ($_POST['is_edit'] == 0) {
\r
17 if (trim($_POST['list_name']) == '') {
\r
18 echo "<div id=\"otherTip\">创建推群失败,推群名不能为空</div>";
\r
20 $isProtect = isset($_POST['list_protect']) ? true : false;
\r
21 $result = $t->createList($_POST['list_name'], $_POST['list_description'], $isProtect);
\r
23 echo "<div id=\"otherTip\">创建推群成功</div>";
\r
25 echo "<div id=\"otherTip\">创建推群失败,请重试</div>";
\r
29 if (trim($_POST['list_name']) == '') {
\r
30 echo "<div id=\"otherTip\">修改推群失败,推群名不能为空</div>";
\r
32 $isProtect = isset($_POST['list_protect']) ? true : false;
\r
33 $result = $t->editList($_POST['pre_list_name'], $_POST['list_name'], $_POST['list_description'], $isProtect);
\r
35 echo "<div id=\"otherTip\">修改推群成功</div>";
\r
37 echo "<div id=\"otherTip\">修改推群失败,请重试</div>";
\r
43 if ( isset($_POST['list_members']) ) {
\r
44 if (trim($_POST['list_members']) == '') {
\r
45 echo "<div id=\"otherTip\">添加成员失败,成员列表不能为空</div>";
\r
47 $listId = $_POST['member_list_name'];
\r
48 $memberList = explode(",", $_POST['list_members']);
\r
52 foreach ($memberList as $member) {
\r
53 $result = $t->addListMember($listId, $member);
\r
54 if (!isset($result->error) && isset($result->user)) $count ++;
\r
55 else $failList .= $member . " ";
\r
59 if ($count == count($memberList))
\r
60 echo "<div id=\"otherTip\">成功添加 $count 个成员</div>";
\r
62 echo "<div id=\"otherTip\">成功添加 $count 个成员,失败名单:$failList </div>";
\r
64 echo "<div id=\"otherTip\">添加成员失败,请重试</div>";
\r
71 if (isset($_GET['id'])) {
\r
77 $type = isset($_GET['t'])? $_GET['t'] : 1;
\r
78 $c = isset($_GET['c'])? $_GET['c'] : -1;
\r
81 $lists = $t->followedLists($id, $c);
\r
82 $nextlist = $lists->next_cursor;
\r
83 $prelist = $lists->previous_cursor;
\r
84 $lists = $lists->lists;
\r
87 $lists = $t->createdLists($id);
\r
88 $lists = $lists->lists;
\r
91 $lists = $t->beAddedLists($id, $c);
\r
92 $nextlist = $lists->next_cursor;
\r
93 $prelist = $lists->previous_cursor;
\r
94 $lists = $lists->lists;
\r
100 if ($lists === false) {
\r
101 header('location: error.php');
\r
107 <?php if ($isSelf) { ?>
\r
108 <?php if ($type == 0) {?>
\r
109 <span class="subnavNormal">Lists you follow</span><span class="subnavLink"><a href="lists.php?t=1">Lists you created</a></span><span class="subnavLink"><a href="lists.php?t=2">Lists following you</a></span>
\r
110 <?php } else if ($type == 1) {?>
\r
111 <span class="subnavLink"><a href="lists.php?t=0">Lists you follow</a></span><span class="subnavNormal">Lists you created</span><span class="subnavLink"><a href="lists.php?t=2">Lists following you</a></span>
\r
113 <span class="subnavLink"><a href="lists.php?t=0">Lists you follow</a></span><span class="subnavLink"><a href="lists.php?t=1">Lists you created</a></span><span class="subnavNormal">Lists following you</span>
\r
116 <?php if ($type == 0) {?>
\r
117 <span class="subnavNormal">Following Lists</span><span class="subnavLink"><a href="lists.php?id=<?php echo $id?>&t=1">Created Lists</a></span><span class="subnavLink"><a href="lists.php?id=<?php echo $id?>&t=2">Lists Following</a></span>
\r
118 <?php } else if ($type == 1) {?>
\r
119 <span class="subnavLink"><a href="lists.php?t=0&id=<?php echo $id?>">Following Lists</a></span><span class="subnavNormal">Created Lists</span><span class="subnavLink"><a href="lists.php?id=<?php echo $id?>&t=2">Lists Following</a></span>
\r
121 <span class="subnavLink"><a href="lists.php?t=0&id=<?php echo $id?>">Following Lists</a></span><span class="subnavLink"><a href="lists.php?id=<?php echo $id?>&t=1">Created Lists</a></span><span class="subnavNormal">Lists Following</span>
\r
128 $empty = count($lists->list) == 0? true: false;
\r
130 echo "<div id=\"empty\">No Tweet To Display</div>";
\r
132 $output = '<ol class="rank_list">';
\r
133 foreach ($lists->list as $list) {
\r
135 $listurl = substr($list->uri,1);
\r
136 $user = $list->user;
\r
137 $listname = explode('/',$list->full_name);
\r
138 $mode = $list->mode == 'private' ? "Private" : "";
\r
142 <span class=\"rank_img\"><a href=\"https://twitter.com/$user->screen_name\"><img src=\"".getAvatar($user->profile_image_url)."\" /></a></span>
\r
143 <div class=\"rank_content\">
\r
144 <span class=\"rank_num\"><span class=\"rank_name\"><a href=\"list.php?id=$listurl\"><em>$listname[0]/</em>$listname[1]</a></span></span>
\r
145 <span class=\"rank_count\">Followers:$list->subscriber_count Members:$list->member_count $mode</span>
\r
147 if ($list->description != '') $output .= "<span class=\"rank_description\">简介:$list->description</span>";
\r
148 if ($type == 0) $output .= "<span id=\"list_action\"><a id=\"btn\" href=\"javascript:void()\" class=\"unfollow_list\">Unfollow</a></span>";
\r
149 if ($type == 1 && $isSelf) $output .= "<span id=\"list_action\"><a id=\"btn\" href=\"javascript:void()\" class=\"edit_list\">Edit</a> <a id=\"btn\" href=\"javascript:void()\" class=\"delete_list\">Delete</a> <a id=\"btn\" href=\"javascript:void()\" class=\"add_member\">Add Members</a></span>";
\r
156 $output .= "</ol>";
\r
163 <?php if ($isSelf && $type == 1) {?>
\r
164 <a href="javascript:void()" class="more round" id="list_create_btn" style="margin: 20px auto;">Create a new list</a>
\r
165 <form method="POST" action="./lists.php?t=1" id="list_form">
\r
166 <input type="hidden" name="pre_list_name" value="" id="pre_list_name" />
\r
167 <input type="hidden" name="is_edit" value="0" id="is_edit" />
\r
168 <span><label for="list_name">List name</label><input type="text" name="list_name" id="list_name" /></span>
\r
169 <span><label for="list_description">Description</label><textarea type="text" name="list_description" id="list_description"></textarea></span>
\r
170 <span><label for="list_protect">Private</label><input type="checkbox" name="list_protect" id="list_protect" />
\r
171 <a style="background: transparent url(img/sprite-icons.png) no-repeat scroll -272px -16px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; text-decoration: none; height: 10px; float: right; position: relative; width: 9px; left: 3px; top: -160px;" title="Close" onclick="$('#list_form').slideToggle(300)" href="#"></a>
\r
172 <input type="submit" class="btn" id="list_submit" value="Creat" />
\r
181 <div id="pagination">
\r
183 if ($type == 0 || $type == 2) {
\r
185 if ($prelist != 0) echo "<a id=\"more\" class=\"round more\" style=\"float: left;\" href=\"lists.php?t=$type&c=$prelist\">Back</a>";
\r
186 if ($nextlist != 0) echo "<a id=\"more\" class=\"round more\" style=\"float: right;\" href=\"lists.php?t=$type&c=$nextlist\">Next</a>";
\r
188 if ($prelist != 0) echo "<a id=\"more\" class=\"round more\" style=\"float: left;\" href=\"lists.php?id=$id&t=$type&c=$prelist\">Back</a>";
\r
189 if ($nextlist != 0) echo "<a id=\"more\" class=\"round more\" style=\"float: right;\" href=\"lists.php?id=$id&t=$type&c=$nextlist\">Next</a>";
\r
197 include ('inc/sidebar.php');
\r
201 include ('inc/footer.php');
\r