예제 #1
0
$rFora = Query("select * from {forums} where id={0}", $fid);
if (NumRows($rFora)) {
    $forum = Fetch($rFora);
} else {
    Kill("Unknown forum ID.");
}
$fid = $forum['id'];
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($thread['closed'] && !HasPermission('mod.closethreads', $fid)) {
    Kill(__("This thread is locked."));
}
$OnlineUsersFid = $fid;
LoadPostToolbar();
$tags = ParseThreadTags($thread['title']);
$urlname = $isHidden ? '' : $tags[0];
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $urlname) => $tags[0], '' => __("New reply")));
if (!$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) {
    Alert(__("You are about to bump an old thread. This is usually a very bad idea. Please think about what you are about to do before you press the Post button."));
}
$attachs = array();
if (isset($_POST['saveuploads'])) {
    $attachs = HandlePostAttachments(0, false);
} else {
    if (isset($_POST['actionpreview'])) {
        $attachs = HandlePostAttachments(0, false);
        $previewPost['text'] = $_POST["text"];
        $previewPost['num'] = $loguser['posts'] + 1;
        $previewPost['posts'] = $loguser['posts'] + 1;
        $previewPost['id'] = 0;
        $previewPost['options'] = 0;
        if ($_POST['nopl']) {
예제 #2
0
$rFora = Query("select * from {forums} where id={0}", $fid);
if (NumRows($rFora)) {
    $forum = Fetch($rFora);
} else {
    Kill(__("Unknown forum ID."));
}
if ($forum['locked']) {
    Kill(__("This forum is locked."));
}
if (!isset($_POST['poll']) || isset($_GET['poll'])) {
    $_POST['poll'] = $_GET['poll'];
}
$isHidden = !HasPermission('forum.viewforum', $fid, true);
$urlname = $isHidden ? '' : $forum['title'];
$OnlineUsersFid = $fid;
MakeCrumbs(forumCrumbs($forum) + array('' => __("New thread")));
$attachs = array();
if (isset($_POST['saveuploads'])) {
    $attachs = HandlePostAttachments(0, false);
} else {
    if (isset($_POST['actionpreview'])) {
        $attachs = HandlePostAttachments(0, false);
        if ($_POST['poll']) {
            $options = array();
            $pdata = array();
            $pdata['question'] = htmlspecialchars($_POST['pollQuestion']);
            $pdata['options'] = array();
            $noColors = 0;
            $defaultColors = array("#0000B6", "#00B600", "#00B6B6", "#B60000", "#B600B6", "#B66700", "#B6B6B6", "#676767", "#6767FF", "#67FF67", "#67FFFF", "#FF6767", "#FF67FF", "#FFFF67", "#FFFFFF");
            $totalVotes = 0;
            foreach ($_POST['pollOption'] as $i => $opt) {
예제 #3
0
if (!HasPermission('forum.viewforum', $fid)) {
    Kill(__('You may not access this forum.'));
}
$tags = ParseThreadTags($thread['title']);
$isHidden = !HasPermission('forum.viewforum', $fid, true);
if ($_POST['report']) {
    if ($_POST['key'] !== $loguser['token']) {
        Kill(__('No.'));
    }
    // TODO make this use actual notifications or anything better
    Query("INSERT INTO {pmsgs_text} (title,text) VALUES ({0},{1})", "Post report (post #{$pid})", '');
    $pmid = InsertId();
    Query("INSERT INTO {pmsgs} (id,userto,userfrom,date,ip,msgread,deleted,drafting)\n\t\tVALUES ({0},{1},{2},{3},{4},0,0,0)", $pmid, -1, $loguserid, time(), $_SERVER['REMOTE_ADDR']);
    $report = "<strong>Post report</strong>\n\n<strong>Post:</strong> " . actionLinkTag($tags[0], 'post', $pid) . " (post #{$pid})\n\n<strong>Message:</strong>\n{$_POST['message']}\n\n" . actionLinkTag('Mark issue as resolved', 'showprivate', $pmid, 'markread=1');
    Query("UPDATE {pmsgs_text} SET text={0} WHERE pid={1}", $report, $pmid);
    SendNotification('pm', $pmid, -1);
    die(header('Location: ' . actionLink('post', $pid)));
}
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $isHidden ? '' : $tags[0]) => $tags[0], '' => __("Report post")));
$user = Fetch(Query("SELECT * FROM {users} WHERE id={0}", $post['user']));
foreach ($user as $key => $value) {
    $post['u_' . $key] = $value;
}
MakePost($post, POST_SAMPLE);
$fields = array('message' => '<textarea id="text" name="message" rows=10></textarea>', 'btnSubmit' => '<input type="submit" name="report" value="' . __('Submit report') . '">');
echo '
	<form action="" method="POST">';
RenderTemplate('form_reportpost', array('fields' => $fields));
echo '
		<input type="hidden" name="key" value="' . $loguser['token'] . '">
	</form>';
예제 #4
0
        }
    }
    if (HasPermission('mod.trashthreads', $fid) && Settings::get('trashForum')) {
        if ($forum['id'] != Settings::get('trashForum')) {
            $links[] = actionLinkTag(__("Trash"), "editthread", $tid, "action=trash&key=" . $loguser['token']);
        }
    }
    if (HasPermission('mod.deletethreads', $fid) && Settings::get('secretTrashForum')) {
        if ($forum['id'] != Settings::get('secretTrashForum')) {
            $links[] = actionLinkTagConfirm(__("Delete"), __("Are you sure you want to just up and delete this whole thread?"), "editthread", $tid, "action=delete&key=" . $loguser['token']);
        }
    }
}
$OnlineUsersFid = $fid;
LoadPostToolbar();
MakeCrumbs(forumCrumbs($forum) + array(actionLink("thread", $tid, '', $urlname) => $threadtags[0]), $links);
if ($thread['poll']) {
    $poll = Fetch(Query("SELECT p.*,\n\t\t\t\t\t\t\t(SELECT COUNT(DISTINCT user) FROM {pollvotes} pv WHERE pv.poll = p.id) as users,\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM {pollvotes} pv WHERE pv.poll = p.id) as votes\n\t\t\t\t\t\t FROM {poll} p\n\t\t\t\t\t\t WHERE p.id={0}", $thread['poll']));
    if (!$poll) {
        Kill(__("Poll not found"));
    }
    $totalVotes = $poll['users'];
    $rOptions = Query("SELECT pc.*,\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM {pollvotes} pv WHERE pv.poll = {0} AND pv.choiceid = pc.id) as votes,\n\t\t\t\t\t\t\t(SELECT COUNT(*) FROM {pollvotes} pv WHERE pv.poll = {0} AND pv.choiceid = pc.id AND pv.user = {1}) as myvote\n\t\t\t\t\t   FROM {poll_choices} pc\n\t\t\t\t\t   WHERE poll={0}", $thread['poll'], $loguserid);
    $pops = 0;
    $noColors = 0;
    $defaultColors = array("#0000B6", "#00B600", "#00B6B6", "#B60000", "#B600B6", "#B66700", "#B6B6B6", "#676767", "#6767FF", "#67FF67", "#67FFFF", "#FF6767", "#FF67FF", "#FFFF67", "#FFFFFF");
    $pdata = array();
    $pdata['question'] = htmlspecialchars($poll['question']);
    $pdata['options'] = array();
    while ($option = Fetch($rOptions)) {
        $odata = array();
예제 #5
0
    $links[] = actionLinkTag(__("Mark forum read"), "forum", $fid, "action=markasread", $urlname);
}
if ($loguserid) {
    if ($isIgnored) {
        $links[] = actionLinkTag(__("Unignore forum"), "forum", $fid, "unignore", $urlname);
    } else {
        $links[] = actionLinkTag(__("Ignore forum"), "forum", $fid, "ignore", $urlname);
    }
    if (HasPermission('forum.postthreads', $fid)) {
        $links[] = actionLinkTag(__("Post thread"), "newthread", $fid, '', $urlname);
    }
}
$metaStuff['description'] = htmlspecialchars(strip_tags($forum['description']));
$metaStuff['tags'] = getKeywords(strip_tags($forum['title']));
$OnlineUsersFid = $fid;
MakeCrumbs(forumCrumbs($forum), $links);
makeAnncBar();
makeForumListing($fid);
$total = $forum['numthreads'];
$tpp = $loguser['threadsperpage'];
if (isset($_GET['from'])) {
    $from = (int) $_GET['from'];
} else {
    $from = 0;
}
if (!$tpp) {
    $tpp = 50;
}
$rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={3}" : '') . "\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {1u}, {2u}", $fid, $from, $tpp, $loguserid);
$pagelinks = PageLinks(actionLink("forum", $fid, "from=", $urlname), $tpp, $from, $total);
$ppp = $loguser['postsperpage'];
예제 #6
0
if (!defined('BLARG')) {
    die;
}
$board = $_GET['id'];
if (!$board) {
    $board = '';
}
if (!isset($forumBoards[$board])) {
    $board = '';
}
if ($loguserid && isset($_GET['action']) && $_GET['action'] == "markallread") {
    Query("REPLACE INTO {threadsread} (id,thread,date) SELECT {0}, t.id, {1} FROM {threads} t" . ($board != '' ? ' LEFT JOIN {forums} f ON f.id=t.forum WHERE f.board={2}' : ''), $loguserid, time(), $board);
    die(header("Location: " . actionLink("board", $board)));
}
$links = array();
if ($loguserid) {
    $links[] = actionLinkTag(__("Mark all forums read"), "board", $board, "action=markallread");
}
MakeCrumbs(forumCrumbs(array('board' => $board)), $links);
if ($board == '') {
    $statData = Fetch(Query("SELECT\n\t\t(SELECT COUNT(*) FROM {threads}) AS numThreads,\n\t\t(SELECT COUNT(*) FROM {posts}) AS numPosts,\n\t\t(SELECT COUNT(*) FROM {users}) AS numUsers,\n\t\t(select count(*) from {posts} where date > {0}) AS newToday,\n\t\t(select count(*) from {posts} where date > {1}) AS newLastHour,\n\t\t(select count(*) from {users} where lastposttime > {2}) AS numActive", time() - 86400, time() - 3600, time() - 2592000));
    $statData['pctActive'] = $statData['numUsers'] ? ceil(100 / $statData['numUsers'] * $statData['numActive']) : 0;
    $lastUser = Query("select u.(_userfields) from {users} u order by u.regdate desc limit 1");
    if (numRows($lastUser)) {
        $lastUser = getDataPrefix(Fetch($lastUser), "u_");
        $statData['lastUserLink'] = UserLink($lastUser);
    }
    RenderTemplate('boardstats', array('stats' => $statData));
}
makeAnncBar();
makeForumListing(0, $board);