Exemple #1
0
		<?php 
if ($userId != $id) {
    if (userFollows($userId, $id)) {
        echo '<p><button type="submit" class="btn btn-danger" id="followButton">Unfollow</button></p>';
    } else {
        echo '<p><button type="submit" class="btn btn-primary" id="followButton">Follow</button></p>';
    }
}
?>
	</div>
</div>
<div class="container">
	<div class="col-md-6 posts">
	<?php 
$postSnippetLength = 500;
foreach (getUserPosts($id) as $post) {
    echo '<div class="panel panel-default">';
    echo '<div class="panel-heading">';
    echo '<img class="avatar-post" src="' . $post['profile_picture'] . '">';
    echo '<a href="viewPost.php?postId=' . $post['id'] . '">';
    echo $post['title'];
    echo '</a>';
    echo '<small> ' . formatDate($post['date_added']) . ' by ' . getUserName($post['user_id']) . '</small>';
    echo ' - Number of comments: <b><a href="viewPost.php?postId=' . $post['id'] . '"><b>' . $post['comment_count'] . '</b></a></b></small>';
    if ($user['id'] === $_SESSION['userId']) {
        echo '<button type="button" class ="btn btn-danger btn-sm pull-right" onclick="deleteAsk(' . (int) $post['id'] . ')">X</button>';
    }
    echo '</div><div class="panel-body">';
    if (strlen($post['body']) > $postSnippetLength) {
        echo substr($post['body'], 0, $postSnippetLength) . '...<br><a href="viewPost.php?postId=' . $post['id'] . '"> Read more</a>' . '<br>';
    } else {
Exemple #2
0
}
$smarty->assign('profile_info', getUserProfileInfo($profile_username));
$smarty->assign('n_friends_usr', countFriends(getUserId($_SESSION['username'])));
$smarty->assign('n_friends_prf', countFriends(getUserId($profile_username)));
$smarty->assign('n_circles', getNumberOfCircles(getUserId($_SESSION['username'])));
$friendsID = getFriendsId($profile_username);
foreach ($friendsID as $friendID) {
    $friends[$friendID['idauthenticated2']] = getUsername($friendID['idauthenticated2']);
    $friends[$friendID['idauthenticated2']]['info'] = getUserProfileInfo(getUsername($friendID['idauthenticated2'])['username']);
}
$smarty->assign('friends', $friends);
$data = getCurrentDate();
$smarty->assign('data', $data);
$circles = getCirclesByUser(getUserId($_SESSION['username']));
$smarty->assign('circles', $circles);
$posts = getUserPosts($profile_username, getUserId($profile_username));
foreach ($posts as $post) {
    if (postInCircle($post['idpost'])) {
        if (postFromCorrectCircle(getUserId($_SESSION['username']), $post['idpost'])) {
            $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost']));
            $posts_profile[$post['idpost']]['post'] = $post;
            $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']);
        }
    } else {
        $posts_profile[$post['idpost']]['date'] = getDatee(extractRegDate($post['idpost']));
        $posts_profile[$post['idpost']]['post'] = $post;
        $posts_profile[$post['idpost']]['profile'] = getUserProfileInfo(getUsername($post['idauthenticated'])['username']);
    }
}
$smarty->assign('posts', $posts_profile);
if (isAdmin($_SESSION['username']) == 1) {
Exemple #3
0
function deleteUser()
{
    if (isset($_POST['del_user'])) {
        $sess_id = $_SESSION['user_id'];
        $sess_username = $_SESSION['username'];
        /* DEL POSTS */
        $posts = getUserPosts($_SESSION['username']);
        foreach ($posts as $post) {
            $post_id = $post['post_id'];
            dbAdd("DELETE FROM litter_posts\n\t\t\tWHERE post_id = '{$post_id}' AND user_id = '{$sess_id}'");
            $comments = getComment($post_id);
            if (!empty($comments)) {
                foreach ($comments as $comments) {
                    $user_id = $comments['user_id'];
                    dbAdd("DELETE FROM litter_posts\n\t\t\t\t\t\tWHERE reply = '{$post_id}' AND user_id = '{$user_id}'");
                }
            }
        }
        /* CLEAN FOLLOWING */
        dbAdd("DELETE FROM litter_following\n\t\t\tWHERE user_id = '{$sess_id}'");
        /* CLEAN FOLLOWERS */
        dbAdd("DELETE FROM litter_following\n\t\t\tWHERE following = '{$sess_id}'");
        /* CLEAN FOLDER */
        $dir = 'userIMG/' . $sess_id . '/';
        // Open the directory
        $dirHandle = opendir($dir);
        // Loop over all of the files in the folder
        while ($file = readdir($dirHandle)) {
            // If $file is NOT a directory remove it
            if (!is_dir($file)) {
                unlink("{$dir}" . "{$file}");
                // unlink() deletes the files
            }
        }
        // Close the directory
        closedir($dirHandle);
        /* REMOVE FOLDER */
        rmdir($dir);
        /* DEL USER */
        dbAdd("DELETE FROM litter_users\n\t\tWHERE user_id = '{$sess_id}' AND username = '******'");
        session_destroy();
        session_start();
        $_SESSION['error'] = 'Your account has been deleted...';
        header('Location: form.php');
    }
}
Exemple #4
0
$post = getAllPosts();
$profile = 'all';
$fulltag = '';
/* WHICH POSTS TO SHOW*/
if (isset($_GET['profile'])) {
    $profile = preg_replace("/[^a-zA-Z0-9@#]/", "", $_GET['profile']);
    if ($profile == 'all') {
        $post = getAllPosts();
    } elseif ($profile == 'at' . $sess['username']) {
        $post = findAt($sess['username']);
    } elseif (!$profile == getUser($profile)) {
        print '<div class="post_it"><h3>';
        print "There's no user with that name...";
        print '</h3><button type="button" id="hide_btn" class="button">close</button></div>';
    } else {
        $post = getUserPosts($profile);
        $get = getUser($profile);
    }
}
/* CREATE TAGS */
if (isset($_GET['tag'])) {
    $tag = preg_replace('#[^a-z0-9_-å-ä-ö-Å-Ä-Ö-]#i', '', $_GET["tag"]);
    $fulltag = "#" . $tag;
    $post = findHashtag($fulltag);
}
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
Exemple #5
0
<?php

if ($post == getUserPosts($profile)) {
    if (empty(getUserPosts($profile))) {
        if ($profile !== $sess['username']) {
            if ($profile == 'at' . $sess['username']) {
                print '<div class="postit"><ul><li>';
                print "You haven't been mentioned by anyone yet...";
                print '</li></ul></div>';
            } else {
                print '<div class="postit"><ul><li>';
                print atLink($get['username']) . "'s too clean, no litter!";
                print '</li></ul></div>';
            }
        } else {
            print '<div class="postit"><ul><li>';
            print "It's all clean, start litter!";
            print '</li></ul></div>';
        }
    }
}
foreach ($post as $post) {
    if ($post['reply'] == 0) {
        if ($post['recycle'] > 0) {
            print '<div class="post paper">';
        } else {
            print '<div class="post">';
        }
        print '<a name="' . $post['post_id'] . '"></a>';
        /*DELETE_BUTTON*/
        if ($sess['user_id'] == $post['user_id']) {
Exemple #6
0
         $img_del = cs_icon('editdelete', 16, $cs_lang['remove']);
         $data['comment'][$run]['remove'] = cs_link($img_del, $mod, 'com_remove', 'id=' . $cs_com[$run]['comments_id'], 0, $cs_lang['remove']);
     }
     $data['comment'][$run]['anch'] = ' | ' . cs_html_link('#threadanch', cs_icon('up'), 0);
 }
 //Thema Neu
 $data['if']['sort_desc'] = false;
 $data['if']['sort_desc'] = false;
 $data['if']['thread_desc_files'] = false;
 $data['thread_desc']['signature'] = '';
 $data['thread_desc']['checkedit'] = '';
 if ($board_sort == 'DESC') {
     $data['if']['sort_desc'] = true;
     $userid = $data['thread']['users_id'];
     if (!isset($count_com[$userid])) {
         $count_com[$userid] = getUserPosts($userid);
     }
     $user = cs_secure($data['thread']['users_nick']);
     $data['thread_desc']['country'] = $data['thread']['users_country'];
     $data['thread_desc']['users_link'] = cs_user($data['thread']['users_id'], $data['thread']['users_nick'], $data['thread']['users_active'], $data['thread']['users_delete']);
     $key = array_search($userid, $mods);
     if (!empty($key)) {
         $data['if']['moderator'] = true;
         $f_user = "******" . $userid . "'";
         $boardmod = cs_sql_select(__FILE__, 'boardmods', 'categories_id, users_id', $f_user);
         $f_cat = "categories_id = '" . $boardmod['categories_id'] . "'";
         $bm_cat = cs_sql_select(__FILE__, 'categories', 'categories_id, categories_name', $f_cat);
         $data['thread_desc']['boardmod'] = $bm_cat['categories_name'];
     } else {
         $data['if']['no_moderator'] = true;
         $data['thread_desc']['users_rank'] = getUserRank($count_com[$userid], $ranks);
Exemple #7
0
<?php

require 'config/initialize.php';
mustBeAuthenticated();
$user = getByUsername($_GET['username'], $connection);
if ($user->num_rows) {
    $user = $user->fetch_array(MYSQLI_ASSOC);
    $posts = getUserPosts($user['id'], $connection);
    $publicPosts = getUserSpecificPosts($user['id'], 2, $connection);
    $pendingStatus = isPending($_SESSION['id'], $user['id'], $connection)->fetch_array(MYSQLI_ASSOC);
    view('main/detail', ['user' => $user, 'posts' => $posts, 'publicPosts' => $publicPosts, 'pendingStatus' => $pendingStatus]);
} else {
    header('location:/');
}
Exemple #8
0
$following = getFollowers($get['user_id']);
if (count($following) == 0) {
    print "None, follow " . $get['username'] . "!";
} else {
    print '<div id="online_container">';
    foreach ($following as $following) {
        print '<div class="whos_online">';
        print '<a href="profile.php?profile=' . $following['username'] . '" title="' . $following['username'] . '">' . getProfilePic($following['user_id'], '50px') . '</a>';
        print '</div>';
    }
    print '</div>';
}
print '</div>';
print '</div>';
if ($sess['user_id'] == $get['user_id']) {
    print '<br><a href="profile.php?profile=at' . $sess['username'] . '">See where you have been mentioned</a><br>';
    print '<a href="edit.php">Edit your settings</a>';
}
print '</div>';
print '<div id="wrapper">';
if ($post == getAllPosts() || $post == getUserPosts($profile)) {
    require_once 'post.php';
} else {
    if ($post == findAt($sess['username'])) {
        require_once 'atpost.php';
    } else {
        require_once 'tagpost.php';
    }
}
print '</div>';
require_once 'footer.php';
Exemple #9
0
$target_likeNum = getLikeNumByuid($target_uid);
$target_avatar = 'images/uploads/avatar_100/' . $row['avatar'];
// pager setting
$totalRows = getPostNumByUid($target_uid);
$pageSize = pageSize;
$totalPage = ceil($totalRows / $pageSize);
@($page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1);
if ($page < 1 || $page == null || !is_numeric($page)) {
    $page = 1;
}
if ($page > $totalPage) {
    $page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
//get target user all posts
$rows = getUserPosts($target_uid, $offset, $pageSize);
// 此页面必须先拿到用户数据,再显示page title,所以引用header放在了下面,并且页面开头单独引用了include.php
$pageTitle = $target_name . "的个人页面";
require_once 'includes/header.php';
//user info block
echo '<div class="user_info">';
echo '<img src="' . $target_avatar . '" alt="">';
echo '<span class="user_info_name">' . $target_name . '</span><br>';
echo '<span class="user_info_num">记录数:&nbsp;' . $totalRows . '&nbsp;条</span><br>';
echo '<span class="user_info_regTime">被赞数:&nbsp;' . $target_likeNum . '</span>';
echo '</div>';
//end user_info div
//user posts block
echo '<ul class="post_list">';
if ($rows) {
    foreach ($rows as $row) {
Exemple #10
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$posts = 10;
$threads = 10;
include 'mods/board/functions.php';
$cs_lang = cs_translate('board');
$user_id = $_GET['id'];
settype($user_id, 'integer');
$board_access = $account['access_board'];
$where = "users_id = '" . $user_id . "'";
$board_count = cs_sql_count(__FILE__, 'board', $where);
$cs_user = cs_sql_select(__FILE__, 'users', 'users_nick, users_register, users_active, users_delete', "users_id = '" . $user_id . "'");
$userposts = getUserPosts($user_id);
$data['users']['addons'] = cs_addons('users', 'view', $user_id, 'board');
$cs_ranks = cs_sql_select(__FILE__, 'boardranks', 'boardranks_min, boardranks_name', 0, 'boardranks_min ASC', 0, 0);
$data['count']['com'] = $userposts;
$since = cs_time() - $cs_user['users_register'];
$since = $since <= 86400 ? 1 : $since / 86400;
$posts_per_day = $userposts / $since;
$data['count_com']['per_day'] = round($posts_per_day, 2) . $cs_lang['posts_per_day'];
$data['count']['rank'] = cs_secure(getRankTitle($userposts, $cs_ranks));
$data['last']['com'] = sprintf($cs_lang['last_com'], $posts);
$data['last']['thr'] = sprintf($cs_lang['last_thr'], $threads);
$from = 'comments cms INNER JOIN {pre}_threads thr ON cms.comments_fid = thr.threads_id ';
$from .= 'INNER JOIN {pre}_board frm ON frm.board_id = thr.board_id ';
$from .= 'INNER JOIN {pre}_categories cat ON cat.categories_id = frm.categories_id';
$select = 'DISTINCT thr.threads_id AS threads_id, cat.categories_name AS categories_name, ';
$select .= 'cat.categories_id AS categories_id, frm.board_name AS board_name, frm.board_id AS board_id, ';
$select .= 'thr.threads_headline AS threads_headline, thr.threads_last_time AS threads_last_time, ';
Exemple #11
0
$pageTitle = "个人中心";
require_once 'includes/header.php';
// pager setting
$totalRows = getPostNumByUid($uid);
$pageSize = pageSize;
$totalPage = ceil($totalRows / $pageSize);
@($page = $_REQUEST['page'] ? (int) $_REQUEST['page'] : 1);
if ($page < 1 || $page == null || !is_numeric($page)) {
    $page = 1;
}
if ($page > $totalPage) {
    $page = $totalPage;
}
$offset = ($page - 1) * $pageSize;
//get user post data
$rows = getUserPosts($uid, $offset, $pageSize);
?>

<!-- post form -->
<form class="post_form" method="post" action="doAction.php?act=post" enctype="multipart/form-data">
	<textarea name="post" id=""  rows="3" placeholder="在想什么呢?"></textarea><br>
	<label for="postImage">添加图片:</label>
	<input class="postImage"  type="file" id="postImage"  name="postImage" accept="image/jpeg,image/gif,image/jpg,image/png"><br><br>
	<input class="submit" type="submit" name="submit" value="记录">
</form>

<?php 
echo '<ul class="post_list">';
if ($rows) {
    foreach ($rows as $row) {
        // loop through each post