예제 #1
0
function threadList($boardid, $page)
{
    global $db;
    $tbl_thread = MYSQL_TABLE_PREFIX . 'thread';
    $tbl_users = MYSQL_TABLE_PREFIX . 'users';
    global $config;
    global $lang;
    if ($page == 0) {
        $page = 1;
    }
    $tpp = $config->get('board', 'threads-per-page');
    $ppp = $config->get('board', 'posts-per-page');
    $limit = ($page - 1) * $tpp;
    $sql = "SELECT * FROM `" . $tbl_thread . "`, `" . $tbl_users . "` WHERE `" . $tbl_thread . "`.`boardid`=" . (int) $boardid . " AND `" . $tbl_thread . "`.`userid`=`" . $tbl_users . "`.`userid` ORDER BY `" . $tbl_thread . "`.`sticky` DESC, `" . $tbl_thread . "`.`lastpost` DESC LIMIT " . $limit . ", " . $tpp . ";";
    $result = $db->query($sql);
    while ($row = mysql_fetch_assoc($result)) {
        if ($row['sticky'] == 1) {
            $row['thread'] = makeHTMLBold($lang->get('sticky') . ":") . " " . $row['thread'];
        }
        $post = $db->selectOneRow('post', 'postid', "`threadid`=" . $row['threadid'], "`postid` DESC", "1");
        $row['last_post'] = makeLastPost($boardid, $row['threadid'], $post['postid'], $ppp);
        $row['thread'] = stripslashes($row['thread']);
        $row['answers'] = numPostsInThread($row['threadid']) - 1;
        $row['url'] = makeURL('board', array('boardid' => $_GET['boardid'], 'threadid' => $row['threadid']));
        $row['newposts'] = makeNewPostsIcon(threadNewPosts($row['threadid']), userPosts($row['threadid']));
        $list[] = $row;
    }
    return $list;
}
예제 #2
0
<?php

include 'include.php';
isAllowed();
if (isset($_GET['id'])) {
    $user = getUser($_GET['id']);
} else {
    $user = $_SESSION['profil'];
}
$pages = userPages($user['id']);
if ($pages > 0) {
    if (isset($_GET['page'])) {
        $content = userPosts($user['id'], $_GET['page']);
    } else {
        $content = userPosts($user['id']);
    }
    $content = $content->posts;
}
if ($user['id'] !== $_SESSION['profil']['id']) {
    $follow = alreadyFollow($_SESSION['profil']['id'], $user['id']);
    $friend = alreadyAsked($_SESSION['profil']['id'], $user['id']);
}
getHeader();
?>

<article>
	<!-- Contenu de la page -->
	<div class="contenu">
		<div class="contenu_static">
			<?php 
if ($user['id'] !== $_SESSION['profil']['id']) {