query( "SELECT p.id, p.user, p.date as date, f.title as ftitle, t.forum as fid, t.title as title, ". "u.name as uname, u.sex as usex, u.powerlevel as upowerlevel ". (($log) ? ", r.read AS tread, r.time as treadtime " : ""). "FROM `posts` p ". "LEFT JOIN `threads` t ON p.thread = t.id ". "LEFT JOIN `forums` f ON t.forum = f.id ". "LEFT JOIN `users` u ON p.user = u.id ". (($log) ? "LEFT JOIN threadsread r ON (t.id=r.tid AND r.uid=$loguser[id]) " : ""). "\n WHERE f.minpower <= '". $loguser['powerlevel'] ."' ". "AND p.date >= ".(($maxtime !== false) ? (ctime()-$maxtime) : (ctime()-86400*7))." ". // time limit here (($_GET['lastid']) ? "AND p.id > $_GET[lastid] ":""). "\nORDER BY `id` DESC ". (($maxposts !== false) ? "LIMIT 0, $maxposts" : '') // posts limit here ); $_count = @mysql_num_rows($data); $output = ""; if ($_GET['raw']) { $outarray = array('id', 'ftitle', 'fid', 'title', 'uname', 'upowerlevel', 'usex', 'ucolor', 'date', 'user'); $outchunks = Array(); } $windowtitle = "$boardname - A revolution in posting technology™"; require 'lib/layout.php'; if($log && !$_GET['raw']) { $headlinks.=' - Mark all posts read'; $header=makeheader($header1,$headlinks,$header2); $forumread = $sql->getresultsbykey("SELECT forum,readdate FROM forumread WHERE user=$loguserid", 'forum', 'readdate'); } $_counter = 1; while ($in = $sql->fetch($data, MYSQL_ASSOC)) { if (!$_GET['raw']) { if ($log && $in['date'] > max($forumread[$in['fid']], $in['treadtime'])) $newpost = $statusicons['new']." "; else $newpost = ""; $output .= " $tccell2>". $in['id'] ." $tccell2>". $in['ftitle'] ." $tccell1l>$newpost". $in['title'] ." $tccell1>". $in['uname'] ." $tccell2>". timeunits(ctime() - $in['date']) ." \n"; } else { $in['ucolor'] = str_replace('color=', '', getnamecolor($in['usex'], $in['upowerlevel'])); $in['title'] = str_replace("\\", "\\\\", $in['title']); $temp = Array(); foreach($outarray as $outkey) $temp[] = ('"'.$outkey . "\":\"" . htmlspecialchars($in[$outkey]) . '"'); $temp = "{".implode(",",$temp)."}".($_counter == $_count ? "" : ","); $output .= $temp; } $_counter++; } if (!$_GET['raw']) { /* Doesn't work, as far as I'm aware? if ($_GET['fungies']) { $jscripts = ''; } */ print " $header Show:$smallfont
Last 30 minutes - 1 hour - 5 hours - 1 day
Most recent 20 posts - 50 posts - 100 posts $tccellc colspan=6>Latest Posts $tccellh width=30>  $tccellh width=280>Forum $tccellh width=*>Thread $tccellh width=200>User $tccellh width=130>Time $output ". $tblend . $jscripts . $footer; printtimedif($startingtime); } else { header("Content-type: text/plain"); header("Ajax-request: ".IS_AJAX_REQUEST); print '{"tzoff": "'.$tzoff.'", "localtime": "'.ctime().'", "posts": ['.$output."]}"; }