function makeThreadListing($threads, $pagelinks, $dostickies = true, $showforum = false) { global $loguserid, $loguser, $misc; $threadlist = array(); while ($thread = Fetch($threads)) { $tdata = array('id' => $thread['id']); $starter = getDataPrefix($thread, 'su_'); $last = getDataPrefix($thread, 'lu_'); $ispublic = HasPermission('forum.viewforum', $thread['forum'], true); $tags = ParseThreadTags($thread['title']); $urlname = $ispublic ? $tags[0] : ''; $threadlink = actionLinkTag($tags[0], 'thread', $thread['id'], '', $urlname); $tdata['link'] = Settings::get("tagsDirection") === 'Left' ? $tags[1] . ' ' . $threadlink : $threadlink . ' ' . $tags[1]; $NewIcon = ''; $tdata['gotonew'] = ''; if ($thread['closed']) { $NewIcon = 'off'; } if ($thread['replies'] >= $misc['hotcount']) { $NewIcon .= 'hot'; } if (!$loguserid && $thread['lastpostdate'] > time() - 900 || $loguserid && $thread['lastpostdate'] > $thread['readdate']) { $NewIcon .= 'new'; if ($loguserid) { $tdata['gotonew'] = actionLinkTag('<img src="' . resourceLink('img/gotounread.png') . '" alt="[go to first unread post]">', 'post', '', 'tid=' . $thread['id'] . '&time=' . (int) $thread['readdate']); } } else { if (!$thread['closed'] && !$thread['sticky'] && Settings::get("oldThreadThreshold") > 0 && $thread['lastpostdate'] < time() - 2592000 * Settings::get("oldThreadThreshold")) { $NewIcon = 'old'; } } if ($NewIcon) { $tdata['new'] = '<div class="statusIcon ' . $NewIcon . '"></div>'; } else { $tdata['new'] = ''; } $tdata['sticky'] = $thread['sticky']; if ($thread['icon']) { //This is a hack, but given how icons are stored in the DB, I can do nothing about it without breaking DB compatibility. if (startsWith($thread['icon'], "img/")) { $thread['icon'] = resourceLink($thread['icon']); } $tdata['icon'] = "<img src=\"" . htmlspecialchars($thread['icon']) . "\" alt=\"\" class=\"smiley\" style=\"max-width:32px; max-height:32px;\">"; } else { $tdata['icon'] = ''; } $tdata['poll'] = $thread['poll'] ? "<img src=\"" . resourceLink("img/poll.png") . "\" alt=\"[poll]\">" : ""; $n = 4; $total = $thread['replies']; $ppp = $loguser['postsperpage']; if (!$ppp) { $ppp = 20; } $numpages = floor($total / $ppp); $pl = ''; if ($numpages <= $n * 2) { for ($i = 1; $i <= $numpages; $i++) { $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname); } } else { for ($i = 1; $i < $n; $i++) { $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname); } $pl .= " … "; for ($i = $numpages - $n + 1; $i <= $numpages; $i++) { $pl .= " " . actionLinkTag($i + 1, "thread", $thread['id'], "from=" . $i * $ppp, $urlname); } } if ($pl) { $tdata['pagelinks'] = actionLinkTag(1, "thread", $thread['id'], '', $urlname) . $pl; } else { $tdata['pagelinks'] = ''; } if ($showforum) { $tdata['forumlink'] = actionLinkTag(htmlspecialchars($thread["f_title"]), "forum", $thread["f_id"], "", $ispublic ? $thread["f_title"] : ''); } $tdata['startuser'] = UserLink($starter); $tdata['replies'] = $thread['replies']; $tdata['views'] = $thread['views']; $tdata['lastpostdate'] = formatdate($thread['lastpostdate']); $tdata['lastpostuser'] = UserLink($last); $tdata['lastpostlink'] = actionLink("post", $thread['lastpostid']); $threadlist[$tdata['id']] = $tdata; } RenderTemplate('threadlist', array('threads' => $threadlist, 'pagelinks' => $pagelinks, 'dostickies' => $dostickies, 'showforum' => $showforum)); }
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"); while ($option = Fetch($rOptions)) { if ($option['color'] == "") { $option['color'] = $defaultColors[($option["id"] + 9) % 15]; } $chosen = $option["myvote"] ? "✔" : ""; $cellClass = ($cellClass + 1) % 2; if ($loguserid && !$thread['closed'] && IsAllowed("vote")) { $label = $chosen . " " . actionLinkTag(htmlspecialchars($option['choice']), "thread", $thread['id'], "vote=" . $option["id"] . "&token=" . $loguser["token"] . "&" . $fromstring); } else { $label = $chosen . " " . htmlspecialchars($option['choice']); } $votes = $option["votes"]; $bar = " 0"; if ($totalVotes > 0) { $width = 100 * ($votes / $totalVotes); $alt = format("{0} of {1}, {2}%", $votes, $totalVotes, $width); $bar = format("<div class=\"pollbar\" style=\"background-color: {0}; width: {1}%;\" title=\"{2}\"> {3}</div>", $option['color'], $width, $alt, $votes); if ($width == 0) { $bar = " " . $votes; } } $pollLines .= "\n\t<tr class=\"cell{$cellClass}\">\n\t\t<td>\n\t\t\t{$label}\n\t\t</td>\n\t\t<td class=\"width75\">\n\t\t\t<div class=\"pollbarContainer\">\n\t\t\t\t{$bar}\n\t\t\t</div>\n\t\t</td>\n\t</tr>"; }
function makeNiceLink($m) { return actionLinkTag(htmlspecialchars($m[2]), 'wiki', title2url($m[1])); }
$entries = Query("select \n\t\t\t\t\t\tup.*, \n\t\t\t\t\t\tu.name, u.displayname, u.powerlevel, u.sex \n\t\t\t\t\tfrom {uploader} up\n\t\t\t\t\tleft join {users} u on up.user = u.id \n\t\t\t\t\twhere up.private = 0 order by " . $skey . $sdir); if (NumRows($entries) == 0 && !$havePrivates) { $public = format("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"7\">" . __("Public Files") . "</th>\n\t\t</tr>\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"4\">\n\t\t\t\t" . __("The uploader is empty.") . "\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n"); } else { if ($havePrivates) { $head = str_replace("<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />", "", $head); } $public = format("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"7\">" . __("Public Files") . "</th>\n\t\t</tr>\n\t\t{0}\n", $head); while ($entry = Fetch($entries)) { $delete = ""; $multidel = ""; if ($loguserid) { $multidel = "<td><input type=\"checkbox\" name=\"delete[" . $entry['id'] . "]\" disabled=\"disabled\" /></td>"; } if ($loguserid == $entry['user'] || $loguser['powerlevel'] > 2) { $delete = "<sup> " . actionLinkTag("✘", "uploader", "", "action=delete&fid=" . $entry['id']) . "</sup>"; $multidel = "<td><input type=\"checkbox\" name=\"del[" . $entry['id'] . "]\" /></td>"; } $cellClass = ($cellClass + 1) % 2; $public .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t{7}\n\t\t\t<td>\n\t\t\t\t<a href=\"{$boardroot}get.php?id={1}\">{2}</a>{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, $entry['id'], $entry['filename'], $delete, $entry['description'], BytesToSize(@filesize($rootdir . "/" . $entry['filename'])), UserLink($entry, "user"), $multidel); } if ($loguserid) { $public .= format("\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"multidel\" />\n\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.forms[2].submit();\">" . __("delete checked") . "</a>\n\t\t\t\t</th>\n\t\t\t</tr>"); } $public .= "</table>"; } $maxSizeMult = $uploaderMaxFileSize * 1024 * 1024; if ($loguserid && IsAllowed("useUploader")) { $uploadPart = format("\n<script type=\"text/javascript\">\n\twindow.addEventListener(\"load\", function() { hookUploadCheck(\"newfile\", 1, {1}) }, false);\n</script>\n<button style=\"float: right;\" onclick=\"var uploadForm = document.getElementById("uploadForm"); uploadForm.style.display = (uploadForm.style.display == 'none' ? 'block' : 'none');\">Upload new file</button>\n<form action=\"" . actionLink("uploader") . "\" method=\"post\" enctype=\"multipart/form-data\" id=\"uploadForm\" style=\"display: none;\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"4\">" . __("Upload") . "</th>\n\t\t</tr>\n\t\t<tr class=\"cell2\">\n\t\t\t<td>\n\t\t\t\t<input type=\"file\" id=\"newfile\" name=\"newfile\" style=\"width: 80%;\" />\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" name=\"description\" style=\"width: 80%;\" />\n\t\t\t\t<label>\n\t\t\t\t\t<input type=\"checkbox\" name=\"private\" /> " . __("Private") . "\n\t\t\t\t</label>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"submit\" id=\"submit\" name=\"action\" value=\"" . __("Upload") . "\" disabled=\"disabled\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr class=\"cell1 smallFonts\">\n\t\t\t<td colspan=\"3\">\n\t\t\t\t" . __("The maximum upload size is {0} per file. You can upload the following types: {2}.") . "\n\t\t\t\t<div id=\"sizeWarning\" style=\"display: none; font-weight: bold\">" . __("File is too large.") . "</div>\n\t\t\t\t<div id=\"typeWarning\" style=\"display: none; font-weight: bold\">" . __("File is not an allowed type.") . "</div>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<br />\n</form>\n", BytesToSize($maxSizeMult), $maxSizeMult, Settings::pluginGet('uploaderWhitelist')); } $bar = " 0%";
$from = 0; } $realFrom = $total - $from - $cpp; $realLen = $cpp; if ($realFrom < 0) { $realLen += $realFrom; $realFrom = 0; } $rComments = Query("SELECT\n\t\tu.(_userfields),\n\t\t{usercomments}.id, {usercomments}.cid, {usercomments}.text\n\t\tFROM {usercomments}\n\t\tLEFT JOIN {users} u ON u.id = {usercomments}.cid\n\t\tWHERE uid={0}\n\t\tORDER BY {usercomments}.date ASC LIMIT {1u},{2u}", $id, $realFrom, $realLen); $pagelinks = PageLinksInverted(actionLink($mobileLayout ? "usercomments" : "profile", $id, "from="), $cpp, $from, $total); $commentList = ""; $commentField = ""; if (NumRows($rComments)) { while ($comment = Fetch($rComments)) { if ($canDeleteComments) { $deleteLink = "<small style=\"float: right; margin: 0px 4px;\">" . actionLinkTag("✘", $mobileLayout ? "usercomments" : "profile", $id, "action=delete&cid=" . $comment['id'] . "&token={$loguser['token']}") . "</small>"; } $cellClass = ($cellClass + 1) % 2; $thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t\t\t\t{0}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"cell{1}\">\n\t\t\t\t\t\t\t\t{3}{2}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n", UserLink(getDataPrefix($comment, "u_")), $cellClass, CleanUpPost($comment['text'], $comment['u_name']), $deleteLink); $commentList = $commentList . $thisComment; if (!isset($lastCID)) { $lastCID = $comment['cid']; } } $pagelinks = "<td colspan=\"2\" class=\"cell1\">{$pagelinks}</td>"; if ($total > $cpp) { $commentList = "{$pagelinks}{$commentList}{$pagelinks}"; } } else { $commentsWasEmpty = true; $commentList = $thisComment = format("\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"cell0\" colspan=\"2\">\n\t\t\t\t\t\t\t\t" . __("No comments.") . "\n\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n");
} if ($pm['drafting'] && !$snoop) { Kill(__("Unknown PM")); } //could say "PM is addresssed to you, but is being drafted", but what they hey? $rUser = Query("select * from {users} where id = {0}", $pm['userfrom']); if (NumRows($rUser)) { $user = Fetch($rUser); } else { Kill(__("Unknown user.")); } $links = array(); if (!$snoop && $pm['userto'] == $loguserid) { Query("update {pmsgs} set msgread=1 where id={0}", $pm['id']); DismissNotification('pm', $pm['id'], $loguserid); $links[] = actionLinkTag(__("Send reply"), "sendprivate", "", "pid=" . $pm['id']); } else { if ($_GET['markread']) { Query("update {pmsgs} set msgread=1 where id={0}", $pm['id']); DismissNotification('pm', $pm['id'], -1); die(header('Location: ' . actionLink('private'))); } } $pmtitle = htmlspecialchars($pm['title']); MakeCrumbs(array(actionLink("private") => __("Private messages"), '' => $pmtitle), $links); $pm['num'] = 0; $pm['posts'] = $user['posts']; $pm['id'] = 0; foreach ($user as $key => $value) { $pm['u_' . $key] = $value; }
} $fid = $thread['forum']; 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 '
function listCategory($cat) { global $loguser, $loguserid, $rootdir, $userSelectUsers, $boardroot; if (isset($_GET['sort']) && $_GET['sort'] == "filename" || $_GET['sort'] == "date") { $skey = $_GET['sort']; } else { $skey = "date"; } $sortOptions = "<div class=\"margin smallFonts\">" . __("Sort order") . ": <ul class=\"pipemenu\">"; $sortOptions .= $skey == "filename" ? "<li>" . __("Name") . "</li>" : actionLinkTagItem(__("Name"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=filename"); $sortOptions .= $skey == "date" ? "<li>" . __("Date") . "</li>" : actionLinkTagItem(__("Date"), "uploaderlist", "", "cat={$_GET["cat"]}&sort=date"); $sortOptions .= "</ul></div>"; $sdir = $skey == "date" ? " desc" : " asc"; print $sortOptions; if ($cat == -1) { $condition = "up.user = "******" and up.private = 1"; } else { if ($cat == -2 && $loguser['powerlevel'] > 2) { $condition = "up.private = 1"; } else { $condition = "up.private = 0 and up.category = {0}"; } } $errormsg = __("The category is empty."); if ($cat < 0) { $errormsg = __("You have no private files."); } $entries = Query("SELECT\n\t\t\tup.*,\n\t\t\tu.(_userfields)\n\t\t\tFROM {uploader} up\n\t\t\tLEFT JOIN {users} u on up.user = u.id\n\t\t\tWHERE {$condition}\n\t\t\tORDER BY " . $skey . $sdir, $cat); $checkbox = ""; if ($loguserid) { $checkbox = "<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />"; $checkbox = "<th style=\"width: 22px;\">{$checkbox}</th>"; } if (NumRows($entries) == 0) { print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell1\">\n\t\t\t\t<td colspan=\"4\">\n\t\t\t\t\t" . $errormsg . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t"; } else { print "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"7\">" . __("Files") . "</th>\n\t\t\t</tr>\n\n\t\t"; print "\n\t\t\t<tr class=\"header1\">\n\t\t\t\t{$checkbox}\n\t\t\t\t<th>\n\t\t\t\t\t" . __("File") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Description") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Size") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Uploader") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Downloads") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t"; while ($entry = Fetch($entries)) { $delete = ""; $multidel = ""; if ($loguserid) { $multidel = "<td><input type=\"checkbox\" name=\"delete[" . $entry['id'] . "]\" disabled=\"disabled\" /></td>"; } if ($loguserid == $entry['user'] || $loguser['powerlevel'] > 2) { $delete = " <sup>" . actionLinkTag("✘", "uploader", "", "action=delete&fid=" . $entry['id'] . "&cat=" . $_GET["cat"]) . "</sup>"; $multidel = "<td><input type=\"checkbox\" name=\"del[" . $entry['id'] . "]\" /></td>"; } $cellClass = ($cellClass + 1) % 2; $filepath = $rootdir . "/" . $entry['filename']; if ($entry['private']) { $filepath = $rootdir . "/" . $entry['user'] . "/" . $entry['filename']; } print format("\n\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t{7}\n\t\t\t\t<td>\n\t\t\t\t\t<a href=\"{$boardroot}get.php?id={1}\">{2}</a>{3}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{4}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{5}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{6}\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t{8}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t", $cellClass, $entry['id'], $entry['filename'], $delete, $entry['description'], BytesToSize(@filesize($filepath)), UserLink(getDataPrefix($entry, "u_")), $multidel, $entry["downloads"]); } if ($loguserid) { $entries = Query("select * from {uploader_categories} order by ord"); $movelist = ""; while ($entry = Fetch($entries)) { $movelist .= "<option value='{$entry["id"]}'>{$entry["name"]}</option>"; } $movelist = "<select name='destcat' size='1'>{$movelist}</select>"; print format("\n\t\t\t\t<tr class=\"header1\">\n\t\t\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t\t\t<input type=\"hidden\" id='actionfield' name=\"action\" value=\"multidel\" />\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multidel'; document.forms[1].submit();\">" . __("delete checked") . "</a>\n\t\t\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.getElementById('actionfield').value = 'multimove'; document.forms[1].submit();\">" . __("Move checked to") . "</a>{$movelist}\n\t\t\t\t\t</th>\n\t\t\t\t</tr>"); } print "</table>"; } }
$pdata['text'] = CleanUpPost($thread['text'], $starter['name'], false, false); if (!$thread['replies']) { $comments = 'No comments yet'; } else { if ($thread['replies'] < 2) { $comments = actionLinkTag('1 comment', 'post', $thread['lastpostid']) . ' (by ' . UserLink($last) . ')'; } else { $comments = actionLinkTag($thread['replies'] . ' comments', 'post', $thread['lastpostid']) . ' (last by ' . UserLink($last) . ')'; } } $pdata['comments'] = $comments; if ($thread['closed']) { $newreply = __('Comment posting closed.'); } else { if (!$loguserid) { $newreply = actionLinkTag(__('Log in'), 'login') . __(' to post a comment.'); } else { $newreply = actionLinkTag(__("Post a comment"), "newreply", $thread['id']); } } $pdata['replylink'] = $newreply; $modlinks = array(); if ($loguserid == $starter['id'] && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum['id'])) { $modlinks['edit'] = actionLinkTag(__('Edit'), 'editpost', $thread['pid']); } if ($loguserid == $starter['id'] && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum['id'])) { $modlinks['delete'] = actionLinkTag(__('Delete'), 'editpost', $thread['pid'], 'delete=1&key=' . $loguser['token']); } RenderTemplate('newspost', array('post' => $pdata)); } RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'bottom'));
$title = __("Administration"); $crumbs = new PipeMenu(); $crumbs->add(new PipeMenuLinkEntry(__("Admin"), "admin")); makeBreadcrumbs($crumbs); $cell2 = 1; function cell2($content) { global $cell2; $cell2 = $cell2 == 1 ? 0 : 1; Write("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t</tr>\n\t", $cell2, $content); } Write("\n\t<table class=\"outline margin width50 floatright\">\n\t\t<tr class=\"header1\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Information") . "\n\t\t\t</th>\n\t\t</tr>\n"); cell2(Format("\n\n\t\t\t\t" . __("Last viewcount milestone") . "\n\t\t\t</td>\n\t\t\t<td style=\"width: 60%;\">\n\t\t\t\t{0}\n\t\t\t", $misc['milestone'])); $bucket = "adminright"; include "./lib/pluginloader.php"; write("\n\t</table>\n"); $cell2 = 1; Write("\n\t<table class=\"outline margin width25\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("Admin tools") . "\n\t\t\t</th>\n\t\t</tr>\n"); cell2(actionLinkTag(__("Recalculate statistics"), "recalc")); cell2(actionLinkTag(__("Last Known Browsers"), "lastknownbrowsers")); cell2(actionLinkTag(__("Manage IP bans"), "ipbans")); cell2(actionLinkTag(__("Manage forum list"), "editfora")); cell2(actionLinkTag(__("Manage plugins"), "pluginmanager")); cell2(actionLinkTag(__("Edit settings"), "editsettings")); cell2(actionLinkTag(__("Edit smilies"), "editsmilies")); cell2(actionLinkTag(__("Optimize tables"), "optimize")); cell2(actionLinkTag(__("View log"), "log")); cell2(actionLinkTag(__("Update table structure"), "updateschema")); $bucket = "adminleft"; include "./lib/pluginloader.php"; write("\n\t</table>\n");
<?php if ($loguser['powerlevel'] > 3) { $shitbugs = @file_get_contents('shitbugs.dat'); $shitbugs = $shitbugs ? unserialize($shitbugs) : array(); $extra = ''; if (count($shitbugs) > 0) { $extra = format(", last at <strong>{0}</strong> by <strong>{1} ({2})</strong>", formatdate($shitbugs[0]['date']), $shitbugs[0]['ip'], $shitbugs[0]['banflags']); } write("\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"cell1\">\n\t\t\t<td style=\"text-align: center;\">\n\t\t\t\t{0}\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n", actionLinkTag(format("<span style=\"color: #f00; font-weight: normal;\"><strong>{0}</strong> suspicious request(s) logged{1}</a>", count($shitbugs), $extra), 'shitbugs')); }
function doLastPosts($compact, $limit) { global $mobileLayout, $loguser; if ($mobileLayout) { $compact = true; } $hours = 72; $rPosts = Query("SELECT\n\t\t\t\t\t\tp.id, p.date,\n\t\t\t\t\t\tu.(_userfields),\n\t\t\t\t\t\tt.title AS ttit, t.id AS tid,\n\t\t\t\t\t\tf.title AS ftit, f.id AS fid\n\t\t\t\t\tFROM {posts} p\n\t\t\t\t\t\tLEFT JOIN {users} u on u.id = p.user\n\t\t\t\t\t\tLEFT JOIN {threads} t on t.id = p.thread\n\t\t\t\t\t\tLEFT JOIN {forums} f on t.forum = f.id\n\t\t\t\t\tWHERE " . forumAccessControlSql() . " AND p.date >= {0}\n\t\t\t\t\tORDER BY date DESC LIMIT 0, {1u}", time() - $hours * 60 * 60, $limit); while ($post = Fetch($rPosts)) { $thread = array(); $thread["title"] = $post["ttit"]; $thread["id"] = $post["tid"]; $c = ($c + 1) % 2; if ($compact) { $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3} » {4}\n\t\t\t\t\t\t<br>{2}, {1} \n\t\t\t\t\t\t<span style=\"float:right\">» {6}</span>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id'])); } else { $theList .= format("\n\t\t\t\t<tr class=\"cell{5}\">\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{4}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{2}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t{1}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t» {6}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", $post['id'], formatdate($post['date']), UserLink(getDataPrefix($post, "u_")), actionLinkTag($post["ftit"], "forum", $post["fid"], "", $post["ftit"]), makeThreadLink($thread), $c, actionLinkTag($post['id'], "post", $post['id'])); } } if ($theList == "") { $theList = format("\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"5\" style=\"text-align: center\">\n\t\t\t\t" . __("Nothing has been posted in the last {0}.") . "\n\t\t\t</td>\n\t\t</tr>\n\t", Plural($hours, __("hour"))); } if ($compact) { write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList); } else { write("\n\t\t<table class=\"margin outline\">\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"5\">" . __("Last posts") . "</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>" . __("Forum") . "</th>\n\t\t\t\t<th>" . __("Thread") . "</th>\n\t\t\t\t<th>" . __("User") . "</th>\n\t\t\t\t<th>" . __("Date") . "</th>\n\t\t\t\t<th></th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t</table>\n\t\t", $theList); } }
} if ($thread['replies'] == 0) { $lastLink = ""; } $subtitle = strip_tags($thread['subtitle']); if ($subtitle != "") { $subtitle = '<br>' . $subtitle; } $postdate = formatdate($thread['date']); $posttext = CleanUpPost($thread['text'], $thread['u_name'], false, false); $comments = Plural($thread['replies'], "comment"); $comments = actionLinkTag($comments, "thread", $thread['id'], "", $thread["title"]) . "."; if ($thread['replies'] != 0) { $comments .= " Last by " . UserLink($last) . ". {$lastLink}"; } $newreply = actionLinkTag("Post a comment", "newreply", $thread['id'], "", $thread["title"]); if ($thread['sticky']) { $forumList .= "<table class='outline margin width100'>"; $forumList .= "<tr class='cell1'><td style='border: 1px solid #000; padding:16px' colspan='2'>{$posttext}</td></tr>"; $forumList .= "</table>"; } else { $forumList .= "<table class='outline margin width100'>"; $forumList .= "\n\t\t<tr class=\"header1\" >\n\t\t\t<th style='text-align:left;'><span style='font-size:15px'>" . $tags[0] . "</span><span style='font-weight:normal;'>{$subtitle}</span></th>\n\t\t\t<th style='text-align:left; width:150px; font-weight:normal;'>Posted by " . UserLink($starter) . "<br>{$postdate}</th>\n\t\t</tr>"; $forumList .= "<tr class='cell1'><td colspan='2' style='padding:10px'>{$posttext}</td></tr>"; $forumList .= "<tr class='cell0'><td>{$comments}</td><td style=\"border-left: 0px none;\">{$newreply}</td></tr>"; $forumList .= "</table>"; } } Write($forumList); if ($pagelinks) { Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks);
MakeCrumbs(array(actionLink('downloads') => 'Downloads', actionLink('downloads', $dl['id']) => $dl['description']), ''); echo ' <table class="outline margin width100"> <tr class="header1"><th colspan="2">' . htmlspecialchars($dl['description']) . '</th></tr>'; $filepath = $rootdir . "/" . $dl['physicalname']; $details = 'Uploaded on ' . formatdate($dl['date']) . ' — Downloaded ' . $dl['downloads'] . ' times<br>'; $details .= 'File size: ' . BytesToSize(@filesize($filepath)) . ' — MD5: ' . @md5_file($filepath) . ' — SHA1: ' . @sha1_file($filepath); $stuff = nl2br(htmlspecialchars($dl['big_description'])) . '<br><br>' . $details; $outdated = ''; $lastid = FetchResult("SELECT id FROM {uploader} WHERE category={0} ORDER BY date DESC LIMIT 1", $dl['category']); if ($lastid != $dl['id']) { $better = FetchResult("SELECT description FROM {uploader} WHERE id={0}", $lastid); $outdated = ' <tr class="cell0"> <td colspan="2" class="center"> <span style="font-size:200%;"><strong>This download is outdated.</strong> We recommend that you check out ' . actionLinkTag($better, 'downloads', $lastid) . ' instead.</span> </td> </tr>'; } echo $outdated . ' <tr class="cell1"> <td style="padding: 0.3em;"> ' . $stuff . ' </td> <td class="center"> <a href="get.php?id=' . $dl['id'] . '&force">Download</a> </td> </tr>'; echo ' </table>'; return;
Kill(__("Invalid thread ID.")); } $thread = Fetch($thread); if (!HasPermission('forum.viewforum', $thread['forum'])) { Kill(__("Nice try, hacker kid, but no.")); } if ($_GET['action'] == 'add') { Query("INSERT IGNORE INTO {favorites} (user,thread) VALUES ({0},{1})", $loguserid, $tid); } else { Query("DELETE FROM {favorites} WHERE user={0} AND thread={1}", $loguserid, $tid); } die(header('Location: ' . $_SERVER['HTTP_REFERER'])); } } $title = 'Favorites'; $links = array(actionLinkTag(__("Mark threads read"), 'favorites', 0, 'action=markasread')); MakeCrumbs(array(actionLink('favorites') => 'Favorites'), $links); $viewableforums = ForumsWithPermission('forum.viewforum'); $total = FetchResult("SELECT COUNT(*) FROM {threads} t INNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id WHERE t.forum IN ({1c})", $loguserid, $viewableforums); $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\ttr.date readdate,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields),\n\t\t\t\t\t\tf.(id,title)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tINNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id\n\t\t\t\t\t\tLEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={0}\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\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\tWHERE f.id IN ({3c})\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {1u}, {2u}", $loguserid, $from, $tpp, $viewableforums); $numonpage = NumRows($rThreads); $pagelinks = PageLinks(actionLink('favorites', '', 'from='), $tpp, $from, $total);
function FormatNotif_ProfileComment($id, $args) { global $loguserid, $loguser; return __('New comments in ') . actionLinkTag(__('your profile'), 'profile', $loguserid, '', $loguser['name']); }
makeBreadcrumbs($crumbs); $rPM = Query("select * from {pmsgs} left join {pmsgs_text} on pid = {pmsgs}.id where " . $whereFrom . " and deleted != {1} order by date desc limit {2u}, {3u}", $user, $deleted, $from, $ppp); $numonpage = NumRows($rPM); $pagelinks = PageLinks(actionLink("private", "", "{$show}{$userGet}&from="), $ppp, $from, $total); if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if (NumRows($rPM)) { while ($pm = Fetch($rPM)) { $rUser = Query("select * from {users} where id = {0}", isset($_GET['show']) ? $pm['userto'] : $pm['userfrom']); if (NumRows($rUser)) { $user = Fetch($rUser); } $cellClass = ($cellClass + 1) % 2; if (!$pm['msgread']) { $img = "<img src=\"" . resourceLink("img/status/new.png") . "\" alt=\"New!\" />"; } else { $img = ""; } $sender = NumRows($rUser) ? UserLink($user) : "_"; $check = $snoop ? "" : "<input type=\"checkbox\" name=\"delete[{2}]\" />"; $delLink = $snoop == "" ? "<sup> " . actionLinkTag("✘", "private", "", "del=" . $pm['id'] . $show . '&token=' . $loguser['token']) . "</sup>" : ""; $pms .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t" . $check . "\n\t\t\t</td>\n\t\t\t<td class=\"center\">\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t" . actionLinkTag(htmlspecialchars($pm['title']), "showprivate", $pm['id'], $snoop) . "{7}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n", $cellClass, $img, $pm['id'], $snoop, htmlspecialchars($pm['title']), $sender, formatdate($pm['date']), $delLink); } } else { $pms = format("\n\t\t<tr class=\"cell1\">\n\t\t\t<td colspan=\"6\">\n\t\t\t\t" . __("There are no messages to display.") . "\n\t\t\t</td>\n\t\t</tr>\n"); } write("\n\t<form method=\"post\" action=\"" . actionLink("private") . "\">\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 22px;\">\n\t\t\t\t<input type=\"checkbox\" id=\"ca\" onchange=\"checkAll();\" />\n\t\t\t</th>\n\t\t\t<th style=\"width: 22px;\"> </th>\n\t\t\t<th style=\"width: 75%;\">" . __("Title") . "</th>\n\t\t\t<th>{0}</th>\n\t\t\t<th style=\"min-width:120px\">" . __("Date") . "</th>\n\t\t</tr>\n\t\t{1}\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"text-align: right;\" colspan=\"6\">\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"multidel\" />\n\t\t\t\t<input type=\"hidden\" name=\"token\" value=\"{$loguser['token']}\" />\n\t\t\t\t<a href=\"javascript:void();\" onclick=\"document.forms[1].submit();\">" . __("delete checked") . "</a>\n\t\t\t</th>\n\t\t</tr>\n\t</table>\n\t</font>\n", isset($_GET['show']) ? __("To") : __("From"), $pms); if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); }
if ($ts == $yesterday) { $ts = 'Yesterday'; } } if ($ts != $lastts) { $lastts = $ts; echo ' <tr class="header0"> <th colspan="2">' . $ts . '</th> </tr>'; } $user = getDataPrefix($change, 'u_'); $userlink = userLink($user); $date = formatdate($date); $links = actionLinkTagItem('View page', 'wiki', $change['id'], 'rev=' . $change['revision']); $changetext = 'Page ' . actionLinkTag(htmlspecialchars(url2title($change['id'])), 'wiki', $change['id']); if ($change['revision'] > 1) { $changetext .= ' edited by ' . $userlink . ' on ' . $date . ' (revision ' . $change['revision'] . ')'; $links .= actionLinkTagItem('Diff', 'wikidiff', $change['id'], 'rev=' . $change['revision']); } else { $changetext .= ' created by ' . $userlink . ' on ' . $date; } echo ' <tr class="cell' . $c . '"> <td>' . $changetext . '</td> <td><ul class="pipemenu">' . $links . '</ul></td> </tr>'; $c = $c == 1 ? 2 : 1; } } echo '
$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(); $odata['color'] = htmlspecialchars($option['color']); if ($odata['color'] == '') { $odata['color'] = $defaultColors[($option['id'] + 9) % 15]; } $chosen = $option['myvote'] ? '✔' : ''; if ($loguserid && (!$thread['closed'] || HasPermission('mod.closethreads', $fid)) && HasPermission('user.votepolls')) { $label = $chosen . " " . actionLinkTag(htmlspecialchars($option['choice']), "thread", $thread['id'], "vote=" . $option['id'] . "&token=" . $loguser['token'], $urlname); } else { $label = $chosen . " " . htmlspecialchars($option['choice']); } $odata['label'] = $label; $odata['votes'] = $option['votes']; if ($totalVotes > 0) { $width = 100 * $odata['votes'] / $totalVotes; $odata['percent'] = sprintf('%.4g', $width); } else { $odata['percent'] = 0; } $pdata['options'][] = $odata; } $pdata['multivote'] = $poll['doublevote']; $pdata['votes'] = $poll['votes'];
if (!$previous) { Kill('Previous revision missing.'); } echo ' <table class="outline margin" id="wikidiff"> <tr class="cell1"> <td style="padding:0px 1em 1em;">'; $revInfo = ''; $revList = ''; if ($rev > 0) { $revs = Query("SELECT pt.revision r FROM {wiki_pages_text} pt WHERE pt.id={0} AND pt.revision>1 ORDER BY r ASC", $urltitle); while ($therev = Fetch($revs)) { if ($therev['r'] == $rev) { $revList .= ' ' . $therev['r'] . ' '; } else { $revList .= ' ' . actionLinkTag($therev['r'], 'wikidiff', $urltitle, 'rev=' . $therev['r']) . ' '; } } $revInfo = 'Viewing diff between revisions ' . $previous['revision'] . ' (previous) and ' . $rev . ' (current)<br>(revisions: 1 ' . $revList . ')<br><br>'; } echo '<h1>' . $nicetitle . '</h1>' . $revInfo . dodiff($page['text'], $previous['text']); echo ' </td> </tr> </table>'; function dodiff($cur, $prev) { $cur = str_replace("\r", '', $cur); $prev = str_replace("\r", '', $prev); $diff = new Text_Diff('native', array(explode("\n", $prev), explode("\n", $cur))); $renderer = new Text_Diff_Renderer_inline();
function bbcodeForum($contents, $arg, $parenttag) { global $forumLinkCache, $loguser; $id = (int) $arg; if (!isset($forumLinkCache[$id])) { $rForum = Query("select id, title from {forums} where id={0} AND id IN ({1c})", $id, ForumsWithPermission('forum.viewforum')); if (NumRows($rForum)) { $forum = Fetch($rForum); $forumLinkCache[$id] = actionLinkTag($forum['title'], "forum", $forum['id'], '', HasPermission('forum.viewforum', $forum['id'], true) ? $forum['title'] : ''); } else { $forumLinkCache[$id] = "<invalid forum ID>"; } } return $forumLinkCache[$id]; }
<?php cell2(actionLinkTag(__("Referral log"), "referrals"));
function formatIP($ip) { global $loguser; $res = $ip; $res .= " " . IP2C($ip); $res = "<nobr>{$res}</nobr>"; if (HasPermission('admin.ipsearch')) { return actionLinkTag($res, "ipquery", $ip); } else { return $res; } }
if (!$rankset || !isset($ranksetData[$rankset])) { $rankset = array_keys($ranksetData); $rankset = $rankset[0]; } die(header("Location: " . actionLink("ranks", $rankset))); } $rankset = $_GET['id']; if (!isset($ranksetData[$rankset])) { Kill(__("Rankset not found.")); } $ranksets = array(); foreach ($ranksetNames as $name => $title) { if ($name == $rankset) { $ranksets[] = $title; } else { $ranksets[] = actionLinkTag($title, 'ranks', $name); } } $users = array(); $rUsers = Query("select u.(_userfields), u.(posts,lastposttime) from {users} u order by id asc"); while ($user = Fetch($rUsers)) { $users[$user['u_id']] = getDataPrefix($user, "u_"); } $ranks = $ranksetData[$rankset]; $ranklist = array(); for ($i = 0; $i < count($ranks); $i++) { $rdata = array(); $rank = $ranks[$i]; $nextRank = $ranks[$i + 1]; if ($nextRank['num'] == 0) { $nextRank['num'] = $ranks[$i]['num'] + 1;
$r['formattedDate'] = formatdate($result['lastpostdate']); $rdata[] = $r; } } } else { $nres = FetchResult("\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision", $results, $viewableforums); $search = Query("\n\t\t\tSELECT\n\t\t\t\tpt.text, pt.pid,\n\t\t\t\tp.date,\n\t\t\t\tt.title, t.id,\n\t\t\t\tu.(_userfields)\n\t\t\tFROM {posts_text} pt\n\t\t\t\tLEFT JOIN {posts} p ON pt.pid = p.id\n\t\t\t\tLEFT JOIN {threads} t ON t.id = p.thread\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\tWHERE pt.pid IN ({0c}) AND t.forum IN ({1c}) AND pt.revision = p.currentrevision\n\t\t\tORDER BY p.date DESC\n\t\t\tLIMIT {2u},{3u}", $results, $viewableforums, $from, $tpp); if (NumRows($search)) { $results = ""; while ($result = Fetch($search)) { $r = array(); $tags = ParseThreadTags($result['title']); // $result['text'] = str_replace("<!--", "~#~", str_replace("-->", "~#~", $result['text'])); $r['description'] = MakeSnippet($result['text'], $terms); $r['user'] = UserLink(getDataPrefix($result, "u_")); $r['link'] = actionLinkTag($tags[0], "post", $result['pid']); $r['formattedDate'] = formatdate($result['date']); $rdata[] = $r; } } } if ($nres == 0) { $restext = __('No results found'); } else { if ($nres == 1) { $restext = __('1 result found'); } else { $restext = $nres . __(' results found'); } } $pagelinks = PageLinks(actionLink('search', '', 'q=' . urlencode($searchQuery) . '&inposts=' . $_GET['inposts'] . '&from='), $tpp, $from, $nres);
<?php // AcmlmBoard XD - Frequently Asked Questions page // Access: all if (!defined('BLARG')) { die; } $title = __("FAQ"); $links = array(); if (HasPermission('admin.editsettings')) { $links[] = actionLinkTag(__("Edit the FAQ"), "editsettings", '', 'field=faqText'); } MakeCrumbs(array(actionLink("faq") => __("FAQ")), $links); makeThemeArrays(); $admin = Fetch(Query("select u.(_userfields) from {users} u where u.primarygroup={0}", Settings::get('rootGroup'))); $admin = userLink(getDataPrefix($admin, 'u_')); $sexes = array(0 => __("Male"), 1 => __("Female"), 2 => __("N/A")); $scolors = array(0 => 'color_male', 1 => 'color_female', 2 => 'color_unspec'); $gcolors = array(); $g = Query("SELECT title, color_male, color_female, color_unspec FROM {usergroups} WHERE type=0 ORDER BY rank"); while ($group = Fetch($g)) { $gcolors[] = $group; } $headers = ""; $colors = ""; foreach ($sexes as $ss) { $headers .= format("\n\t<th>\n\t\t{0}\n\t</th>\n", $ss); } foreach ($gcolors as $g) { $cellClass = ($cellClass + 1) % 2; $items = "";
function makePost($post, $type, $params = array()) { global $loguser, $loguserid, $usergroups, $isBot, $blocklayouts; $poster = getDataPrefix($post, 'u_'); $post['userlink'] = UserLink($poster); LoadBlockLayouts(); $pltype = Settings::get('postLayoutType'); $isBlocked = $poster['globalblock'] || $loguser['blocklayouts'] || $post['options'] & 1 || isset($blocklayouts[$poster['id']]); $post['type'] = $type; $post['formattedDate'] = formatdate($post['date']); if (!HasPermission('admin.viewips')) { $post['ip'] = ''; } else { $post['ip'] = htmlspecialchars($post['ip']); } // TODO IP formatting? if ($post['deleted'] && $type == POST_NORMAL) { $post['deluserlink'] = UserLink(getDataPrefix($post, 'du_')); $post['delreason'] = htmlspecialchars($post['reason']); $links = array(); if (HasPermission('mod.deleteposts', $params['fid'])) { $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']); $links['view'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",true); return false;\">" . __("View") . "</a>"; } $post['links'] = $links; RenderTemplate('postbox_deleted', array('post' => $post)); return; } $links = array(); if ($type != POST_SAMPLE) { $forum = $params['fid']; $thread = $params['tid']; $notclosed = !$post['closed'] || HasPermission('mod.closethreads', $forum); $extraLinks = array(); if (!$isBot) { if ($type == POST_DELETED_SNOOP) { if ($notclosed && HasPermission('mod.deleteposts', $forum)) { $links['undelete'] = actionLinkTag(__("Undelete"), "editpost", $post['id'], "delete=2&key=" . $loguser['token']); } $links['close'] = "<a href=\"#\" onclick=\"replacePost(" . $post['id'] . ",false); return false;\">" . __("Close") . "</a>"; } else { if ($type == POST_NORMAL) { if ($notclosed) { if ($loguserid && HasPermission('forum.postreplies', $forum) && !$params['noreplylinks']) { $links['quote'] = actionLinkTag(__("Quote"), "newreply", $thread, "quote=" . $post['id']); } $editrights = 0; if ($poster['id'] == $loguserid && HasPermission('user.editownposts') || HasPermission('mod.editposts', $forum)) { $links['edit'] = actionLinkTag(__("Edit"), "editpost", $post['id']); $editrights++; } if ($poster['id'] == $loguserid && HasPermission('user.deleteownposts') || HasPermission('mod.deleteposts', $forum)) { if ($post['id'] != $post['firstpostid']) { $link = htmlspecialchars(actionLink('editpost', $post['id'], 'delete=1&key=' . $loguser['token'])); $onclick = HasPermission('mod.deleteposts', $forum) ? " onclick=\"deletePost(this);return false;\"" : ' onclick="if(!confirm(\'Really delete this post?\'))return false;"'; $links['delete'] = "<a href=\"{$link}\"{$onclick}>" . __('Delete') . "</a>"; } $editrights++; } if ($editrights < 2 && HasPermission('user.reportposts')) { $links['report'] = actionLinkTag(__('Report'), 'reportpost', $post['id']); } } // plugins should add to $extraLinks $bucket = "topbar"; include __DIR__ . "/pluginloader.php"; } } $links['extra'] = $extraLinks; } //Threadlinks for listpost.php if ($params['threadlink']) { $thread = array(); $thread['id'] = $post['thread']; $thread['title'] = $post['threadname']; $thread['forum'] = $post['fid']; $post['threadlink'] = makeThreadLink($thread); } else { $post['threadlink'] = ''; } //Revisions if ($post['revision']) { $ru_link = UserLink(getDataPrefix($post, "ru_")); $revdetail = ' ' . format(__('by {0} on {1}'), $ru_link, formatdate($post['revdate'])); if (HasPermission('mod.editposts', $forum)) { $post['revdetail'] = "<a href=\"javascript:void(0);\" onclick=\"showRevisions(" . $post['id'] . ")\">" . Format(__('rev. {0}'), $post['revision']) . "</a>" . $revdetail; } else { $post['revdetail'] = Format(__('rev. {0}'), $post['revision']) . $revdetail; } } //</revisions> } $post['links'] = $links; // POST SIDEBAR $sidebar = array(); // quit abusing custom syndromes you unoriginal fuckers $poster['title'] = preg_replace('@Affected by \'?.*?Syndrome\'?@si', '', $poster['title']); $sidebar['rank'] = GetRank($poster['rankset'], $poster['posts']); if ($poster['title']) { $sidebar['title'] = strip_tags(CleanUpPost($poster['title'], '', true), '<b><strong><i><em><span><s><del><img><a><br/><br><small>'); } else { $sidebar['title'] = htmlspecialchars($usergroups[$poster['primarygroup']]['title']); } $sidebar['syndrome'] = GetSyndrome(getActivity($poster['id'])); if ($post['mood'] > 0) { if (file_exists(DATA_DIR . "avatars/" . $poster['id'] . "_" . $post['mood'])) { $sidebar['avatar'] = "<img src=\"" . DATA_URL . "avatars/" . $poster['id'] . "_" . $post['mood'] . "\" alt=\"\">"; } } else { if ($poster['picture']) { $pic = str_replace('$root/', DATA_URL, $poster['picture']); $sidebar['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\">"; } } $lastpost = $poster['lastposttime'] ? timeunits(time() - $poster['lastposttime']) : "none"; $lastview = timeunits(time() - $poster['lastactivity']); if (!$post['num']) { $sidebar['posts'] = $poster['posts']; } else { $sidebar['posts'] = $post['num'] . '/' . $poster['posts']; } $sidebar['since'] = cdate($loguser['dateformat'], $poster['regdate']); $sidebar['lastpost'] = $lastpost; $sidebar['lastview'] = $lastview; if ($poster['lastactivity'] > time() - 300) { $sidebar['isonline'] = __("User is <strong>online</strong>"); } $sidebarExtra = array(); $bucket = "sidebar"; include __DIR__ . "/pluginloader.php"; $sidebar['extra'] = $sidebarExtra; $post['sidebar'] = $sidebar; // OTHER STUFF $post['haslayout'] = false; $post['fulllayout'] = false; if (!$isBlocked) { $poster['postheader'] = $pltype ? trim($poster['postheader']) : ''; $poster['signature'] = trim($poster['signature']); $post['haslayout'] = $poster['postheader'] ? 1 : 0; $post['fulllayout'] = $poster['fulllayout'] && $post['haslayout'] && $pltype == 2; if (!$post['haslayout'] && $poster['signature']) { $poster['signature'] = '<div class="signature">' . $poster['signature'] . '</div>'; } } else { $poster['postheader'] = ''; $poster['signature'] = ''; } $post['contents'] = makePostText($post, $poster); //PRINT THE POST! RenderTemplate('postbox', array('post' => $post)); }
$show = 'threads'; } $from = (int) $_GET['from']; $fparam = $from ? '&from=' . $from : ''; $spans = array(3600 => __('1 hour'), 86400 => __('1 day'), 259200 => __('3 days'), 'new' => __('New posts')); $options = array(); foreach ($spans as $span => $desc) { if ($span == $time) { $options[] = $desc; } else { $options[] = actionLinkTag($desc, 'lastposts', '', 'time=' . $span . '&show=' . $show . $fparam); } } $options2 = array(); $options2[] = $show == 'threads' ? __('List threads') : actionLinkTag(__('Show threads'), 'lastposts', '', 'time=' . $time . '&show=threads' . $fparam); $options2[] = $show == 'posts' ? __('Show posts') : actionLinkTag(__('Show posts'), 'lastposts', '', 'time=' . $time . '&show=posts' . $fparam); RenderTemplate('lastposts_options', array('timelinks' => $options, 'misclinks' => $options2)); $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}'; $total = FetchResult("SELECT COUNT(" . ($show == 'threads' ? 'DISTINCT p.thread' : '*') . ") FROM {posts} p LEFT JOIN {threads} t ON t.id=p.thread " . ($loguserid && $time == 'new' ? 'LEFT JOIN {threadsread} tr ON tr.thread=p.thread AND tr.id={0}' : '') . " WHERE p.date>{$mindate} AND t.forum IN ({3c})", $loguserid, time() - $time, time() - 900, $allowedforums); if (!$total) { Alert($time == 'new' ? __('No unread posts.') : __('No posts have been made during this timespan.'), __('Notice')); return; } $perpage = $show == 'posts' ? $loguser['postsperpage'] : $loguser['threadsperpage']; $pagelinks = PageLinks(actionLink("lastposts", '', "time={$time}&show={$show}&from="), $perpage, $from, $total); if ($show == 'threads') { $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}'; $rThreads = Query("\tSELECT\n\t\t\t\t\t\t\tt.*,\n\t\t\t\t\t\t\tf.(id,title),\n\t\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={0}" : '') . "\n\t\t\t\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\t\tWHERE t.forum IN ({5c}) AND t.lastpostdate>{$mindate}\n\t\t\t\t\t\tORDER BY t.lastpostdate DESC LIMIT {3u}, {4u}", $loguserid, time() - $time, time() - 900, $from, $perpage, $allowedforums); makeThreadListing($rThreads, $pagelinks, false, true); } else { $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}';
} if ($loguserid) { $filecount = FetchResult("select count(*) from {uploader} where uploader.user = {0} and uploader.private = 1", $loguserid); print "<tr class=\"cell{$cellClass}\"><td>"; print actionLinkTag("Private files", "uploaderlist", "", "cat=-1"); print "<br>"; print "Only for you."; print "<br>"; print $filecount . " files."; print "<br>"; print "</td></tr>"; $cellClass = ($cellClass + 1) % 2; if ($loguser['powerlevel'] > 2) { $filecount = FetchResult("select count(*) from {uploader} where uploader.private = 1"); print "<tr class=\"cell{$cellClass}\"><td>"; print actionLinkTag("All private files", "uploaderlist", "", "cat=-2"); print "<br>"; print $filecount . " files."; print "<br>"; print "</td></tr>"; } } print "</table>"; } } } } } } //From the PHP Manual User Comments function foldersize($path)
<?php if ($loguser['powerlevel'] > 3) { cell2(actionLinkTag(__("Firewall log"), "shitbugs")); }