From 1b136555d279bf2cfb28f5661225c010426754f5 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 5 Oct 2011 15:22:53 +1100 Subject: transition to Twig --- templates/themes/4chon/theme.php | 215 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 templates/themes/4chon/theme.php (limited to 'templates/themes/4chon/theme.php') diff --git a/templates/themes/4chon/theme.php b/templates/themes/4chon/theme.php new file mode 100644 index 00000000..df72b8ee --- /dev/null +++ b/templates/themes/4chon/theme.php @@ -0,0 +1,215 @@ + 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 = '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' + . '' . $settings['title'] . '' + . ''; + + $body .= '

' . $settings['title'] . '

' + . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; + + $body .= '
'; + + $body .= '

4chon

'; + + $body .= ''; + + $body .= '

Welcome to 4chon.net!

'; + $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.

'; + + $body .= '

Our Boards

'; + $__boards = listBoards(); + foreach($settings['boards'] as $board => $description) { + foreach($__boards as $_board) { + if($_board['uri'] == $board) { + $board = $_board; + break; + } + } + $body .= '
'; + $body .= '/' . $board['uri'] . '/'; + $body .= '

' . $description . '

'; + $body .= '
'; + } + + $body .= '
'; + + $body .= '
'; + + + $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 .= '
'; + while($post = $query->fetch()) { + openBoard($post['board']); + $x_ratio = $settings['thumbwidth'] / $post['thumbwidth']; + $y_ratio = $settings['thumbheight'] / $post['thumbheight']; + + if(($post['thumbwidth'] <= $settings['thumbwidth']) && ($post['thumbheight'] <= $settings['thumbheight'])) { + $tn_width = $post['thumbwidth']; + $tn_height = $post['thumbheight']; + } elseif (($x_ratio * $post['thumbheight']) < $settings['thumbheight']) { + $tn_height = ceil($x_ratio * $post['thumbheight']); + $tn_width = $settings['thumbwidth']; + } else { + $tn_width = ceil($y_ratio * $post['thumbwidth']); + $tn_height = $settings['thumbheight']; + } + + $post['thumbwidth'] = $tn_width; + $post['thumbheight'] = $tn_height; + + $body .= ''; + } + $body .= '
'; + + + + // Latest posts + $body .= '
    '; + $query = ''; + foreach($settings['boards'] as $board => $description) { + $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $board, $board); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 35', $query); + $query = query($query) or error(db_error()); + + while($post = $query->fetch()) { + openBoard($post['board']); + + $body .= '
  • ' . $board['name'] . ': ' . (empty($post['body']) ? '…' : pm_snippet($post['body'], 25)) . '
  • '; + } + $body .= '
'; + + $body .= '
'; + + $body .= '
'; + $body .= '

4chon Community

'; + $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
  • '; + $body .= '
'; + + $body .= '

4chon

'; + $body .= '

Please read the general and board-specifc rules as well as the 4chon FAQ before posting.

'; + + $body .= '

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].

'; + + $body .= '

The admin may be contacted at admin@4chon.net or >>>/meta/.

'; + + $body .= '

For status updates and explanations of downtime, please see our status page or follow us on our rarely-used @4chonable Twitter account

'; + + $body .= '
'; + + $body .= '
'; + + $body .= '
'; + + $body .= '

In memory of Scott “Wingo” Canner (1989-2011).

'; + + $body .= ''; + + // Finish page + $body .= '

Powered by Tinyboard | You must be at least 18 years of age to continue browsing.' . + + '' . + + ''; + + return $body; + } + }; + +?> -- cgit v1.3