function showUserPostsWithPagination($username, $userid, $start, $count, $includeFollowees) { global $_SERVER; $thispage = $_SERVER['PHP_SELF']; $navlink = ""; $next = $start + 10; $prev = $start - 10; $nextlink = $prevlink = false; if ($prev < 0) { $prev = 0; } $u = $username ? "&u=" . urlencode($username) : ""; if (showUserPosts($userid, $start, $count, $includeFollowees)) { $nextlink = "<a href=\"{$thispage}?start={$next}" . $u . "\">Older posts »</a>"; } if ($start > 0) { $prevlink = "<a href=\"{$thispage}?start={$prev}" . $u . "\">« Newer posts</a>" . ($nextlink ? " | " : ""); } if ($nextlink || $prevlink) { echo "<div class=\"rightlink\">{$prevlink} {$nextlink}</div>"; } }
function showUserPostsWithPagination($username,$userid,$start,$count) { global $_SERVER; $thispage = $_SERVER['PHP_SELF']; $navlink = ""; $next = $start+10; $prev = $start-10; $nextlink = $prevlink = false; if ($prev < 0) $prev = 0; $u = $username ? "&u=".urlencode($username) : ""; if (showUserPosts($userid,$start,$count)) $nextlink = "<a href=\"$thispage?start=$next".$u."\">Older posts »</a>"; if ($start > 0) { $prevlink = "<a href=\"$thispage?start=$prev".$u."\">« Newer posts</a>".($nextlink ? " | " : ""); } if ($nextlink || $prevlink) echo("<div class=\"rightlink\">$prevlink $nextlink</div>"); }
<?php include "retwis.php"; include "header.php"; ?> <h2>Timeline</h2> <i>Latest registered users (an example of sorted sets)</i><br> <?php showLastUsers(); ?> <i>Latest 50 messages from users aroud the world!</i><br> <?php showUserPosts(-1, 0, 50); include "footer.php";
<? include("retwis.php"); include("header.php"); ?> <h2>Global Timeline</h2> <i>Latest registered users (an example of SORT command!)</i><br> <? showLastUsers(); ?> <i>Latest 50 messages from users around the world!</i><br> <? showUserPosts(-1,0,50,false); include("footer.php") ?>
?> <form method="POST" action="post.php"> <p>Hey <?php echo $User['username']; ?> , What are you up to?</p> <div> <textarea cols="70" rows="3" name="status"></textarea> <input type="submit" name="doit" value="SayIt" /> </div> </form> <div id="info-box"> <?php echo $r->zcard("followers:" . $User['id']); ?> followers <br /> <?php echo $r->zcard("following:" . $User['id']); ?> following <br /> </div> <? $start = gt("start") === false ? 0 : intval(gt("start")); showUserPosts($User['id'], $start, 100); include("footer.php"); ?>
<? include("saidis.php"); include("header.php"); $r = redisLink(); if(!gt("u") || !($userid = $r->hget("users", gt("u")))) { errorPage("The user " . gt("u") . " you are looking for does not exist"); } echo "<h2 class=\"username\">" . gt('u') . "</h2>"; if (isLoggedIn() && $User['id'] != $userid) { $isFollowing = $r->zscore("following:" . $User['id'], $userid); if (!$isFollowing) { echo("<a href=\"follow.php?uid=$userid&f=1\" class=\"button\">Follow this user</a>"); } else { echo("<a href=\"follow.php?uid=$userid&f=0\" class=\"button\">Stop following</a>"); } } $start = gt("start") === false ? 0 : intval(gt("start")); showUserPosts($userid, $start, 1000); include("footer.php"); ?>