transition to Twig

This commit is contained in:
Savetheinternet
2011-10-05 15:22:53 +11:00
parent e077166030
commit 1b136555d2
145 changed files with 11031 additions and 320 deletions

28
templates/error.html Normal file
View File

@@ -0,0 +1,28 @@
{% if error %}<h2 style="text-align:center">{{ error }}</h2>{% endif %}
<form action="" method="post">
{% if redirect %}<input type="hidden" name="redirect" value="{{ redirect }}" />{% endif %}
<table style="margin-top:25px;">
<tr>
<th>
Username
</th>
<td>
<input type="text" name="username" size="20" maxlength="30" value="{{ username }}" />
</td>
</tr>
<tr>
<th>
Password
</th>
<td>
<input type="password" name="password" size="20" maxlength="30" value="" />
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="login" value="Continue" />
</td>
</tr>
</table>
</form>

View File

@@ -1,16 +1,15 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
{config[url_favicon]?<link rel="shortcut icon" href="{config[url_favicon]}" />}
<title>{board[url]} - {board[name]}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}" />
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %}
<title>{{ board.url }} - {{ board.name }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
{config[meta_keywords]?<meta name="keywords" content="{config[meta_keywords]}" />}
<link rel="stylesheet" type="text/css" id="stylesheet" href="{config[uri_stylesheets]}{config[default_stylesheet][1]}">
<script type="text/javascript" src="{config[url_javascript]}"></script>
{config[recaptcha]?<style type="text/css">
/* reCaptcha style */
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}" />{% endif %}
<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}" />
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
{% if config.recaptcha %}<style type="text/css">{% raw %}
.recaptcha_image_cell {
background: none !important;
}
@@ -24,20 +23,20 @@
.recaptchatable a {
display: block;
}
</style>}
{% endraw %}</style>{% endif %}
</head>
<body>
{boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>}
{config[url_banner]?<img class="banner" src="{config[url_banner]}" {config[banner_height]?style="width:{config[banner_width]px?{config[banner_width]}px};height:{config[banner_height]}px" }alt="" />}
<h1>{board[url]} - {board[name]}</h1>
<div class="title">{board[title]?{board[title]}}<p>{mod?<a href="?/">Return to dashboard</a>}</p></div>
{{ boardlist.top }}
{% if pm %}<div class="top_notice">{{ pm }}</div><hr />{% endif %}
{% if config.url_banner %}<img class="banner" src="{{ config.url_banner }}" {% if config.banner_height %}style="width:{% if config.banner_width %}{{ config.banner_width }}px{% endif %};height:{{ config.banner_height }}px" {% endif %}alt="" />{% endif %}
<h1>{{ board.url }} - {{ board.name }}</h1>
<div class="title">{% if board.title %}{{ board.title }}{% endif %}<p>{% if mod %}<a href="?/">Return to dashboard</a>{% endif %}</p></div>
<form name="post" onsubmit="return dopost(this);" enctype="multipart/form-data" action="{config[post_url]}" method="post">
{hidden_inputs}
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
<form name="post" onsubmit="return dopost(this);" enctype="multipart/form-data" action="{{ config.post_url }}" method="post">
{{ hidden_inputs }}
<input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
<table>
<tr>
<th>
@@ -61,7 +60,7 @@
</th>
<td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off" />
<input accesskey="s" style="margin-left:2px" type="submit" name="post" value="{config[button_newtopic]=New Topic}" />{config[spoiler_images]? <input name="spoiler" type="checkbox"/> Spoiler Image}
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if config.button_newtopic %}{{ config.button_newtopic }}{% else %}New Topic{% endif %}" />{% if config.spoiler_images %} <input name="spoiler" type="checkbox" /> Spoiler Image{% endif %}
</td>
</tr>
<tr>
@@ -72,25 +71,25 @@
<textarea name="body" id="body" rows="5" cols="30"></textarea>
</td>
</tr>
{config[recaptcha]?
{% if config.recaptcha %}
<tr>
<th>
Verification
</th>
<td>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k={config[recaptcha_public]}"></script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k={{ config.recaptcha_public }}"></script>
</td>
</tr>
}
{% endif %}
<tr>
<th>
File
</th>
<td>
<input type="file" name="file"/>
<input type="file" name="file" />
</td>
</tr>
{config[enable_embedding]?
{% if config.enable_embedding %}
<tr>
<th>
Embed
@@ -99,8 +98,8 @@
<input type="text" name="embed" size="30" maxlength="120" autocomplete="off" />
</td>
</tr>
}
{mod?
{% endif %}
{% if mod %}
<tr>
<th>
Flags
@@ -108,42 +107,42 @@
<td>
<div>
<label for="sticky">Sticky</label>
<input title="Sticky" type="checkbox" name="sticky" id="sticky"><br/>
<input title="Sticky" type="checkbox" name="sticky" id="sticky" /><br />
</div>
<div>
<label for="lock">Lock</label><br/>
<input title="Lock" type="checkbox" name="lock" id="lock">
<label for="lock">Lock</label><br />
<input title="Lock" type="checkbox" name="lock" id="lock" />
</div>
<div>
<label for="raw">Raw HTML</label><br/>
<input title="Raw HTML" type="checkbox" name="raw" id="raw">
<label for="raw">Raw HTML</label><br />
<input title="Raw HTML" type="checkbox" name="raw" id="raw" />
</div>
</td>
</tr>
}
{% endif %}
<tr>
<th>
Password
</th>
<td>
<input type="password" name="password" size="12" maxlength="18" autocomplete="off" />
<input type="password" name="password" size="12" maxlength="18" autocomplete="off" />
<span class="unimportant">(For file deletion.)</span>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<script type="text/javascript">{% raw %}
rememberStuff();
</script></script>
{config[blotter]?<hr/><div class="blotter">{config[blotter]}</div>}
<hr/>
<form name="postcontrols" action="{post_url}" method="post">
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
{body}
{% endraw %}</script>
{% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<hr />
<form name="postcontrols" action="{{ post_url }}" method="post">
<input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }}
<div class="delete">
Delete Post [<input title="Delete file only" type="checkbox" name="file" id="delete_file"/>
Delete Post [<input title="Delete file only" type="checkbox" name="file" id="delete_file" />
<label for="delete_file">File</label>] <label for="password">Password</label>
<input id="password" type="password" name="password" size="12" maxlength="18" />
<input type="submit" name="delete" value="Delete" />
@@ -154,11 +153,12 @@
<input type="submit" name="report" value="Report" />
</div>
</form>
<div class="pages">{btn[prev]} {pages:
[<a {pages[selected]?class="selected"}{!pages[selected]?href="{pages[link]}"}>{pages[num]}</a>]{!%last? }
} {btn[next]}</div>
{boardlist[bottom]}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.3 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2011 Tinyboard Development Group</p>
<p class="unimportant" style="text-align:center;">All trademarks, copyrights, comments and images on this page are owned by and/or are the responsibility of their respective parties.</p>
<div class="pages">{{ btn.prev }} {% for page in pages %}
[<a {% if page.selected %}class="selected"{% endif %}{% if not page.selected %}href="{{ page.link }}"{% endif %}>{{ page.num }}</a>]{% if loop.last %} {% endif %}
{% endfor %} {{ btn.next }}</div>
{{ boardlist.bottom }}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.4 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2011 Tinyboard Development Group</p>
<p class="unimportant" style="text-align:center;">All trademarks, copyrights, comments, and images on this page are owned by or are the responsibility of their respective parties.</p>
</body>
</html>
</html>

View File

@@ -1,13 +1,13 @@
{error?<h2 style="text-align:center">{error}</h2>}
{% if error %}<h2 style="text-align:center">{{ error }}</h2>{% endif %}
<form action="" method="post">
{redirect?<input type="hidden" name="redirect" value="{redirect}" />}
{% if redirect %}<input type="hidden" name="redirect" value="{{ redirect }}" />{% endif %}
<table style="margin-top:25px;">
<tr>
<th>
Username
</th>
<td>
<input type="text" name="username" size="20" maxlength="30" value="{username}">
<input type="text" name="username" size="20" maxlength="30" value="{{ username }}">
</td>
</tr>
<tr>

View File

@@ -1,4 +1,4 @@
function get_cookie(cookie_name)
{% raw %}function get_cookie(cookie_name)
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if(results)
@@ -34,7 +34,7 @@ function focusId(id)
function generatePassword() {
pass = '';
chars = '{config[genpassword_chars]}';
chars = '{% endraw %}{{ config.genpassword_chars }}{% raw %}';
for(i=0;i<8;i++) {
rnd = Math.floor(Math.random() * chars.length);
pass += chars.substring(rnd,rnd + 1);
@@ -71,10 +71,10 @@ function citeReply(id) {
}
}
var selectedstyle = '{config[default_stylesheet][0]}';
var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0 }}{% raw %}';
var styles = [
{stylesheets:['{stylesheets[name]}', '{stylesheets[uri]}']{!%last?,
}}
{% endraw %}{% for stylesheet in stylesheets %}{% raw %}['{% endraw %}{{ stylesheet.name }}{% raw %}', '{% endraw %}{{ stylesheet.uri }}{% raw %}']{% endraw %}{% if not loop.last %}{% raw %},
{% endraw %}{% endif %}{% endfor %}{% raw %}
];
var saved = {};
@@ -109,15 +109,15 @@ function rememberStuff() {
if(sessionStorage.body) {
saved = JSON.parse(sessionStorage.body);
if(get_cookie('{config[cookies][js]}')) {
if(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) {
// Remove successful posts
successful = JSON.parse(get_cookie('{config[cookies][js]}'));
successful = JSON.parse(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}'));
for (var url in successful) {
saved[url] = null;
}
sessionStorage.body = JSON.stringify(saved);
document.cookie = '{config[cookies][js]}={};expires=0;path=/;';
document.cookie = '{% endraw %}{{ config.cookies.js }}{% raw %}={};expires=0;path=/;';
}
if(saved[document.location]) {
document.forms.post.body.value = saved[document.location];
@@ -186,7 +186,7 @@ function init()
if(window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1))
highlightReply(window.location.hash.substring(1));
{config[inline_expanding]?init_expanding();}
{% endraw %}{% if config.inline_expanding %}{% raw %}init_expanding();{% endraw %}{% endif %}{% raw %}
}
var RecaptchaOptions = {
@@ -194,6 +194,6 @@ var RecaptchaOptions = {
};
window.onload = init;
{config[google_analytics]?
{% endraw %}{% if config.google_analytics %}{% raw %}
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{config[google_analytics]}']);{config[google_analytics_domain]?_gaq.push(['_setDomainName', '{config[google_analytics_domain]}'])}{!config[google_analytics_domain]?_gaq.push(['_setDomainName', 'none'])};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();}
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %}

View File

@@ -1,20 +1,20 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
{config[url_favicon]?<link rel="shortcut icon" href="{config[url_favicon]}" />}
<title>{title}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}" />
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %}
<title>{{ title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" type="text/css" id="stylesheet" href="{config[uri_stylesheets]}{config[default_stylesheet][1]}">
<script type="text/javascript" src="{config[url_javascript]}"></script>
<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}" />
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
</head>
<body>
{pm?<div class="top_notice">{pm}</div><hr/>}
<h1>{title}</h1>
<div class="title">{subtitle?{subtitle}}<p>{mod?<a href="?/">Return to dashboard</a>}</p></div>
{body}
<hr/>
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.3 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2011 Tinyboard Development Group</p>
{% if pm %}<div class="top_notice">{{ pm }}</div><hr />{% endif %}
<h1>{{ title }}</h1>
<div class="title">{% if subtitle %}{{subtitle}}{% endif %}<p>{% if mod %}<a href="?/">Return to dashboard</a>{% endif %}</p></div>
{{ body }}
<hr />
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.4 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2011 Tinyboard Development Group</p>
</body>
</html>

View File

@@ -1,30 +1,30 @@
CREATE TABLE IF NOT EXISTS `posts_{board}` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`thread` int(11) DEFAULT NULL,
`subject` varchar(100) NOT NULL,
`email` varchar(30) NOT NULL,
`name` varchar(35) NOT NULL,
`trip` varchar(15) DEFAULT NULL,
`capcode` varchar(50) DEFAULT NULL,
`body` text NOT NULL,
`time` int(11) NOT NULL,
`bump` int(11) DEFAULT NULL,
`thumb` varchar(50) DEFAULT NULL,
`thumbwidth` int(11) DEFAULT NULL,
`thumbheight` int(11) DEFAULT NULL,
`file` varchar(50) DEFAULT NULL,
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,
`sticky` int(1) NOT NULL,
`locked` int(1) NOT NULL,
`embed` text,
UNIQUE KEY `id` (`id`),
KEY `thread` (`thread`),
KEY `time` (`time`),
FULLTEXT KEY `body` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `posts_{{ board }}` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`thread` int(11) DEFAULT NULL,
`subject` varchar(100) NOT NULL,
`email` varchar(30) NOT NULL,
`name` varchar(35) NOT NULL,
`trip` varchar(15) DEFAULT NULL,
`capcode` varchar(50) DEFAULT NULL,
`body` text NOT NULL,
`time` int(11) NOT NULL,
`bump` int(11) DEFAULT NULL,
`thumb` varchar(50) DEFAULT NULL,
`thumbwidth` int(11) DEFAULT NULL,
`thumbheight` int(11) DEFAULT NULL,
`file` varchar(50) DEFAULT NULL,
`filewidth` int(11) DEFAULT NULL,
`fileheight` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT NULL,
`filename` text DEFAULT NULL,
`filehash` text DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`ip` varchar(45) NOT NULL,
`sticky` int(1) NOT NULL,
`locked` int(1) NOT NULL,
`embed` text,
UNIQUE KEY `id` (`id`),
KEY `thread` (`thread`),
KEY `time` (`time`),
FULLTEXT KEY `body` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

View File

@@ -0,0 +1,109 @@
div.ban {
max-width: 1200px;
min-width: 348px;
width: 85%;
}
div.ban .wrap {
margin: 10px;
overflow: auto;
}
div.board {
width: 100%;
overflow: auto;
margin: 10px 0;
}
div.board p {
text-align: justify;
}
div.board a.button {
text-align: center;
font-weight: bold;
font-size: 15pt;
height: 60px;
width: 75px;
display: inline-block;
background: #98E;
line-height: 60px;
margin: 5px 25px;
box-shadow:0 2px 5px 0px #D0D0D0;
-webkit-box-shadow:0 2px 5px 0px #D0D0D0;
border-radius:15px;
-webkit-border-radius:15px;
float: left;
}
div.board a.button:hover {
box-shadow:0 2px 5px 0px #222;
-webkit-box-shadow:0 2px 5px 0px #222;
}
img:hover {
box-shadow:0 2px 5px 0px #555;
-webkit-box-shadow:0 2px 5px 0px #555;
}
div.container {
margin: auto;
max-width: 1000px;
}
div.split {
margin-top: 40px;
overflow: auto;
border: 1px solid #ccc;
border-style: solid none none none;
}
div.panel {
margin: 0;
float: left;
width: 40%;
}
div.panel h3 {
margin: 10px 0;
}
div.panel.left {
min-width: 150px;
max-width: 400px;
padding: 10px 0;
}
div.panel.left ul {
padding: 5px;
margin: 0;
word-wrap: break-word;
}
div.panel.right {
border: 1px solid #ccc;
border-style: none none none solid;
min-width: 175px;
max-width: 50%;
width: 100%;
padding: 10px 0;
}
div.panel.right ul, div.panel.right p, div.panel.right h3 {
padding: 5px 10px;
}
div.panel.right ul {
padding: 0 25px;
}
div.panel.right ul li {
margin: 10px 0;
}
div.panel.left ul li {
list-style: none;
}
div.panel.left .images {
float: left;
max-width: 80px;
margin: 10px 20px 0px 0px;
}
div.panel.left .images a, div.panel.left .images img {
padding: 0;
margin: 2px 3px;
display: inline;
}
div.panel.left .images img {
float: none;
}
div.panel.right ul ul li {
margin: 2px 0;
}

View File

@@ -0,0 +1,15 @@
<?php
$theme = Array();
// Theme name
$theme['name'] = '4chon';
// Description (you can use Tinyboard markup here)
$theme['description'] = 'Official 4chon.net theme.';
$theme['version'] = 'v0.9';
// Theme configuration
$theme['config'] = Array();
// Unique function name for building everything
$theme['build_function'] = 'chon_build';
?>

View File

@@ -0,0 +1,215 @@
<?php
require 'info.php';
$chon_settings = Array(
'thumbwidth' => 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 = '<!DOCTYPE html><html>'
. '<head>'
. '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
. '<link rel="stylesheet" media="screen" href="http://static.4chon.net/home.css"/>'
. '<link rel="shortcut icon" href="http://static.4chon.net/favicon.gif" />'
. '<script type="text/javascript" src="http://static.4chon.net/ga.js"></script>'
. '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />'
. '<meta name="keywords" content="4chon,chon,r9k,robot9000,r9k1,4chon r9k,4chon new,free speech imageboard,racist imageboard,4chan new,moot is a faggot,r9k deleted,new deleted,the vidya,robot 9000,tinyboard,imageboard" />'
. '<title>' . $settings['title'] . '</title>'
. '</head><body>';
$body .= '<h1><a title="4chon" href="/">' . $settings['title'] . '</a></h1>'
. '<div class="title">' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '</div>';
$body .= '<div class="ban">';
$body .= '<h2>4chon</h2><div class="wrap">';
$body .= '<g:plusone size="medium" count="false" href="http://4chon.net/"></g:plusone>';
$body .= '<h3>Welcome to 4chon.net!</h3>';
$body .= '<p>The largest and most popular community based on <a href="http://tinyboard.org/">Tinyboard</a>; 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.</p>';
$body .= '<h3>Our Boards</h3>';
$__boards = listBoards();
foreach($settings['boards'] as $board => $description) {
foreach($__boards as $_board) {
if($_board['uri'] == $board) {
$board = $_board;
break;
}
}
$body .= '<div class="board">';
$body .= '<a title="' . $board['title'] . '" href="' . $config['root'] . $board['uri'] . '/' . $config['file_index'] . '" class="button">/' . $board['uri'] . '/</a>';
$body .= '<p>' . $description . '</p>';
$body .= '</div>';
}
$body .= '<div class="container"><div class="split">';
$body .= '<div class="panel left">';
$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 .= '<div class="images">';
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 .= '<a href="' .
$config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $post['id'] .
'"><img src="' . $config['uri_thumb'] . str_replace('.', '_small.', $post['thumb']) . '" style="width:' . $post['thumbwidth'] . 'px;height:' . $post['thumbheight'] . 'px;" /></a>';
}
$body .= '</div>';
// Latest posts
$body .= '<ul>';
$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 .= '<li><strong>' . $board['name'] . '</strong>: <a href="' .
$config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $post['id'] .
'">' . (empty($post['body']) ? '…' : pm_snippet($post['body'], 25)) . '</a></li>';
}
$body .= '</ul>';
$body .= '</div>';
$body .= '<div class="panel right">';
$body .= '<h3>4chon Community</h3>';
$body .= '<p>Aside from our boards, we also have an active community in the following places:</p>';
$body .= '<ul>';
$body .= '<li><a href="http://tv.4chon.net/">/tv/</a> - We automatically maintain a list of livestreams that were posted on the boards, where users of 4chon can watch television shows, movies, and circlejerks.</li>';
$body .= '<li>Minecraft - Our unofficial Minecraft server. Come build with bros and visit our giant penis sculpture! eironeia.datnode.net:24598</li>';
$body .= '</ul>';
$body .= '<h3>4chon</h3>';
$body .= '<p>Please read the <a href="rules.html">general and board-specifc rules</a> as well as the <a href="faq.html">4chon FAQ</a> before posting.</p>';
$body .= '<p>4chon keeps a <a href="stats.html">statistics page</a> which gives detailed information about all of our boards, such as posts per minute, user locations, referring sites and more!. There\'s also a <a href="http://status.4chon.net/map.html">map of our posters around the globe</a>!</p>';
$body .= '<p>If, for any reason, you need to contact the 4chon staff, they can be reached in IRC - <a href="irc://irc.datnode.net/4chon">irc.datnode.net #4chon</a> / [<a href="irc.html">WebIRC</a>].</p>';
$body .= '<p>The admin may be contacted at <a href="mailto:admin@4chon.net">admin@4chon.net</a> or <a href="/meta/">&gt;&gt;&gt;/meta/</a>.</p>';
$body .= '<p>For status updates and explanations of downtime, please see our <a href="http://status.4chon.net/">status page</a> or follow us on <a href="http://twitter.com/#!/4chonable">our rarely-used @4chonable</a> Twitter account</p>';
$body .= '</div>';
$body .= '</div>';
$body .= '</div></div></div>';
$body .= '<p style="text-align:center">In memory of Scott &ldquo;Wingo&rdquo; Canner (1989-2011).</p>';
$body .= '<ul style="text-align:center;list-style:none;padding:0">';
// 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 .= '<li>Total posts: ' . number_format($res['count']) . '</li>';
// 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 .= '<li>Current posters: ' . number_format($res['count']) . '</li>';
// 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 .= '<li>Active content: ' . format_bytes($res['count']) . '</li>';
$body .= '</ul>';
// Finish page
$body .= '<hr/><p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> | You must be at least 18 years of age to continue browsing.' .
'<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>' .
'</body></html>';
return $body;
}
};
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,28 @@
<?php
$theme = Array();
// Theme name
$theme['name'] = 'Drudge Report';
// Description (you can use Tinyboard markup here)
$theme['description'] = 'Recent posts theme, styled like Druge Report.';
$theme['version'] = 'v0.1';
// Theme configuration
$theme['config'] = Array();
$theme['config'][] = Array(
'title' => 'Title',
'name' => 'title',
'type' => 'text'
);
$theme['config'][] = Array(
'title' => 'Excluded boards',
'name' => 'exclude',
'type' => 'text',
'comment' => '(space seperated)'
);
// Unique function name for building everything
$theme['build_function'] = 'drudge_build';
?>

View File

@@ -0,0 +1,145 @@
<?php
require 'info.php';
function drudge_build($action, $settings) {
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
// - boards (board list changed)
// - post (a post has been made)
$b = new Drudge();
$b->build($action, $settings);
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Drudge {
public function build($action, $settings) {
global $config, $_theme, $threads;
// Don't worry about this for now:
//if($action == 'all') {
// copy($config['dir']['themes'] . '/' . $_theme . '/master.css', $config['dir']['home'] . 'drudge_master.css');
// copy($config['dir']['themes'] . '/' . $_theme . '/reset.css', $config['dir']['home'] . 'drudge_reset.css');
//}
$this->excluded = explode(' ', $settings['exclude']);
if($action == 'all' || $action == 'post')
file_write($config['dir']['home'] . 'landing/index.html', $this->homepage($settings));
}
private function spot($num) {
global $config;
$prime = $num < 7;
if(!isset($this->threads[$num]))
return '';
$post = &$this->threads[$num];
return ($prime ?
'<img src="' . $config['uri_thumb'] . $post['thumb'] . '"/>'
: '')
. '<h2><a href="' . $post['email'] . '">' . $post['subject'] . '</a><a href="' . $post['email'] . '">...</a></h2><hr />';
}
// Build news page
public function homepage($settings) {
global $config, $board;
openBoard('a');
// HTML5
$body = '<!DOCTYPE html><html>'
. '<head>'
//. '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
. '<link rel="stylesheet" media="screen" href="' . $config['root'] . 'landing/reset.css"/>'
. '<link rel="stylesheet" media="screen" href="' . $config['root'] . 'landing/master.css"/>'
. '<title>' . $settings['title'] . '</title>'
. '</head><body>'
// heading
. '<div id="hed-container">'
/*
Sub-headlines related to the main headline appear here.
They are pulled from the subject lines of the replies to the top thread.
Drudge follows all stories with "...", other than the main headline
We will use the ellipse to link to the forum thread, while the headline links directly to the story
*/
. '<div id="hed-sub">'
. '<h2 class="sub"><a href="">Subject Line of latest reply in top thread</a><a href="">...</a></h2>'
. '</div>'
. '<div id="hed">'
. '<img src="breitbart.jpg" title="" />'
. '<br />';
$this->threads = Array(); // 0 = main heading, 1-6 = prime spots, 7-18 = normal
$query = query("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_a` WHERE `thread` = `thread_id`) AS `replies` FROM `posts_a` WHERE `thread` IS NULL AND `email` != '' AND `subject` != '' ORDER BY `sticky` DESC, `replies` DESC, `bump` DESC LIMIT 19") or error(db_error());
while($post = $query->fetch()) {
$this->threads[] = $post;
}
// first prime gets headline
$body .= '<h1><a href="' . $this->threads[0]['email'] . '">' . strtoupper($this->threads[0]['subject']) . '</a></h1>';
$body .= '</div>'
. '</div>'
;
$body .= '<div id="fold"><a href="http://serfin.us/a"><img src="serfinus.png" title="" /></a></div>';
// begin three column layout here
$body .= '<div id="below-the-fold">';
// <stobor> Headline: P Left column: xxPxPx Center: PxxxPx Right: xPxxPx
// first column
$body .= '<div class="column" id="c-left">' .
$this->spot(7) .
$this->spot(8) .
$this->spot(1) .
$this->spot(9) .
$this->spot(2) .
$this->spot(10) .
'</div>';
// second column
$body .= '<div class="column" id="c-center">' .
$this->spot(3) .
$this->spot(11) .
$this->spot(12) .
$this->spot(13) .
$this->spot(4) .
$this->spot(14) .
'</div>';
// third column
$body .= '<div class="column" id="c-right">' .
$this->spot(15) .
$this->spot(5) .
$this->spot(16) .
$this->spot(17) .
$this->spot(6) .
$this->spot(18) .
'</div>';
// end container
$body .= '</div>';
// Finish page
$body .= '<hr/><p class="unimportant" style="margin-top:20px;text-align:center;font-size:8pt;font-weight:normal">Powered by <a href="http://tinyboard.org/">Tinyboard</a></body></html>';
return $body;
}
};
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
templates/themes/ruiwy1.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1,27 @@
<?php
$theme = Array();
// Theme name
$theme['name'] = 'Rui\'s Mod';
// Description (you can use Tinyboard markup here)
$theme['description'] = 'Extremely basic news listing for the homepage. It\'s suggested that you enable boardlinks for this theme.';
$theme['version'] = 'v0.9';
// Theme configuration
$theme['config'] = Array();
$theme['config'][] = Array(
'title' => 'Title',
'name' => 'title',
'type' => 'text'
);
$theme['config'][] = Array(
'title' => 'Slogan',
'name' => 'subtitle',
'type' => 'text'
);
// Unique function name for building everything
$theme['build_function'] = 'rui_build';
?>

View File

@@ -0,0 +1,77 @@
<?php
require 'info.php';
function rui_build($action, $settings) {
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
// - boards (board list changed)
Rui::build($action, $settings);
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Rui {
public static function build($action, $settings) {
global $config;
if($action == 'all' || $action == 'news')
file_write($config['dir']['home'] . $config['file_index'], self::homepage($settings));
}
// Build news page
public static function homepage($settings) {
global $config;
// HTML5
$body = '<!DOCTYPE html><html>'
. '<head>'
. '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
. '<title>' . $settings['title'] . '</title>'
. '</head><body>';
$boardlist = createBoardlist();
$body .= '<div class="boardlist">' . $boardlist['top'] . '</div>';
$body .= '<h1>' . $settings['title'] . '</h1>'
. '<div class="title">' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '</div>';
$body .= '<div class="ban">';
$query = query("SELECT * FROM `news` ORDER BY `name` = 'static' DESC, `time` DESC") or error(db_error());
if($query->rowCount() == 0) {
$body .= '<p style="text-align:center" class="unimportant">(No news to show.)</p>';
} else {
// List news
while($news = $query->fetch()) {
$body .= '<h2 id="' . $news['id'] . '">' .
($news['subject'] ?
$news['subject']
:
'<em>no subject</em>'
) .
($news['name'] != 'static' ?
'<span class="unimportant"> - ' .
date($config['post_date'], $news['time']) .
'</span>'
: '') .
'</h2><p>' . $news['body'] . '</p>';
if($news['name'] == 'static') {
// static notice
$body .= '</div><div class="ban">';
}
}
}
$body .= '</div>';
// Finish page
$body .= '<hr/><p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a></body></html>';
return $body;
}
};
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -1,15 +1,15 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" media="screen" href="{config[url_stylesheet]}"/>
{config[url_favicon]?<link rel="shortcut icon" href="{config[url_favicon]}" />}
<title>{board[url]} - {board[name]}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}" />
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %}
<title>{{ board.url }} - {{ board.name }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" type="text/css" id="stylesheet" href="{config[uri_stylesheets]}{config[default_stylesheet][1]}">
<script type="text/javascript" src="{config[url_javascript]}"></script>
{config[recaptcha]?<style type="text/css">
/* reCaptcha style */
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}" />{% endif %}
<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}" />
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
{% if config.recaptcha %}<style type="text/css">{% raw %}
.recaptcha_image_cell {
background: none !important;
}
@@ -23,20 +23,21 @@
.recaptchatable a {
display: block;
}
</style>}
{% endraw %}</style>{% endif %}
</head>
<body>
{boardlist[top]}
{pm?<div class="top_notice">{pm}</div><hr/>}
{config[url_banner]?<img class="banner" src="{config[url_banner]}" {config[banner_height]?style="width:{config[banner_width]px?{config[banner_width]}px};height:{config[banner_height]}px" }alt="" />}
<h1>{board[url]} - {board[name]}</h1>
<div class="title">{board[title]?{board[title]}}<p>{mod?<a href="?/">Return to dashboard</a>}</p></div>
{{ boardlist.top }}
{% if pm %}<div class="top_notice">{{ pm }}</div><hr />{% endif %}
{% if config.url_banner %}<img class="banner" src="{{ config.url_banner }}" {% if config.banner_height %}style="width:{% if config.banner_width %}{{ config.banner_width }}px{% endif %};height:{{ config.banner_height }}px" {% endif %}alt="" />{% endif %}
<h1>{{ board.url }} - {{ board.name }}</h1>
<div class="title">{% if board.title %}{{ board.title }}{% endif %}<p>{% if mod %}<a href="?/">Return to dashboard</a>{% endif %}</p></div>
<div class="banner">Posting mode: Reply <a class="unimportant" href="{return}">[Return]</a></div>
<form name="post" onsubmit="return dopost(this);" enctype="multipart/form-data" action="{config[post_url]}" method="post">{hidden_inputs}
<input type="hidden" name="thread" value="{id}" />
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
<div class="banner">Posting mode: Reply <a class="unimportant" href="{{ return }}">[Return]</a></div>
<form name="post" onsubmit="return dopost(this);" enctype="multipart/form-data" action="{{ config.post_url }}" method="post">
{{ hidden_inputs }}
<input type="hidden" name="thread" value="{{ id }}" />
<input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
<table>
<tr>
<th>
@@ -60,7 +61,7 @@
</th>
<td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off" />
<input accesskey="s" style="margin-left:2px" type="submit" name="post" value="{config[button_reply]=New Reply}" />{config[spoiler_images]? <input name="spoiler" type="checkbox"/> Spoiler Image}
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if config.button_reply %}{{ config.button_reply }}{% else %}New Reply{% endif %}" />{% if config.spoiler_images %} <input name="spoiler" type="checkbox" /> Spoiler Image{% endif %}
</td>
</tr>
<tr>
@@ -71,25 +72,25 @@
<textarea name="body" id="body" rows="5" cols="30"></textarea>
</td>
</tr>
{config[recaptcha]?
{% if config.recaptcha %}
<tr>
<th>
Verification
</th>
<td>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k={config[recaptcha_public]}"></script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k={{ config.recaptcha_public }}"></script>
</td>
</tr>
}
{% endif %}
<tr>
<th>
File
</th>
<td>
<input type="file" name="file"/>
<input type="file" name="file" />
</td>
</tr>
{config[enable_embedding]?
{% if config.enable_embedding %}
<tr>
<th>
Embed
@@ -98,43 +99,43 @@
<input type="text" name="embed" size="30" maxlength="120" autocomplete="off" />
</td>
</tr>
}
{mod?
{% endif %}
{% if mod %}
<tr>
<th>
Flags
</th>
<td>
<div>
<label for="raw">Raw HTML</label><br/>
<input title="Raw HTML" type="checkbox" name="raw" id="raw">
<label for="raw">Raw HTML</label><br />
<input title="Raw HTML" type="checkbox" name="raw" id="raw" />
</div>
</td>
</tr>
}
{% endif %}
<tr>
<th>
Password
</th>
<td>
<input type="password" name="password" size="12" maxlength="18" autocomplete="off" />
<input type="password" name="password" size="12" maxlength="18" autocomplete="off" />
<span class="unimportant">(For file deletion.)</span>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<script type="text/javascript">{% raw %}
rememberStuff();
</script></script>
{% endraw %}</script>
{config[blotter]?<hr/><div class="blotter">{config[blotter]}</div>}
<hr/>
<form name="postcontrols" action="{config[post_url]}" method="post">
<input type="hidden" name="board" value="{board[uri]}" />
{mod?<input type="hidden" name="mod" value="1" />}
{body}
{% if config.blotter %}<hr /><div class="blotter">{{ config.blotter }}</div>{% endif %}
<hr />
<form name="postcontrols" action="{{ post_url }}" method="post">
<input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
{{ body }}
<div class="delete">
Delete Post [<input title="Delete file only" type="checkbox" name="file" id="delete_file"/>
Delete Post [<input title="Delete file only" type="checkbox" name="file" id="delete_file" />
<label for="delete_file">File</label>] <label for="password">Password</label>
<input id="password" type="password" name="password" size="12" maxlength="18" />
<input type="submit" name="delete" value="Delete" />
@@ -145,9 +146,12 @@
<input type="submit" name="report" value="Report" />
</div>
</form>
<a href="{return}">[Return]</a>
{boardlist[bottom]}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.3 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2011 Tinyboard Development Group</p>
<p class="unimportant" style="text-align:center;">All trademarks, copyrights, comments and images on this page are owned by and/or are the responsibility of their respective parties.</p>
<div class="pages">{{ btn.prev }} {% for page in pages %}
[<a {% if page.selected %}class="selected"{% endif %}{% if not page.selected %}href="{{ page.link }}"{% endif %}>{{ page.num }}</a>]{% if loop.last %} {% endif %}
{% endfor %} {{ btn.next }}</div>
{{ boardlist.bottom }}
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> v0.9.4 | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2011 Tinyboard Development Group</p>
<p class="unimportant" style="text-align:center;">All trademarks, copyrights, comments, and images on this page are owned by or are the responsibility of their respective parties.</p>
</body>
</html>
</html>