コード例 #1
0
ファイル: retwis.php プロジェクト: raphaelcm/Retwis-w-Predis
function showPost($id)
{
    $r = redisLink();
    $postdata = $r->get("post:{$id}");
    if (!$postdata) {
        return false;
    }
    $aux = explode("|", $postdata);
    $id = $aux[0];
    $time = $aux[1];
    $username = $r->get("uid:{$id}:username");
    $post = join(array_splice($aux, 2, count($aux) - 2), "|");
    $elapsed = strElapsed($time);
    $userlink = "<a class=\"username\" href=\"profile.php?u=" . urlencode($username) . "\">" . utf8entities($username) . "</a>";
    echo '<div class="post">' . $userlink . ' ' . utf8entities($post) . "<br>";
    echo '<i>posted ' . $elapsed . ' ago via web</i></div>';
    return true;
}
コード例 #2
0
function showPost($id) {
    $r = redisLink();
    $post = $r->hgetall("post:$id");
    if (empty($post)) return false;

    $userid = $post['user_id'];
    $username = $r->hget("user:$userid","username");
    $elapsed = strElapsed($post['time']);
    $userlink = "<a class=\"username\" href=\"profile.php?u=".urlencode($username)."\">".utf8entities($username)."</a>";

    echo('<div class="post">'.$userlink.' '.utf8entities($post['body'])."<br>");
    echo('<i>posted '.$elapsed.' ago via web</i></div>');
    return true;
}