Esempio n. 1
0
function reportUser($userID, $reporterID, $reason)
{
    $user = getUserForID($userID);
    if (!$user) {
        return returnResponse(0, "Failed to report, user not found.", $result);
    }
    $username = $user['username'];
    $fullName = $user['fullName'];
    $emailAdd = $user['emailAddress'];
    $result = dbResultFromQuery("INSERT INTO reported_users (user_id, username, fullName, emailAddress, reporter_id, reportReason) VALUES ('{$userID}', '{$username}', '{$fullName}', '{$emailAdd}', '{$reporterID}', '{$reason}');");
    if ($result) {
        return returnResponse(1, "User reported, thank you for keeping the community clean.");
    } else {
        return returnResponse(0, "Failed to report, please try again.");
    }
}
Esempio n. 2
0
                </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">
                        <header>
                            <h2 class="entry-title"><a href="' . $postURL . '" rel="bookmark">' . $post['title'] . '</a></h2>
                        </header>
                        <footer class="post-info">
                            <abbr class="published">' . $timestamp . '</abbr>
                            <address class="vcard author">by <a class="url fn" href="' . $userURL . '">' . $authorName . '</a></address>
                        </footer>' . $postImage . '<div class="entry-content"><p>' . $postBody . '</p></div>
                    </article>
                </section>
                ';
Esempio n. 3
0
        }
        $imagePath = $imagesDir . $imageName;
        $uploaded = move_uploaded_file($imageTempDir, $imagePath);
        if ($uploaded) {
            $imageURL = $imagePath;
            $submittingDetails['profileImage'] = $imageURL;
            squareImageAtPath($imagePath, $imagePath, 200);
        }
    }
    if (isValidEmail($_POST['emailAddress'])) {
        updateUserForID($myUserID, $submittingDetails);
    } else {
        $errorMsg = "<b>* Invalid email address</b><br><br>";
    }
}
$user = getUserForID($myUserID);
$profilePicURL = $user['profileImage'] ? $user['profileImage'] : NULL;
$profilePic = file_exists($profilePicURL) ? $profilePicURL : "images/default.png";
$fullName = $user['fullName'] ? $user['fullName'] : "No name set";
$username = $user['username'] ? $user['username'] : "******";
$emailAdd = $user['emailAddress'] ? $user['emailAddress'] : "No email address set";
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Account Settings</title>
        <meta charset="utf-8" />
        <link rel="stylesheet" href="css/main.css" type="text/css" />

        <!--[if IE]>
          <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
Esempio n. 4
0
$commentID = isset($_GET['commentID']) ? $_GET['commentID'] : 0;
$postID = isset($_GET['postID']) ? $_GET['postID'] : 0;
$responseMsg = NULL;
$reportingMsg = "<p>Cannot report user/comment at this moment.</p>";
$reporting = NULL;
if ($commentID && $postID) {
    // Reporting comment
    $reporting = "comment";
    $user = getUserForID($id);
    $url = 'post.php?id=' . $postID . '#' . $commentID;
    $reportingMsg = '<p>Reporting comment <a href="' . $url . '">' . $commentID . '</a></p>';
} else {
    if ($userID && !$commentID) {
        // Reporting user
        $reporting = "user";
        $user = getUserForID($id);
        $url = 'user.php?id=' . $id;
        $reportingMsg = '<p>Reporting user <a href="' . $url . '">' . $user['username'] . '</a></p>';
    }
}
if ($submitted) {
    if ($reason) {
        if ($reporting === "user") {
            // Insert user report to db
            $reported = reportUser($userID, $myUserID, $reason);
            if ($reported['success']) {
                header("Location:user.php?id={$userID}");
            } else {
                $responseMsg = $reported['response'] . "<br><br>";
            }
        } else {