Exemplo n.º 1
0
function makeLastPost($boardid, $threadid, $postid, $ppp)
{
    global $lang;
    global $db;
    global $user;
    global $debug;
    if ($postid > 0) {
        $debug->add('ppp', $ppp);
        $page = lastPage($threadid, $ppp);
        $post = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'post', "*", "`postid`=" . (int) $postid);
        $u = $user->getUserByID($post['userid']);
        $s[] = "%a";
        $r[] = $u['nickname'];
        $s[] = "%t";
        $r[] = timeElapsed($post['timestamp']);
        return makeHTMLURL(str_replace($s, $r, $lang->get('last_post_by')), makeURL('board', array('boardid' => $boardid, 'threadid' => $threadid, 'page' => $page), "post" . $postid));
    } else {
        return $lang->get('last_post_none');
    }
}
Exemplo n.º 2
0
<?php

$lang->addModSpecificLocalization('board');
$tbl_p = MYSQL_TABLE_PREFIX . 'post';
$tbl_t = MYSQL_TABLE_PREFIX . 'thread';
$tbl_b = MYSQL_TABLE_PREFIX . 'board';
$tbl_gu = MYSQL_TABLE_PREFIX . 'group_users';
$tbl_g = MYSQL_TABLE_PREFIX . 'groups';
$limit = (int) $config->get('board', 'box-posts');
$limit = $limit > 0 ? $limit : 5;
$ppp = $config->get('board', 'posts-per-page');
require_once './mod/default/board/board.function.php';
if ($config->get('board', 'box-thread-once') == 1) {
    $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid, threads.lastpost \r\n\t\t\t\t\tFROM `" . $tbl_t . "` AS threads \r\n\t\t\t\t\tINNER JOIN `" . $tbl_p . "` AS posts\r\n\t\t\t\t\tON threads.lastpost=posts.postid\r\n\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\t\t\t\t\tWHERE group_users.userid=" . $login->currentUserID() . " OR (group_users.userid is NULL AND groups.groupid IS NULL)\r\n\t\t\t\t\tORDER BY posts.timestamp DESC\r\n\t\t\t\t\tLIMIT {$limit};");
} else {
    $sql = $db->query("SELECT posts.userid as userid, posts.timestamp, threads.thread, boards.boardid, threads.threadid, threads.lastpost FROM \r\n\t\t\t\t\t`" . $tbl_p . "` AS posts \r\n\t\t\t\t\tINNER JOIN `" . $tbl_t . "` AS threads \r\n\t\t\t\t\tON threads.threadid=posts.threadid\r\n\t\t\t\t\tINNER JOIN `" . $tbl_b . "` AS boards\r\n\t\t\t\t\tON threads.boardid=boards.boardid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_g . "` AS groups\r\n\t\t\t\t\tON boards.`assigned_groupid`=groups.groupid\r\n\t\t\t\t\tLEFT JOIN `" . $tbl_gu . "` AS group_users\r\n\t\t\t\t\tON boards.`assigned_groupid`=group_users.groupid\r\n\t\t\t\t\tWHERE group_users.userid=" . $login->currentUserID() . " OR (group_users.userid is NULL AND groups.groupid IS NULL)\r\n\t\t\t\t\tORDER BY posts.timestamp DESC\r\n\t\t\t\t\tLIMIT {$limit};");
}
$list = array();
while ($list_entry = mysql_fetch_assoc($sql)) {
    $list[] = $list_entry;
}
if (null != $list && count($list) > 0) {
    foreach ($list as $i => $l) {
        $u = $user->getUserById($l['userid']);
        $list[$i]['url'] = makeURL('board', array('boardid' => $l['boardid'], 'threadid' => $l['threadid'], 'page' => lastPage($l['threadid'], $ppp)), "post" . $l['lastpost']);
        $list[$i]['info'] = '(' . makeHTMLURL($u['nickname'], makeURL('profile', array('userid' => $u['userid']))) . ', ' . timeElapsed($l['timestamp']) . ')';
    }
}
$smarty->assign('box_board_posts', $list);
$tpl_file = $template_dir . "/posts.tpl";
$visible = true;
Exemplo n.º 3
0
     }
 default:
     // add admin menu
     if ($isallowed) {
         $menu->addSubElement($mod, $lang->get('thread_move'), 'thread_move', array('boardid' => $boardid, 'threadid' => $threadid));
         $menu->addSubElement($mod, $lang->get('thread_remove'), 'thread_remove', array('boardid' => $boardid, 'threadid' => $threadid));
         $menu->addSubElement($mod, $lang->get('thread_edit'), 'thread_edit', array('boardid' => $boardid, 'threadid' => $threadid));
     }
     // Increase hit counter
     if ($mode == '' and @$_GET['page'] == '') {
         incHits($threadid);
     }
     // add a post
     if (isset($_POST['add']) && $login->currentUser() !== false && $thread['closed'] == 0) {
         $postid = postAdd($threadid, $_POST['post'], @$_POST['attachments']);
         redirect(makeURL('board', array('boardid' => $boardid, 'threadid' => $threadid, 'page' => lastPage($threadid, $config->get('board', 'posts-per-page'))), 'post' . $postid));
     }
     @($quoteid = (int) $_GET['quoteid']);
     if ($quoteid > 0) {
         $q = getQuote($quoteid);
         $u = $user->getUserByID($q['userid']);
         $a = str_replace("%u", $u['nickname'], $lang->get('quote_by'));
         $quote = '[quote][i][url="' . makeURL('profile', array('userid' => $q['userid'])) . '"]' . $a . "[/url][/i]\n" . $q['post'] . "[/quote]";
         $smarty->assign('quote', $quote);
     } else {
         $smarty->assign('quote', '');
     }
     // Pages
     $ppp = $config->get('board', 'posts-per-page');
     @$pages->setValues($_GET['page'], $ppp, numPostsInThread($threadid));
     $smarty->assign('pages', $pages->get('board', array('boardid' => $boardid, 'threadid' => $threadid)));