if ($isBanned) { $banUrl = ' - <a href="banUser.php?ban=0&id=' . $userID . '">Unban User</a>'; } else { $banUrl = ' - <a href="banUser.php?ban=1&id=' . $userID . '">Ban User</a>'; } } $url = '<p>' . $reportUrl . $banUrl . '</p>'; } } } $profilePic = $user['profileImage'] ? $user['profileImage'] : NULL; $profilePic = file_exists($profilePic) ? $profilePic : "images/default.png"; $fullName = $user['fullName'] ? $user['fullName'] : "No name"; $username = $user['username'] ? $user['username'] : "******"; $emailAddress = $user['emailAddress'] ? $user['emailAddress'] : "No email address"; $date = $user['registerDate'] ? wordedTimestamp($user['registerDate'], false) : "Never registered"; $banned = $user['banned'] ? "Banned" : "Good"; ?> <!DOCTYPE html> <html lang="en-US"> <head> <title>Profile</title> <meta charset="utf-8" /> <link rel="stylesheet" href="css/main.css" type="text/css" /> </head> <body id="index" class="home"> <?php echo $htmlNavigation; ?>
<?php echo $htmlNavigation; if (!$posts) { echo ' <section id="content" class="body"> <article class="hentry"> <header> <h2 class="entry-title">No Posts Found!</a></h2> </header> </article> </section> '; } else { // Loop through posts foreach ($posts as $post) { $timestamp = wordedTimestamp($post['timestamp'], true); $postURL = "post.php?id=" . $post['post_id']; $postBody = $post['body']; $postBody = str_replace('<br />', ' ', $postBody); $postImgURL = $post['thumbURL'] ? $post['thumbURL'] : NULL; $postImage = file_exists($postImgURL) ? '<img class="uploaded_image" height="100" width="100" src="' . $postImgURL . '" alt="Post Image">' : NULL; if (strlen($postBody) > 500) { $postBody = substr($postBody, 0, 460); $postBody .= '... <a href="' . $postURL . '">Read more</a>'; } $user = getUserForID($post['user_id']); $userURL = "user.php?id=" . $user['user_id']; $authorName = $user['username']; echo ' <section id="content" class="body"> <article class="hentry">
</article> </section> <section id="comments" class="body"> <header> <h2><?php echo $commentsCount; ?> Comments</h2> </header> <ol id="posts-list" class="hfeed"> <?php foreach ($comments as $comment) { $timestamp = wordedTimestamp($comment['timestamp'], true); $userID = $comment['user_id']; $user = getUserForID($userID); $userURL = "user.php?id={$userID}"; $username = $user['username']; $body = ['comment']; $commentID = $comment['comment_id']; $reportURL = $isLoggedIn ? '<a href="report.php?commentID=' . $commentID . '&postID=' . $postID . '" target="_blank">Report comment</a>' : NULL; $deleteURL = $isAdmin ? ' - <a href="javascript:confirmCommentDelete(\'?id=' . $postID . '&deleteComment=' . $commentID . '\')">Delete comment</a>' : NULL; $urlsDiv = '<div>' . $reportURL . $deleteURL . '</div>'; echo ' <li> <article id="' . $commentID . '" class="hentry"> <footer class="post-info"> <abbr class="published">' . $timestamp . '</abbr> <address class="vcard author">by <a class="url fn" href="' . $userURL . '">' . $username . '</a></address>