function threadpost($post, $bg, $pthread = '') { global $loguser, $quote, $edit, $ip, $smallfont, $tzoff, $sep, $dateformat, $dateshort, $tlayout, ${"tablebg{$bg}"}; $post = setlayout($post); $p = $post['id']; $u = $post['uid']; $set['bg'] = ${"tablebg{$bg}"}; $set['tdbg'] = "<td class='tbl font tdbg{$bg}' valign=top"; $linkclass = "url" . $post['uid']; $userlink = getuserlink($post, array('id' => 'uid'), $linkclass); unset($postuser); $set['userrank'] = getrank($post['useranks'], str_replace("<div", "<<z>idiot", $post['title']), $post['posts'], $post['powerlevel']); $set['userlink'] = "<a name={$p}></a>{$userlink}"; $set['date'] = date($dateformat, $post['date'] + $tzoff); if ($post['location']) { $set['location'] = "<br>From: {$post['location']}"; } if ($post['picture'] || $post['moodid'] && $post['moodurl']) { $post['picture'] = str_replace('>', '%3E', $post['picture']); $set['userpic'] = "<img src=\"{$post['picture']}\">"; $set['picture'] = $post['picture']; if ($post['moodid'] && $post['moodurl']) { $set['userpic'] = "<img src=\"" . str_replace(array('$', '>'), array($post['moodid'], '%3E'), $post['moodurl']) . "\">"; $set['picture'] = str_replace(array('$', '>'), array($post['moodid'], '%3E'), $post['moodurl']); } // $userpicture="<img src=\"$user['picture']\" name=pic$p onload=sizelimit(pic$p,60,100)>"; } if ($post['signtext']) { $post['signtext'] = $sep[$loguser['signsep']] . $post['signtext']; } if ($pthread) { $set['threadlink'] = "<a href=thread.php?id={$pthread['id']}>{$pthread['title']}</a>"; } $post['text'] = doreplace2($post['text'], $post['options']); // if (strpos($post['text'], "http://hyperhacker.no-ip.org/b/smilies/lolface.png") || strpos($post['text'], "images/smilies/roflx.gif")) $post['text'] = "<img src=images/smilies/roflx.gif><br><br><small>(Excessive post content hidden)</small>"; if (filter_int($post['editdate'])) { $post['edited'] = " (last edited by {$post['edited']} at " . date($dateformat, $post['editdate'] + $tzoff) . ")"; } $return = dofilters(postcode($post, $set)); return $return; }
} } // Dailystats update in one query $sql->query("INSERT INTO dailystats (date, users, threads, posts, views) " . "VALUES ('" . date('m-d-y', ctime()) . "', (SELECT COUNT( * ) FROM users), (SELECT COUNT(*) FROM threads), (SELECT COUNT(*) FROM posts), {$views}) " . "ON DUPLICATE KEY UPDATE users=VALUES(users), threads=VALUES(threads), posts=VALUES(posts), views={$views}"); // $sql->query("INSERT INTO dailystats (date) VALUES ('".date('m-d-y',ctime())."')"); // $sql->query("UPDATE dailystats SET users=$count[u],threads=$count[t],posts=$count[p],views=$views WHERE date='".date('m-d-y',ctime())."'"); //No gunbound rankset here (yet), stop futily trying to update it //updategb(); $new = ' '; $privatebox = ""; // Note that we ignore this in private.php (obviously) and the index page (it handles PMs itself) // This box only shows up when a new PM is found, so it's optimized for that if ($log && strpos($PHP_SELF, "private.php") == false && strpos($PHP_SELF, "index.php") == 0) { $newmsgquery = $sql->query("SELECT date,u.id uid,name,sex,powerlevel,aka FROM pmsgs p LEFT JOIN users u ON u.id=p.userfrom WHERE userto={$loguserid} AND msgread=0 ORDER BY p.id DESC"); if ($pmsg = $sql->fetch($newmsgquery)) { $namelink = getuserlink($pmsg, array('id' => 'uid')); $lastmsg = "Last unread message from {$namelink} on " . date($dateformat, $pmsg['date'] + $tzoff); $numnew = mysql_num_rows($newmsgquery); if ($numnew > 1) { $ssss = "s"; } $privatebox = "<tr><td colspan=3 class='tbl tdbg2 center fonts'>{$newpic} <a href=private.php>You have {$numnew} new private message{$ssss}</a> -- {$lastmsg}</td></tr>"; } } $jscripts = ''; if (true) { // Ikachan! :D! //$ikachan = 'images/ikachan/vikingikachan.png'; //$ikachan = 'images/sankachan.png'; //$ikachan = 'images/ikamad.png'; $ikachan = 'images/squid.png';
} $sort = filter_bool($_GET['sort']); $lnk = '<a href=online.php' . ($sort ? "?sort=1&" : '?') . 'time'; print "\n\t\t{$header}{$smallfont}\n\t\tShow online users during the last:\n\t\t{$lnk}=60>minute</a> |\n\t\t{$lnk}=300>5 minutes</a> |\n\t\t{$lnk}=900>15 minutes</a> |\n\t\t{$lnk}=3600>hour</a> |\n\t\t{$lnk}=86400>day</a>\n\t"; if ($isadmin) { print '<br>Admin cruft: <a href=online.php' . ($sort ? '?sort=1&' : '?') . "time={$time}>Sort by " . ($sort == 'IP' ? 'date' : 'IP') . "</a>"; } // Logged in users $posters = $sql->query("SELECT id,posts,name,sex,powerlevel,aka,lastactivity,lastip,lastposttime,lasturl,birthday FROM users WHERE lastactivity>" . (ctime() - $time) . ' ORDER BY ' . ($sort == 'IP' && $isadmin ? 'lastip' : 'lastactivity DESC')); print "<br>\n\t{$fonttag} Online users during the last " . timeunits2($time) . ":\n\t{$tblstart}\n\t\t{$tccellh} width=20> </td>\n\t\t{$tccellh} width=200>Username</td>\n\t\t{$tccellh} width=120> Last activity</td>\n\t\t{$tccellh} width=180> Last post</td>\n\t\t{$tccellh} width=*>URL</td>\n\t"; if ($isadmin) { print "{$tccellh} width=120>IP address</td>"; } print "{$tccellh} width=60> Posts</tr>"; for ($i = 1; $user = $sql->fetch($posters); $i++) { $userlink = getuserlink($user); if (!$user['posts']) { $user['lastposttime'] = getblankdate(); } else { $user['lastposttime'] = date($dateformat, $user['lastposttime'] + $tzoff); } $user['lasturl'] = str_replace('<', '<', $user['lasturl']); $user['lasturl'] = str_replace('>', '>', $user['lasturl']); $user['lasturl'] = str_replace('%20', ' ', $user['lasturl']); $user['lasturl'] = str_replace('shoph', 'shop', $user['lasturl']); $user['lasturl'] = preg_replace('/[\\?\\&]debugsql(|=[0-9]+)/i', '', $user['lasturl']); // let's not give idiots any ideas $lasturltd = "{$tccell2l}><a rel=\"nofollow\" href=\"" . urlformat($user['lasturl']) . "\">{$user['lasturl']}"; if (substr($user['lasturl'], -11) == '(IP banned)') { $lasturltd = "{$tccell2l}><a rel=\"nofollow\" href=\"" . substr($user['lasturl'], 0, -12) . "\">" . substr($user[lasturl], 0, -12) . "</a> (IP banned)"; } elseif (substr($user['lasturl'], -11) == '(Tor proxy)') {
if (!$page) { $page = 1; } $pmin = ($page - 1) * $ppp; $msgtotal = $sql->resultq("SELECT count(*) FROM pmsgs WHERE user{$to}={$u}"); $pagelinks = 'Pages:'; $p = 0; for ($i = 0; $i < $msgtotal; $i += $ppp) { $p++; if ($p == $page) { $pagelinks .= " {$p}"; } else { $pagelinks .= " <a href=private.php?{$idparam}{$viewparam}page={$p}>{$p}</a>"; } } // 1252378129 $pmsgs = $sql->query("SELECT p.id,user{$from} uid,date,t.title,msgread,name,sex,powerlevel,aka\n\t\tFROM pmsgs p,pmsgs_text t,users u\n\t\tWHERE user{$to}={$u}\n\t\tAND p.id=pid\n\t\tAND user{$from}=u.id " . ($loguser['id'] == 175 ? "AND p.id > 8387 " : "") . "ORDER BY " . ($loguser['id'] == 175 ? "user{$from} DESC, " : "msgread ASC, ") . "p.id DESC\n\t\tLIMIT {$pmin},{$ppp}\n\t"); $from[0] = strtoupper($from[0]); if (!$view) { $viewlink = "<a href=private.php?{$idparam}view=sent>View sent messages</a>"; } else { $viewlink = "<a href=private.php?{$idparam}>View received messages</a>"; } print "{$header}\n\t\t<table width=100%><td>{$fonttag}<a href=index.php>{$boardname}</a> - " . ($u != $loguserid ? $sql->resultq("SELECT `name` FROM `users` WHERE `id` = '{$u}'") . "'s private messages" : "Private messages") . " - " . (!$view ? 'Inbox' : 'Outbox') . ": {$msgtotal}</td>\n\t\t<td align=right>{$smallfont}{$viewlink} | <a href=sendprivate.php>Send new message</a></table>\n\t\t{$tblstart}<tr>\n\t\t{$tccellh} width=50> </td>\n\t\t{$tccellh}>Subject</td>\n\t\t{$tccellh} width=15%>{$from}</td>\n\t\t{$tccellh} width=180>Sent on</td></tr>\n\t"; while ($pmsg = $sql->fetch($pmsgs)) { $new = $pmsg['msgread'] ? ' ' : $statusicons['new']; $namecolor = getuserlink($pmsg, array('id' => 'uid')); print "\n\t\t\t<tr style='height:20px;'>\n\t\t\t{$tccell1}>{$new}</td>\n\t\t\t{$tccell2l}><a href=showprivate.php?id={$pmsg['id']}>{$pmsg['title']}</td>\n\t\t\t{$tccell2}>{$namecolor}</td>\n\t\t\t{$tccell2}>" . date($dateformat, $pmsg['date'] + $tzoff) . "\n\t\t\t</tr>\n\t\t"; } print "{$tblend}{$smallfont}{$pagelinks}{$footer}"; printtimedif($startingtime);
} if ($loguser['pagestyle']) { $belowtitle[] = "Page:{$pagelinks}"; } else { $threadtitle .= " {$smallfont}(Pages:{$pagelinks})</span>"; } } if (!empty($belowtitle)) { $secondline = '<br><span class="fonts" style="position: relative; top: -1px;"> ' . implode(' - ', $belowtitle) . '</span>'; } else { $secondline = ''; } if (!$thread['icon']) { $posticon = ' '; } $userlink1 = getuserlink($thread, array('sex' => 'sex1', 'powerlevel' => 'pwr1', 'id' => 'user', 'aka' => 'aka1', 'name' => 'name1', 'birthday' => 'bd1')); $userlink2 = getuserlink($thread, array('sex' => 'sex2', 'powerlevel' => 'pwr2', 'id' => 'lastposter', 'aka' => 'aka2', 'name' => 'name2', 'birthday' => 'bd2')); $threadlist .= "<tr>\r\n\t\t\t{$tccell1}>{$new}</td>\r\n\t\t\t{$tccell2} width=40px><div style=\"max-width:60px;max-height:30px;overflow:hidden;\">{$posticon}</div></td>\r\n\t\t\t{$tccell2l}>" . ($newpost ? "<a href='thread.php?id={$thread['id']}&lpt=" . $newpostt . "'>" . $statusicons['getnew'] . "</a> " : "") . "{$threadtitle}{$secondline}</td>\r\n\t\t\t{$tccell2}>{$userlink1}</td>\r\n\t\t\t{$tccell1}>{$thread['replies']}</td>\r\n\t\t\t{$tccell1}>{$thread['views']}</td>\r\n\t\t\t{$tccell2}><div class='lastpost'>" . date($dateformat, $thread['lastpostdate'] + $tzoff) . "<br>\r\n\t\t\t\tby {$userlink2}\r\n\t\t\t\t<a href='thread.php?id={$thread['id']}&end=1'>{$statusicons['getlast']}</a>\r\n\t\t\t</div></td></tr>"; } } $threadlist .= "{$tblend}"; print "\r\n\t\t{$header}\r\n\t\t{$infotable}\r\n\t\t{$forumpagelinks}\r\n\t\t{$threadlist}\r\n\t\t{$forumpagelinks}\r\n\t\t{$infotable}\r\n\t\t{$forumlist}\r\n\t\t{$footer}\r\n\t"; printtimedif($startingtime); function notAuthorizedError() { global $log; $rreason = $log ? 'don\'t have access to it' : 'are not logged in'; $redir = $log ? 'index.php' : 'login.php'; $rtext = $log ? 'the index page' : 'log in (then try again)'; errorpage("Couldn't enter this restricted forum, as you {$rreason}.", $rtext, $redir); }
function cu($a, $b) { global $hacks; $dif = $a - $b['posts']; if ($dif < 0) { $t = (!$hacks['noposts'] ? -$dif : "") . " behind"; } elseif ($dif > 0) { $t = (!$hacks['noposts'] ? $dif : "") . " ahead of"; } else { $t = ' tied with'; } $namelink = getuserlink($b); $t .= " {$namelink}" . (!$hacks['noposts'] ? " ({$b['posts']})" : ""); return "<nobr>{$t}</nobr>"; }
$chks[1] = "checked"; } $user = $sql->fetchq("SELECT name FROM users WHERE id={$post['user']}"); print "\n\t\t\t{$tccellh} width=150> </td>{$tccellh} colspan=2> <tr>\n\t\t\t{$tccell1}><b>Header:</td>\t {$tccell2l} width=800px valign=top>{$txta}=head ROWS=8 COLS={$numcols} style=\"width: 100%; max-width: 800px; resize:vertical;\">" . htmlspecialchars($head) . "</textarea>\n\t\t\t{$tccell2l} width=* rowspan=3>" . moodlist($post['moodid']) . "</td><tr>\n\t\t\t{$tccell1}><b>Post:</td>\t\t {$tccell2l} width=800px valign=top>{$txta}=message ROWS=12 COLS={$numcols} style=\"width: 100%; max-width: 800px; resize:vertical;\">" . htmlspecialchars($message) . "</textarea><tr>\n\t\t\t{$tccell1}><b>Signature:</td>\t {$tccell2l} width=800px valign=top>{$txta}=sign ROWS=8 COLS={$numcols} style=\"width: 100%; max-width: 800px; resize:vertical;\">" . htmlspecialchars($sign) . "</textarea><tr>\n\t\t\t{$tccell1}> </td>{$tccell2l} colspan=2>\n\t\t\t{$inph}=action VALUE=editpost>\n\t\t\t{$inph}=id VALUE={$id}>\n\t\t\t{$inps}=submit VALUE=\"Edit post\">\n\t\t\t{$inps}=preview VALUE=\"Preview post\"></td>\n\t\t\t<tr>{$tccell1}><b>Options:</b></td>{$tccell2l} colspan=2>\n\t\t\t{$inpc}=\"nosmilies\" id=\"nosmilies\" value=\"1\" {$chks['0']}><label for=\"nosmilies\">Disable Smilies</label> -\n\t\t\t{$inpc}=\"nohtml\" id=\"nohtml\" value=\"1\" {$chks['1']}><label for=\"nohtml\">Disable HTML</label></td></tr>\n\t\t\t</FORM>\n\t\t{$tblend}{$fonttag}<a href=index.php>{$boardname}</a> - <a href=forum.php?id={$forum['id']}>" . $forum[title] . "</a> - {$thread['title']}\n\t\t"; } elseif (!$action) { print "\n\t\t{$tccell1}>You are not allowed to edit this post.<br>\n\t\t" . redirect("thread.php?id={$threadid}", "the thread", 0); } if ($_POST['action'] == 'editpost') { $poptions = intval($nosmilies) . "|" . intval($nohtml); print $tblstart; if (($ismod or $loguserid == $post[user] && $loguser['powerlevel'] >= 0) and (!$forum['minpower'] or $power >= $forum['minpower']) && !$thread['closed']) { $user = $sql->fetchq("SELECT posts,regdate FROM users WHERE id={$loguserid}"); $numposts = $user['posts']; $numdays = (ctime() - $user['regdate']) / 86400; $message = doreplace($message, $numposts, $numdays, $loguser['name']); $edited = str_replace('\'', '\\\'', getuserlink($loguser)); if ($submit) { if ($loguserid == 1162) { xk_ircsend("1|The jceggbert5 dipshit tried to edit another post: " . $id); } elseif ($message == "COCKS" || $head == "COCKS" || $sign == "COCKS" || $message == $head && $head == $sign) { mysql_query("INSERT INTO `ipbans` SET `reason` = 'Idiot hack attempt', `ip` = '" . $_SERVER['REMOTE_ADDR'] . "', `date` = '" . ctime() . "'"); die("NO BONUS"); } else { $headid = @$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '{$head}' LIMIT 1", 0, 0); $signid = @$sql->resultq("SELECT `id` FROM `postlayouts` WHERE `text` = '{$sign}' LIMIT 1", 0, 0); if ($headid) { $head = ''; } else { $headid = 0; } if ($signid) {
} $options['meta_description'] = $options['meta_description'] ? $options['meta_description'] : $options['description']; $options['title_keywords'] = $options['title_keywords'] ? ' - ' . $options['title_keywords'] : ''; // 执行查询 if ($total) { $query = $DB->query($query_sql); $multipage = multi($total, $pagenum, $page, $pageurl, $extra, $maxpages); $articledb = array(); $haveattach = 0; $aids = $comma = ''; while ($querystick && ($article = $DB->fetch_array($querystick)) || $query && ($article = $DB->fetch_array($query))) { $aids .= $comma . $article['articleid']; $comma = ','; $article['avatardb'] = get_avatar($article['email']); $article['url'] = getpermalink($article['articleid'], $article['alias']); $article['userurl'] = getuserlink($article['username']); $article['cateurl'] = getcatelink($article['cid'], $article['curl']); //隐藏变量,默认模板用不着,方便那些做模板可以单独显示月份和号数的的朋友. $article['month'] = sadate('M', $article['dateline']); $article['day'] = sadate('d', $article['dateline']); $article['dateline'] = sadate($timeformat, $article['dateline'], 1); if ($article['readpassword'] && $_COOKIE['readpassword_' . $article['articleid']] != $article['readpassword'] && $sax_group != 1 && $sax_group != 2) { $article['allowread'] = 0; } else { $article['allowread'] = 1; if ($article['attachments']) { $haveattach = 1; } if ($article['description']) { $article['content'] = $article['description']; }
continue; } $m = 0; $modlist = ""; foreach ($mods as $modplace => $mod) { if ($mod['forum'] != $forum['id']) { continue; } $namelink = getuserlink($mod); $modlist .= ($m++ ? ', ' : '') . $namelink; unset($mods[$modplace]); } if ($m) { $modlist = "{$smallfont}(moderated by: {$modlist})</font>"; } $namelink = getuserlink($forum, array('id' => 'uid')); if ($forum['numposts']) { $forumlastpost = "<nobr>" . date($dateformat, $forum['lastpostdate'] + $tzoff); $by = "{$smallfont}<br>by {$namelink}" . ($forum['lastpostid'] ? " <a href='thread.php?pid=" . $forum['lastpostid'] . "#" . $forum['lastpostid'] . "'>" . $statusicons['getlast'] . "</a>" : "") . "</nobr></font>"; } else { $forumlastpost = getblankdate(); $by = ''; } $new = ' '; if ($forum['numposts']) { if ($log && intval($forumnew[$forum['id']]) > 0) { $new = $statusicons['new'] . "<br>" . generatenumbergfx(intval($forumnew[$forum['id']])); } elseif (!$log && $forum['lastpostdate'] > ctime() - 3600) { $new = $statusicons['new']; } }
$rank = $sql->fetch($ranks); // 300 queries [11sec] ---> 20 queries [1sec] $users = $sql->query("SELECT id,name,sex,powerlevel,aka,birthday,posts,lastactivity,lastposttime FROM users WHERE posts >= {$rank['num']} {$useranks} ORDER BY posts ASC"); $user = $sql->fetch($users); $total = mysql_num_rows($users); } for ($i = 0; $i < $totalranks; ++$i) { $rankn = $sql->fetch($ranks); if (!$rankn['num']) { $rankn['num'] = 8388607; } $userarray = array(); $inactive = 0; for ($u = 0; $user && $user['posts'] < $rankn['num']; $u++) { if (max($user['lastactivity'], $user['lastposttime']) > $btime) { $userarray[$user['name']] = getuserlink($user); } else { ++$inactive; } $user = $sql->fetch($users); } @ksort($userarray); $userlisting = implode(", ", $userarray); if ($inactive) { $userlisting .= ($userlisting ? ', ' : '') . "{$inactive} inactive"; } if (!$userlisting) { $userlisting = ' '; } if ($userlisting != ' ' || $rank['num'] <= $loguser['posts'] || $ismod) { print "<tr>\n\t\t\t\t{$tccell2ls} width=200>{$rank['text']}</td>\n\t\t\t\t{$tccell1} width=60>{$rank['num']}</td>\n\t\t\t\t{$tccell1} width=60>{$total}</td>\n\t\t\t\t{$tccell1} width=30>{$u}</td>\n\t\t\t\t{$tccell2s} width=*>{$userlisting}";
$forums = $sql->query("SELECT id,title,description,catid FROM forums ORDER BY catid"); $fa = ""; $forumselect = "<option value=\"0\">Select a forum...</option>\r\n"; $forumselectforrem = "<option value=\"0|0\">Select a forum and moderator...</option>\r\n"; while ($forum = $sql->fetch($forums)) { $m = 0; $modlist = ""; $forumselect .= "<option value=\"{$forum['id']}\">{$forum['title']}</option>"; $mods = $sql->query("SELECT user FROM forummods WHERE forum={$forum['id']}"); if ($mods) { while ($mod = $sql->fetch($mods)) { $usermod = $sql->fetchq("SELECT aka,sex,powerlevel,name,id from users where id={$mod['user']}"); if ($m) { $modlist .= ", "; } $modlist .= getuserlink($usermod); $forumselectforrem .= "<option value=\"{$forum['id']}|{$usermod['id']}\">{$forum['title']} -- {$usermod['name']}</option>\r\n"; $m++; } } if ($m) { $fa .= "\n\t\t\t<tr>\n <td class='tbl tdbg2 center fonts'>{$forum['id']}</td>\n\t\t\t<td class='tbl tdbg1 center fonts'>{$forum['title']}</td>\n\t\t\t<td colspan=3 class='tbl tdbg2 left fonts'>{$modlist}</td>\n </tr>\n\t\t"; } } $userlist = "<option value=\"0\">Select a user...</option>\r\n"; $users1 = $sql->query("SELECT `id`, `name` FROM `users` WHERE `powerlevel` > '0' ORDER BY `name`"); while ($user = $sql->fetch($users1)) { $userlist .= "<option value={$user['id']}>{$user['name']}</option>\r\n"; } print "\n\n{$tblstart}\n<tr><td class='tbl tdbgh center fonts' width=50>ID</td>\n<td class='tbl tdbgh center fonts' width=30%>Forum Name</td>\n<td class='tbl tdbgh center fonts' width=65%>Moderators</td></tr>{$fa}{$tblend}\n\n<form action=\"admin-editmods.php\" method=\"POST\">{$inph}=\"action\" value=\"add\"><br>{$tblstart}" . "<tr>{$tccellh} colspan=\"2\">Add Moderator:</td></tr>\n<tr>{$tccell1} width=15%>Forum:</td>{$tccell2l} width=85%><select name=\"addmodforum\" size=\"1\">{$forumselect}</select></td></tr> \n<tr>{$tccell1} width=15%>User:</td>{$tccell2l} width=85%><select name=\"addmoduser\" size=\"1\">{$userlist}</select> {$smallfont}(note: this only shows Member+ and above)</font></td></tr>\n<tr>{$tccell1} width=15%> </td>{$tccell2l} width=85%>{$inps}=\"addmodsubmit\" value=\"Add Moderator\"></td></tr>{$tblend}</form>" . ($forumselectforrem != "" ? "<form action=\"admin-editmods.php\" method=\"POST\">{$inph}=\"action\" value=\"remove\">{$tblstart}" . "<tr>{$tccellh} colspan=\"2\">Remove Moderator:</td></tr>\n<tr>{$tccell1} width=15%>Forum and Moderator:</td>{$tccell2l} width=85%><select name=\"removemod\" size=\"1\">{$forumselectforrem}</select></td></tr> \n<tr>{$tccell1} width=15%> </td>{$tccell2l} width=85%>{$inps}=\"removemodsubmit\" value=\"Remove Moderator\"></td></tr>{$tblend}</form>" : ""); }