'
. '
'
. '' . $boardlist['top'] . '
';
$body .= '';
// Recent images
$body .= '
Recent Images
';
$query = '';
foreach($boards as &$_board) {
$query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL UNION ALL ", $_board['uri'], $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 3', $query);
$query = query($query) or error(db_error());
while($post = $query->fetch()) {
openBoard($post['board']);
$body .= ' ';
}
$body .= '
';
// Latest posts
$body .= '
Latest Posts
';
$query = '';
foreach($boards as &$_board) {
$query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 30', $query);
$query = query($query) or error(db_error());
while($post = $query->fetch()) {
openBoard($post['board']);
$body .= '- ' . $board['name'] . ': ' . pm_snippet($post['body'], 30) . '
';
}
$body .= '
';
// Stats
$body .= '
Stats
';
// Total posts
$query = 'SELECT SUM(`top`) AS `count` FROM (';
foreach($boards as &$_board) {
$query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = query($query) or error(db_error());
$res = $query->fetch();
$body .= '- Total posts: ' . number_format($res['count']) . '
';
// Unique IPs
$query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM (';
foreach($boards as &$_board) {
$query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = query($query) or error(db_error());
$res = $query->fetch();
$body .= '- Unqiue posters: ' . number_format($res['count']) . '
';
// Active content
$query = 'SELECT SUM(`filesize`) AS `count` FROM (';
foreach($boards as &$_board) {
$query .= sprintf("SELECT `filesize` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = query($query) or error(db_error());
$res = $query->fetch();
$body .= '- Active content: ' . format_bytes($res['count']) . '
';
$body .= '
';
// End wrap
$body .= '
';
// Finish page
$body .= '