OSDN Git Service

embrj
[embrj/master.git] / inc / sidebar.php
1 <td class="column round-right" id="side_base">
2 <table>
3 <tr>
4 <td>
5 <div id="side" class="round-right">
6         <div id="sideinfo">
7                 <a href="profile.php"><img id="sideimg" src="<?php echo getCookie("imgurl")?>" /></a>
8                 <span id="sideid"><span id="side_name"><?php echo getEncryptCookie('twitese_name')?></span><a href="#" id="profileRefresh" title="refresh your profile"><i></i></a></span>
9                 <a href="profile.php"><span id="me_tweets"><span id="update_count"><?php echo getCookie('statuses_count')?></span> tweets</span></a>
10         </div>
11         <?php if (strrpos($_SERVER['PHP_SELF'], 'profile')) {
12                 $t = getTwitter();
13         $user = $t->showUser();
14         $expanded_url = $user->entities->url->urls[0]->expanded_url ? $user->entities->url->urls[0]->expanded_url : $user->url;
15 ?>
16         <ul id="user_info_profile">
17                 <li><span>Name</span> <?php echo $user->name ?></li>
18                 <?php if ($user->location) echo "<li><span>Location</span> $user->location</li>"; ?>
19                 <?php if (($expanded_url) and (strlen($expanded_url)>20)) echo '<li><span>Web</span> <a href="' .$expanded_url. '" target="_blank">' .substr($expanded_url, 0, 20). '...</a></li>'; else if (($expanded_url) and (strlen($expanded_url)<=20)) echo '<li><span>Web</span> <a href="' .$expanded_url. '" target="_blank">' .$expanded_url. '</a></li>';?>
20                 <?php if ($user->description) echo "<li><span>Bio</span> ".formatText($user->description)."</li>"; ?>
21                 </ul>
22         <?php }?>
23         <ul id="user_stats">
24                 <li>
25                         <a href="friends.php">
26                                 <span class="count"><?php echo getCookie('friends_count')?></span>
27                                 <span class="label">following</span>
28                         </a>
29                 </li>
30                 <li>
31                         <a href="followers.php">
32                                 <span class="count"><?php echo getCookie('followers_count')?></span>
33                                 <span class="label">followers</span>
34                         </a>
35                 </li>
36                 <li>
37                         <a href="lists.php?t=2">
38                                 <span class="count"><?php $listed_count = getCookie('listed_count'); echo ($listed_count > 0 ? $listed_count : 0);?></span>
39                                 <span class="label">listed</span>
40                         </a>
41                 </li>
42         </ul>
43         
44                 <li>
45                 <DIV id='profile' class='section'> 
46                 <p id="sidebarTip" class='promotion round'> 
47         <?php
48         $preset = array(
49                 array(
50                         'term' => 'Short&middot;cuts',
51                         'def' => '<em>n.</em> Use shortcuts in Embr.',
52                         'more' => '<strong>Shortcuts available now:</strong><br>
53                         C / U - Update<br>
54                         T - Go to top<br>
55                         B - Go to bottom<br>
56                         R - Refresh<br>
57                         S - Search'
58                 ),
59                 array(
60                         'term' => 'User Di&middot;rect View',
61                         'def' => '<em>n.</em> Now you can view the user page of your interested more incentively.',
62                         'more' => 'take @'.SITE_OWNER.' for example, you can visit his/her page via '.BASE_URL.'/'.SITE_OWNER,
63                 ),
64                 array(
65                         'term' => 'Realtime Refresh',
66                         'def' => '<em>v.</em> Now you can refresh your profile whenever you like!',
67                         'more' => 'See the circle behind your username? Try to click it!'
68                 ),
69                 array(
70                         'term' => 'Custom&middot;Tips',
71                         'def' => '<em>n.</em> Hate embr tips so much? Now you can edit me into your own tips!',
72                         'more' => 'Your tips will be encrypted in your cookies all for your privacy!'
73                 ),
74         );
75                 if(isset($_COOKIE['Tip_Title']) || isset($_COOKIE['Tip_Content']) || isset($_COOKIE['Tip_More'])){
76                         $raw = array(
77                                 'term' => getEncryptCookie('Tip_Title'),
78                                 'def' => getEncryptCookie('Tip_Content'),
79                                 'more' => getEncryptCookie('Tip_More'),
80                         );
81                         initSidebarTip($raw);
82                 } else {
83                         initSidebarTip($preset[3]);
84                 }
85         ?>
86                 </p>
87                 </DIV>
88                 </li>
89                 
90         <div class="clear"></div>
91         <ul id="primary_nav" class="sidebar-menu">
92         <li id="updates_tab"><a class="in-page-link" href="all.php"><span>Updates</span></a></li>
93         <li id="replies_tab"><a class="in-page-link" href="replies.php"><span>@<?php echo is_null(getEncryptCookie('twitese_name')) ? $t->screen_name : getEncryptCookie('twitese_name'); ?></span></a></li>
94         <li id="msgs_tab"><a class="in-page-link" href="message.php"><span>Direct Messages</span></a></li>
95         <li id="lists_tab"><a class="in-page-link" href="lists.php"><span>Lists</span></a></li>
96         <li id="favs_tab"><a class="in-page-link" href="favor.php"><span>Favorites</span></a></li>
97         <li id="retweets_tab"><a class="in-page-link" href="retweets.php"><span>Retweets</span></a></li>
98         </ul>
99         <?php include ('sidepost.php') ?>
100 </div>
101 </td>
102 </tr>
103 </table>
104 <?php
105         function initSidebarTip($entity){
106                 echo '<a class="definition"><strong contenteditable="true">'.$entity['term'].'</strong><span contenteditable="true">'.$entity['def'].'</span></a><br><br><span>Click for more details.<span id="indicator">[+]</span></span><span id="sidebarTip_more"><span contenteditable="true">'.$entity['more'].'</span><br><br><a href="#" id="tip_reset" title="You will lose all customized Tips!">Reset to default</a></span>';
107         }
108 ?>