예제 #1
0
function make_comment_from_id($comment_id)
{
    $comment = get_comment_by_id($comment_id);
    $user = find_user_by_id($comment["user_id"]);
    $votes = get_votes_by_comment_id($comment_id);
    $formatted_votes = format_votes($votes);
    $avatar = get_user_avatar($comment["user_id"])["file_path"];
    // bug where time since doesn;'t show, figure it out later (edit, this fixes that)
    $time = format_time_in_words(strtotime($comment["date"]));
    if ($time == "") {
        $time_text = "now";
    } else {
        $time_text = $time . " ago ";
    }
    $output = "<div class=\"row comment_output_panel\" data-comment-id=\"{$comment_id}\">";
    $output .= "<div>";
    $output .= "<img class=\"left\" src=\"" . $avatar . "\"/>";
    $output .= "</div>";
    $output .= "<div class=\"comment_output\">";
    $output .= "<div ><span class=\"comment_output_info_label\">";
    $output .= "<a href=\"user.php?user="******"user_id"] . "\">" . $user["username"] . "</a>";
    $output .= "</span> ";
    $output .= "<span> " . $time_text . " </span></div>";
    $output .= "<div>";
    $output .= $comment["text"];
    $output .= "</div>";
    $output .= "<div class=\"vote_panel\">";
    $output .= "<span class=\"upvote_button  ";
    if (user_logged_in() && already_upvoted($_SESSION["user_id"], $comment_id)) {
        $output .= "upvote_button_clicked";
    }
    $output .= "\">";
    $output .= "<i class=\"fi-like\" ></i> Upvote <span class=\"vote_display_box ";
    if ($votes != "null" && (int) $votes > 0) {
        $output .= " positive_votes ";
    } else {
        if ($votes != "null" && (int) $votes < 0) {
            $output .= " negative_votes ";
        } else {
            if ($votes != "null" && (int) $votes == 0) {
                $output .= " zero_votes ";
            }
        }
    }
    $output .= "\" >" . $formatted_votes . "</span>";
    $output .= "</span>";
    $output .= "<span class=\"downvote_button ";
    if (user_logged_in() && already_downvoted($_SESSION["user_id"], $comment_id)) {
        $output .= "downvote_button_clicked";
    }
    $output .= "\">";
    $output .= "<i class=\"fi-dislike\" >   </i>";
    $output .= "</span>";
    $output .= "</div>";
    $output .= "</div>";
    $output .= "</div>";
    return $output;
}
예제 #2
0
			<h2><?php 
echo $user["username"];
?>
</h2>
			<img src="<?php 
echo get_user_avatar($user["id"])["file_path"];
?>
"
			width="" height="">
			<div>
				<div><span>Member since:</span> <?php 
echo substr($user["activation_date"], 0, 10);
?>
 </div>
				<div><span>Last login:</span> <?php 
echo format_time_in_words(strtotime($user["last_login"])) . " ago";
?>
 </div>
			</div>
		
		</div>
		
		<div class="panel">
			<?php 
if (!$users_profile) {
    echo "<div class=\"text-red-1\"> <a href=\"add_friend.php?user="******"id"] . "\">";
    echo "<i class=\"fi-heart\" id=\"user_add_friend_icon\"></i>";
    echo " Add to Friends";
    echo "</div>";
} else {
    include "user_cp.php";