Example #1
0
 public static function getUserAttributes($comments, $session_user)
 {
     foreach ($comments as $comment) {
         $comment->username = User::getUsernameById($comment->user_id);
         $comment->likecount = Likes::countLike($comment->id);
         $comment->is_author = $comment->isAuthor($session_user);
         $comment->is_liked = Likes::isLiked($comment->id, $session_user);
     }
 }
Example #2
0
include "site_body.php";
echo "<div style='margin-top:20px;'></div>";
echo "<h3>All Users</h3>";
$offset = 0;
$noContributors = 0;
if (isset($_GET['page'])) {
    $offset .= 5 * $_GET['page'];
}
$query2 = "SELECT * FROM users";
$count = $mySQL->query($query2);
$noContributors = mysqli_num_rows($count);
$query = "SELECT * FROM users LIMIT 5 OFFSET {$offset}";
$result = $mySQL->query($query);
while ($res = $result->fetch_assoc()) {
    echo "\n\t\t<div class='panel panel-default'>\n\t\t  <div class='panel-body'>\n\t\t  <b><a href='profile.php?user={$res['user_id']}'>" . User::getUsernameById($res['user_id'], $mySQL) . "</a></b>";
    if (!empty($res['name'])) {
        echo " ({$res['name']})";
    }
    if (!empty($res['country_id']) && $res['country_id'] != 1) {
        echo " from {$a->getCountryNameById($res['country_id'], $mySQL)}";
    }
    echo "\n\t\t  </div>\n\t\t  <div class='panel-footer'><a href='profile.php?user={$res['user_id']}'>View Profile</a></div>\n\t\t</div>\n\t\t\n\t\t\n\t\t";
}
?>
	<nav>
		<ul class='pagination'>
	<?php 
$is = false;
if (isset($_GET['page'])) {
    $is = true;
Example #3
0
 public static function getAttributes($threads, $session_user)
 {
     foreach ($threads as $thread) {
         $thread->username = User::getUsernameById($thread->user_id);
         $thread->comment = Comment::getByThreadId($thread->id);
         $thread->is_author = $thread->isAuthor($session_user);
         $thread->is_followed = Follow::isFollowed($thread->id, $session_user);
     }
 }
Example #4
0
 function getAdventure($id)
 {
     $result = $this->mysql->query("SELECT * FROM adventure WHERE adventure_id = {$id}");
     if ($result->num_rows == 1) {
         $row = $result->fetch_assoc();
         if (!empty($row['user_id'])) {
             $adventure['username'] = User::getUsernameById($row['user_id'], $this->mysql);
         } else {
             $adventure['username'] = "******";
         }
         $adventure['title'] = $row['title'];
         $adventure['description'] = $row['description'];
         $adventure['country'] = parent::getCountryNameById($row['country_id'], $this->mysql);
         $adventure['main_picture'] = $this->getPictureFilename($row['main_picture_id'], $this->mysql);
         $adventure['rating'] = $row['rating'];
         $result = $this->mysql->query("SELECT picture_id,name FROM picture where adventure_id={$id}");
         $i = 0;
         while ($picture = $result->fetch_assoc()) {
             if ($picture['picture_id'] != $row['main_picture_id']) {
                 $adventure['picture'][$i] = "./uploads/" . $picture['name'];
             }
             $i++;
         }
         $result = $this->mysql->query("SELECT value FROM tags where adventure_id={$id}");
         $i = 0;
         while ($tag = $result->fetch_assoc()) {
             $adventure['tag'][$i] = $tag["value"];
             $i++;
         }
         $title = $adventure['title'];
         return $adventure;
     } else {
         return null;
     }
 }
Example #5
0
    echo "</div></div>";
}
?>

<script>
	$(document).ready(function () {
		$("#votes_show").click( function () {
			$("#votes_list").show();
		});
	});
</script>

<?php 
$comments = $adventure['comments'];
foreach ($comments as $comment) {
    $commentUser = User::getUsernameById($comment['user_id'], $mysql);
    $datetime = new DateTime($comment['date']);
    echo "<div class='panel panel-default'>\n\t\t  <div class='panel-body comment_text' comment_id='{$comment['comment_id']}'>{$comment['message']}</div>\n\t\t  <div class='panel-footer'>Comment By: <b><a href='profile.php?user={$comment['user_id']}'>{$commentUser}</a></b> <span>On: <b>{$datetime->format('Y-m-d')}</b> at <b>{$datetime->format('H:i:s')}</b></span>";
    if ($siteUser->getUserId() == $comment['user_id']) {
        echo "<button class='btn btn-default edit_comment_button' style='margin-left: 10px;'>Edit</button>";
    }
    if ($siteUser->getUserId() == $comment['user_id'] || $siteUser->getUserId() == $adventure['user_id'] || $siteUser->getType() == "Admin") {
        echo "<form action='http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}' method='POST' style='display: inline !important'>";
        echo "<button type='submit' class='btn btn-default' name='remove_comment' style='margin-left: 10px;'>Remove</button>";
        echo "<input type='hidden' name='remove_comment_id' value='{$comment['comment_id']}' />";
        echo "</form>";
    }
    echo "</div><span></span>\n\t\t</div>";
}
?>
<div class="well">
Example #6
0
<?php

require_once '../BackEnd/Includes.php';
require_once 'NavBar.php';
?>
        <?php 
if (isset($_GET['value']) && !empty($_GET['value'])) {
    $user = new User();
    $username = $user->getUsernameById($_GET['value']);
    echo "<div class='Page'>\n                    <div class='main-content'>\n                        <h1 class='text-center main-page-header-style'><strong>";
    foreach ($username as $users) {
        echo $users->Username . " ";
    }
    echo "Decks!</strong></h1>";
    $decks = new Decks();
    $data = $decks->getDecksByUserId($_GET['value']);
    if (!$data) {
        echo "<div class='content text-center'>\n                        <h2 class='text-center main-page-header-style'><strong>This user has no decks</strong></h2>\n                      </div>";
    }
    $picture = new Pictures();
    echo "\n                <div class='container-fluid marginBottom'>";
    foreach ($data as $row) {
        echo "<div class='col-md-4 text-center deck-class'>\n                        <div style='width: 300px; height: 200px;'>\n                            <a href='DeckView.php?Id={$row->Id}'><img src ='" . $picture->getHeroLogo($row->Class) . "'></a>\n                            <span class='DeckName-style'>{$row->Name}</span>\n                        </div>\n                 </div>";
    }
    echo "</div>\n                </div>\n            </div>";
}
?>
<div id="login-dialog" style="display: none;">
    <form id="data">
        <div class="form-group">
            <label>Email or Username</label>