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']; if (!$ppp) { $ppp = 20;
<?php if ($loguserid && isset($_GET['action']) && $_GET['action'] == "markallread") { Query("REPLACE INTO {threadsread} (id,thread,date) SELECT {0}, {threads}.id, {1} FROM {threads}", $loguserid, time()); redirectAction("board"); } $links = new PipeMenu(); if ($loguserid) { $links->add(new PipeMenuLinkEntry(__("Mark all forums read"), "board", 0, "action=markallread", "ok")); } makeLinks($links); makeBreadcrumbs(new PipeMenu()); if (!$mobileLayout) { $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)); $stats = Format(__("{0} and {1} total"), Plural($statData["numThreads"], __("thread")), Plural($statData["numPosts"], __("post"))); $stats .= "<br />" . format(__("{0} today, {1} last hour"), Plural($statData["newToday"], __("new post")), $statData["newLastHour"]); $percent = $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_"); $last = format(__("{0}, {1} active ({2}%)"), Plural($statData["numUsers"], __("registered user")), $statData["numActive"], $percent) . "<br />" . format(__("Newest: {0}"), UserLink($lastUser)); } else { $last = __("No registered users") . "<br /> "; } write("\n\t\t<table class=\"outline margin width100\" style=\"overflow: auto;\">\n\t\t\t<tr class=\"cell2 center\" style=\"overflow: auto;\">\n\t\t\t<td>\n\t\t\t\t<div style=\"float: left; width: 25%;\"> <br /> </div>\n\t\t\t\t<div style=\"float: right; width: 25%;\">{1}</div>\n\t\t\t\t<div class=\"center\">\n\t\t\t\t\t{0}\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t", $stats, $last); } printRefreshCode(); makeForumListing(0);
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);