80,
'thumbheight' => 80
);
function chon_build($action, $settings) {
$settings = Array(
'title' => '4chon',
'subtitle' => '',
'boards' => Array(
'new' => 'A place for the debate of political intrigue and current events. This board has a wide and varied user base with many unique, and sometimes controversial, views expressed.',
'r9k' => 'A unique board for open discussion based on an original content script. If a post has been made before, the reposter is muted. The length of the mute increases at the rate of 2^n seconds with each additional mute a user receives. Loosely based upon robot9000 of #xkcd-signal.',
'v' => 'A board in which to discuss many of our favourite hobbies: video games. New and old, PC and console, the discussion is always fresh and on-topic.',
'meta' => 'A board for the discussion and improvement of the community, 4chon or otherwise. Questions, comments, and modposts are frequently found here.'
),
'thumbwidth' => 80,
'thumbheight' => 80
);
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
// - boards (board list changed)
Chon::build($action, $settings);
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Chon {
public static function build($action, $settings) {
global $config;
//if($action == 'all' || $action == 'news')
file_write($config['dir']['home'] . $config['file_index'], Chon::homepage($settings));
}
// Build news page
public static function homepage($settings) {
global $config, $board;
// HTML5
$body = ''
. '
The largest and most popular community based on Tinyboard; we\'re picking up where 4chan is dying! In mid-January, /r9k/ and /new/ were simultaneously deleted from 4chan. Less than an hour later, 4chon was created to give these boards a new life, and we have been growing ever since. With over one million posts in just a few months, we\'re the largest chon in existence.
';
$query = '';
foreach($settings['boards'] as $board => $description) {
$query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL AND `file` != 'deleted' UNION ALL ", $board, $board);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 10', $query);
$query = query($query) or error(db_error());
$body .= '
Aside from our boards, we also have an active community in the following places:
';
$body .= '
';
$body .= '
/tv/ - We automatically maintain a list of livestreams that were posted on the boards, where users of 4chon can watch television shows, movies, and circlejerks.
';
$body .= '
Minecraft - Our unofficial Minecraft server. Come build with bros and visit our giant penis sculpture! eironeia.datnode.net:24598
4chon keeps a statistics page which gives detailed information about all of our boards, such as posts per minute, user locations, referring sites and more!. There\'s also a map of our posters around the globe!
';
$body .= '
If, for any reason, you need to contact the 4chon staff, they can be reached in IRC - irc.datnode.net #4chon / [WebIRC].
';
// Total posts
$query = 'SELECT SUM(`top`) AS `count` FROM (';
foreach($settings['boards'] as $board => $description) {
$query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $board);
}
$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($settings['boards'] as $board => $description) {
$query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $board);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = query($query) or error(db_error());
$res = $query->fetch();
$body .= '
Current posters: ' . number_format($res['count']) . '
';
// Active content
$query = 'SELECT SUM(`filesize`) AS `count` FROM (';
foreach($settings['boards'] as $board => $description) {
$query .= sprintf("SELECT `filesize` FROM `posts_%s` UNION ALL ", $board);
}
$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 .= '
';
// Finish page
$body .= '
Powered by Tinyboard | You must be at least 18 years of age to continue browsing.' .
'' .
'';
return $body;
}
};
?>