Upload files to ''
This commit is contained in:
		
							parent
							
								
									435a807499
								
							
						
					
					
						commit
						95320c475b
					
				
					 5 changed files with 612 additions and 0 deletions
				
			
		
							
								
								
									
										161
									
								
								userReplies.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								userReplies.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,161 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('lib/htm.php');
 | 
			
		||||
require_once('lib/htmUsers.php');
 | 
			
		||||
 | 
			
		||||
$get_user = $dbc->prepare('SELECT * FROM users INNER JOIN profiles ON profiles.user_id = users.user_id WHERE user_name = ? LIMIT 1');
 | 
			
		||||
$get_user->bind_param('s', $action);
 | 
			
		||||
$get_user->execute();
 | 
			
		||||
$user_result = $get_user->get_result();
 | 
			
		||||
 | 
			
		||||
if ($user_result->num_rows == 0){
 | 
			
		||||
    printHeader('');
 | 
			
		||||
    noUser();
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
	$user = $user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
	if(!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))){
 | 
			
		||||
 | 
			
		||||
		$tabTitle = 'Ziiverse - '. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Profile';
 | 
			
		||||
 | 
			
		||||
		printHeader('');
 | 
			
		||||
 | 
			
		||||
		echo '<script>var loadOnScroll=true;</script><div id="sidebar" class="user-sidebar">';
 | 
			
		||||
 | 
			
		||||
		userContent($user, "yeahs");
 | 
			
		||||
 | 
			
		||||
		userSidebarSetting($user, 2);
 | 
			
		||||
 | 
			
		||||
		userInfo($user);
 | 
			
		||||
 | 
			
		||||
		echo '</div>
 | 
			
		||||
		<div class="main-column">
 | 
			
		||||
		  <div class="post-list-outline">
 | 
			
		||||
		    <h2 class="label">'. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Replies</h2>
 | 
			
		||||
		    <div class="list post-list js-post-list" data-next-page-url="/users/'. $user['user_name'] .'/replies?offset=1&dateTime='.date("Y-m-d H:i:s").'">';
 | 
			
		||||
 | 
			
		||||
		$get_replies = $dbc->prepare('SELECT * FROM replies WHERE reply_by_id = ? AND deleted = 0 ORDER BY date_time DESC LIMIT 20');
 | 
			
		||||
		$get_replies->bind_param('i', $user['user_id']);
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
		$offset = ($_GET['offset'] * 25);
 | 
			
		||||
		$dateTime = htmlspecialchars($_GET['dateTime']);
 | 
			
		||||
		$get_replies = $dbc->prepare('SELECT * FROM replies WHERE reply_by_id = ? AND deleted = 0 AND date_time < ? ORDER BY date_time DESC LIMIT 20 OFFSET ?');
 | 
			
		||||
		$get_replies->bind_param('isi', $user['user_id'], $dateTime, $offset);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$get_replies->execute();
 | 
			
		||||
	$replies_result = $get_replies->get_result();
 | 
			
		||||
 | 
			
		||||
	if(!$replies_result->num_rows == 0){
 | 
			
		||||
 | 
			
		||||
		while($replies = $replies_result->fetch_array()){
 | 
			
		||||
 | 
			
		||||
			$get_user_post = $dbc->prepare('SELECT users.* FROM users, posts WHERE users.user_id = posts.post_by_id AND posts.id = ? LIMIT 1');
 | 
			
		||||
			$get_user_post->bind_param('i', $replies['reply_post']);
 | 
			
		||||
			$get_user_post->execute();
 | 
			
		||||
			$user_post_result = $get_user_post->get_result();
 | 
			
		||||
			$user_post = $user_post_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
			$get_reply_post = $dbc->prepare('SELECT * FROM posts WHERE id = ? LIMIT 1');
 | 
			
		||||
			$get_reply_post->bind_param('i', $replies['reply_post']);
 | 
			
		||||
			$get_reply_post->execute();
 | 
			
		||||
			$reply_post_result = $get_reply_post->get_result();
 | 
			
		||||
			$reply_post = $reply_post_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
			$get_reply_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
 | 
			
		||||
			$get_reply_user->bind_param('i', $replies['reply_by_id']);
 | 
			
		||||
			$get_reply_user->execute();
 | 
			
		||||
			$reply_user_result = $get_reply_user->get_result();
 | 
			
		||||
			$reply_user = $reply_user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
			echo '<div data-href="/replies/'. $replies['reply_id'] .'" class="post post-subtype-default trigger">
 | 
			
		||||
			  <p class="community-container">
 | 
			
		||||
			    <a class="test-community-link" href="/posts/'. $replies['reply_post'] .'"><img src="'. printFace($user_post['user_face'], $reply_post['feeling_id']) .'" class="community-icon">Comment on '. htmlspecialchars($user_post['nickname'], ENT_QUOTES) .'\'s Post</a>
 | 
			
		||||
			  </p>
 | 
			
		||||
			  <a href="/users/'. $reply_user['user_name'] .'/posts" class="icon-container';
 | 
			
		||||
 | 
			
		||||
			if($reply_user['user_level']>1){
 | 
			
		||||
				echo ' verified';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '"><img src="'. printFace($reply_user['user_face'], $replies['feeling_id']) .'" id="icon"></a><p class="user-name"><a href="/users/'. $reply_user['user_name'] .'/posts">'. htmlspecialchars($reply_user['nickname'], ENT_QUOTES) .'</a></p><p class="timestamp-container"><a id="timestamp">' . humanTiming(strtotime($replies['date_time'])) . '</a></p><div id="body">';
 | 
			
		||||
 | 
			
		||||
			if (!empty($replies['reply_image'])){
 | 
			
		||||
				echo '<div class="screenshot-container"><img src="' . $replies['reply_image'] . '"></div>';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '<div id="post-body">' . (mb_strlen($replies['text']) > 199 ? mb_substr($replies['text'],0,200) . '...' : $replies['text']) . '</div><div id="post-meta">';
 | 
			
		||||
 | 
			
		||||
			    	$yeah_count = $dbc->prepare('SELECT COUNT(yeah_by) FROM yeahs WHERE type = "reply" AND yeah_post = ?');
 | 
			
		||||
			    	$yeah_count->bind_param('i', $replies['reply_id']);
 | 
			
		||||
			    	$yeah_count->execute();
 | 
			
		||||
			    	$result_count = $yeah_count->get_result();
 | 
			
		||||
			    	$yeah_amount = $result_count->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
			    	$nah_count = $dbc->prepare('SELECT COUNT(nah_by) FROM nahs WHERE type = 1 AND nah_post = ?');
 | 
			
		||||
			    	$nah_count->bind_param('i', $replies['reply_id']);
 | 
			
		||||
			    	$nah_count->execute();
 | 
			
		||||
			    	$result_count = $nah_count->get_result();
 | 
			
		||||
			    	$nah_amount = $result_count->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
			    	$yeahs = $yeah_amount['COUNT(yeah_by)'] - $nah_amount['COUNT(nah_by)'];
 | 
			
		||||
 | 
			
		||||
			echo '<button class="yeah symbol';
 | 
			
		||||
 | 
			
		||||
			if (!empty($_SESSION['signed_in']) && checkYeahAdded($replies['reply_id'], 'reply', $_SESSION['user_id'])) {
 | 
			
		||||
				echo ' yeah-added';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '"'; 
 | 
			
		||||
 | 
			
		||||
			if (empty($_SESSION['signed_in']) || checkReplyCreator($replies['reply_id'], $_SESSION['user_id'])) {
 | 
			
		||||
				echo ' disabled ';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo 'id="'. $replies['reply_id'] .'" data-track-label="reply"><span class="yeah-button-text">';
 | 
			
		||||
 | 
			
		||||
			if (!empty($_SESSION['signed_in']) && checkYeahAdded($replies['reply_id'], 'reply', $_SESSION['user_id'])) {
 | 
			
		||||
				echo 'Unyeah';
 | 
			
		||||
			} else {
 | 
			
		||||
				echo 'Yeah!';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '</span></button>';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			echo '<button class="nah symbol';
 | 
			
		||||
 | 
			
		||||
			if (!empty($_SESSION['signed_in']) && checkNahAdded($replies['reply_id'], 1, $_SESSION['user_id'])) {
 | 
			
		||||
				echo ' nah-added';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '"'; 
 | 
			
		||||
 | 
			
		||||
			if (empty($_SESSION['signed_in']) || checkReplyCreator($replies['reply_id'], $_SESSION['user_id'])) {
 | 
			
		||||
				echo ' disabled ';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo 'id="'. $replies['reply_id'] .'" data-track-label="1"><span class="nah-button-text">';
 | 
			
		||||
 | 
			
		||||
			if (!empty($_SESSION['signed_in']) && checkNahAdded($replies['reply_id'], 1, $_SESSION['user_id'])) {
 | 
			
		||||
				echo 'Un-nah.';
 | 
			
		||||
			} else {
 | 
			
		||||
				echo 'Nah...';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			echo '</span></button>';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			echo '<div class="empathy symbol" yeahs="'. $yeah_amount['COUNT(yeah_by)']  .'" nahs="'. $nah_amount['COUNT(nah_by)']  .'" title="'. $yeah_amount['COUNT(yeah_by)'] .' '. ($yeah_amount['COUNT(yeah_by)'] == 1 ? 'Yeah' : 'Yeahs') .' / '. $nah_amount['COUNT(nah_by)'] .' '. ($nah_amount['COUNT(nah_by)'] == 1 ? 'Nah' : 'Nahs') .'"><span class="yeah-count">'. $yeahs .'</span></div></div></div></div>';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
 | 
			
		||||
		if(!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))){
 | 
			
		||||
 | 
			
		||||
			echo '<div id="user-page-no-content" class="no-content"><div><p>There are no replies yet.</p></div></div></div>';
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										193
									
								
								userYeahs.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										193
									
								
								userYeahs.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,193 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('lib/htm.php');
 | 
			
		||||
require_once('lib/htmUsers.php');
 | 
			
		||||
 | 
			
		||||
$get_user = $dbc->prepare('SELECT * FROM users INNER JOIN profiles ON profiles.user_id = users.user_id WHERE user_name = ? LIMIT 1');
 | 
			
		||||
$get_user->bind_param('s', $action);
 | 
			
		||||
$get_user->execute();
 | 
			
		||||
$user_result = $get_user->get_result();
 | 
			
		||||
 | 
			
		||||
if ($user_result->num_rows == 0) {
 | 
			
		||||
    printHeader('');
 | 
			
		||||
    noUser();
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
    $user = $user_result->fetch_assoc();
 | 
			
		||||
    if (!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))) {
 | 
			
		||||
 | 
			
		||||
        $tabTitle = 'Ziiverse - '. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Profile';
 | 
			
		||||
 | 
			
		||||
        printHeader('');
 | 
			
		||||
 | 
			
		||||
        echo '<script>var loadOnScroll=true;</script><div id="sidebar" class="user-sidebar">';
 | 
			
		||||
 | 
			
		||||
        userContent($user, "yeahs");
 | 
			
		||||
 | 
			
		||||
        userSidebarSetting($user, 3);
 | 
			
		||||
 | 
			
		||||
        userInfo($user);
 | 
			
		||||
 | 
			
		||||
        echo '</div>
 | 
			
		||||
        <div class="main-column">
 | 
			
		||||
          <div class="post-list-outline">
 | 
			
		||||
            <h2 class="label">'. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Yeahs</h2>
 | 
			
		||||
            <div class="post-body">
 | 
			
		||||
          <div class="list multi-timeline-post-list" data-next-page-url="/users/'. $user['user_name'] .'/yeahs?offset=1&dateTime='.date("Y-m-d H:i:s").'">';
 | 
			
		||||
 | 
			
		||||
        $get_yeahs = $dbc->prepare('SELECT * FROM yeahs WHERE yeah_by = ? ORDER BY yeah_id DESC LIMIT 20');
 | 
			
		||||
        $get_yeahs->bind_param('i', $user['user_id']);
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        $offset = ($_GET['offset'] * 25);
 | 
			
		||||
        $dateTime = htmlspecialchars($_GET['dateTime']);
 | 
			
		||||
        $get_yeahs = $dbc->prepare('SELECT * FROM yeahs WHERE yeah_by = ? AND date_time < ? ORDER BY date_time DESC LIMIT 20 OFFSET ?');
 | 
			
		||||
        $get_yeahs->bind_param('isi', $user['user_id'], $dateTime, $offset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $get_yeahs->execute();
 | 
			
		||||
    $yeahs_result = $get_yeahs->get_result();
 | 
			
		||||
 | 
			
		||||
    if (!$yeahs_result->num_rows == 0) {
 | 
			
		||||
 | 
			
		||||
        while ($yeahs = $yeahs_result->fetch_array()) {
 | 
			
		||||
 | 
			
		||||
            if ($yeahs['type'] == "post") {
 | 
			
		||||
 | 
			
		||||
                $get_posts = $dbc->prepare('SELECT * FROM posts INNER JOIN titles ON title_id = post_title INNER JOIN users ON user_id = post_by_id WHERE id = ? AND deleted = 0 LIMIT 1');
 | 
			
		||||
                $get_posts->bind_param('i', $yeahs['yeah_post']);
 | 
			
		||||
                $get_posts->execute();
 | 
			
		||||
                $posts_result = $get_posts->get_result();
 | 
			
		||||
                if ($posts_result->num_rows==0) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                $posts = $posts_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                echo '<div data-href="/posts/'. $posts['id'] .'" class="post post-subtype-default trigger">
 | 
			
		||||
                <p class="community-container">
 | 
			
		||||
 | 
			
		||||
                <a class="test-community-link" href="/titles/'. $posts['title_id'] .'"><img src="'. $posts['title_icon'] .'" class="community-icon">'. $posts['title_name'] .'</a></p>';
 | 
			
		||||
 | 
			
		||||
                printPost($posts, 1);
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
 | 
			
		||||
                //replies
 | 
			
		||||
                $get_replies = $dbc->prepare('SELECT * FROM replies WHERE reply_id = ? LIMIT 1');
 | 
			
		||||
                $get_replies->bind_param('i', $yeahs['yeah_post']);
 | 
			
		||||
                $get_replies->execute();
 | 
			
		||||
                $replies_result = $get_replies->get_result();
 | 
			
		||||
                $replies = $replies_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                $get_user_post = $dbc->prepare('SELECT users.* FROM users, posts WHERE users.user_id = posts.post_by_id AND posts.id = ? LIMIT 1');
 | 
			
		||||
                $get_user_post->bind_param('i', $replies['reply_post']);
 | 
			
		||||
                $get_user_post->execute();
 | 
			
		||||
                $user_post_result = $get_user_post->get_result();
 | 
			
		||||
                $user_post = $user_post_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                $get_reply_post = $dbc->prepare('SELECT * FROM posts WHERE id = ? LIMIT 1');
 | 
			
		||||
                $get_reply_post->bind_param('i', $replies['reply_post']);
 | 
			
		||||
                $get_reply_post->execute();
 | 
			
		||||
                $reply_post_result = $get_reply_post->get_result();
 | 
			
		||||
                $reply_post = $reply_post_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                $get_reply_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
 | 
			
		||||
                $get_reply_user->bind_param('i', $replies['reply_by_id']);
 | 
			
		||||
                $get_reply_user->execute();
 | 
			
		||||
                $reply_user_result = $get_reply_user->get_result();
 | 
			
		||||
                $reply_user = $reply_user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                echo '<div data-href="/replies/'. $replies['reply_id'] .'" class="post post-subtype-default trigger">
 | 
			
		||||
                  <p class="community-container">
 | 
			
		||||
                    <a class="test-community-link" href="/posts/'. $replies['reply_post'] .'"><img src="'. printFace($user_post['user_face'], $reply_post['feeling_id']) .'" class="community-icon">Comment on '. htmlspecialchars($user_post['nickname'], ENT_QUOTES) .'\'s Post</a>
 | 
			
		||||
                  </p>
 | 
			
		||||
                  <a href="/users/'. $reply_user['user_name'] .'/posts" class="icon-container';
 | 
			
		||||
 | 
			
		||||
                if ($reply_user['user_level'] > 1) {
 | 
			
		||||
                    echo ' verified';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '"><img src="'. printFace($reply_user['user_face'], $replies['feeling_id']) .'" id="icon"></a><p class="user-name"><a href="/users/'. $reply_user['user_name'] .'/posts">'. htmlspecialchars($reply_user['nickname'], ENT_QUOTES) .'</a></p><p class="timestamp-container"><a id="timestamp">' .
 | 
			
		||||
                humanTiming(strtotime($replies['date_time'])) . '</a></p><div id="body">';
 | 
			
		||||
 | 
			
		||||
                if (!empty($replies['reply_image'])) {
 | 
			
		||||
                    echo '<div class="screenshot-container"><img src="' . $replies['reply_image'] . '"></div>';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '<div id="post-body">'. (mb_strlen($replies['text']) > 199 ? mb_substr($replies['text'],0,200) . '...' : $replies['text']) .'</div><div id="post-meta">';
 | 
			
		||||
                                $yeah_count = $dbc->prepare('SELECT COUNT(yeah_by) FROM yeahs WHERE type = "reply" AND yeah_post = ?');
 | 
			
		||||
                $yeah_count->bind_param('i', $replies['reply_id']);
 | 
			
		||||
                $yeah_count->execute();
 | 
			
		||||
                $result_count = $yeah_count->get_result();
 | 
			
		||||
                $yeah_amount = $result_count->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                $nah_count = $dbc->prepare('SELECT COUNT(nah_by) FROM nahs WHERE type = 1 AND nah_post = ?');
 | 
			
		||||
                $nah_count->bind_param('i', $replies['reply_id']);
 | 
			
		||||
                $nah_count->execute();
 | 
			
		||||
                $result_count = $nah_count->get_result();
 | 
			
		||||
                $nah_amount = $result_count->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                $yeahs = $yeah_amount['COUNT(yeah_by)'] - $nah_amount['COUNT(nah_by)'];
 | 
			
		||||
 | 
			
		||||
                echo '<button class="yeah symbol';
 | 
			
		||||
 | 
			
		||||
                if (!empty($_SESSION['signed_in']) && checkYeahAdded($replies['reply_id'], 'reply', $_SESSION['user_id'])) {
 | 
			
		||||
                    echo ' yeah-added';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '"';
 | 
			
		||||
 | 
			
		||||
                if (empty($_SESSION['signed_in']) || checkReplyCreator($replies['reply_id'], $_SESSION['user_id'])) {
 | 
			
		||||
                    echo ' disabled ';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo 'id="'. $replies['reply_id'] .'" data-track-label="reply"><span class="yeah-button-text">';
 | 
			
		||||
 | 
			
		||||
                if (!empty($_SESSION['signed_in']) && checkYeahAdded($replies['reply_id'], 'reply', $_SESSION['user_id'])) {
 | 
			
		||||
                    echo 'Unyeah';
 | 
			
		||||
                } else {
 | 
			
		||||
                    echo 'Yeah!';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '</span></button>';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                echo '<button class="nah symbol';
 | 
			
		||||
 | 
			
		||||
                if (!empty($_SESSION['signed_in']) && checkNahAdded($replies['reply_id'], 1, $_SESSION['user_id'])) {
 | 
			
		||||
                    echo ' nah-added';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '"';
 | 
			
		||||
 | 
			
		||||
                if (empty($_SESSION['signed_in']) || checkReplyCreator($replies['reply_id'], $_SESSION['user_id'])) {
 | 
			
		||||
                    echo ' disabled ';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo 'id="'. $replies['reply_id'] .'" data-track-label="1"><span class="nah-button-text">';
 | 
			
		||||
 | 
			
		||||
                if (!empty($_SESSION['signed_in']) && checkNahAdded($replies['reply_id'], 1, $_SESSION['user_id'])) {
 | 
			
		||||
                    echo 'Un-nah.';
 | 
			
		||||
                } else {
 | 
			
		||||
                    echo 'Nah...';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                echo '</span></button>';
 | 
			
		||||
 | 
			
		||||
                echo '<div class="empathy symbol" yeahs="'. $yeah_amount['COUNT(yeah_by)']  .'" nahs="'. $nah_amount['COUNT(nah_by)']  .'" title="'. $yeah_amount['COUNT(yeah_by)'] .' '. ($yeah_amount['COUNT(yeah_by)'] == 1 ? 'Yeah' : 'Yeahs') .' / '. $nah_amount['COUNT(nah_by)'] .' '. ($nah_amount['COUNT(nah_by)'] == 1 ? 'Nah' : 'Nahs') .'"><span class="yeah-count">'. $yeahs .'</span></div>';
 | 
			
		||||
 | 
			
		||||
                echo '</div></div></div>';
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
        if (!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))) {
 | 
			
		||||
            echo '
 | 
			
		||||
            <div id="user-page-no-content" class="no-content"><div>
 | 
			
		||||
            <p>There are no posts with Yeahs yet.</p>
 | 
			
		||||
            </div></div>
 | 
			
		||||
            </div>';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										88
									
								
								users.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								users.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,88 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('lib/htm.php');
 | 
			
		||||
require_once('lib/htmUsers.php');
 | 
			
		||||
 | 
			
		||||
$get_user = $dbc->prepare('SELECT * FROM users INNER JOIN profiles ON profiles.user_id = users.user_id WHERE user_name = ? LIMIT 1');
 | 
			
		||||
$get_user->bind_param('s', $action);
 | 
			
		||||
$get_user->execute();
 | 
			
		||||
$user_result = $get_user->get_result();
 | 
			
		||||
 | 
			
		||||
if ($user_result->num_rows == 0){
 | 
			
		||||
	printHeader('');
 | 
			
		||||
	noUser();
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
	$user = $user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
	if(!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))){
 | 
			
		||||
 | 
			
		||||
		$tabTitle = 'Ziiverse - '. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Profile';
 | 
			
		||||
 | 
			
		||||
		if (empty($_SESSION['signed_in']) || $_SESSION['user_id'] == $user['user_id']) {printHeader(1);} else {printHeader('');}
 | 
			
		||||
 | 
			
		||||
		echo '<script>var loadOnScroll=true;</script><div id="sidebar" class="user-sidebar">';
 | 
			
		||||
 | 
			
		||||
		userContent($user, "posts");
 | 
			
		||||
 | 
			
		||||
		userSidebarSetting($user, 1);
 | 
			
		||||
 | 
			
		||||
		userInfo($user);
 | 
			
		||||
 | 
			
		||||
		echo '</div><div class="main-column"><div class="post-list-outline">
 | 
			
		||||
		<h2 class="label">
 | 
			
		||||
        <span class="label-diary_post-msgid">
 | 
			
		||||
         '. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Posts
 | 
			
		||||
        </span></h2>
 | 
			
		||||
		<div class="post-body">
 | 
			
		||||
          <div class="list multi-timeline-post-list" data-next-page-url="/users/'. $user['user_name'] .'/posts?offset=1&dateTime='.date("Y-m-d H:i:s").'">';
 | 
			
		||||
 | 
			
		||||
		if (!empty($_SESSION['signed_in']) && $user['user_id'] == $_SESSION['user_id']) {
 | 
			
		||||
			$get_posts = $dbc->prepare('SELECT * FROM posts INNER JOIN titles ON title_id = post_title WHERE post_by_id = ? AND deleted < 2 ORDER BY posts.date_time DESC LIMIT 25');
 | 
			
		||||
		} else {
 | 
			
		||||
			$get_posts = $dbc->prepare('SELECT * FROM posts INNER JOIN titles ON title_id = post_title WHERE post_by_id = ? AND deleted = 0 ORDER BY posts.date_time DESC LIMIT 25');
 | 
			
		||||
		}
 | 
			
		||||
		$get_posts->bind_param('i', $user['user_id']);
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
 | 
			
		||||
		$offset = ($_GET['offset'] * 25);
 | 
			
		||||
		$dateTime = htmlspecialchars($_GET['dateTime']);
 | 
			
		||||
		if ($user['user_id'] == $_SESSION['user_id']) {
 | 
			
		||||
			$get_posts = $dbc->prepare('SELECT * FROM posts INNER JOIN titles ON title_id = post_title WHERE post_by_id = ? AND posts.date_time < ? AND deleted < 2 ORDER BY posts.date_time DESC LIMIT 25 OFFSET ?');
 | 
			
		||||
		} else {
 | 
			
		||||
			$get_posts = $dbc->prepare('SELECT * FROM posts INNER JOIN titles ON title_id = post_title WHERE post_by_id = ? AND posts.date_time < ? AND deleted = 0 ORDER BY posts.date_time DESC LIMIT 25 OFFSET ?');
 | 
			
		||||
		}
 | 
			
		||||
		$get_posts->bind_param('isi', $user['user_id'], $dateTime, $offset);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$get_posts->execute();
 | 
			
		||||
	$posts_result = $get_posts->get_result();
 | 
			
		||||
 | 
			
		||||
	if(!$posts_result->num_rows == 0){
 | 
			
		||||
 | 
			
		||||
		echo '<div id="user-page-no-content" class="none"></div>';
 | 
			
		||||
 | 
			
		||||
		while($posts = $posts_result->fetch_array()){
 | 
			
		||||
 | 
			
		||||
			echo '<div data-href="/posts/'. $posts['id'] .'" class="post post-subtype-default trigger">
 | 
			
		||||
			<p class="community-container">
 | 
			
		||||
 | 
			
		||||
			<a class="test-community-link" href="/titles/'. $posts['title_id'] .'"><img src="'. $posts['title_icon'] .'" class="community-icon">'. $posts['title_name'] .'</a></p>';
 | 
			
		||||
 | 
			
		||||
			printPost(array_merge($posts, $user), 1);
 | 
			
		||||
		}
 | 
			
		||||
      echo '</div>';
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
		if(!(isset($_GET['offset']) && is_numeric($_GET['offset']) && isset($_GET['dateTime']))){
 | 
			
		||||
			echo '
 | 
			
		||||
			<div id="user-page-no-content" class="no-content">
 | 
			
		||||
			  <div>
 | 
			
		||||
			    <p>No posts have been made yet.</p>
 | 
			
		||||
			  </div>
 | 
			
		||||
			</div>';
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
<div id="footer"><div id="footer-inner"><div class="link-container"><p><a href="/guide/">Code of Conduct</a></p><p id="copyright"><a href="https://nintendo.com/">Ziiverse is a non-profit revival of Nintendo and Hatena's Miiverse service. We are not affiliated with these companies and they deserve your business.</a><br><a href="/contact">Contact Us</a></p></div></div></div>
 | 
			
		||||
							
								
								
									
										101
									
								
								verifiedPosts.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								verifiedPosts.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,101 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('lib/htm.php');
 | 
			
		||||
require_once('lib/htmUsers.php');
 | 
			
		||||
 | 
			
		||||
$tabTitle = 'Cedar - Posts from Verified Users';
 | 
			
		||||
 | 
			
		||||
printHeader(3);
 | 
			
		||||
 | 
			
		||||
echo '<div id="sidebar" class="general-sidebar">';
 | 
			
		||||
 | 
			
		||||
if(!empty($_SESSION['signed_in'])){
 | 
			
		||||
	$get_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
 | 
			
		||||
	$get_user->bind_param('i', $_SESSION['user_id']);
 | 
			
		||||
	$get_user->execute();
 | 
			
		||||
	$user_result = $get_user->get_result();
 | 
			
		||||
	$user = $user_result->fetch_assoc();
 | 
			
		||||
	userContent($user, "");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sidebarSetting();
 | 
			
		||||
echo '</div>';
 | 
			
		||||
 | 
			
		||||
echo '<div class="main-column"><div class="post-list-outline">
 | 
			
		||||
  <div id="image-header-content">
 | 
			
		||||
    <span class="image-header-title">
 | 
			
		||||
      <span class="title">Posts from Verified Users</span>
 | 
			
		||||
      <span class="text">Get the latest news here!</span>
 | 
			
		||||
    </span>
 | 
			
		||||
    <img src="/assets/img/identified-user.png">
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="list post-list js-post-list list post-list js-post-list test-identified-post-list">';
 | 
			
		||||
 | 
			
		||||
$get_posts = $dbc->prepare('SELECT posts.* FROM posts, users WHERE posts.post_by_id = users.user_id AND users.user_level > 1 AND posts.deleted = 0 ORDER BY posts.date_time DESC LIMIT 25');
 | 
			
		||||
$get_posts->execute();
 | 
			
		||||
$posts_result = $get_posts->get_result();
 | 
			
		||||
 | 
			
		||||
while($posts = $posts_result->fetch_array()){
 | 
			
		||||
    $get_title = $dbc->prepare('SELECT title_id, title_name, title_icon FROM titles WHERE title_id = ? LIMIT 1');
 | 
			
		||||
    $get_title->bind_param('i', $posts['post_title']);
 | 
			
		||||
    $get_title->execute();
 | 
			
		||||
    $title_result = $get_title->get_result();
 | 
			
		||||
    $title = $title_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
	$get_user = $dbc->prepare('SELECT users.*, profiles.* FROM users INNER JOIN profiles ON profiles.user_id = ? WHERE users.user_id = ?');
 | 
			
		||||
	$get_user->bind_param('ii', $posts['post_by_id'], $posts['post_by_id']);
 | 
			
		||||
	$get_user->execute();
 | 
			
		||||
	$user_result = $get_user->get_result();
 | 
			
		||||
	$user = $user_result->fetch_assoc();
 | 
			
		||||
		
 | 
			
		||||
	echo '<div class="post trigger" data-href="/posts/' . $posts['id'] . '">
 | 
			
		||||
	  <p class="community-container">
 | 
			
		||||
        <a href="/titles/'. $title['title_id'] .'"><img src="'. $title['title_icon'] .'" class="community-icon">'. $title['title_name'] .'</a></p>
 | 
			
		||||
		<a href="/users/'. $user['user_name'] .'/posts" class="icon-container';
 | 
			
		||||
		
 | 
			
		||||
	if($user['user_level'] > 1){
 | 
			
		||||
		echo ' verified';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	echo '"><img src="' . printFace($user['user_face'], $posts['feeling_id']) . '" id="icon"></a><div class="toggle-button">';
 | 
			
		||||
 | 
			
		||||
	$check_followed = $dbc->prepare('SELECT * FROM follows WHERE follow_by = ? AND follow_to = ? LIMIT 1');
 | 
			
		||||
	$check_followed->bind_param('ii', $_SESSION['user_id'], $user['user_id']);
 | 
			
		||||
	$check_followed->execute();
 | 
			
		||||
	$followed_result = $check_followed->get_result();
 | 
			
		||||
 | 
			
		||||
	if (($followed_result->num_rows == 0) && ($_SESSION['user_id'] != $user['user_id']) && !empty($_SESSION['signed_in'])){
 | 
			
		||||
		echo '<button type="button" data-user-id="'. $user['user_id'] .'" class="follow-button button symbol relationship-button" data-community-id="" data-url-id="" data-track-label="user" data-title-id="" data-track-action="follow" data-track-category="follow">Follow</button>
 | 
			
		||||
		<button type="button" class="button follow-done-button relationship-button symbol none" disabled="">Follow</button>';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	echo '</div><p class="user-name"><a href="/users/'. $user['user_name'] .'/posts">'. htmlspecialchars($user['nickname'], ENT_QUOTES) .'</a></p>
 | 
			
		||||
	<p class="text test-profile-comment">'. $user['bio'] .'</p>
 | 
			
		||||
	<div id="body">';
 | 
			
		||||
		
 | 
			
		||||
	if (!empty($posts['post_image'])){
 | 
			
		||||
		echo '<div class="screenshot-container"><img src="' . $posts['post_image'] . '"></div>';
 | 
			
		||||
	}
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
	echo '<div id="post-body">'. (mb_strlen($posts['text']) > 199 ? htmlspecialchars(mb_substr($posts['text'],0,200), ENT_QUOTES) .'...' : htmlspecialchars($posts['text'], ENT_QUOTES)) . '</div>';
 | 
			
		||||
		
 | 
			
		||||
			
 | 
			
		||||
	echo '<div id="post-meta"><p class="timestamp-container"><a id="timestamp">'. humanTiming(strtotime($posts['date_time'])) .'</a></p>';
 | 
			
		||||
		
 | 
			
		||||
	$yeah_count = $dbc->prepare('SELECT COUNT(yeah_by) FROM yeahs WHERE type = "post" AND yeahs.yeah_post = ?');
 | 
			
		||||
	$yeah_count->bind_param('i', $posts['id']);
 | 
			
		||||
	$yeah_count->execute();
 | 
			
		||||
    $result_count = $yeah_count->get_result();
 | 
			
		||||
	$yeah_amount = $result_count->fetch_assoc();
 | 
			
		||||
					
 | 
			
		||||
	echo '<div class="empathy symbol"><span class="yeah-count">' . $yeah_amount['COUNT(yeah_by)'] . '</span></div>';
 | 
			
		||||
		
 | 
			
		||||
	$reply_count = $dbc->prepare('SELECT COUNT(reply_id) FROM replies WHERE reply_post = ? AND deleted = 0');
 | 
			
		||||
	$reply_count->bind_param('i', $posts['id']);
 | 
			
		||||
	$reply_count->execute();
 | 
			
		||||
    $result_count = $reply_count->get_result();
 | 
			
		||||
	$reply_amount = $result_count->fetch_assoc();
 | 
			
		||||
		
 | 
			
		||||
	echo '<div class="reply symbol"><span id="reply-count">' . $reply_amount['COUNT(reply_id)'] . '</span></div>
 | 
			
		||||
	</div></div></div>';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										69
									
								
								yeah.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								yeah.php
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
<?php
 | 
			
		||||
require_once('lib/htm.php');
 | 
			
		||||
 | 
			
		||||
if (!empty($_SESSION['signed_in'])) {
 | 
			
		||||
    if (isset($_POST['postId']) && isset($_POST['yeahType'])) {
 | 
			
		||||
 | 
			
		||||
        if ((checkPostExists($_POST['postId']) && $_POST['yeahType'] == 'post') || (checkReplyExists($_POST['postId']) && $_POST['yeahType'] == 'reply')) {
 | 
			
		||||
            if ($_POST['yeahType'] == 'post') {
 | 
			
		||||
                if (!checkPostCreator($_POST['postId'], $_SESSION['user_id'])) {
 | 
			
		||||
                    $yeah = $dbc->prepare('INSERT INTO yeahs (yeah_post, type, date_time, yeah_by) VALUES (?, ?, NOW(), ?)');
 | 
			
		||||
                    $yeah->bind_param('isi', $_POST['postId'], $_POST['yeahType'], $_SESSION['user_id']);
 | 
			
		||||
                    $yeah->execute();
 | 
			
		||||
 | 
			
		||||
                    $get_user = $dbc->prepare('SELECT * FROM posts INNER JOIN profiles ON user_id = post_by_id WHERE id = ?');
 | 
			
		||||
                    $get_user->bind_param('i', $_POST['postId']);
 | 
			
		||||
                    $get_user->execute();
 | 
			
		||||
                    $user_result = $get_user->get_result();
 | 
			
		||||
                    $user = $user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                    if ($user['yeah_notifs'] == 1) {
 | 
			
		||||
                        notify($user['post_by_id'], 0, $_POST['postId']);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    $check_nah = $dbc->prepare('SELECT * FROM nahs WHERE nah_post = ? AND type = 0 AND nah_by = ?');
 | 
			
		||||
                    $check_nah->bind_param('ii', $_POST['postId'], $_SESSION['user_id']);
 | 
			
		||||
                    $check_nah->execute();
 | 
			
		||||
                    $nah_result = $check_nah->get_result();
 | 
			
		||||
 | 
			
		||||
                    if (!$nah_result->num_rows == 0) {
 | 
			
		||||
                        $delete_nah = $dbc->prepare('DELETE FROM nahs WHERE nah_post = ? AND type = 0 AND nah_by = ?');
 | 
			
		||||
                        $delete_nah->bind_param('ii', $_POST['postId'], $_SESSION['user_id']);
 | 
			
		||||
                        $delete_nah->execute();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    echo 'success';
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                if (!checkReplyCreator($_POST['postId'], $_SESSION['user_id'])) {
 | 
			
		||||
                    $yeah = $dbc->prepare('INSERT INTO yeahs (yeah_post, type, date_time, yeah_by) VALUES (?, ?, NOW(), ?)');
 | 
			
		||||
                    $yeah->bind_param('isi', $_POST['postId'], $_POST['yeahType'], $_SESSION['user_id']);
 | 
			
		||||
                    $yeah->execute();
 | 
			
		||||
 | 
			
		||||
                    $get_user = $dbc->prepare('SELECT * FROM replies INNER JOIN profiles ON user_id = reply_by_id WHERE reply_id = ?');
 | 
			
		||||
                    $get_user->bind_param('i', $_POST['postId']);
 | 
			
		||||
                    $get_user->execute();
 | 
			
		||||
                    $user_result = $get_user->get_result();
 | 
			
		||||
                    $user = $user_result->fetch_assoc();
 | 
			
		||||
 | 
			
		||||
                    if($user['yeah_notifs']==1){
 | 
			
		||||
                        notify($user['reply_by_id'], 1, $_POST['postId']);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    $check_nah = $dbc->prepare('SELECT * FROM nahs WHERE nah_post = ? AND type = 1 AND nah_by = ?');
 | 
			
		||||
                    $check_nah->bind_param('ii', $_POST['postId'], $_SESSION['user_id']);
 | 
			
		||||
                    $check_nah->execute();
 | 
			
		||||
                    $nah_result = $check_nah->get_result();
 | 
			
		||||
 | 
			
		||||
                    if (!$nah_result->num_rows == 0) {
 | 
			
		||||
                        $delete_nah = $dbc->prepare('DELETE FROM nahs WHERE nah_post = ? AND type = 1 AND nah_by = ?');
 | 
			
		||||
                        $delete_nah->bind_param('ii', $_POST['postId'], $_SESSION['user_id']);
 | 
			
		||||
                        $delete_nah->execute();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    echo 'success';
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue